2.2.1. The ModelUnit element

The top-level element information item in a Crop2ML model unit infoset MUST be referred to as the ModelUnit element.

<?xml version="1.0" encoding= ?> (1)
     <!DOCTYPE ModelUnit PUBLIC " " "https://raw.githubusercontent.com/AgriculturalModelExchangeInitiative/crop2ml/master/ModelUnit.dtd"> (2)
     <ModelUnit modelid=" " timestep=" " name=" " version=""> (3)
                     ....
     </ModelUnit>
(1) XML header with version 1.0 and “utf-8” encoding
(2) External DTD declaration in the file
  1. A ModelUnit element MUST contain a name, a modelid, a version attributes. (3)

    • The value of the name attribute must obey a number of constraints

See the constraints

The ModelUnit is the highest level in the Crop2ML model file, not including the opening xml tags.

A Crop2ML name attribute must obey some constraints:

  • it starts by a letter

  • It is a single word

  • Only alphanumeric characters and underscore characters

    eg: name: CropHeatFlux or crop_heat_flux (valid names),

    name: crop-heat-flux or 1cropheatflux (not valid names)

  • It MUST NOT be a keyword of any programming language

These are valid Crop2ML name attributes:

  • myName 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 Crop2ML 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).

  • lambda is not valid (language keyword not permitted).

  • The value of the modelid attribute MUST ensure the provenance of the model. It is composed by an identifier of the platform and model package that provides the model and the name of the model unit separated by a dot. It is used to reference the model elsewhere and must be an unique identifier.

    Eg. SQ.EnergyBalance.CropHeatFlux where SQ.EnergyBalance means that it is a strategy of Energy Balance component of SiriusQuality (SQ) model and CropHeatFlux the name of the model unit

  • The value of the version corresponds to a state of evolution of the model unit. It is defined by numbering.

  1. A ModelUnit element MAY contain a timestep attribute. Without this attribute, a time step of one day is considered.

  2. A ModelUnit element MUST contain one additional specific element child:

    1. A Description element;

    2. An Inputs element;

    3. An Outputs element;

    4. A ParameterSets element;

    5. A TestSets element

  3. A ModelUnit element MUST contain one or more Algorithm element children

  4. A ModelUnit element MAY contain one Initialization element children

  5. A ModelUnit element MAY contain one or more Function element children