2.1. The model elementΒΆ

The top-level element information item in a CellML infoset MUST be an element in the CellML namespace with a local name equal to model. In this specification, the top-level element is referred to as the model element.

  1. Every model element MUST contain a name attribute.

    1. The value of the name attribute MUST be a CellML identifier.

See more

The model is the highest level in the CellML file, not including the opening xml tags. And, just like the Highlander, there can be only one.

These are valid CellML name attributes:

  • myValidName is valid (both cases are permitted),

  • my_other_valid_name is valid (underscores are permitted), and

  • this1too is valid (numerals 0-9 are permitted).

These are not valid CellML name attributes:

  • my invalid name is not valid (spaces are not permitted),

  • thisIsInvalidToo! is not valid (special characters other than the underscore _ are not permitted),

  • 1amNotValidEither is not valid (must not begin with a number), and

  • " " empty string is not valid (a name must be present).

  1. A model element MAY contain one or more additional specific element children, each of which MUST be of one of the following types:

    1. A component element;

    2. A connection element;

    3. An encapsulation element;

    4. An import element; or

    5. A units element.

See more

<model name="myModel">
  <component name="myFirstComponent"> ... </component>
  <component name="aDuplicatedComponentName"> ... </component>

  <!-- INVALID: This component is not valid because it has the same name as an existing one. -->
  <component name="aDuplicatedComponentName"> ... </component>

  <units name="myUnits"> ... </units>
  <units name="myOtherUnits"> ... </units>
  <units name="aDuplicatedUnitName"> ... </units>

  <!-- INVALID This units item is not valid because it has the same name as an existing units item. -->
  <units name="aDuplicatedUnitName"> ... </units>

  <!-- A model can contain any number of import items. -->
  <import />
  <import />

  <!-- A model can contain any number of connection items, as long as the things they connect are unique. -->
  <connection />
  <connection />

  <encapsulation>...</encapsulation>
  <!-- INVALID: A model must contain only ONE encapsulation item. -->
  <encapsulation>...</encapsulation>

  <!-- INVALID: The only child elements of the model are those stated. -->
  <apples> ... </apples>

</model>
  1. A model element MUST NOT contain more than one encapsulation elements.

See more

The encapsulation of a model defines the nested structure of its components. This in turn affects which variables have access to which other variables, and allows the modular behaviour to happen at any level. For this reason, there can be only one encapsulation item in any model.

For more information about encapsulation, please refer to 2.13 The encapsulation element.