2.4 Creating a Dynamic Model in Wolfram SystemModeler
51
type Temperature = Real(unit="K");// Can be
used for temperature difference.
type AbsoluteTemperature = Temperature(min=0);
// Must be positive
In addition to the above types, Modelica also has an enumeration type—enumerations. It is used to determine the type of variables that can take on only a limited set
of specific values. In fact, enumerations are not strictly necessary in the language.
Their values can always be represented by integers. The enumeration type is specified
using the enumeration keyword.
Also, to create new data types can be used record, which will be discussed below.
More information about data types in Modelica can be found in [4].
Let’s go to the basic equation.
Equation
Consider the types of equations that we can use when creating a model. First of
all, these are ordinary equations.
All equations consist of left and right sides, separated by an equal sign, i.e.,
representable as:
=
"Description of the equation (abstract)";
Newton’s law can serve as an example of an equation in mechanics:
m*der(v) = F "Newton's Second Law";
The left and right sides of the equation in Modelica are expressions, not assignments. In other words (and unlike most programming languages), the left side should
not be variable (as we see in the case of Newton’s law above).
Another type of equation is the initial equation.
You can specify the equations in the model that will be used to set the initial
conditions as follows:
initial equation
x = 0; // Only used to solve for initial conditions
Finally, conditional equations can be used.
Précédent

- 64/274

Suivant