.FCSys.Utilities.Chemistry.countElements

Information

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.

Interface

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;

Generated at 2024-11-22T19:25:38Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos