Ticket #2177: TestPosture.mo

File TestPosture.mo, 604 bytes (added by Pavol Privitzer, 12 years ago)
Line 
1type Posture = enumeration(
2 Lying,
3 Sitting,
4 Standing,
5 Tilting);
6
7model TorsoModel
8 parameter Real arrayByEnum[Posture];
9 parameter Real arrayByInt[5];
10 Posture enmIndex;
11 Integer intIndex;
12 Real resultE;
13 Real resultI;
14equation
15 resultE = arrayByEnum[enmIndex];
16 resultI = arrayByInt[intIndex];
17end TorsoModel;
18
19model TestPosture
20 TorsoModel tmodel;
21initial equation
22 tmodel.enmIndex = Posture.Lying;
23 tmodel.intIndex = 1;
24equation
25 when time >= 1.0 then
26 tmodel.enmIndex = Posture.Sitting;
27 tmodel.intIndex = 2;
28 end when;
29end TestPosture;