functionstoich
Return stoichiometric coefficients of a reaction based on chemical formulas of reacting species
Extends from Modelica.Icons.Function (Icon for functions).
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.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| String[:] | formulas | Chemical formulas of the species |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Integer[size(formulas, 1)] | n | Stoichiometric coefficients |