-
Notifications
You must be signed in to change notification settings - Fork 298
/
UnitCheck4.mos
45 lines (42 loc) · 926 Bytes
/
UnitCheck4.mos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// name: UnitCheck4
// keywords: initialization
// status: correct
loadString("
package unitCheckTests
model UnitCheck4
Real S(unit=\"m\");
Real V(unit=\"m/s\");
Real A;
equation
der(S) = V;
A = der(V);
S = 5.0;
end UnitCheck4;
end unitCheckTests;
"); getErrorString();
setCommandLineOptions("--unitChecking -d=dumpUnits"); getErrorString();
instantiateModel(unitCheckTests.UnitCheck4); getErrorString();
// Result:
// true
// ""
// true
// ""
// HashTable:
// {S,{1.0 * m^(1)}}
// {V,{1.0 * m^(1) * s^(-1)}}
// {A,{1.0 * m^(1) * s^(-2)}}
// {jhagemann,{MASTER()}}
// ######## UnitCheck COMPLETED ########
// "class unitCheckTests.UnitCheck4
// Real S(unit = \"m\");
// Real V(unit = \"m/s\");
// Real A(unit = \"m.s-2\");
// equation
// der(S) = V;
// A = der(V);
// S = 5.0;
// end unitCheckTests.UnitCheck4;
// "
// "Notification: \"A\" has the Unit \"m.s-2\"
// "
// endResult