.FCSys.Utilities.Chemistry.charge

Information

This function returns the net electrical charge associated with a species represented by a chemical formula (formula). If the charge number is not given explicitly in the formula, then it is assumed to be zero. A "+" or "-" without any immediately following digits is interpreted as a charge of +1 or -1, respectively. If there is an error in the chemical formula, then 0 is returned.

Example:
charge("Hg2+2") returns 2.

Interface

function charge
  extends Modelica.Icons.Function;
  input String formula "Chemical formula";
  output Integer z "Charge number" annotation(
    Dialog(__Dymola_label = "<html><i>z</i></html>"));
end charge;

Generated at 2024-12-27T19:26:12Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos