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, and 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 thenameattribute MUST be a valid CellML identifier.The value of the
nameattribute MUST NOT be identical to thenameattribute on any siblingvariableelement.
- The
unitsattribute. The value of theunitsattribute MUST be a valid CellML identifier, and MUST meet the constraints described in the Effect of units on variables section.
Every
variableelement MAY contain one or more of the following attributes:- The
interfaceattribute. If the attribute is present, it MUST have value ofpublic,private,public_and_private, ornone.
- The
initial_valueattribute. If the attribute is present, it MUST meet the requirements described by the Interpretation of initial values section.
- The
In addition to the standard name attribute, each variable must also define a units attribute too.
Reusing Einstein’s example from the component item 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 the Interpretation of initial values section.
Finally, where one variable has been mapped to another in a different component, the interface attribute must be specified.
This determines the relative position in the encapsulation that the mapped component must have in order to access this variable.
This is outlined in more detail in the encapsulation item section.