.FCSys.Utilities.Chemistry.stoich

Information

This function returns a vector of stoichiometric coefficients (n) that balance a chemical reaction among the species given by a vector of chemical formulas (formulas). If the reaction is ill-posed or non-unique, then the function will fail with a message. Each formula is interpreted according to the rules in the readElement function.

Example:
stoich({"e-","H+","O2","H2O"}) returns {-4,-4,-1,2}, which indicates the reaction 4e- + 4H+ + O2 ⇌ 2H2O.

Interface

function stoich
  import Modelica.Math.Matrices.singularValues;
  extends Modelica.Icons.Function;
  input String formulas[:] "Chemical formulas of the species";
  output Integer n[size(formulas, 1)] "Stoichiometric coefficients" annotation(
    Dialog(__Dymola_label = "<html><i>n</i></html>"));
end stoich;

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