This function returns the number of elements in a chemical formula. Electrons are counted as a present element (or rather particle) if the net charge is nonzero.
Examples:
countElements("C19HF37O5S-")
returns 5 and countElements("H+")
returns 2.
Please see the readElement function for details about the format of the chemical formula.
function countElements extends Modelica.Icons.Function; input String formula "Chemical formula"; output Integer n "Number of elements" annotation( Dialog(__Dymola_label = "<html><i>n</i></html>")); end countElements;