2.8. The variable element¶
A variable element information item (referred to in this specification as a variable element) is an element in the CellML namespace with a local name equal to variable, which appears as a child of a component element.
Every
variableelement MUST have exactly one of each of the following attributes:The
nameattribute.The value of the
nameattribute MUST be a CellML identifier.The value of the
nameattribute MUST NOT be identical to the value of thenameattribute on any siblingvariableelement.
The
unitsattribute.The value of the
unitsattribute MUST be a valid units reference, as defined in 3.2 Units references.
Every
variableelement MAY contain one or more of the following attributes:The
interfaceattribute.If the attribute is present, it MUST have value of
public,private,public_and_private, ornone.
The
initial_valueattribute.If the attribute is present, it MUST meet the requirements described by 3.6 Interpretation of initial_value attributes.
See more
In addition to the standard name attribute, each variable must also define a units attribute too.
Reusing Einstein’s example from 2.7 The component element section we can give the three variables their fuller definitions:
<component name="mass_into_energy">
<math>
...
</math>
<variable name="E" units="joule"/>
<variable name="m" units="kilogram"/>
<variable name="c" units="metre_per_second"/>
</component>
Extra attributes that can be used as needed include the initial_value, which will either set a constant value for a variable, or set its initial conditions if it’s being solved for.
More information about initialisation can be found in 3.6 Interpretation of initial_value attributes.
Finally, where one variable (A) has been mapped to another (B) in a different component (BB), both A and B must specify interface attributes.
These prescribe the relative positions in the encapsulation that the components AA and BB must have in order for their respective variables A and B to access one another.
This is outlined in more detail in 2.13 The encapsulation element.