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