-
Notifications
You must be signed in to change notification settings - Fork 296
/
fmi_attributes_13.mos
153 lines (146 loc) · 3.83 KB
/
fmi_attributes_13.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// name: fmi_attributes_13.mos
// keywords: FMI 2.0 export
// status: correct
// teardown_command: rm -rf fmi_attributes_13.fmu fmi_attributes_13.log fmi_attributes_13.xml fmi_attributes_13_tmp.xml fmi_attributes_13.fmutmp/
setCommandLineOptions("-d=newInst,-disableDirectionalDerivatives,fmuExperimental");
getErrorString();
loadString("
model fmi_attributes_13
input Real u;
Real x;
output Real y;
Real a, b;
parameter Real z=30;
protected
Real m, n;
initial equation
x = 0.0;
equation
a = 2.0*u;
b = 0.5*a;
der(x) = b+z;
y = x;
m = z;
n = a;
end fmi_attributes_13;
"); getErrorString();
setCommandLineOptions("--fmiFilter=none"); getErrorString();
translateModelFMU(fmi_attributes_13); getErrorString();
// unzip to console, quiet, extra quiet
system("unzip -cqq fmi_attributes_13.fmu modelDescription.xml > fmi_attributes_13_tmp.xml"); getErrorString();
system("sed -n \"/<ModelVariables>/,/<\\/ModelVariables>/p\" fmi_attributes_13_tmp.xml > fmi_attributes_13.xml"); getErrorString();
readFile("fmi_attributes_13.xml"); getErrorString();
system("sed -n \"/<ModelStructure>/,/<\\/ModelStructure>/p\" fmi_attributes_13_tmp.xml > fmi_attributes_13.xml"); getErrorString();
readFile("fmi_attributes_13.xml"); getErrorString();
// Result:
// true
// ""
// true
// ""
// true
// ""
// "fmi_attributes_13.fmu"
// ""
// 0
// ""
// 0
// ""
// " <ModelVariables>
// <!-- Index of variable = \"1\" -->
// <ScalarVariable
// name=\"x\"
// valueReference=\"0\"
// >
// <Real/>
// </ScalarVariable>
// <!-- Index of variable = \"2\" -->
// <ScalarVariable
// name=\"der(x)\"
// valueReference=\"1\"
// >
// <Real derivative=\"1\"/>
// </ScalarVariable>
// <!-- Index of variable = \"3\" -->
// <ScalarVariable
// name=\"a\"
// valueReference=\"2\"
// >
// <Real/>
// </ScalarVariable>
// <!-- Index of variable = \"4\" -->
// <ScalarVariable
// name=\"b\"
// valueReference=\"3\"
// >
// <Real/>
// </ScalarVariable>
// <!-- Index of variable = \"5\" -->
// <ScalarVariable
// name=\"u\"
// valueReference=\"4\"
// causality=\"input\"
// >
// <Real start=\"0.0\"/>
// </ScalarVariable>
// <!-- Index of variable = \"6\" -->
// <ScalarVariable
// name=\"y\"
// valueReference=\"5\"
// causality=\"output\"
// >
// <Real/>
// </ScalarVariable>
// <!-- Index of variable = \"7\" -->
// <ScalarVariable
// name=\"m\"
// valueReference=\"6\"
// variability=\"fixed\"
// causality=\"calculatedParameter\"
// >
// <Real/>
// </ScalarVariable>
// <!-- Index of variable = \"8\" -->
// <ScalarVariable
// name=\"z\"
// valueReference=\"7\"
// variability=\"fixed\"
// causality=\"parameter\"
// >
// <Real start=\"30.0\"/>
// </ScalarVariable>
// <!-- Index of variable = \"9\" -->
// <ScalarVariable
// name=\"_D_outputAlias_y\"
// valueReference=\"0\"
// >
// <Real/>
// </ScalarVariable>
// <!-- Index of variable = \"10\" -->
// <ScalarVariable
// name=\"n\"
// valueReference=\"2\"
// >
// <Real/>
// </ScalarVariable>
// </ModelVariables>
// "
// ""
// 0
// ""
// " <ModelStructure>
// <Outputs>
// <Unknown index=\"6\" dependencies=\"1\" dependenciesKind=\"dependent\" />
// </Outputs>
// <Derivatives>
// <Unknown index=\"2\" dependencies=\"5\" dependenciesKind=\"dependent\" />
// </Derivatives>
// <InitialUnknowns>
// <Unknown index=\"1\" dependencies=\"\" dependenciesKind=\"\" />
// <Unknown index=\"2\" dependencies=\"5 8\" dependenciesKind=\"dependent dependent\" />
// <Unknown index=\"6\" dependencies=\"\" dependenciesKind=\"\" />
// <Unknown index=\"7\" dependencies=\"8\" dependenciesKind=\"dependent\" />
// </InitialUnknowns>
// </ModelStructure>
// "
// ""
// endResult