2.4 Creating a Dynamic Model in Wolfram SystemModeler
49
If this model is a descendant of another class, then this fact is passed by the
keyword extends, followed by the name of the base class. Keep in mind that Modelica supports multiple inheritances. In this case, inheritance can be performed with
modification of the parameters of the base classes.
Thus, the definition of the model has the following general form:
model ModelName "An optional description"
extends Model1; // Inheritance without
modifications
extends Model2(n=5);// Inheritance with
modification
// In this block, variables, parameters and
constants are declared.
equation
/* This block describes the equations. */
end ModelName;
More information about the description of models in the Modelica language can
be found in [4].
Now, it is time to add a variable and an equation.
Consider setting variables. The basic data types in Modelica are represented by
the following types:
Real—real data type;
Integer—integer data type;
String—string data type;
Boolean—Boolean data type.
They are also classes and possess their properties, for example, can act as base
classes. For variables of type Real, the function der() is defined, which returns the
value of the time derivative.
Addition: additional data types
Record
Record type is a class type that serves to combine into a logical integer variable
of different types. A record may have variables like a model but does not include
equations. Records are mainly used to group data. But, they are also very useful in
describing data associated with annotations.
Record looks like a model, but without any equations:
49
If this model is a descendant of another class, then this fact is passed by the
keyword extends, followed by the name of the base class. Keep in mind that Modelica supports multiple inheritances. In this case, inheritance can be performed with
modification of the parameters of the base classes.
Thus, the definition of the model has the following general form:
model ModelName "An optional description"
extends Model1; // Inheritance without
modifications
extends Model2(n=5);// Inheritance with
modification
// In this block, variables, parameters and
constants are declared.
equation
/* This block describes the equations. */
end ModelName;
More information about the description of models in the Modelica language can
be found in [4].
Now, it is time to add a variable and an equation.
Consider setting variables. The basic data types in Modelica are represented by
the following types:
Real—real data type;
Integer—integer data type;
String—string data type;
Boolean—Boolean data type.
They are also classes and possess their properties, for example, can act as base
classes. For variables of type Real, the function der() is defined, which returns the
value of the time derivative.
Addition: additional data types
Record
Record type is a class type that serves to combine into a logical integer variable
of different types. A record may have variables like a model but does not include
equations. Records are mainly used to group data. But, they are also very useful in
describing data associated with annotations.
Record looks like a model, but without any equations:
