Initializing help system before first use

Structure of a Mosel model

A Mosel model (text file with extension .mos) has the form

model model_name

  Compiler directives

  Parameters

  Body

end-model
Compiler directives
  • Options are specified as a compiler directive, at the beginning of the model
  • Options include explterm, which means that each statement must end with a semi-colon, and noimplicit, which forces all objects to be declared
    options explterm
    options noimplicit
  • uses statements are also compiler directives
    uses "mmxprs", "mmodbc"
  • Can define a version number for your model
    version 1.0.0
Run-time parameters
  • Scalars (of type integer, real, boolean, or string) with a specified default value
  • Their value may be reset when executing the model
  • Use initializations from for inputting structured data (arrays, sets,...)
  • At most one parameters block per model
Model body
  • Model statements other than compiler directives and parameters, including any number of
    • declarations
    • initializations from / initializations to
    • functions and procedures
Implicit declaration
  • Mosel does not require all objects to be declared
  • Simple objects can be used without declaring them, if their type is obvious
  • Use the noimplicit option to force all objects to be declared before using them (see item Compiler directives above)
Mosel statements
  • Can extend over several lines and use spaces
  • However, a line break acts as an expression terminator
  • To continue an expression, it must be cut after a symbol that implies continuation (e.g. + - , * )