classversion
Extends from ModelicaReference.Icons.Information (Icon for general information packages).
Information
Define version information of package
Examples
package Modelica
annotation(version="2.1",
conversion(noneFromVersion="2.1 Beta 1",
from(version="1.5",
script="convertFromModelica1_5.mos")));
...
end Modelica;
model A
annotation(version="1.0",
uses(Modelica(version="1.5")));
...
end A;
model B
annotation(uses(Modelica(version="2.1 Beta 1")));
...
end B;
In this example the model A uses an older version of the Modelica library and can be upgraded using the given script, and model B uses an older version of the Modelica library but no changes are required when upgrading.
Description
Version numbers are of the forms:
- Main release versions:
Example:""" UNSIGNED_INTEGER { "." UNSIGNED_INTEGER } """"2.1"
- Pre-release versions:
Example:""" UNSIGNED_INTEGER { "." UNSIGNED_INTEGER } " " {S-CHAR} """"2.1 Beta 1"
- Un-ordered versions:
Example:""" NON-DIGIT {S-CHAR} """"Test 1"
The main release versions are ordered using the hierarchical numerical names, and follow the corresponding pre-release versions. The pre-release versions of the same main release version are internally ordered alphabetically.
In a top-level class, the version number and the dependency to earlier versions of this class are defined using one or more of the following annotations:
-
version = CURRENT-VERSION-NUMBER
Defines the version number of the model or package. All classes within this top-level class have this version number.
-
conversion ( noneFromVersion = VERSION-NUMBER)
Defines that user models using the VERSION-NUMBER can be upgraded to the CURRENT-VERSION-NUMBER of the current class without any changes.
-
conversion ( from (version = VERSION-NUMBER, [to = VERSION_NUMBER ","] script = "?" ) )
Defines that user models using the VERSION-NUMBER or any of the given VERSION-NUMBER can be upgraded to the given VERSION-NUMBER (if the to-tag is missing this is the CURRENT-VERSION-NUMBER) of the current class by applying the given conversion rules. The to-tag is added for clarity and optionally allows a tool to convert in multiple steps.
-
uses(IDENT (version = VERSION-NUMBER) )
Defines that classes within this top-level class uses version VERSION-NUMBER of classes within the top-level class IDENT. The annotations uses and conversion may contain several different sub-entries.
A top-level class, IDENT, with version VERSION-NUMBER can be stored in one of the following ways in a directory given in the MODELICAPATH:
- The file IDENT ".mo"
Example: Modelica.mo - The file IDENT " " VERSION-NUMBER ".mo"
Example: Modelica 2.1.mo - The directory IDENT
Example: Modelica - The directory IDENT " " VERSION-NUMBER
Example: Modelica 2.1
This allows a tool to access multiple versions of the same package.