This function takes a value and converts units based on compound name.
Arguments
- value
Value to be converted
- formula
Chemical formula of compound; accepts compounds in mweights. Optional when converting within the same unit type and basis (e.g., mg/L to g/L, mM to M, meq/L to eq/L, or mg/L CaCO3 to g/L CaCO3).
- startunit
Units of current value, currently accepts g/L; g/L CaCO3; g/L N; g/L P; g/L Cl2; M; eq/L; and the same units with "m", "u", "n" prefixes
- endunit
Desired units, currently accepts same as start units
Details
Mass concentrations may be expressed as CaCO3, N, P, or molecular chlorine (Cl2). Mass as CaCO3 is an equivalents basis: 1 eq of the compound = 50 g as CaCO3, so 61 mg/L HCO3 is 50 mg/L as CaCO3. Mass as N or P counts the atoms in the compound: 1 mol of (NH4)2SO4 is 28 g as N. Mass as Cl2 counts oxidizing capacity: 1 mol of NHCl2 is 2 mol as Cl2. "mg/L Cl" is treated as "mg/L Cl2".
