Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 79.0% 1157 / 0 / 1464
Functions: -% 0 / 1 / 1
Branches: 84.6% 110 / 0 / 130

build_cmake/OMCompiler/Compiler/generated-mo/Template/CodegenFMUCommon.mo
Line Branch Exec Source
1 encapsulated package CodegenFMUCommon
2 "
3 file: CodegenFMUCommon.mo
4 package: CodegenFMUCommon
5 description: Generated by Susan.
6 "
7
8 public import Tpl;
9
10 public import SimCodeVar;
11 public import HashTableCrefSimVar;
12 public import SimCode;
13 public import SimCodeFunction;
14 public import SimCodeCodegenUtil;
15 public import SimCodeFunctionUtil;
16 public import BackendDAE;
17 public import System;
18 public import Autoconf;
19 protected import Absyn;
20 protected import AbsynUtil;
21 public import MMath;
22 public import DAE;
23 public import ClassInf;
24 public import ClassInfUtil;
25 protected import SCode;
26 protected import SCodeDump;
27 public import StringUtil;
28 public import Util;
29 public import List;
30 public import ComponentReferenceBasics;
31 public import ComponentReference;
32 public import Expression;
33 protected import ExpressionDump;
34 public import ExpressionBasics;
35 public import Config;
36 public import Testsuite;
37 public import Flags;
38 public import FlagsUtil;
39 public import Settings;
40 public import Patternm;
41 public import Error;
42 public import Values;
43 public import ValuesUtil;
44 public import DAEDump;
45 public import Algorithm;
46 protected import ElementSource;
47 public import DAEUtil;
48 public import TypesDump;
49 public import Types;
50 public import HashTableCrIListArray;
51 public import BackendVariable;
52 public import HpcOmSimCode;
53 public import HpcOmCodegenUtil;
54 public import FMI;
55 public import CodegenUtil;
56 public import CodegenUtilSimulation;
57
58 protected function fun_49
59 input Tpl.Text in_txt;
60 input Boolean in_mArg;
61
62 output Tpl.Text out_txt;
63 algorithm
64 out_txt :=
65 match(in_txt, in_mArg)
66 local
67 Tpl.Text txt;
68
69 case ( txt,
70 false )
71 algorithm
72 54 txt := Tpl.writeTok(txt, Tpl.ST_STRING("providesDirectionalDerivative=\"false\""));
73 then txt;
74
75 case ( txt,
76 _ )
77 algorithm
78 12 txt := Tpl.writeTok(txt, Tpl.ST_STRING("providesDirectionalDerivative=\"true\""));
79 then txt;
80 end match;
81 end fun_49;
82
83 public function ModelExchange
84 input Tpl.Text in_txt;
85 input SimCode.SimCode in_a_simCode;
86 input list<String> in_a_sourceFiles;
87
88 output Tpl.Text out_txt;
89 algorithm
90 out_txt :=
91 match(in_txt, in_a_simCode, in_a_sourceFiles)
92 local
93 Tpl.Text txt;
94 list<String> a_sourceFiles;
95 SimCode.SimCode i_simCode;
96 Boolean ret_1;
97 Tpl.Text l_modelIdentifier;
98
99 case ( txt,
100 (i_simCode as SimCode.SIMCODE(modelInfo = _)),
101 a_sourceFiles )
102 algorithm
103 66 l_modelIdentifier := CodegenUtilSimulation.modelNamePrefix(Tpl.emptyTxt, i_simCode);
104 66 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<ModelExchange\n"));
105 66 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
106 66 txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelIdentifier=\""));
107 66 txt := Tpl.writeText(txt, l_modelIdentifier);
108 66 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
109 "\"\n",
110 "needsExecutionTool=\"false\"\n",
111 "completedIntegratorStepNotNeeded=\"false\"\n",
112 "canBeInstantiatedOnlyOncePerProcess=\"false\"\n",
113 "canNotUseMemoryManagementFunctions=\"false\"\n",
114 "canGetAndSetFMUstate=\"true\"\n",
115 "canSerializeFMUstate=\"true\"\n"
116 }, true));
117 66 ret_1 := SimCodeCodegenUtil.providesDirectionalDerivative(i_simCode);
118 66 txt := fun_49(txt, ret_1);
119 66 txt := Tpl.writeTok(txt, Tpl.ST_LINE(">\n"));
120 66 txt := SourceFiles(txt, a_sourceFiles);
121 66 txt := Tpl.softNewLine(txt);
122 66 txt := Tpl.popBlock(txt);
123 66 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</ModelExchange>"));
124 then txt;
125
126 case ( txt,
127 _,
128 _ )
129 then txt;
130 end match;
131 end ModelExchange;
132
133 protected function lm_51
134 input output Tpl.Text txt;
135 input list<String> items;
136 algorithm
137
2/2
✓ Branch 0 taken 296 times.
✓ Branch 1 taken 4 times.
300 for lstElt_51 in items loop
138 txt := match lstElt_51
139 local
140 String i_file;
141
142 case i_file
143 algorithm
144 296 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<File name=\""));
145 296 txt := Tpl.writeStr(txt, i_file);
146 296 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" />"));
147 296 txt := Tpl.nextIter(txt);
148 then txt;
149 end match;
150 end for;
151 end lm_51;
152
153 public function SourceFiles
154 input Tpl.Text in_txt;
155 input list<String> in_a_sourceFiles;
156
157 output Tpl.Text out_txt;
158 algorithm
159 out_txt :=
160 match(in_txt, in_a_sourceFiles)
161 local
162 Tpl.Text txt;
163 list<String> i_sourceFiles;
164
165 case ( txt,
166 {} )
167 then txt;
168
169 case ( txt,
170 i_sourceFiles )
171 algorithm
172 4 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<SourceFiles>\n"));
173 4 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
174 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
175 4 txt := lm_51(txt, i_sourceFiles);
176 4 txt := Tpl.popIter(txt);
177 4 txt := Tpl.softNewLine(txt);
178 4 txt := Tpl.popBlock(txt);
179 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</SourceFiles>"));
180 then txt;
181 end match;
182 end SourceFiles;
183
184 protected function lm_53
185 input output Tpl.Text txt;
186 input list<SimCodeVar.SimVar> items;
187 input String a_FMUVersion;
188 input list<SimCodeVar.SimVar> a_stateVars;
189 input SimCode.SimCode a_simCode;
190 algorithm
191
2/2
✓ Branch 0 taken 81 times.
✓ Branch 1 taken 74 times.
155 for lstElt_53 in items loop
192 txt := match lstElt_53
193 local
194 SimCodeVar.SimVar i_var;
195
196 case i_var
197 algorithm
198 81 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
199 81 txt := Tpl.nextIter(txt);
200 then txt;
201 end match;
202 end for;
203 end lm_53;
204
205 protected function lm_54
206 input output Tpl.Text txt;
207 input list<SimCodeVar.SimVar> items;
208 input String a_FMUVersion;
209 input list<SimCodeVar.SimVar> a_stateVars;
210 input SimCode.SimCode a_simCode;
211 algorithm
212
2/2
✓ Branch 0 taken 81 times.
✓ Branch 1 taken 74 times.
155 for lstElt_54 in items loop
213 txt := match lstElt_54
214 local
215 SimCodeVar.SimVar i_var;
216
217 case i_var
218 algorithm
219 81 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
220 81 txt := Tpl.nextIter(txt);
221 then txt;
222 end match;
223 end for;
224 end lm_54;
225
226 protected function lm_55
227 input output Tpl.Text txt;
228 input list<SimCodeVar.SimVar> items;
229 input String a_FMUVersion;
230 input list<SimCodeVar.SimVar> a_stateVars;
231 input SimCode.SimCode a_simCode;
232 algorithm
233
2/2
✓ Branch 0 taken 2744 times.
✓ Branch 1 taken 74 times.
2818 for lstElt_55 in items loop
234 txt := match lstElt_55
235 local
236 SimCodeVar.SimVar i_var;
237
238 case i_var
239 algorithm
240 2744 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
241 2744 txt := Tpl.nextIter(txt);
242 then txt;
243 end match;
244 end for;
245 end lm_55;
246
247 protected function lm_56
248 input output Tpl.Text txt;
249 input list<SimCodeVar.SimVar> items;
250 input String a_FMUVersion;
251 input list<SimCodeVar.SimVar> a_stateVars;
252 input SimCode.SimCode a_simCode;
253 algorithm
254
2/2
✓ Branch 0 taken 248 times.
✓ Branch 1 taken 74 times.
322 for lstElt_56 in items loop
255 txt := match lstElt_56
256 local
257 SimCodeVar.SimVar i_var;
258
259 case i_var
260 algorithm
261 248 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
262 248 txt := Tpl.nextIter(txt);
263 then txt;
264 end match;
265 end for;
266 end lm_56;
267
268 protected function lm_57
269 input output Tpl.Text txt;
270 input list<SimCodeVar.SimVar> items;
271 input String a_FMUVersion;
272 input list<SimCodeVar.SimVar> a_stateVars;
273 input SimCode.SimCode a_simCode;
274 algorithm
275
2/2
✓ Branch 0 taken 1088 times.
✓ Branch 1 taken 74 times.
1162 for lstElt_57 in items loop
276 txt := match lstElt_57
277 local
278 SimCodeVar.SimVar i_var;
279
280 case i_var
281 algorithm
282 1088 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
283 1088 txt := Tpl.nextIter(txt);
284 then txt;
285 end match;
286 end for;
287 end lm_57;
288
289 protected function lm_58
290 input output Tpl.Text txt;
291 input list<SimCodeVar.SimVar> items;
292 input String a_FMUVersion;
293 input list<SimCodeVar.SimVar> a_stateVars;
294 input SimCode.SimCode a_simCode;
295 algorithm
296
2/2
✓ Branch 0 taken 1368 times.
✓ Branch 1 taken 74 times.
1442 for lstElt_58 in items loop
297 txt := match lstElt_58
298 local
299 SimCodeVar.SimVar i_var;
300
301 case i_var
302 algorithm
303 1368 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
304 1368 txt := Tpl.nextIter(txt);
305 then txt;
306 end match;
307 end for;
308 end lm_58;
309
310 protected function lm_59
311 input output Tpl.Text txt;
312 input list<SimCodeVar.SimVar> items;
313 input String a_FMUVersion;
314 input list<SimCodeVar.SimVar> a_stateVars;
315 input SimCode.SimCode a_simCode;
316 algorithm
317
2/2
✓ Branch 0 taken 113 times.
✓ Branch 1 taken 74 times.
187 for lstElt_59 in items loop
318 txt := match lstElt_59
319 local
320 SimCodeVar.SimVar i_var;
321
322 case i_var
323 algorithm
324 113 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
325 113 txt := Tpl.nextIter(txt);
326 then txt;
327 end match;
328 end for;
329 end lm_59;
330
331 protected function lm_60
332 input output Tpl.Text txt;
333 input list<SimCodeVar.SimVar> items;
334 input String a_FMUVersion;
335 input list<SimCodeVar.SimVar> a_stateVars;
336 input SimCode.SimCode a_simCode;
337 algorithm
338
2/2
✓ Branch 0 taken 100 times.
✓ Branch 1 taken 74 times.
174 for lstElt_60 in items loop
339 txt := match lstElt_60
340 local
341 SimCodeVar.SimVar i_var;
342
343 case i_var
344 algorithm
345 100 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
346 100 txt := Tpl.nextIter(txt);
347 then txt;
348 end match;
349 end for;
350 end lm_60;
351
352 protected function lm_61
353 input output Tpl.Text txt;
354 input list<SimCodeVar.SimVar> items;
355 input String a_FMUVersion;
356 input list<SimCodeVar.SimVar> a_stateVars;
357 input SimCode.SimCode a_simCode;
358 algorithm
359
2/2
✓ Branch 0 taken 76 times.
✓ Branch 1 taken 74 times.
150 for lstElt_61 in items loop
360 txt := match lstElt_61
361 local
362 SimCodeVar.SimVar i_var;
363
364 case i_var
365 algorithm
366 76 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
367 76 txt := Tpl.nextIter(txt);
368 then txt;
369 end match;
370 end for;
371 end lm_61;
372
373 protected function lm_62
374 input output Tpl.Text txt;
375 input list<SimCodeVar.SimVar> items;
376 input String a_FMUVersion;
377 input list<SimCodeVar.SimVar> a_stateVars;
378 input SimCode.SimCode a_simCode;
379 algorithm
380
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 74 times.
91 for lstElt_62 in items loop
381 txt := match lstElt_62
382 local
383 SimCodeVar.SimVar i_var;
384
385 case i_var
386 algorithm
387 17 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
388 17 txt := Tpl.nextIter(txt);
389 then txt;
390 end match;
391 end for;
392 end lm_62;
393
394 protected function lm_63
395 input output Tpl.Text txt;
396 input list<SimCodeVar.SimVar> items;
397 input String a_FMUVersion;
398 input list<SimCodeVar.SimVar> a_stateVars;
399 input SimCode.SimCode a_simCode;
400 algorithm
401
2/2
✓ Branch 0 taken 115 times.
✓ Branch 1 taken 74 times.
189 for lstElt_63 in items loop
402 txt := match lstElt_63
403 local
404 SimCodeVar.SimVar i_var;
405
406 case i_var
407 algorithm
408 115 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
409 115 txt := Tpl.nextIter(txt);
410 then txt;
411 end match;
412 end for;
413 end lm_63;
414
415 protected function lm_64
416 input output Tpl.Text txt;
417 input list<SimCodeVar.SimVar> items;
418 input String a_FMUVersion;
419 input list<SimCodeVar.SimVar> a_stateVars;
420 input SimCode.SimCode a_simCode;
421 algorithm
422
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
74 for lstElt_64 in items loop
423 txt := match lstElt_64
424 local
425 SimCodeVar.SimVar i_var;
426
427 case i_var
428 algorithm
429 ✗ txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
430 ✗ txt := Tpl.nextIter(txt);
431 then txt;
432 end match;
433 end for;
434 end lm_64;
435
436 protected function lm_65
437 input output Tpl.Text txt;
438 input list<SimCodeVar.SimVar> items;
439 input String a_FMUVersion;
440 input list<SimCodeVar.SimVar> a_stateVars;
441 input SimCode.SimCode a_simCode;
442 algorithm
443
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 74 times.
77 for lstElt_65 in items loop
444 txt := match lstElt_65
445 local
446 SimCodeVar.SimVar i_var;
447
448 case i_var
449 algorithm
450 3 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
451 3 txt := Tpl.nextIter(txt);
452 then txt;
453 end match;
454 end for;
455 end lm_65;
456
457 protected function lm_66
458 input output Tpl.Text txt;
459 input list<SimCodeVar.SimVar> items;
460 input String a_FMUVersion;
461 input list<SimCodeVar.SimVar> a_stateVars;
462 input SimCode.SimCode a_simCode;
463 algorithm
464
2/2
✓ Branch 0 taken 88 times.
✓ Branch 1 taken 74 times.
162 for lstElt_66 in items loop
465 txt := match lstElt_66
466 local
467 SimCodeVar.SimVar i_var;
468
469 case i_var
470 algorithm
471 88 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
472 88 txt := Tpl.nextIter(txt);
473 then txt;
474 end match;
475 end for;
476 end lm_66;
477
478 protected function lm_67
479 input output Tpl.Text txt;
480 input list<SimCodeVar.SimVar> items;
481 input String a_FMUVersion;
482 input list<SimCodeVar.SimVar> a_stateVars;
483 input SimCode.SimCode a_simCode;
484 algorithm
485
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
74 for lstElt_67 in items loop
486 txt := match lstElt_67
487 local
488 SimCodeVar.SimVar i_var;
489
490 case i_var
491 algorithm
492 ✗ txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
493 ✗ txt := Tpl.nextIter(txt);
494 then txt;
495 end match;
496 end for;
497 end lm_67;
498
499 protected function fun_68
500 input Tpl.Text in_txt;
501 input SimCode.ModelInfo in_a_modelInfo;
502 input String in_a_FMUVersion;
503 input SimCode.SimCode in_a_simCode;
504
505 output Tpl.Text out_txt;
506 algorithm
507 out_txt :=
508 match(in_txt, in_a_modelInfo, in_a_FMUVersion, in_a_simCode)
509 local
510 Tpl.Text txt;
511 String a_FMUVersion;
512 SimCode.SimCode a_simCode;
513 SimCode.ModelInfo i_modelInfo;
514 list<SimCodeVar.SimVar> i_vars_stringAliasVars;
515 list<SimCodeVar.SimVar> i_vars_stringParamVars;
516 list<SimCodeVar.SimVar> i_vars_stringAlgVars;
517 list<SimCodeVar.SimVar> i_vars_boolAliasVars;
518 list<SimCodeVar.SimVar> i_vars_boolParamVars;
519 list<SimCodeVar.SimVar> i_vars_boolAlgVars;
520 list<SimCodeVar.SimVar> i_vars_intAliasVars;
521 list<SimCodeVar.SimVar> i_vars_intParamVars;
522 list<SimCodeVar.SimVar> i_vars_intAlgVars;
523 list<SimCodeVar.SimVar> i_vars_aliasVars;
524 list<SimCodeVar.SimVar> i_vars_paramVars;
525 list<SimCodeVar.SimVar> i_vars_discreteAlgVars;
526 list<SimCodeVar.SimVar> i_vars_algVars;
527 list<SimCodeVar.SimVar> i_vars_derivativeVars;
528 list<SimCodeVar.SimVar> i_stateVars;
529 list<SimCodeVar.SimVar> i_vars_stateVars;
530
531 case ( txt,
532 (i_modelInfo as SimCode.MODELINFO(vars = SimCodeVar.SIMVARS(stateVars = (i_vars_stateVars as i_stateVars), derivativeVars = i_vars_derivativeVars, algVars = i_vars_algVars, discreteAlgVars = i_vars_discreteAlgVars, paramVars = i_vars_paramVars, aliasVars = i_vars_aliasVars, intAlgVars = i_vars_intAlgVars, intParamVars = i_vars_intParamVars, intAliasVars = i_vars_intAliasVars, boolAlgVars = i_vars_boolAlgVars, boolParamVars = i_vars_boolParamVars, boolAliasVars = i_vars_boolAliasVars, stringAlgVars = i_vars_stringAlgVars, stringParamVars = i_vars_stringParamVars, stringAliasVars = i_vars_stringAliasVars))),
533 a_FMUVersion,
534 a_simCode )
535 algorithm
536 74 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<ModelVariables>\n"));
537 74 System.tmpTickReset(0);
538 74 txt := Tpl.softNewLine(txt);
539 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
540 74 txt := lm_53(txt, i_vars_stateVars, a_FMUVersion, i_stateVars, a_simCode);
541 74 txt := Tpl.popIter(txt);
542 74 txt := Tpl.softNewLine(txt);
543 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
544 74 txt := lm_54(txt, i_vars_derivativeVars, a_FMUVersion, i_stateVars, a_simCode);
545 74 txt := Tpl.popIter(txt);
546 74 txt := Tpl.softNewLine(txt);
547 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
548 74 txt := lm_55(txt, i_vars_algVars, a_FMUVersion, i_stateVars, a_simCode);
549 74 txt := Tpl.popIter(txt);
550 74 txt := Tpl.softNewLine(txt);
551 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
552 74 txt := lm_56(txt, i_vars_discreteAlgVars, a_FMUVersion, i_stateVars, a_simCode);
553 74 txt := Tpl.popIter(txt);
554 74 txt := Tpl.softNewLine(txt);
555 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
556 74 txt := lm_57(txt, i_vars_paramVars, a_FMUVersion, i_stateVars, a_simCode);
557 74 txt := Tpl.popIter(txt);
558 74 txt := Tpl.softNewLine(txt);
559 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
560 74 txt := lm_58(txt, i_vars_aliasVars, a_FMUVersion, i_stateVars, a_simCode);
561 74 txt := Tpl.popIter(txt);
562 74 txt := Tpl.softNewLine(txt);
563 74 System.tmpTickReset(0);
564 74 txt := Tpl.softNewLine(txt);
565 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
566 74 txt := lm_59(txt, i_vars_intAlgVars, a_FMUVersion, i_stateVars, a_simCode);
567 74 txt := Tpl.popIter(txt);
568 74 txt := Tpl.softNewLine(txt);
569 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
570 74 txt := lm_60(txt, i_vars_intParamVars, a_FMUVersion, i_stateVars, a_simCode);
571 74 txt := Tpl.popIter(txt);
572 74 txt := Tpl.softNewLine(txt);
573 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
574 74 txt := lm_61(txt, i_vars_intAliasVars, a_FMUVersion, i_stateVars, a_simCode);
575 74 txt := Tpl.popIter(txt);
576 74 txt := Tpl.softNewLine(txt);
577 74 System.tmpTickReset(0);
578 74 txt := Tpl.softNewLine(txt);
579 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
580 74 txt := lm_62(txt, i_vars_boolAlgVars, a_FMUVersion, i_stateVars, a_simCode);
581 74 txt := Tpl.popIter(txt);
582 74 txt := Tpl.softNewLine(txt);
583 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
584 74 txt := lm_63(txt, i_vars_boolParamVars, a_FMUVersion, i_stateVars, a_simCode);
585 74 txt := Tpl.popIter(txt);
586 74 txt := Tpl.softNewLine(txt);
587 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
588 74 txt := lm_64(txt, i_vars_boolAliasVars, a_FMUVersion, i_stateVars, a_simCode);
589 74 txt := Tpl.popIter(txt);
590 74 txt := Tpl.softNewLine(txt);
591 74 System.tmpTickReset(0);
592 74 txt := Tpl.softNewLine(txt);
593 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
594 74 txt := lm_65(txt, i_vars_stringAlgVars, a_FMUVersion, i_stateVars, a_simCode);
595 74 txt := Tpl.popIter(txt);
596 74 txt := Tpl.softNewLine(txt);
597 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
598 74 txt := lm_66(txt, i_vars_stringParamVars, a_FMUVersion, i_stateVars, a_simCode);
599 74 txt := Tpl.popIter(txt);
600 74 txt := Tpl.softNewLine(txt);
601 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
602 74 txt := lm_67(txt, i_vars_stringAliasVars, a_FMUVersion, i_stateVars, a_simCode);
603 74 txt := Tpl.popIter(txt);
604 74 txt := Tpl.softNewLine(txt);
605 74 System.tmpTickReset(0);
606 74 txt := Tpl.softNewLine(txt);
607 74 txt := externalFunctions(txt, i_modelInfo);
608 74 txt := Tpl.softNewLine(txt);
609 74 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</ModelVariables>"));
610 then txt;
611
612 case ( txt,
613 _,
614 _,
615 _ )
616 then txt;
617 end match;
618 end fun_68;
619
620 public function fmiModelVariables
621 input Tpl.Text in_txt;
622 input SimCode.SimCode in_a_simCode;
623 input String in_a_FMUVersion;
624
625 output Tpl.Text out_txt;
626 algorithm
627 out_txt :=
628 match(in_txt, in_a_simCode, in_a_FMUVersion)
629 local
630 Tpl.Text txt;
631 String a_FMUVersion;
632 SimCode.SimCode i_simCode;
633 SimCode.ModelInfo i_modelInfo;
634
635 case ( txt,
636 (i_simCode as SimCode.SIMCODE(modelInfo = i_modelInfo)),
637 a_FMUVersion )
638 algorithm
639 74 txt := fun_68(txt, i_modelInfo, a_FMUVersion, i_simCode);
640 then txt;
641
642 case ( txt,
643 _,
644 _ )
645 then txt;
646 end match;
647 end fmiModelVariables;
648
649 protected function lm_70
650 input output Tpl.Text txt;
651 input list<SimCodeVar.SimVar> items;
652 input String a_FMUVersion;
653 input list<SimCodeVar.SimVar> a_stateVars;
654 input SimCode.SimCode a_simCode;
655 algorithm
656
2/2
✓ Branch 0 taken 146 times.
✓ Branch 1 taken 17 times.
163 for lstElt_70 in items loop
657 txt := match lstElt_70
658 local
659 SimCodeVar.SimVar i_var;
660
661 case i_var
662 algorithm
663 146 txt := ScalarVariable(txt, i_var, a_simCode, a_stateVars, a_FMUVersion);
664 146 txt := Tpl.nextIter(txt);
665 then txt;
666 end match;
667 end for;
668 end lm_70;
669
670 protected function fun_71
671 input Tpl.Text in_txt;
672 input Boolean in_mArg;
673 input list<SimCodeVar.SimVar> in_a_stateVars;
674 input SimCode.SimCode in_a_simCode;
675 input SimCodeVar.SimVar in_a_simVar;
676
677 output Tpl.Text out_txt;
678 algorithm
679 out_txt :=
680 match(in_txt, in_mArg, in_a_stateVars, in_a_simCode, in_a_simVar)
681 local
682 Tpl.Text txt;
683 list<SimCodeVar.SimVar> a_stateVars;
684 SimCode.SimCode a_simCode;
685 SimCodeVar.SimVar a_simVar;
686 Integer ret_0;
687
688 case ( txt,
689 false,
690 _,
691 _,
692 _ )
693 then txt;
694
695 case ( txt,
696 _,
697 a_stateVars,
698 a_simCode,
699 a_simVar )
700 algorithm
701 2286 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<!-- Index of variable = \""));
702 2286 ret_0 := SimCodeCodegenUtil.getVariableFMIIndex(a_simVar);
703 2286 txt := Tpl.writeStr(txt, intString(ret_0));
704 2286 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
705 "\" -->\n",
706 "<ScalarVariable\n"
707 }, true));
708 2286 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
709 2286 txt := ScalarVariableAttribute2(txt, a_simVar, a_simCode);
710 2286 txt := Tpl.writeTok(txt, Tpl.ST_LINE(">\n"));
711 2286 txt := ScalarVariableType2(txt, a_simVar, a_stateVars);
712 2286 txt := Tpl.softNewLine(txt);
713 2286 txt := Tpl.popBlock(txt);
714 2286 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</ScalarVariable>"));
715 then txt;
716 end match;
717 end fun_71;
718
719 protected function fun_72
720 input Tpl.Text in_txt;
721 input Boolean in_mArg;
722 input list<SimCodeVar.SimVar> in_a_stateVars;
723 input SimCode.SimCode in_a_simCode;
724 input Option<DAE.ComponentRef> in_a_exportVar;
725 input SimCodeVar.SimVar in_a_simVar;
726
727 output Tpl.Text out_txt;
728 algorithm
729 out_txt :=
730 match(in_txt, in_mArg, in_a_stateVars, in_a_simCode, in_a_exportVar, in_a_simVar)
731 local
732 Tpl.Text txt;
733 list<SimCodeVar.SimVar> a_stateVars;
734 SimCode.SimCode a_simCode;
735 Option<DAE.ComponentRef> a_exportVar;
736 SimCodeVar.SimVar a_simVar;
737 Boolean ret_0;
738
739 case ( txt,
740 false,
741 _,
742 _,
743 _,
744 a_simVar )
745 algorithm
746 8 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<ScalarVariable\n"));
747 8 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
748 8 txt := ScalarVariableAttribute(txt, a_simVar);
749 8 txt := Tpl.writeTok(txt, Tpl.ST_LINE(">\n"));
750 8 txt := ScalarVariableType(txt, a_simVar);
751 8 txt := Tpl.softNewLine(txt);
752 8 txt := Tpl.popBlock(txt);
753 8 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</ScalarVariable>"));
754 then txt;
755
756 case ( txt,
757 _,
758 a_stateVars,
759 a_simCode,
760 a_exportVar,
761 a_simVar )
762 algorithm
763
3/4
✗ Branch 0 not taken.
✓ Branch 1 taken 6243 times.
✓ Branch 2 taken 2286 times.
✓ Branch 3 taken 3957 times.
6243 ret_0 := isSome(a_exportVar);
764 6243 txt := fun_71(txt, ret_0, a_stateVars, a_simCode, a_simVar);
765 then txt;
766 end match;
767 end fun_72;
768
769 protected function fun_73
770 input Tpl.Text in_txt;
771 input Boolean in_mArg;
772 input list<SimCodeVar.SimVar> in_a_stateVars;
773 input SimCode.SimCode in_a_simCode;
774 input Option<DAE.ComponentRef> in_a_exportVar;
775 input SimCodeVar.SimVar in_a_simVar;
776 input String in_a_FMUVersion;
777
778 output Tpl.Text out_txt;
779 algorithm
780 out_txt :=
781 match(in_txt, in_mArg, in_a_stateVars, in_a_simCode, in_a_exportVar, in_a_simVar, in_a_FMUVersion)
782 local
783 Tpl.Text txt;
784 list<SimCodeVar.SimVar> a_stateVars;
785 SimCode.SimCode a_simCode;
786 Option<DAE.ComponentRef> a_exportVar;
787 SimCodeVar.SimVar a_simVar;
788 String a_FMUVersion;
789 Boolean ret_0;
790
791 case ( txt,
792 false,
793 a_stateVars,
794 a_simCode,
795 a_exportVar,
796 a_simVar,
797 a_FMUVersion )
798 algorithm
799 6251 ret_0 := FMI.isFMIVersion20(a_FMUVersion);
800 6251 txt := fun_72(txt, ret_0, a_stateVars, a_simCode, a_exportVar, a_simVar);
801 then txt;
802
803 case ( txt,
804 _,
805 _,
806 _,
807 _,
808 _,
809 _ )
810 then txt;
811 end match;
812 end fun_73;
813
814 protected function fun_74
815 input Tpl.Text in_txt;
816 input Boolean in_mArg;
817 input list<SimCodeVar.SimVar> in_a_stateVars;
818 input SimCode.SimCode in_a_simCode;
819 input Option<DAE.ComponentRef> in_a_exportVar;
820 input SimCodeVar.SimVar in_a_simVar;
821 input String in_a_FMUVersion;
822 input DAE.ComponentRef in_a_name;
823
824 output Tpl.Text out_txt;
825 algorithm
826 out_txt :=
827 match(in_txt, in_mArg, in_a_stateVars, in_a_simCode, in_a_exportVar, in_a_simVar, in_a_FMUVersion, in_a_name)
828 local
829 Tpl.Text txt;
830 list<SimCodeVar.SimVar> a_stateVars;
831 SimCode.SimCode a_simCode;
832 Option<DAE.ComponentRef> a_exportVar;
833 SimCodeVar.SimVar a_simVar;
834 String a_FMUVersion;
835 DAE.ComponentRef a_name;
836 Boolean ret_1;
837 Tpl.Text txt_0;
838
839 case ( txt,
840 false,
841 a_stateVars,
842 a_simCode,
843 a_exportVar,
844 a_simVar,
845 a_FMUVersion,
846 a_name )
847 algorithm
848 6251 txt_0 := CodegenUtil.crefStr(Tpl.emptyTxt, a_name);
849
3/4
✓ Branch 1 taken 28 times.
✓ Branch 2 taken 6223 times.
✓ Branch 5 taken 28 times.
✗ Branch 6 not taken.
6251 ret_1 := stringEq(Tpl.textString(txt_0), "der($dummy)");
850 6251 txt := fun_73(txt, ret_1, a_stateVars, a_simCode, a_exportVar, a_simVar, a_FMUVersion);
851 then txt;
852
853 case ( txt,
854 _,
855 _,
856 _,
857 _,
858 _,
859 _,
860 _ )
861 then txt;
862 end match;
863 end fun_74;
864
865 public function ScalarVariable
866 input Tpl.Text in_txt;
867 input SimCodeVar.SimVar in_a_simVar;
868 input SimCode.SimCode in_a_simCode;
869 input list<SimCodeVar.SimVar> in_a_stateVars;
870 input String in_a_FMUVersion;
871
872 output Tpl.Text out_txt;
873 algorithm
874 out_txt :=
875 match(in_txt, in_a_simVar, in_a_simCode, in_a_stateVars, in_a_FMUVersion)
876 local
877 Tpl.Text txt;
878 SimCode.SimCode a_simCode;
879 list<SimCodeVar.SimVar> a_stateVars;
880 String a_FMUVersion;
881 Option<DAE.ComponentRef> i_exportVar;
882 DAE.ComponentRef i_name;
883 SimCodeVar.SimVar i_simVar;
884 Boolean ret_2;
885 Tpl.Text txt_1;
886 list<SimCodeVar.SimVar> ret_0;
887
888 case ( txt,
889 (i_simVar as SimCodeVar.SIMVAR(type_ = DAE.T_ARRAY(ty = _))),
890 a_simCode,
891 a_stateVars,
892 a_FMUVersion )
893 algorithm
894 17 ret_0 := SimCodeCodegenUtil.getScalarElements(i_simVar);
895 17 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
896 17 txt := lm_70(txt, ret_0, a_FMUVersion, a_stateVars, a_simCode);
897 17 txt := Tpl.popIter(txt);
898 then txt;
899
900 case ( txt,
901 (i_simVar as SimCodeVar.SIMVAR(name = i_name, exportVar = i_exportVar)),
902 a_simCode,
903 a_stateVars,
904 a_FMUVersion )
905 algorithm
906 6251 txt_1 := CodegenUtil.crefStr(Tpl.emptyTxt, i_name);
907
3/4
✓ Branch 1 taken 101 times.
✓ Branch 2 taken 6150 times.
✓ Branch 5 taken 101 times.
✗ Branch 6 not taken.
6251 ret_2 := stringEq(Tpl.textString(txt_1), "$dummy");
908 6251 txt := fun_74(txt, ret_2, a_stateVars, a_simCode, i_exportVar, i_simVar, a_FMUVersion, i_name);
909 then txt;
910
911 case ( txt,
912 _,
913 _,
914 _,
915 _ )
916 then txt;
917 end match;
918 end ScalarVariable;
919
920 protected function fun_76
921 input Tpl.Text in_txt;
922 input String in_a_comment;
923
924 output Tpl.Text out_txt;
925 algorithm
926 out_txt :=
927 match(in_txt, in_a_comment)
928 local
929 Tpl.Text txt;
930 String i_comment;
931 String ret_0;
932
933 case ( txt,
934 "" )
935 then txt;
936
937 case ( txt,
938 i_comment )
939 algorithm
940 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("description=\""));
941 ✗ ret_0 := Util.escapeModelicaStringToXmlString(i_comment);
942 ✗ txt := Tpl.writeStr(txt, ret_0);
943 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
944 then txt;
945 end match;
946 end fun_76;
947
948 public function ScalarVariableAttribute
949 input Tpl.Text in_txt;
950 input SimCodeVar.SimVar in_a_simVar;
951
952 output Tpl.Text out_txt;
953 algorithm
954 out_txt :=
955 match(in_txt, in_a_simVar)
956 local
957 Tpl.Text txt;
958 DAE.ComponentRef i_name;
959 Option<SimCodeVar.Causality> i_causality;
960 SimCodeVar.AliasVariable i_aliasvar;
961 String i_comment;
962 DAE.Type i_type__;
963 Option<SimCodeVar.Variability> i_variability;
964 String ret_7;
965 Tpl.Text txt_6;
966 Tpl.Text l_caus;
967 Tpl.Text l_alias;
968 Tpl.Text l_description;
969 Tpl.Text l_variability__;
970 Integer ret_1;
971 Tpl.Text l_valueReference;
972
973 case ( txt,
974 SimCodeVar.SIMVAR(variability = i_variability, type_ = i_type__, comment = i_comment, aliasvar = i_aliasvar, causality = i_causality, name = i_name) )
975 algorithm
976 8 ret_1 := System.tmpTick();
977 8 l_valueReference := Tpl.writeStr(Tpl.emptyTxt, intString(ret_1));
978 8 l_variability__ := getVariabilityFMI1(Tpl.emptyTxt, i_variability, i_type__);
979 8 l_description := fun_76(Tpl.emptyTxt, i_comment);
980 8 l_alias := getAliasVar(Tpl.emptyTxt, i_aliasvar);
981 8 l_caus := getCausality(Tpl.emptyTxt, i_causality);
982 8 txt := Tpl.writeTok(txt, Tpl.ST_STRING("name=\""));
983 8 txt_6 := CodegenUtil.crefStrNoUnderscore(Tpl.emptyTxt, i_name);
984 8 ret_7 := System.stringReplace(Tpl.textString(txt_6), "$", "_D_");
985 8 txt := Tpl.writeStr(txt, ret_7);
986 8 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
987 "\"\n",
988 "valueReference=\""
989 }, false));
990 8 txt := Tpl.writeText(txt, l_valueReference);
991 8 txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"\n"));
992 8 txt := Tpl.writeText(txt, l_description);
993 8 txt := Tpl.softNewLine(txt);
994 8 txt := Tpl.writeTok(txt, Tpl.ST_STRING("variability=\""));
995 8 txt := Tpl.writeText(txt, l_variability__);
996 8 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
997 "\"\n",
998 "causality=\""
999 }, false));
1000 8 txt := Tpl.writeText(txt, l_caus);
1001 8 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
1002 "\"\n",
1003 "alias=\""
1004 }, false));
1005 8 txt := Tpl.writeText(txt, l_alias);
1006 8 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1007 then txt;
1008
1009 case ( txt,
1010 _ )
1011 then txt;
1012 end match;
1013 end ScalarVariableAttribute;
1014
1015 public function getCausality
1016 input Tpl.Text in_txt;
1017 input Option<SimCodeVar.Causality> in_a_c;
1018
1019 output Tpl.Text out_txt;
1020 algorithm
1021 out_txt :=
1022 match(in_txt, in_a_c)
1023 local
1024 Tpl.Text txt;
1025
1026 case ( txt,
1027 SOME(SimCodeVar.NONECAUS()) )
1028 algorithm
1029 18 txt := Tpl.writeTok(txt, Tpl.ST_STRING("none"));
1030 then txt;
1031
1032 case ( txt,
1033 SOME(SimCodeVar.OUTPUT()) )
1034 algorithm
1035 99 txt := Tpl.writeTok(txt, Tpl.ST_STRING("output"));
1036 then txt;
1037
1038 case ( txt,
1039 SOME(SimCodeVar.INPUT()) )
1040 algorithm
1041 38 txt := Tpl.writeTok(txt, Tpl.ST_STRING("input"));
1042 then txt;
1043
1044 case ( txt,
1045 _ )
1046 algorithm
1047 11723 txt := Tpl.writeTok(txt, Tpl.ST_STRING("internal"));
1048 then txt;
1049 end match;
1050 end getCausality;
1051
1052 public function getVariability
1053 input Tpl.Text in_txt;
1054 input Option<SimCodeVar.Variability> in_a_variability__;
1055
1056 output Tpl.Text out_txt;
1057 algorithm
1058 out_txt :=
1059 match(in_txt, in_a_variability__)
1060 local
1061 Tpl.Text txt;
1062
1063 case ( txt,
1064 SOME(SimCodeVar.DISCRETE()) )
1065 algorithm
1066 2 txt := Tpl.writeTok(txt, Tpl.ST_STRING("discrete"));
1067 then txt;
1068
1069 case ( txt,
1070 SOME(SimCodeVar.FIXED()) )
1071 algorithm
1072 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("parameter"));
1073 then txt;
1074
1075 case ( txt,
1076 SOME(SimCodeVar.CONSTANT()) )
1077 algorithm
1078 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("constant"));
1079 then txt;
1080
1081 case ( txt,
1082 SOME(SimCodeVar.CONTINUOUS()) )
1083 algorithm
1084 2 txt := Tpl.writeTok(txt, Tpl.ST_STRING("continuous"));
1085 then txt;
1086
1087 case ( txt,
1088 _ )
1089 algorithm
1090 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("continuous"));
1091 then txt;
1092 end match;
1093 end getVariability;
1094
1095 protected function fun_80
1096 input Tpl.Text in_txt;
1097 input Option<SimCodeVar.Variability> in_a_variability__;
1098
1099 output Tpl.Text out_txt;
1100 algorithm
1101 out_txt :=
1102 match(in_txt, in_a_variability__)
1103 local
1104 Tpl.Text txt;
1105 Option<SimCodeVar.Variability> i_variability__;
1106
1107 case ( txt,
1108 SOME(SimCodeVar.CONTINUOUS()) )
1109 algorithm
1110 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("discrete"));
1111 then txt;
1112
1113 case ( txt,
1114 NONE() )
1115 algorithm
1116 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("discrete"));
1117 then txt;
1118
1119 case ( txt,
1120 i_variability__ )
1121 algorithm
1122 6 txt := getVariability(txt, i_variability__);
1123 then txt;
1124 end match;
1125 end fun_80;
1126
1127 protected function fun_81
1128 input Tpl.Text in_txt;
1129 input DAE.Type in_a_type__;
1130 input Option<SimCodeVar.Variability> in_a_variability__;
1131
1132 output Tpl.Text out_txt;
1133 algorithm
1134 out_txt :=
1135 match(in_txt, in_a_type__, in_a_variability__)
1136 local
1137 Tpl.Text txt;
1138 Option<SimCodeVar.Variability> a_variability__;
1139
1140 case ( txt,
1141 DAE.T_REAL(varLst = _),
1142 a_variability__ )
1143 algorithm
1144 2 txt := getVariability(txt, a_variability__);
1145 then txt;
1146
1147 case ( txt,
1148 _,
1149 a_variability__ )
1150 algorithm
1151 6 txt := fun_80(txt, a_variability__);
1152 then txt;
1153 end match;
1154 end fun_81;
1155
1156 public function getVariabilityFMI1
1157 input Tpl.Text txt;
1158 input Option<SimCodeVar.Variability> a_variability__;
1159 input DAE.Type a_type__;
1160
1161 output Tpl.Text out_txt;
1162 algorithm
1163 8 out_txt := fun_81(txt, a_type__, a_variability__);
1164 end getVariabilityFMI1;
1165
1166 public function getAliasVar
1167 input Tpl.Text in_txt;
1168 input SimCodeVar.AliasVariable in_a_aliasvar;
1169
1170 output Tpl.Text out_txt;
1171 algorithm
1172 out_txt :=
1173 match(in_txt, in_a_aliasvar)
1174 local
1175 Tpl.Text txt;
1176
1177 case ( txt,
1178 SimCodeVar.NOALIAS() )
1179 algorithm
1180 8 txt := Tpl.writeTok(txt, Tpl.ST_STRING("noAlias"));
1181 then txt;
1182
1183 case ( txt,
1184 _ )
1185 algorithm
1186 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("noAlias"));
1187 then txt;
1188 end match;
1189 end getAliasVar;
1190
1191 protected function fun_84
1192 input Tpl.Text in_txt;
1193 input DAE.Type in_a_type__;
1194 input SimCodeVar.SimVar in_a_simvar;
1195
1196 output Tpl.Text out_txt;
1197 algorithm
1198 out_txt :=
1199 match(in_txt, in_a_type__, in_a_simvar)
1200 local
1201 Tpl.Text txt;
1202 SimCodeVar.SimVar a_simvar;
1203 Absyn.Path i_path;
1204 String ret_0;
1205
1206 case ( txt,
1207 DAE.T_INTEGER(varLst = _),
1208 a_simvar )
1209 algorithm
1210 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Integer"));
1211 ✗ txt := StartString(txt, a_simvar);
1212 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
1213 then txt;
1214
1215 case ( txt,
1216 DAE.T_REAL(varLst = _),
1217 a_simvar )
1218 algorithm
1219 10 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Real"));
1220 10 txt := StartString(txt, a_simvar);
1221 10 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
1222 then txt;
1223
1224 case ( txt,
1225 DAE.T_BOOL(varLst = _),
1226 a_simvar )
1227 algorithm
1228 6 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Boolean"));
1229 6 txt := StartString(txt, a_simvar);
1230 6 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
1231 then txt;
1232
1233 case ( txt,
1234 DAE.T_STRING(varLst = _),
1235 a_simvar )
1236 algorithm
1237 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<String"));
1238 ✗ txt := StartString(txt, a_simvar);
1239 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
1240 then txt;
1241
1242 case ( txt,
1243 DAE.T_ENUMERATION(path = i_path),
1244 a_simvar )
1245 algorithm
1246 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Enumeration declaredType=\""));
1247 ✗ ret_0 := AbsynUtil.pathString(i_path, ".", false, false);
1248 ✗ txt := Tpl.writeStr(txt, ret_0);
1249 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1250 ✗ txt := StartString(txt, a_simvar);
1251 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
1252 then txt;
1253
1254 case ( txt,
1255 _,
1256 _ )
1257 algorithm
1258 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("UNKOWN_TYPE"));
1259 then txt;
1260 end match;
1261 end fun_84;
1262
1263 public function ScalarVariableType
1264 input Tpl.Text in_txt;
1265 input SimCodeVar.SimVar in_a_simvar;
1266
1267 output Tpl.Text out_txt;
1268 algorithm
1269 out_txt :=
1270 match(in_txt, in_a_simvar)
1271 local
1272 Tpl.Text txt;
1273 SimCodeVar.SimVar i_simvar;
1274 DAE.Type i_type__;
1275
1276 case ( txt,
1277 (i_simvar as SimCodeVar.SIMVAR(type_ = i_type__)) )
1278 algorithm
1279 16 txt := fun_84(txt, i_type__, i_simvar);
1280 then txt;
1281
1282 case ( txt,
1283 _ )
1284 then txt;
1285 end match;
1286 end ScalarVariableType;
1287
1288 protected function fun_86
1289 input Tpl.Text in_txt;
1290 input Option<SimCodeVar.Causality> in_a_causality;
1291 input DAE.Type in_a_type__;
1292
1293 output Tpl.Text out_txt;
1294 algorithm
1295 out_txt :=
1296 match(in_txt, in_a_causality, in_a_type__)
1297 local
1298 Tpl.Text txt;
1299 DAE.Type a_type__;
1300
1301 case ( txt,
1302 SOME(SimCodeVar.INPUT()),
1303 a_type__ )
1304 algorithm
1305 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
1306 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("start=\""));
1307 ✗ txt := CodegenUtil.initDefaultValXml(txt, a_type__);
1308 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1309 ✗ txt := Tpl.popBlock(txt);
1310 then txt;
1311
1312 case ( txt,
1313 _,
1314 _ )
1315 then txt;
1316 end match;
1317 end fun_86;
1318
1319 protected function fun_87
1320 input Tpl.Text in_txt;
1321 input Option<DAE.Exp> in_a_initialValue;
1322 input DAE.Type in_a_type__;
1323 input Option<SimCodeVar.Causality> in_a_causality;
1324
1325 output Tpl.Text out_txt;
1326 algorithm
1327 out_txt :=
1328 match(in_txt, in_a_initialValue, in_a_type__, in_a_causality)
1329 local
1330 Tpl.Text txt;
1331 DAE.Type a_type__;
1332 Option<SimCodeVar.Causality> a_causality;
1333 DAE.Exp i_e;
1334
1335 case ( txt,
1336 SOME((i_e as DAE.ICONST(integer = _))),
1337 _,
1338 _ )
1339 algorithm
1340 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
1341 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("start=\""));
1342 ✗ txt := CodegenUtil.initValXml(txt, i_e, "");
1343 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1344 ✗ txt := Tpl.popBlock(txt);
1345 then txt;
1346
1347 case ( txt,
1348 SOME((i_e as DAE.RCONST(real = _))),
1349 _,
1350 _ )
1351 algorithm
1352 5 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
1353 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("start=\""));
1354 5 txt := CodegenUtil.initValXml(txt, i_e, "");
1355 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1356 5 txt := Tpl.popBlock(txt);
1357 then txt;
1358
1359 case ( txt,
1360 SOME((i_e as DAE.SCONST(string = _))),
1361 _,
1362 _ )
1363 algorithm
1364 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
1365 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("start=\""));
1366 ✗ txt := CodegenUtil.initValXml(txt, i_e, "");
1367 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1368 ✗ txt := Tpl.popBlock(txt);
1369 then txt;
1370
1371 case ( txt,
1372 SOME((i_e as DAE.BCONST(bool = _))),
1373 _,
1374 _ )
1375 algorithm
1376 3 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
1377 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("start=\""));
1378 3 txt := CodegenUtil.initValXml(txt, i_e, "");
1379 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1380 3 txt := Tpl.popBlock(txt);
1381 then txt;
1382
1383 case ( txt,
1384 SOME((i_e as DAE.ENUM_LITERAL(name = _))),
1385 _,
1386 _ )
1387 algorithm
1388 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
1389 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("start=\""));
1390 ✗ txt := CodegenUtil.initValXml(txt, i_e, "");
1391 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1392 ✗ txt := Tpl.popBlock(txt);
1393 then txt;
1394
1395 case ( txt,
1396 _,
1397 a_type__,
1398 a_causality )
1399 algorithm
1400 8 txt := fun_86(txt, a_causality, a_type__);
1401 then txt;
1402 end match;
1403 end fun_87;
1404
1405 public function StartString
1406 input Tpl.Text in_txt;
1407 input SimCodeVar.SimVar in_a_simvar;
1408
1409 output Tpl.Text out_txt;
1410 algorithm
1411 out_txt :=
1412 match(in_txt, in_a_simvar)
1413 local
1414 Tpl.Text txt;
1415 DAE.Type i_type__;
1416 Option<SimCodeVar.Causality> i_causality;
1417 Option<DAE.Exp> i_initialValue;
1418
1419 case ( txt,
1420 SimCodeVar.SIMVAR(initialValue = i_initialValue, causality = i_causality, type_ = i_type__) )
1421 algorithm
1422 16 txt := fun_87(txt, i_initialValue, i_type__, i_causality);
1423 then txt;
1424
1425 case ( txt,
1426 _ )
1427 then txt;
1428 end match;
1429 end StartString;
1430
1431 protected function fun_89
1432 input Tpl.Text in_txt;
1433 input String in_a_unit;
1434
1435 output Tpl.Text out_txt;
1436 algorithm
1437 out_txt :=
1438 match(in_txt, in_a_unit)
1439 local
1440 Tpl.Text txt;
1441 String i_unit;
1442 String ret_0;
1443
1444 case ( txt,
1445 "" )
1446 then txt;
1447
1448 case ( txt,
1449 i_unit )
1450 algorithm
1451 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("unit=\""));
1452 ✗ ret_0 := Util.escapeModelicaStringToXmlString(i_unit);
1453 ✗ txt := Tpl.writeStr(txt, ret_0);
1454 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1455 then txt;
1456 end match;
1457 end fun_89;
1458
1459 protected function fun_90
1460 input Tpl.Text in_txt;
1461 input String in_a_displayUnit;
1462
1463 output Tpl.Text out_txt;
1464 algorithm
1465 out_txt :=
1466 match(in_txt, in_a_displayUnit)
1467 local
1468 Tpl.Text txt;
1469 String i_displayUnit;
1470 String ret_0;
1471
1472 case ( txt,
1473 "" )
1474 then txt;
1475
1476 case ( txt,
1477 i_displayUnit )
1478 algorithm
1479 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("displayUnit=\""));
1480 ✗ ret_0 := Util.escapeModelicaStringToXmlString(i_displayUnit);
1481 ✗ txt := Tpl.writeStr(txt, ret_0);
1482 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1483 then txt;
1484 end match;
1485 end fun_90;
1486
1487 public function ScalarVariableTypeRealAttribute
1488 input Tpl.Text txt;
1489 input String a_unit;
1490 input String a_displayUnit;
1491
1492 output Tpl.Text out_txt;
1493 protected
1494 Tpl.Text l_displayUnit__;
1495 Tpl.Text l_unit__;
1496 algorithm
1497 ✗ l_unit__ := fun_89(Tpl.emptyTxt, a_unit);
1498 ✗ l_displayUnit__ := fun_90(Tpl.emptyTxt, a_displayUnit);
1499 ✗ out_txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
1500 ✗ out_txt := Tpl.writeText(out_txt, l_unit__);
1501 ✗ out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING(" "));
1502 ✗ out_txt := Tpl.writeText(out_txt, l_displayUnit__);
1503 ✗ out_txt := Tpl.popBlock(out_txt);
1504 end ScalarVariableTypeRealAttribute;
1505
1506 protected function lm_92
1507 input output Tpl.Text txt;
1508 input list<SimCodeFunction.Function> items;
1509 algorithm
1510
2/2
✓ Branch 0 taken 239 times.
✓ Branch 1 taken 74 times.
313 for lstElt_92 in items loop
1511 txt := match lstElt_92
1512 local
1513 SimCodeFunction.Function i_fn;
1514
1515 case i_fn
1516 algorithm
1517 239 txt := externalFunction(txt, i_fn);
1518 239 txt := Tpl.nextIter(txt);
1519 then txt;
1520 end match;
1521 end for;
1522 end lm_92;
1523
1524 public function externalFunctions
1525 input Tpl.Text in_txt;
1526 input SimCode.ModelInfo in_a_modelInfo;
1527
1528 output Tpl.Text out_txt;
1529 algorithm
1530 out_txt :=
1531 match(in_txt, in_a_modelInfo)
1532 local
1533 Tpl.Text txt;
1534 list<SimCodeFunction.Function> i_functions;
1535
1536 case ( txt,
1537 SimCode.MODELINFO(functions = i_functions) )
1538 algorithm
1539 74 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
1540 74 txt := lm_92(txt, i_functions);
1541 74 txt := Tpl.popIter(txt);
1542 then txt;
1543
1544 case ( txt,
1545 _ )
1546 then txt;
1547 end match;
1548 end externalFunctions;
1549
1550 public function externalFunction
1551 input Tpl.Text in_txt;
1552 input SimCodeFunction.Function in_a_fn;
1553
1554 output Tpl.Text out_txt;
1555 algorithm
1556 out_txt :=
1557 match(in_txt, in_a_fn)
1558 local
1559 Tpl.Text txt;
1560 String i_language;
1561 String i_extName;
1562 Integer ret_1;
1563 Tpl.Text l_fname;
1564
1565 case ( txt,
1566 SimCodeFunction.EXTERNAL_FUNCTION(dynamicLoad = true, extName = i_extName, language = i_language) )
1567 algorithm
1568 ✗ l_fname := CodegenUtil.extFunctionName(Tpl.emptyTxt, i_extName, i_language);
1569 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<ExternalFunction\n"));
1570 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
1571 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("name=\""));
1572 ✗ txt := Tpl.writeText(txt, l_fname);
1573 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
1574 "\"\n",
1575 "valueReference=\""
1576 }, false));
1577 ✗ ret_1 := System.tmpTick();
1578 ✗ txt := Tpl.writeStr(txt, intString(ret_1));
1579 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"/>"));
1580 ✗ txt := Tpl.popBlock(txt);
1581 then txt;
1582
1583 case ( txt,
1584 _ )
1585 then txt;
1586 end match;
1587 end externalFunction;
1588
1589 public function Implementation
1590 input Tpl.Text txt;
1591
1592 output Tpl.Text out_txt;
1593 algorithm
1594 ✗ out_txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
1595 "<Implementation>\n",
1596 " <CoSimulation_StandAlone>\n",
1597 " <Capabilities\n",
1598 " canHandleVariableCommunicationStepSize=\"true\"\n",
1599 " canHandleEvents=\"true\"\n",
1600 " canBeInstantiatedOnlyOncePerProcess=\"false\"\n",
1601 " canInterpolateInputs=\"true\"\n",
1602 " maxOutputDerivativeOrder=\"0\"/>\n",
1603 " </CoSimulation_StandAlone>\n",
1604 "</Implementation>"
1605 }, false));
1606 end Implementation;
1607
1608 protected function fun_96
1609 input Tpl.Text in_txt;
1610 input Boolean in_mArg;
1611 input SimCode.FmiDiscreteStates in_a_fmistruct_fmiDiscreteStates;
1612
1613 output Tpl.Text out_txt;
1614 algorithm
1615 out_txt :=
1616 match(in_txt, in_mArg, in_a_fmistruct_fmiDiscreteStates)
1617 local
1618 Tpl.Text txt;
1619 SimCode.FmiDiscreteStates a_fmistruct_fmiDiscreteStates;
1620
1621 case ( txt,
1622 false,
1623 _ )
1624 then txt;
1625
1626 case ( txt,
1627 _,
1628 a_fmistruct_fmiDiscreteStates )
1629 algorithm
1630 5 txt := ModelStructureDiscreteStates(txt, a_fmistruct_fmiDiscreteStates);
1631 then txt;
1632 end match;
1633 end fun_96;
1634
1635 public function ModelStructure
1636 input Tpl.Text in_txt;
1637 input Option<SimCode.FmiModelStructure> in_a_fmiModelStructure;
1638
1639 output Tpl.Text out_txt;
1640 algorithm
1641 out_txt :=
1642 match(in_txt, in_a_fmiModelStructure)
1643 local
1644 Tpl.Text txt;
1645 SimCode.FmiInitialUnknowns i_fmistruct_fmiInitialUnknowns;
1646 SimCode.FmiDiscreteStates i_fmistruct_fmiDiscreteStates;
1647 SimCode.FmiDerivatives i_fmistruct_fmiDerivatives;
1648 SimCode.FmiOutputs i_fmistruct_fmiOutputs;
1649 Boolean ret_0;
1650
1651 case ( txt,
1652 SOME(SimCode.FMIMODELSTRUCTURE(fmiOutputs = i_fmistruct_fmiOutputs, fmiDerivatives = i_fmistruct_fmiDerivatives, fmiDiscreteStates = i_fmistruct_fmiDiscreteStates, fmiInitialUnknowns = i_fmistruct_fmiInitialUnknowns)) )
1653 algorithm
1654 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<ModelStructure>\n"));
1655 72 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
1656 72 txt := ModelStructureOutputs(txt, i_fmistruct_fmiOutputs);
1657 72 txt := Tpl.softNewLine(txt);
1658 72 txt := ModelStructureDerivatives(txt, i_fmistruct_fmiDerivatives);
1659 72 txt := Tpl.softNewLine(txt);
1660 72 ret_0 := Flags.getConfigBool(Flags.EXPORT_CLOCKS_IN_MODELDESCRIPTION);
1661 72 txt := fun_96(txt, ret_0, i_fmistruct_fmiDiscreteStates);
1662 72 txt := Tpl.softNewLine(txt);
1663 72 txt := ModelStructureInitialUnknowns(txt, i_fmistruct_fmiInitialUnknowns);
1664 72 txt := Tpl.softNewLine(txt);
1665 72 txt := Tpl.popBlock(txt);
1666 72 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</ModelStructure>"));
1667 then txt;
1668
1669 case ( txt,
1670 _ )
1671 algorithm
1672 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
1673 "<ModelStructure>\n",
1674 "</ModelStructure>"
1675 }, false));
1676 then txt;
1677 end match;
1678 end ModelStructure;
1679
1680 protected function fun_98
1681 input Tpl.Text in_txt;
1682 input Boolean in_mArg;
1683 input Integer in_a_snom;
1684
1685 output Tpl.Text out_txt;
1686 algorithm
1687 out_txt :=
1688 match(in_txt, in_mArg, in_a_snom)
1689 local
1690 Tpl.Text txt;
1691 Integer a_snom;
1692
1693 case ( txt,
1694 false,
1695 _ )
1696 then txt;
1697
1698 case ( txt,
1699 _,
1700 a_snom )
1701 algorithm
1702 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("shiftCounter=\""));
1703 1 txt := Tpl.writeStr(txt, intString(a_snom));
1704 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1705 then txt;
1706 end match;
1707 end fun_98;
1708
1709 protected function fun_99
1710 input Tpl.Text in_txt;
1711 input Boolean in_mArg;
1712 input Integer in_a_sres;
1713
1714 output Tpl.Text out_txt;
1715 algorithm
1716 out_txt :=
1717 match(in_txt, in_mArg, in_a_sres)
1718 local
1719 Tpl.Text txt;
1720 Integer a_sres;
1721
1722 case ( txt,
1723 false,
1724 _ )
1725 then txt;
1726
1727 case ( txt,
1728 _,
1729 a_sres )
1730 algorithm
1731 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("resolution=\""));
1732 ✗ txt := Tpl.writeStr(txt, intString(a_sres));
1733 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1734 then txt;
1735 end match;
1736 end fun_99;
1737
1738 protected function fun_100
1739 input Tpl.Text in_txt;
1740 input SimCode.SubPartition in_a_subPartition;
1741 input Real in_a_bi;
1742
1743 output Tpl.Text out_txt;
1744 algorithm
1745 out_txt :=
1746 match(in_txt, in_a_subPartition, in_a_bi)
1747 local
1748 Tpl.Text txt;
1749 Real a_bi;
1750 Integer i_sres;
1751 Integer i_snom;
1752 Integer i_fsuper;
1753 Integer i_fsub;
1754 Boolean ret_5;
1755 Boolean ret_4;
1756 Real ret_3;
1757 Real ret_2;
1758 Real ret_1;
1759 Real ret_0;
1760
1761 case ( txt,
1762 SimCode.SUBPARTITION(subClock = BackendDAE.SUBCLOCK(factor = MMath.RATIONAL(nom = i_fsub, denom = i_fsuper), shift = MMath.RATIONAL(nom = i_snom, denom = i_sres))),
1763 a_bi )
1764 algorithm
1765 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<Clock><Inferred\n"));
1766 3 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(8));
1767 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("interval=\""));
1768 3 ret_0 := intReal(i_fsub);
1769 3 ret_1 := intReal(i_fsuper);
1770
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 ret_2 := realDiv(ret_0, ret_1);
1771 3 ret_3 := realMul(a_bi, ret_2);
1772 3 txt := Tpl.writeStr(txt, realString(ret_3));
1773 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"\n"));
1774 3 ret_4 := intGt(i_snom, 0);
1775 3 txt := fun_98(txt, ret_4, i_snom);
1776 3 txt := Tpl.softNewLine(txt);
1777 3 ret_5 := intGt(i_sres, 1);
1778 3 txt := fun_99(txt, ret_5, i_sres);
1779 3 txt := Tpl.softNewLine(txt);
1780 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/></Clock>"));
1781 3 txt := Tpl.popBlock(txt);
1782 then txt;
1783
1784 case ( txt,
1785 _,
1786 _ )
1787 then txt;
1788 end match;
1789 end fun_100;
1790
1791 protected function lm_101
1792 input output Tpl.Text txt;
1793 input list<SimCode.SubPartition> items;
1794 input Real a_bi;
1795 algorithm
1796
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
6 for lstElt_101 in items loop
1797 txt := match lstElt_101
1798 local
1799 SimCode.SubPartition i_subPartition;
1800
1801 case i_subPartition
1802 algorithm
1803 3 txt := fun_100(txt, i_subPartition, a_bi);
1804 3 txt := Tpl.nextIter(txt);
1805 then txt;
1806 end match;
1807 end for;
1808 end lm_101;
1809
1810 protected function fun_102
1811 input Tpl.Text in_txt;
1812 input Boolean in_mArg;
1813 input Integer in_a_fsuper;
1814 input Integer in_a_resi;
1815 input Integer in_a_snom;
1816
1817 output Tpl.Text out_txt;
1818 algorithm
1819 out_txt :=
1820 match(in_txt, in_mArg, in_a_fsuper, in_a_resi, in_a_snom)
1821 local
1822 Tpl.Text txt;
1823 Integer a_fsuper;
1824 Integer a_resi;
1825 Integer a_snom;
1826 Integer ret_1;
1827 Integer ret_0;
1828
1829 case ( txt,
1830 false,
1831 _,
1832 _,
1833 _ )
1834 then txt;
1835
1836 case ( txt,
1837 _,
1838 a_fsuper,
1839 a_resi,
1840 a_snom )
1841 algorithm
1842 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("shiftCounter=\""));
1843 3 ret_0 := intMul(a_snom, a_resi);
1844 3 ret_1 := intMul(ret_0, a_fsuper);
1845 3 txt := Tpl.writeStr(txt, intString(ret_1));
1846 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1847 then txt;
1848 end match;
1849 end fun_102;
1850
1851 protected function fun_103
1852 input Tpl.Text in_txt;
1853 input SimCode.SubPartition in_a_subPartition;
1854 input Integer in_a_resi;
1855 input Integer in_a_bic;
1856
1857 output Tpl.Text out_txt;
1858 algorithm
1859 out_txt :=
1860 match(in_txt, in_a_subPartition, in_a_resi, in_a_bic)
1861 local
1862 Tpl.Text txt;
1863 Integer a_resi;
1864 Integer a_bic;
1865 Integer i_fsuper;
1866 Integer i_snom;
1867 Integer i_sres;
1868 Integer i_fsub;
1869 Integer ret_4;
1870 Integer ret_3;
1871 Boolean ret_2;
1872 Integer ret_1;
1873 Integer ret_0;
1874
1875 case ( txt,
1876 SimCode.SUBPARTITION(subClock = BackendDAE.SUBCLOCK(factor = MMath.RATIONAL(nom = i_fsub, denom = i_fsuper), shift = MMath.RATIONAL(nom = i_snom, denom = i_sres))),
1877 a_resi,
1878 a_bic )
1879 algorithm
1880 4 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<Clock><Inferred\n"));
1881 4 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(8));
1882 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("intervalCounter=\""));
1883 4 ret_0 := intMul(a_bic, i_fsub);
1884 4 ret_1 := intMul(ret_0, i_sres);
1885 4 txt := Tpl.writeStr(txt, intString(ret_1));
1886 4 txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"\n"));
1887 4 ret_2 := intGt(i_snom, 0);
1888 4 txt := fun_102(txt, ret_2, i_fsuper, a_resi, i_snom);
1889 4 txt := Tpl.softNewLine(txt);
1890 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("resolution=\""));
1891 4 ret_3 := intMul(a_resi, i_sres);
1892 4 ret_4 := intMul(ret_3, i_fsuper);
1893 4 txt := Tpl.writeStr(txt, intString(ret_4));
1894 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
1895 "\"\n",
1896 "/></Clock>"
1897 }, false));
1898 4 txt := Tpl.popBlock(txt);
1899 then txt;
1900
1901 case ( txt,
1902 _,
1903 _,
1904 _ )
1905 then txt;
1906 end match;
1907 end fun_103;
1908
1909 protected function lm_104
1910 input output Tpl.Text txt;
1911 input list<SimCode.SubPartition> items;
1912 input Integer a_resi;
1913 input Integer a_bic;
1914 algorithm
1915
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 time.
5 for lstElt_104 in items loop
1916 txt := match lstElt_104
1917 local
1918 SimCode.SubPartition i_subPartition;
1919
1920 case i_subPartition
1921 algorithm
1922 4 txt := fun_103(txt, i_subPartition, a_resi, a_bic);
1923 4 txt := Tpl.nextIter(txt);
1924 then txt;
1925 end match;
1926 end for;
1927 end lm_104;
1928
1929 protected function fun_105
1930 input Tpl.Text in_txt;
1931 input DAE.ClockKind in_a_baseClock;
1932 input list<SimCode.SubPartition> in_a_subPartitions;
1933
1934 output Tpl.Text out_txt;
1935 algorithm
1936 out_txt :=
1937 match(in_txt, in_a_baseClock, in_a_subPartitions)
1938 local
1939 Tpl.Text txt;
1940 list<SimCode.SubPartition> a_subPartitions;
1941 Integer i_resi;
1942 Integer i_bic;
1943 Real i_bi;
1944
1945 case ( txt,
1946 DAE.REAL_CLOCK(interval = DAE.RCONST(real = i_bi)),
1947 a_subPartitions )
1948 algorithm
1949 3 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
1950 3 txt := lm_101(txt, a_subPartitions, i_bi);
1951 3 txt := Tpl.popIter(txt);
1952 then txt;
1953
1954 case ( txt,
1955 DAE.RATIONAL_CLOCK(intervalCounter = DAE.ICONST(integer = i_bic), resolution = DAE.ICONST(integer = i_resi)),
1956 a_subPartitions )
1957 algorithm
1958 1 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
1959 1 txt := lm_104(txt, a_subPartitions, i_resi, i_bic);
1960 1 txt := Tpl.popIter(txt);
1961 then txt;
1962
1963 case ( txt,
1964 DAE.REAL_CLOCK(interval = _),
1965 _ )
1966 algorithm
1967 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Clock><Inferred/></Clock>"));
1968 then txt;
1969
1970 case ( txt,
1971 DAE.RATIONAL_CLOCK(intervalCounter = _),
1972 _ )
1973 algorithm
1974 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Clock><Inferred/></Clock>"));
1975 then txt;
1976
1977 case ( txt,
1978 DAE.INFERRED_CLOCK(),
1979 _ )
1980 algorithm
1981 2 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Clock><Inferred/></Clock>"));
1982 then txt;
1983
1984 case ( txt,
1985 _,
1986 _ )
1987 algorithm
1988 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Clock><Triggered/></Clock>"));
1989 then txt;
1990 end match;
1991 end fun_105;
1992
1993 protected function fun_106
1994 input Tpl.Text in_txt;
1995 input SimCode.ClockedPartition in_a_partition;
1996
1997 output Tpl.Text out_txt;
1998 algorithm
1999 out_txt :=
2000 match(in_txt, in_a_partition)
2001 local
2002 Tpl.Text txt;
2003 list<SimCode.SubPartition> i_subPartitions;
2004 DAE.ClockKind i_baseClock;
2005
2006 case ( txt,
2007 SimCode.CLOCKED_PARTITION(baseClock = i_baseClock, subPartitions = i_subPartitions) )
2008 algorithm
2009 6 txt := fun_105(txt, i_baseClock, i_subPartitions);
2010 then txt;
2011
2012 case ( txt,
2013 _ )
2014 then txt;
2015 end match;
2016 end fun_106;
2017
2018 protected function lm_107
2019 input output Tpl.Text txt;
2020 input list<SimCode.ClockedPartition> items;
2021 algorithm
2022
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 5 times.
11 for lstElt_107 in items loop
2023 txt := match lstElt_107
2024 local
2025 SimCode.ClockedPartition i_partition;
2026
2027 case i_partition
2028 algorithm
2029 6 txt := fun_106(txt, i_partition);
2030 6 txt := Tpl.nextIter(txt);
2031 then txt;
2032 end match;
2033 end for;
2034 end lm_107;
2035
2036 protected function fun_108
2037 input Tpl.Text in_txt;
2038 input String in_mArg;
2039 input Tpl.Text in_a_clocks;
2040
2041 output Tpl.Text out_txt;
2042 algorithm
2043 out_txt :=
2044 match(in_txt, in_mArg, in_a_clocks)
2045 local
2046 Tpl.Text txt;
2047 Tpl.Text a_clocks;
2048
2049 case ( txt,
2050 "",
2051 _ )
2052 then txt;
2053
2054 case ( txt,
2055 _,
2056 a_clocks )
2057 algorithm
2058 5 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<Clocks>\n"));
2059 5 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2060 5 txt := Tpl.writeText(txt, a_clocks);
2061 5 txt := Tpl.softNewLine(txt);
2062 5 txt := Tpl.popBlock(txt);
2063 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</Clocks>"));
2064 then txt;
2065 end match;
2066 end fun_108;
2067
2068 public function TypeDefinitionsClocks
2069 input Tpl.Text in_txt;
2070 input SimCode.SimCode in_a_simCode;
2071
2072 output Tpl.Text out_txt;
2073 algorithm
2074 out_txt :=
2075 match(in_txt, in_a_simCode)
2076 local
2077 Tpl.Text txt;
2078 list<SimCode.ClockedPartition> i_clockedPartitions;
2079 String str_1;
2080 Tpl.Text l_clocks;
2081
2082 case ( txt,
2083 SimCode.SIMCODE(modelInfo = SimCode.MODELINFO(name = _), clockedPartitions = i_clockedPartitions) )
2084 algorithm
2085 5 l_clocks := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2086 5 l_clocks := lm_107(l_clocks, i_clockedPartitions);
2087 5 l_clocks := Tpl.popIter(l_clocks);
2088 5 str_1 := Tpl.textString(l_clocks);
2089 5 txt := fun_108(txt, str_1, l_clocks);
2090 then txt;
2091
2092 case ( txt,
2093 _ )
2094 then txt;
2095 end match;
2096 end TypeDefinitionsClocks;
2097
2098 public function ModelStructureOutputs
2099 input Tpl.Text in_txt;
2100 input SimCode.FmiOutputs in_a_fmiOutputs;
2101
2102 output Tpl.Text out_txt;
2103 algorithm
2104 out_txt :=
2105 match(in_txt, in_a_fmiOutputs)
2106 local
2107 Tpl.Text txt;
2108 list<SimCode.FmiUnknown> i_fmiUnknownsList;
2109
2110 case ( txt,
2111 SimCode.FMIOUTPUTS(fmiUnknownsList = {}) )
2112 then txt;
2113
2114 case ( txt,
2115 SimCode.FMIOUTPUTS(fmiUnknownsList = i_fmiUnknownsList) )
2116 algorithm
2117 38 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<Outputs>\n"));
2118 38 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2119 38 txt := ModelStructureUnknowns(txt, i_fmiUnknownsList);
2120 38 txt := Tpl.softNewLine(txt);
2121 38 txt := Tpl.popBlock(txt);
2122 38 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</Outputs>"));
2123 then txt;
2124
2125 case ( txt,
2126 _ )
2127 then txt;
2128 end match;
2129 end ModelStructureOutputs;
2130
2131 public function ModelStructureDerivatives
2132 input Tpl.Text in_txt;
2133 input SimCode.FmiDerivatives in_a_fmiDerivatives;
2134
2135 output Tpl.Text out_txt;
2136 algorithm
2137 out_txt :=
2138 match(in_txt, in_a_fmiDerivatives)
2139 local
2140 Tpl.Text txt;
2141 list<SimCode.FmiUnknown> i_fmiUnknownsList;
2142
2143 case ( txt,
2144 SimCode.FMIDERIVATIVES(fmiUnknownsList = {}) )
2145 then txt;
2146
2147 case ( txt,
2148 SimCode.FMIDERIVATIVES(fmiUnknownsList = i_fmiUnknownsList) )
2149 algorithm
2150 52 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<Derivatives>\n"));
2151 52 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2152 52 txt := ModelStructureUnknowns(txt, i_fmiUnknownsList);
2153 52 txt := Tpl.softNewLine(txt);
2154 52 txt := Tpl.popBlock(txt);
2155 52 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</Derivatives>"));
2156 then txt;
2157
2158 case ( txt,
2159 _ )
2160 then txt;
2161 end match;
2162 end ModelStructureDerivatives;
2163
2164 public function ModelStructureDiscreteStates
2165 input Tpl.Text in_txt;
2166 input SimCode.FmiDiscreteStates in_a_fmiDiscreteStates;
2167
2168 output Tpl.Text out_txt;
2169 algorithm
2170 out_txt :=
2171 match(in_txt, in_a_fmiDiscreteStates)
2172 local
2173 Tpl.Text txt;
2174 list<SimCode.FmiUnknown> i_fmiUnknownsList;
2175
2176 case ( txt,
2177 SimCode.FMIDISCRETESTATES(fmiUnknownsList = {}) )
2178 then txt;
2179
2180 case ( txt,
2181 SimCode.FMIDISCRETESTATES(fmiUnknownsList = i_fmiUnknownsList) )
2182 algorithm
2183 4 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<DiscreteStates>\n"));
2184 4 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2185 4 txt := ModelStructureUnknowns(txt, i_fmiUnknownsList);
2186 4 txt := Tpl.softNewLine(txt);
2187 4 txt := Tpl.popBlock(txt);
2188 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</DiscreteStates>"));
2189 then txt;
2190
2191 case ( txt,
2192 _ )
2193 then txt;
2194 end match;
2195 end ModelStructureDiscreteStates;
2196
2197 public function ModelStructureInitialUnknowns
2198 input Tpl.Text in_txt;
2199 input SimCode.FmiInitialUnknowns in_a_fmiInitialUnknowns;
2200
2201 output Tpl.Text out_txt;
2202 algorithm
2203 out_txt :=
2204 match(in_txt, in_a_fmiInitialUnknowns)
2205 local
2206 Tpl.Text txt;
2207 list<SimCode.FmiUnknown> i_fmiUnknownsList;
2208
2209 case ( txt,
2210 SimCode.FMIINITIALUNKNOWNS(fmiUnknownsList = {}) )
2211 then txt;
2212
2213 case ( txt,
2214 SimCode.FMIINITIALUNKNOWNS(fmiUnknownsList = i_fmiUnknownsList) )
2215 algorithm
2216 66 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<InitialUnknowns>\n"));
2217 66 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2218 66 txt := ModelStructureUnknowns(txt, i_fmiUnknownsList);
2219 66 txt := Tpl.softNewLine(txt);
2220 66 txt := Tpl.popBlock(txt);
2221 66 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</InitialUnknowns>"));
2222 then txt;
2223
2224 case ( txt,
2225 _ )
2226 then txt;
2227 end match;
2228 end ModelStructureInitialUnknowns;
2229
2230 protected function lm_114
2231 input output Tpl.Text txt;
2232 input list<SimCode.FmiUnknown> items;
2233 algorithm
2234
2/2
✓ Branch 0 taken 821 times.
✓ Branch 1 taken 160 times.
981 for lstElt_114 in items loop
2235 txt := match lstElt_114
2236 local
2237 SimCode.FmiUnknown i_fmiUnknown;
2238
2239 case i_fmiUnknown
2240 algorithm
2241 821 txt := FmiUnknownAttributes(txt, i_fmiUnknown);
2242 821 txt := Tpl.nextIter(txt);
2243 then txt;
2244 end match;
2245 end for;
2246 end lm_114;
2247
2248 public function ModelStructureUnknowns
2249 input Tpl.Text txt;
2250 input list<SimCode.FmiUnknown> a_fmiUnknownsList;
2251
2252 output Tpl.Text out_txt;
2253 algorithm
2254 160 out_txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2255 160 out_txt := lm_114(out_txt, a_fmiUnknownsList);
2256 160 out_txt := Tpl.popIter(out_txt);
2257 end ModelStructureUnknowns;
2258
2259 public function FmiUnknownAttributes
2260 input Tpl.Text in_txt;
2261 input SimCode.FmiUnknown in_a_fmiUnknown;
2262
2263 output Tpl.Text out_txt;
2264 algorithm
2265 out_txt :=
2266 match(in_txt, in_a_fmiUnknown)
2267 local
2268 Tpl.Text txt;
2269 list<String> i_dependenciesKind;
2270 list<Integer> i_dependencies;
2271 Integer i_index;
2272
2273 case ( txt,
2274 SimCode.FMIUNKNOWN(index = i_index, dependencies = i_dependencies, dependenciesKind = i_dependenciesKind) )
2275 algorithm
2276 821 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Unknown index=\""));
2277 821 txt := Tpl.writeStr(txt, intString(i_index));
2278 821 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
2279 821 txt := FmiUnknownDependencies(txt, i_dependencies);
2280 821 txt := FmiUnknownDependenciesKind(txt, i_dependenciesKind);
2281 821 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" />"));
2282 then txt;
2283
2284 case ( txt,
2285 _ )
2286 then txt;
2287 end match;
2288 end FmiUnknownAttributes;
2289
2290 public function FmiUnknownDependencies
2291 input Tpl.Text txt;
2292 input list<Integer> a_dependencies;
2293
2294 output Tpl.Text out_txt;
2295 protected
2296 String ret_0;
2297 algorithm
2298 821 out_txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
2299 821 out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING("dependencies=\""));
2300 821 ret_0 := SimCodeCodegenUtil.fmiDependenciesString(a_dependencies);
2301 821 out_txt := Tpl.writeStr(out_txt, ret_0);
2302 821 out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING("\""));
2303 821 out_txt := Tpl.popBlock(out_txt);
2304 end FmiUnknownDependencies;
2305
2306 public function FmiUnknownDependenciesKind
2307 input Tpl.Text txt;
2308 input list<String> a_dependenciesKind;
2309
2310 output Tpl.Text out_txt;
2311 protected
2312 String ret_0;
2313 algorithm
2314 821 out_txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
2315 821 out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING("dependenciesKind=\""));
2316 821 ret_0 := SimCodeCodegenUtil.fmiDependenciesKindString(a_dependenciesKind);
2317 821 out_txt := Tpl.writeStr(out_txt, ret_0);
2318 821 out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING("\""));
2319 821 out_txt := Tpl.popBlock(out_txt);
2320 end FmiUnknownDependenciesKind;
2321
2322 protected function fun_119
2323 input Tpl.Text in_txt;
2324 input String in_a_comment;
2325
2326 output Tpl.Text out_txt;
2327 algorithm
2328 out_txt :=
2329 match(in_txt, in_a_comment)
2330 local
2331 Tpl.Text txt;
2332 String i_comment;
2333 String ret_0;
2334
2335 case ( txt,
2336 "" )
2337 then txt;
2338
2339 case ( txt,
2340 i_comment )
2341 algorithm
2342 1720 txt := Tpl.writeTok(txt, Tpl.ST_STRING("description=\""));
2343 1720 ret_0 := Util.escapeModelicaStringToXmlString(i_comment);
2344 1720 txt := Tpl.writeStr(txt, ret_0);
2345 1720 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
2346 then txt;
2347 end match;
2348 end fun_119;
2349
2350 protected function fun_120
2351 input Tpl.Text in_txt;
2352 input Option<Integer> in_mArg;
2353 input DAE.Type in_a_type__;
2354 input Option<SimCodeVar.Variability> in_a_variability;
2355
2356 output Tpl.Text out_txt;
2357 algorithm
2358 out_txt :=
2359 match(in_txt, in_mArg, in_a_type__, in_a_variability)
2360 local
2361 Tpl.Text txt;
2362 DAE.Type a_type__;
2363 Option<SimCodeVar.Variability> a_variability;
2364
2365 case ( txt,
2366 NONE(),
2367 a_type__,
2368 a_variability )
2369 algorithm
2370 2240 txt := getVariabilityFMI2(txt, a_variability, a_type__);
2371 then txt;
2372
2373 case ( txt,
2374 _,
2375 _,
2376 _ )
2377 algorithm
2378 46 txt := Tpl.writeTok(txt, Tpl.ST_STRING("discrete"));
2379 then txt;
2380 end match;
2381 end fun_120;
2382
2383 protected function fun_121
2384 input Tpl.Text in_txt;
2385 input Option<Integer> in_mArg;
2386
2387 output Tpl.Text out_txt;
2388 algorithm
2389 out_txt :=
2390 match(in_txt, in_mArg)
2391 local
2392 Tpl.Text txt;
2393 Integer i_val;
2394
2395 case ( txt,
2396 SOME(i_val) )
2397 algorithm
2398 46 txt := Tpl.writeStr(txt, intString(i_val));
2399 then txt;
2400
2401 case ( txt,
2402 _ )
2403 then txt;
2404 end match;
2405 end fun_121;
2406
2407 protected function fun_122
2408 input Tpl.Text in_txt;
2409 input BackendDAE.VarKind in_a_varKind;
2410 input SimCode.SimCode in_a_simCode;
2411
2412 output Tpl.Text out_txt;
2413 algorithm
2414 out_txt :=
2415 match(in_txt, in_a_varKind, in_a_simCode)
2416 local
2417 Tpl.Text txt;
2418 SimCode.SimCode a_simCode;
2419 DAE.ComponentRef i_previousName;
2420 Integer ret_1;
2421 SimCodeVar.SimVar ret_0;
2422
2423 case ( txt,
2424 BackendDAE.CLOCKED_STATE(previousName = i_previousName),
2425 a_simCode )
2426 algorithm
2427 57 ret_0 := SimCodeCodegenUtil.cref2simvar(i_previousName, a_simCode);
2428 57 ret_1 := SimCodeCodegenUtil.getVariableFMIIndex(ret_0);
2429 57 txt := Tpl.writeStr(txt, intString(ret_1));
2430 then txt;
2431
2432 case ( txt,
2433 _,
2434 _ )
2435 then txt;
2436 end match;
2437 end fun_122;
2438
2439 protected function fun_123
2440 input Tpl.Text in_txt;
2441 input Boolean in_mArg;
2442 input Tpl.Text in_a_variability__;
2443
2444 output Tpl.Text out_txt;
2445 algorithm
2446 out_txt :=
2447 match(in_txt, in_mArg, in_a_variability__)
2448 local
2449 Tpl.Text txt;
2450 Tpl.Text a_variability__;
2451
2452 case ( txt,
2453 false,
2454 _ )
2455 then txt;
2456
2457 case ( txt,
2458 _,
2459 a_variability__ )
2460 algorithm
2461 1060 txt := Tpl.writeTok(txt, Tpl.ST_STRING("variability=\""));
2462 1060 txt := Tpl.writeText(txt, a_variability__);
2463 1060 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
2464 then txt;
2465 end match;
2466 end fun_123;
2467
2468 protected function fun_124
2469 input Tpl.Text in_txt;
2470 input Boolean in_mArg;
2471 input Tpl.Text in_a_caus;
2472
2473 output Tpl.Text out_txt;
2474 algorithm
2475 out_txt :=
2476 match(in_txt, in_mArg, in_a_caus)
2477 local
2478 Tpl.Text txt;
2479 Tpl.Text a_caus;
2480
2481 case ( txt,
2482 false,
2483 _ )
2484 then txt;
2485
2486 case ( txt,
2487 _,
2488 a_caus )
2489 algorithm
2490 968 txt := Tpl.writeTok(txt, Tpl.ST_STRING("causality=\""));
2491 968 txt := Tpl.writeText(txt, a_caus);
2492 968 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
2493 then txt;
2494 end match;
2495 end fun_124;
2496
2497 protected function fun_125
2498 input Tpl.Text in_txt;
2499 input Boolean in_mArg;
2500 input Tpl.Text in_a_clockIndex;
2501
2502 output Tpl.Text out_txt;
2503 algorithm
2504 out_txt :=
2505 match(in_txt, in_mArg, in_a_clockIndex)
2506 local
2507 Tpl.Text txt;
2508 Tpl.Text a_clockIndex;
2509
2510 case ( txt,
2511 false,
2512 _ )
2513 then txt;
2514
2515 case ( txt,
2516 _,
2517 a_clockIndex )
2518 algorithm
2519 23 txt := Tpl.writeTok(txt, Tpl.ST_STRING("clockIndex=\""));
2520 23 txt := Tpl.writeText(txt, a_clockIndex);
2521 23 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
2522 then txt;
2523 end match;
2524 end fun_125;
2525
2526 protected function fun_126
2527 input Tpl.Text in_txt;
2528 input Boolean in_mArg;
2529 input Tpl.Text in_a_previous;
2530
2531 output Tpl.Text out_txt;
2532 algorithm
2533 out_txt :=
2534 match(in_txt, in_mArg, in_a_previous)
2535 local
2536 Tpl.Text txt;
2537 Tpl.Text a_previous;
2538
2539 case ( txt,
2540 false,
2541 _ )
2542 then txt;
2543
2544 case ( txt,
2545 _,
2546 a_previous )
2547 algorithm
2548 54 txt := Tpl.writeTok(txt, Tpl.ST_STRING("previous=\""));
2549 54 txt := Tpl.writeText(txt, a_previous);
2550 54 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
2551 then txt;
2552 end match;
2553 end fun_126;
2554
2555 protected function fun_127
2556 input Tpl.Text in_txt;
2557 input Boolean in_mArg;
2558 input Tpl.Text in_a_initial;
2559
2560 output Tpl.Text out_txt;
2561 algorithm
2562 out_txt :=
2563 match(in_txt, in_mArg, in_a_initial)
2564 local
2565 Tpl.Text txt;
2566 Tpl.Text a_initial;
2567
2568 case ( txt,
2569 false,
2570 _ )
2571 then txt;
2572
2573 case ( txt,
2574 _,
2575 a_initial )
2576 algorithm
2577 351 txt := Tpl.writeTok(txt, Tpl.ST_STRING("initial=\""));
2578 351 txt := Tpl.writeText(txt, a_initial);
2579 351 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
2580 then txt;
2581 end match;
2582 end fun_127;
2583
2584 public function ScalarVariableAttribute2
2585 input Tpl.Text in_txt;
2586 input SimCodeVar.SimVar in_a_simVar;
2587 input SimCode.SimCode in_a_simCode;
2588
2589 output Tpl.Text out_txt;
2590 algorithm
2591 out_txt :=
2592 match(in_txt, in_a_simVar, in_a_simCode)
2593 local
2594 Tpl.Text txt;
2595 SimCode.SimCode a_simCode;
2596 Option<SimCodeVar.Causality> i_causality;
2597 BackendDAE.VarKind i_varKind;
2598 DAE.Type i_type__;
2599 Option<SimCodeVar.Variability> i_variability;
2600 String i_comment;
2601 SimCodeVar.SimVar i_simVar;
2602 Option<DAE.ComponentRef> i_exportVar;
2603 Boolean ret_31;
2604 Boolean ret_30;
2605 Boolean ret_29;
2606 Boolean ret_28;
2607 Boolean ret_27;
2608 Boolean ret_26;
2609 Boolean ret_25;
2610 Boolean ret_24;
2611 Boolean ret_23;
2612 Boolean ret_22;
2613 Boolean ret_21;
2614 Boolean ret_20;
2615 Boolean ret_19;
2616 Boolean ret_18;
2617 String ret_17;
2618 Tpl.Text l_initial;
2619 Tpl.Text l_caus;
2620 Tpl.Text l_previous;
2621 Option<Integer> ret_13;
2622 Tpl.Text l_clockIndex;
2623 Option<Integer> ret_11;
2624 Tpl.Text l_variability__;
2625 Tpl.Text l_description;
2626 String ret_8;
2627 Tpl.Text l_valueReference;
2628 Integer ret_6;
2629 Tpl.Text l_defaultValueReference;
2630 String ret_4;
2631 String ret_3;
2632 Tpl.Text txt_2;
2633 DAE.ComponentRef ret_1;
2634 Tpl.Text l_name;
2635
2636 case ( txt,
2637 (i_simVar as SimCodeVar.SIMVAR(exportVar = i_exportVar, comment = i_comment, variability = i_variability, type_ = i_type__, varKind = i_varKind, causality = i_causality)),
2638 a_simCode )
2639 algorithm
2640 2286 ret_1 := Util.getOption(i_exportVar);
2641 2286 txt_2 := CodegenUtil.crefStrNoUnderscore(Tpl.emptyTxt, ret_1);
2642 2286 ret_3 := System.stringReplace(Tpl.textString(txt_2), "$", "_D_");
2643 2286 ret_4 := Util.escapeModelicaStringToXmlString(ret_3);
2644 2286 l_name := Tpl.writeStr(Tpl.emptyTxt, ret_4);
2645 2286 ret_6 := System.tmpTick();
2646 2286 l_defaultValueReference := Tpl.writeStr(Tpl.emptyTxt, intString(ret_6));
2647 2286 ret_8 := SimCodeCodegenUtil.getValueReference(i_simVar, a_simCode, false);
2648 2286 l_valueReference := Tpl.writeStr(Tpl.emptyTxt, ret_8);
2649 2286 l_description := fun_119(Tpl.emptyTxt, i_comment);
2650 2286 ret_11 := SimCodeCodegenUtil.getClockIndex(i_simVar, a_simCode);
2651 2286 l_variability__ := fun_120(Tpl.emptyTxt, ret_11, i_type__, i_variability);
2652 2286 ret_13 := SimCodeCodegenUtil.getClockIndex(i_simVar, a_simCode);
2653 2286 l_clockIndex := fun_121(Tpl.emptyTxt, ret_13);
2654 2286 l_previous := fun_122(Tpl.emptyTxt, i_varKind, a_simCode);
2655 2286 l_caus := getCausality2(Tpl.emptyTxt, i_causality);
2656 2286 ret_17 := SimCodeCodegenUtil.getFmiInitialAttributeStr(i_simVar);
2657 2286 l_initial := Tpl.writeStr(Tpl.emptyTxt, ret_17);
2658 2286 txt := Tpl.writeTok(txt, Tpl.ST_STRING("name=\""));
2659 2286 txt := Tpl.writeText(txt, l_name);
2660 2286 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
2661 "\"\n",
2662 "valueReference=\""
2663 }, false));
2664 2286 txt := Tpl.writeText(txt, l_valueReference);
2665 2286 txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"\n"));
2666 2286 txt := Tpl.writeText(txt, l_description);
2667 2286 txt := Tpl.softNewLine(txt);
2668
3/4
✓ Branch 1 taken 1226 times.
✓ Branch 2 taken 1060 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1226 times.
2286 ret_18 := stringEq(Tpl.textString(l_variability__), "");
2669 2286 ret_19 := boolNot(ret_18);
2670 2286 txt := fun_123(txt, ret_19, l_variability__);
2671 2286 txt := Tpl.softNewLine(txt);
2672
3/4
✓ Branch 1 taken 1318 times.
✓ Branch 2 taken 968 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1318 times.
2286 ret_20 := stringEq(Tpl.textString(l_caus), "");
2673 2286 ret_21 := boolNot(ret_20);
2674 2286 txt := fun_124(txt, ret_21, l_caus);
2675 2286 txt := Tpl.softNewLine(txt);
2676
3/4
✓ Branch 1 taken 2240 times.
✓ Branch 2 taken 46 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2240 times.
2286 ret_22 := stringEq(Tpl.textString(l_clockIndex), "");
2677 2286 ret_23 := boolNot(ret_22);
2678 2286 ret_24 := Flags.getConfigBool(Flags.EXPORT_CLOCKS_IN_MODELDESCRIPTION);
2679 2286 ret_25 := boolAnd(ret_23, ret_24);
2680 2286 txt := fun_125(txt, ret_25, l_clockIndex);
2681 2286 txt := Tpl.softNewLine(txt);
2682
3/4
✓ Branch 1 taken 2229 times.
✓ Branch 2 taken 57 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2229 times.
2286 ret_26 := stringEq(Tpl.textString(l_previous), "");
2683 2286 ret_27 := boolNot(ret_26);
2684 2286 ret_28 := Flags.getConfigBool(Flags.EXPORT_CLOCKS_IN_MODELDESCRIPTION);
2685 2286 ret_29 := boolAnd(ret_27, ret_28);
2686 2286 txt := fun_126(txt, ret_29, l_previous);
2687 2286 txt := Tpl.softNewLine(txt);
2688
3/4
✓ Branch 1 taken 1935 times.
✓ Branch 2 taken 351 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1935 times.
2286 ret_30 := stringEq(Tpl.textString(l_initial), "");
2689 2286 ret_31 := boolNot(ret_30);
2690 2286 txt := fun_127(txt, ret_31, l_initial);
2691 then txt;
2692
2693 case ( txt,
2694 _,
2695 _ )
2696 then txt;
2697 end match;
2698 end ScalarVariableAttribute2;
2699
2700 protected function fun_129
2701 input Tpl.Text in_txt;
2702 input Boolean in_mArg;
2703
2704 output Tpl.Text out_txt;
2705 algorithm
2706 out_txt :=
2707 match(in_txt, in_mArg)
2708 local
2709 Tpl.Text txt;
2710
2711 case ( txt,
2712 false )
2713 then txt;
2714
2715 case ( txt,
2716 _ )
2717 algorithm
2718 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("continuous"));
2719 then txt;
2720 end match;
2721 end fun_129;
2722
2723 public function getVariability2
2724 input Tpl.Text in_txt;
2725 input Option<SimCodeVar.Variability> in_a_variability;
2726
2727 output Tpl.Text out_txt;
2728 algorithm
2729 out_txt :=
2730 match(in_txt, in_a_variability)
2731 local
2732 Tpl.Text txt;
2733 Boolean ret_0;
2734
2735 case ( txt,
2736 SOME(SimCodeVar.DISCRETE()) )
2737 algorithm
2738 275 txt := Tpl.writeTok(txt, Tpl.ST_STRING("discrete"));
2739 then txt;
2740
2741 case ( txt,
2742 SOME(SimCodeVar.FIXED()) )
2743 algorithm
2744 1395 txt := Tpl.writeTok(txt, Tpl.ST_STRING("fixed"));
2745 then txt;
2746
2747 case ( txt,
2748 SOME(SimCodeVar.CONSTANT()) )
2749 algorithm
2750 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("constant"));
2751 then txt;
2752
2753 case ( txt,
2754 SOME(SimCodeVar.CONTINUOUS()) )
2755 algorithm
2756 1785 ret_0 := Flags.isSet(Flags.DUMP_FORCE_FMI_ATTRIBUTES);
2757 1785 txt := fun_129(txt, ret_0);
2758 then txt;
2759
2760 case ( txt,
2761 SOME(SimCodeVar.TUNABLE()) )
2762 algorithm
2763 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("tunable"));
2764 then txt;
2765
2766 case ( txt,
2767 _ )
2768 then txt;
2769 end match;
2770 end getVariability2;
2771
2772 protected function fun_131
2773 input Tpl.Text in_txt;
2774 input Option<SimCodeVar.Variability> in_a_variability;
2775
2776 output Tpl.Text out_txt;
2777 algorithm
2778 out_txt :=
2779 match(in_txt, in_a_variability)
2780 local
2781 Tpl.Text txt;
2782 Option<SimCodeVar.Variability> i_variability;
2783
2784 case ( txt,
2785 SOME(SimCodeVar.CONTINUOUS()) )
2786 algorithm
2787 2 txt := Tpl.writeTok(txt, Tpl.ST_STRING("discrete"));
2788 then txt;
2789
2790 case ( txt,
2791 NONE() )
2792 algorithm
2793 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("discrete"));
2794 then txt;
2795
2796 case ( txt,
2797 i_variability )
2798 algorithm
2799 322 txt := getVariability2(txt, i_variability);
2800 then txt;
2801 end match;
2802 end fun_131;
2803
2804 protected function fun_132
2805 input Tpl.Text in_txt;
2806 input DAE.Type in_a_type__;
2807 input Option<SimCodeVar.Variability> in_a_variability;
2808
2809 output Tpl.Text out_txt;
2810 algorithm
2811 out_txt :=
2812 match(in_txt, in_a_type__, in_a_variability)
2813 local
2814 Tpl.Text txt;
2815 Option<SimCodeVar.Variability> a_variability;
2816
2817 case ( txt,
2818 DAE.T_REAL(varLst = _),
2819 a_variability )
2820 algorithm
2821 1915 txt := getVariability2(txt, a_variability);
2822 then txt;
2823
2824 case ( txt,
2825 _,
2826 a_variability )
2827 algorithm
2828 325 txt := fun_131(txt, a_variability);
2829 then txt;
2830 end match;
2831 end fun_132;
2832
2833 public function getVariabilityFMI2
2834 input Tpl.Text txt;
2835 input Option<SimCodeVar.Variability> a_variability;
2836 input DAE.Type a_type__;
2837
2838 output Tpl.Text out_txt;
2839 algorithm
2840 2240 out_txt := fun_132(txt, a_type__, a_variability);
2841 end getVariabilityFMI2;
2842
2843 protected function fun_134
2844 input Tpl.Text in_txt;
2845 input Boolean in_mArg;
2846
2847 output Tpl.Text out_txt;
2848 algorithm
2849 out_txt :=
2850 match(in_txt, in_mArg)
2851 local
2852 Tpl.Text txt;
2853
2854 case ( txt,
2855 false )
2856 then txt;
2857
2858 case ( txt,
2859 _ )
2860 algorithm
2861 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("local"));
2862 then txt;
2863 end match;
2864 end fun_134;
2865
2866 public function getCausality2
2867 input Tpl.Text in_txt;
2868 input Option<SimCodeVar.Causality> in_a_c;
2869
2870 output Tpl.Text out_txt;
2871 algorithm
2872 out_txt :=
2873 match(in_txt, in_a_c)
2874 local
2875 Tpl.Text txt;
2876 Boolean ret_0;
2877
2878 case ( txt,
2879 SOME(SimCodeVar.NONECAUS()) )
2880 algorithm
2881 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("none"));
2882 then txt;
2883
2884 case ( txt,
2885 SOME(SimCodeVar.OUTPUT()) )
2886 algorithm
2887 128 txt := Tpl.writeTok(txt, Tpl.ST_STRING("output"));
2888 then txt;
2889
2890 case ( txt,
2891 SOME(SimCodeVar.INPUT()) )
2892 algorithm
2893 63 txt := Tpl.writeTok(txt, Tpl.ST_STRING("input"));
2894 then txt;
2895
2896 case ( txt,
2897 SOME(SimCodeVar.LOCAL()) )
2898 algorithm
2899 1925 ret_0 := Flags.isSet(Flags.DUMP_FORCE_FMI_ATTRIBUTES);
2900 1925 txt := fun_134(txt, ret_0);
2901 then txt;
2902
2903 case ( txt,
2904 SOME(SimCodeVar.PARAMETER()) )
2905 algorithm
2906 537 txt := Tpl.writeTok(txt, Tpl.ST_STRING("parameter"));
2907 then txt;
2908
2909 case ( txt,
2910 SOME(SimCodeVar.CALCULATED_PARAMETER()) )
2911 algorithm
2912 858 txt := Tpl.writeTok(txt, Tpl.ST_STRING("calculatedParameter"));
2913 then txt;
2914
2915 case ( txt,
2916 _ )
2917 then txt;
2918 end match;
2919 end getCausality2;
2920
2921 protected function fun_136
2922 input Tpl.Text in_txt;
2923 input String in_mArg;
2924 input Integer in_a_vi_numZeroCrossings;
2925 input list<BackendDAE.ZeroCrossing> in_a_zeroCrossings;
2926
2927 output Tpl.Text out_txt;
2928 algorithm
2929 out_txt :=
2930 match(in_txt, in_mArg, in_a_vi_numZeroCrossings, in_a_zeroCrossings)
2931 local
2932 Tpl.Text txt;
2933 Integer a_vi_numZeroCrossings;
2934 list<BackendDAE.ZeroCrossing> a_zeroCrossings;
2935 Integer ret_0;
2936
2937 case ( txt,
2938 "Cpp",
2939 _,
2940 a_zeroCrossings )
2941 algorithm
2942 20 ret_0 := listLength(a_zeroCrossings);
2943 20 txt := Tpl.writeStr(txt, intString(ret_0));
2944 then txt;
2945
2946 case ( txt,
2947 _,
2948 a_vi_numZeroCrossings,
2949 _ )
2950 algorithm
2951 112 txt := Tpl.writeStr(txt, intString(a_vi_numZeroCrossings));
2952 then txt;
2953 end match;
2954 end fun_136;
2955
2956 public function getNumberOfEventIndicators
2957 input Tpl.Text in_txt;
2958 input SimCode.SimCode in_a_simCode;
2959
2960 output Tpl.Text out_txt;
2961 algorithm
2962 out_txt :=
2963 match(in_txt, in_a_simCode)
2964 local
2965 Tpl.Text txt;
2966 Integer i_vi_numZeroCrossings;
2967 list<BackendDAE.ZeroCrossing> i_zeroCrossings;
2968 String ret_0;
2969
2970 case ( txt,
2971 SimCode.SIMCODE(zeroCrossings = i_zeroCrossings, modelInfo = SimCode.MODELINFO(varInfo = SimCode.VARINFO(numZeroCrossings = i_vi_numZeroCrossings))) )
2972 algorithm
2973 132 ret_0 := Config.simCodeTarget();
2974 132 txt := fun_136(txt, ret_0, i_vi_numZeroCrossings, i_zeroCrossings);
2975 then txt;
2976
2977 case ( txt,
2978 _ )
2979 then txt;
2980 end match;
2981 end getNumberOfEventIndicators;
2982
2983 protected function fun_138
2984 input Tpl.Text in_txt;
2985 input DAE.Type in_a_type__;
2986 input list<SimCodeVar.SimVar> in_a_stateVars;
2987 input SimCodeVar.SimVar in_a_simvar;
2988
2989 output Tpl.Text out_txt;
2990 algorithm
2991 out_txt :=
2992 match(in_txt, in_a_type__, in_a_stateVars, in_a_simvar)
2993 local
2994 Tpl.Text txt;
2995 list<SimCodeVar.SimVar> a_stateVars;
2996 SimCodeVar.SimVar a_simvar;
2997 Absyn.Path i_path;
2998 String ret_0;
2999
3000 case ( txt,
3001 DAE.T_REAL(varLst = _),
3002 a_stateVars,
3003 a_simvar )
3004 algorithm
3005 1959 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Real"));
3006 1959 txt := ScalarVariableTypeCommonAttribute2(txt, a_simvar, a_stateVars);
3007 1959 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
3008 then txt;
3009
3010 case ( txt,
3011 DAE.T_INTEGER(varLst = _),
3012 a_stateVars,
3013 a_simvar )
3014 algorithm
3015 166 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Integer"));
3016 166 txt := ScalarVariableTypeCommonAttribute2(txt, a_simvar, a_stateVars);
3017 166 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
3018 then txt;
3019
3020 case ( txt,
3021 DAE.T_BOOL(varLst = _),
3022 a_stateVars,
3023 a_simvar )
3024 algorithm
3025 103 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Boolean"));
3026 103 txt := ScalarVariableTypeCommonAttribute2(txt, a_simvar, a_stateVars);
3027 103 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
3028 then txt;
3029
3030 case ( txt,
3031 DAE.T_STRING(varLst = _),
3032 a_stateVars,
3033 a_simvar )
3034 algorithm
3035 18 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<String"));
3036 18 txt := ScalarVariableTypeCommonAttribute2(txt, a_simvar, a_stateVars);
3037 18 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
3038 then txt;
3039
3040 case ( txt,
3041 DAE.T_ENUMERATION(path = i_path),
3042 a_stateVars,
3043 a_simvar )
3044 algorithm
3045 40 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Enumeration declaredType=\""));
3046 40 ret_0 := AbsynUtil.pathString(i_path, ".", false, false);
3047 40 txt := Tpl.writeStr(txt, ret_0);
3048 40 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3049 40 txt := ScalarVariableTypeCommonAttribute2(txt, a_simvar, a_stateVars);
3050 40 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
3051 then txt;
3052
3053 case ( txt,
3054 _,
3055 _,
3056 _ )
3057 algorithm
3058 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("UNKOWN_TYPE"));
3059 then txt;
3060 end match;
3061 end fun_138;
3062
3063 public function ScalarVariableType2
3064 input Tpl.Text in_txt;
3065 input SimCodeVar.SimVar in_a_simvar;
3066 input list<SimCodeVar.SimVar> in_a_stateVars;
3067
3068 output Tpl.Text out_txt;
3069 algorithm
3070 out_txt :=
3071 match(in_txt, in_a_simvar, in_a_stateVars)
3072 local
3073 Tpl.Text txt;
3074 list<SimCodeVar.SimVar> a_stateVars;
3075 SimCodeVar.SimVar i_simvar;
3076 DAE.Type i_type__;
3077
3078 case ( txt,
3079 (i_simvar as SimCodeVar.SIMVAR(type_ = i_type__)),
3080 a_stateVars )
3081 algorithm
3082 2286 txt := fun_138(txt, i_type__, a_stateVars, i_simvar);
3083 then txt;
3084
3085 case ( txt,
3086 _,
3087 _ )
3088 then txt;
3089 end match;
3090 end ScalarVariableType2;
3091
3092 public function ScalarVariableTypeCommonAttribute2
3093 input Tpl.Text in_txt;
3094 input SimCodeVar.SimVar in_a_simvar;
3095 input list<SimCodeVar.SimVar> in_a_stateVars;
3096
3097 output Tpl.Text out_txt;
3098 algorithm
3099 out_txt :=
3100 match(in_txt, in_a_simvar, in_a_stateVars)
3101 local
3102 Tpl.Text txt;
3103 list<SimCodeVar.SimVar> a_stateVars;
3104 SimCodeVar.SimVar i_simvar;
3105 Tpl.Text l_extraAttributes;
3106 Tpl.Text l_startString;
3107
3108 case ( txt,
3109 (i_simvar as SimCodeVar.SIMVAR(name = _)),
3110 a_stateVars )
3111 algorithm
3112 2286 l_startString := StartString2(Tpl.emptyTxt, i_simvar);
3113 2286 l_extraAttributes := DerivativeVarIndex(Tpl.emptyTxt, i_simvar, a_stateVars);
3114 2286 l_extraAttributes := MinString2(l_extraAttributes, i_simvar);
3115 2286 l_extraAttributes := MaxString2(l_extraAttributes, i_simvar);
3116 2286 l_extraAttributes := NominalString2(l_extraAttributes, i_simvar);
3117 2286 l_extraAttributes := UnitString2(l_extraAttributes, i_simvar);
3118 2286 l_extraAttributes := relativeQuantity(l_extraAttributes, i_simvar);
3119 2286 txt := Tpl.writeText(txt, l_startString);
3120 2286 txt := Tpl.writeText(txt, l_extraAttributes);
3121 then txt;
3122
3123 case ( txt,
3124 _,
3125 _ )
3126 then txt;
3127 end match;
3128 end ScalarVariableTypeCommonAttribute2;
3129
3130 protected function fun_141
3131 input Tpl.Text in_txt;
3132 input BackendDAE.VarKind in_a_varKind;
3133 input Integer in_a_index;
3134 input list<SimCodeVar.SimVar> in_a_stateVars;
3135
3136 output Tpl.Text out_txt;
3137 algorithm
3138 out_txt :=
3139 match(in_txt, in_a_varKind, in_a_index, in_a_stateVars)
3140 local
3141 Tpl.Text txt;
3142 Integer a_index;
3143 list<SimCodeVar.SimVar> a_stateVars;
3144 Integer ret_0;
3145
3146 case ( txt,
3147 BackendDAE.STATE_DER(),
3148 a_index,
3149 a_stateVars )
3150 algorithm
3151 82 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3152 82 txt := Tpl.writeTok(txt, Tpl.ST_STRING("derivative=\""));
3153 82 ret_0 := SimCodeCodegenUtil.getStateSimVarIndexFromIndex(a_stateVars, a_index);
3154 82 txt := Tpl.writeStr(txt, intString(ret_0));
3155 82 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3156 82 txt := Tpl.popBlock(txt);
3157 then txt;
3158
3159 case ( txt,
3160 _,
3161 _,
3162 _ )
3163 then txt;
3164 end match;
3165 end fun_141;
3166
3167 public function DerivativeVarIndex
3168 input Tpl.Text in_txt;
3169 input SimCodeVar.SimVar in_a_simvar;
3170 input list<SimCodeVar.SimVar> in_a_stateVars;
3171
3172 output Tpl.Text out_txt;
3173 algorithm
3174 out_txt :=
3175 match(in_txt, in_a_simvar, in_a_stateVars)
3176 local
3177 Tpl.Text txt;
3178 list<SimCodeVar.SimVar> a_stateVars;
3179 Integer i_index;
3180 BackendDAE.VarKind i_varKind;
3181
3182 case ( txt,
3183 SimCodeVar.SIMVAR(varKind = i_varKind, index = i_index),
3184 a_stateVars )
3185 algorithm
3186 2286 txt := fun_141(txt, i_varKind, i_index, a_stateVars);
3187 then txt;
3188
3189 case ( txt,
3190 _,
3191 _ )
3192 then txt;
3193 end match;
3194 end DerivativeVarIndex;
3195
3196 protected function fun_143
3197 input Tpl.Text in_txt;
3198 input Option<SimCodeVar.Initial> in_a_initial__;
3199 input SimCodeVar.SimVar in_a_simvar;
3200
3201 output Tpl.Text out_txt;
3202 algorithm
3203 out_txt :=
3204 match(in_txt, in_a_initial__, in_a_simvar)
3205 local
3206 Tpl.Text txt;
3207 SimCodeVar.SimVar a_simvar;
3208
3209 case ( txt,
3210 SOME(SimCodeVar.EXACT()),
3211 a_simvar )
3212 algorithm
3213 932 txt := startString3(txt, a_simvar);
3214 then txt;
3215
3216 case ( txt,
3217 SOME(SimCodeVar.APPROX()),
3218 a_simvar )
3219 algorithm
3220 14 txt := startString3(txt, a_simvar);
3221 then txt;
3222
3223 case ( txt,
3224 _,
3225 _ )
3226 then txt;
3227 end match;
3228 end fun_143;
3229
3230 public function StartString2
3231 input Tpl.Text in_txt;
3232 input SimCodeVar.SimVar in_a_simvar;
3233
3234 output Tpl.Text out_txt;
3235 algorithm
3236 out_txt :=
3237 match(in_txt, in_a_simvar)
3238 local
3239 Tpl.Text txt;
3240 Option<SimCodeVar.Initial> i_initial__;
3241 SimCodeVar.SimVar i_simvar;
3242
3243 case ( txt,
3244 SimCodeVar.SIMVAR(aliasvar = SimCodeVar.ALIAS(varName = _)) )
3245 then txt;
3246
3247 case ( txt,
3248 SimCodeVar.SIMVAR(initialValue = NONE()) )
3249 then txt;
3250
3251 case ( txt,
3252 (i_simvar as SimCodeVar.SIMVAR(causality = SOME(SimCodeVar.INPUT()))) )
3253 algorithm
3254 43 txt := startString3(txt, i_simvar);
3255 then txt;
3256
3257 case ( txt,
3258 (i_simvar as SimCodeVar.SIMVAR(initial_ = i_initial__)) )
3259 algorithm
3260 2037 txt := fun_143(txt, i_initial__, i_simvar);
3261 then txt;
3262
3263 case ( txt,
3264 _ )
3265 then txt;
3266 end match;
3267 end StartString2;
3268
3269 protected function fun_145
3270 input Tpl.Text in_txt;
3271 input Option<DAE.Exp> in_a_initialValue;
3272
3273 output Tpl.Text out_txt;
3274 algorithm
3275 out_txt :=
3276 match(in_txt, in_a_initialValue)
3277 local
3278 Tpl.Text txt;
3279 DAE.Exp i_e;
3280
3281 case ( txt,
3282 SOME((i_e as DAE.ICONST(integer = _))) )
3283 algorithm
3284 126 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3285 126 txt := Tpl.writeTok(txt, Tpl.ST_STRING("start=\""));
3286 126 txt := CodegenUtil.initValXml(txt, i_e, "");
3287 126 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3288 126 txt := Tpl.popBlock(txt);
3289 then txt;
3290
3291 case ( txt,
3292 SOME((i_e as DAE.RCONST(real = _))) )
3293 algorithm
3294 815 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3295 815 txt := Tpl.writeTok(txt, Tpl.ST_STRING("start=\""));
3296 815 txt := CodegenUtil.initValXml(txt, i_e, "");
3297 815 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3298 815 txt := Tpl.popBlock(txt);
3299 then txt;
3300
3301 case ( txt,
3302 SOME((i_e as DAE.SCONST(string = _))) )
3303 algorithm
3304 16 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3305 16 txt := Tpl.writeTok(txt, Tpl.ST_STRING("start=\""));
3306 16 txt := CodegenUtil.initValXml(txt, i_e, "");
3307 16 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3308 16 txt := Tpl.popBlock(txt);
3309 then txt;
3310
3311 case ( txt,
3312 SOME((i_e as DAE.BCONST(bool = _))) )
3313 algorithm
3314 23 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3315 23 txt := Tpl.writeTok(txt, Tpl.ST_STRING("start=\""));
3316 23 txt := CodegenUtil.initValXml(txt, i_e, "");
3317 23 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3318 23 txt := Tpl.popBlock(txt);
3319 then txt;
3320
3321 case ( txt,
3322 SOME((i_e as DAE.ENUM_LITERAL(name = _))) )
3323 algorithm
3324 9 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3325 9 txt := Tpl.writeTok(txt, Tpl.ST_STRING("start=\""));
3326 9 txt := CodegenUtil.initValXml(txt, i_e, "");
3327 9 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3328 9 txt := Tpl.popBlock(txt);
3329 then txt;
3330
3331 case ( txt,
3332 _ )
3333 then txt;
3334 end match;
3335 end fun_145;
3336
3337 public function startString3
3338 input Tpl.Text in_txt;
3339 input SimCodeVar.SimVar in_a_simvar;
3340
3341 output Tpl.Text out_txt;
3342 algorithm
3343 out_txt :=
3344 match(in_txt, in_a_simvar)
3345 local
3346 Tpl.Text txt;
3347 Option<DAE.Exp> i_initialValue;
3348
3349 case ( txt,
3350 SimCodeVar.SIMVAR(initialValue = i_initialValue) )
3351 algorithm
3352 989 txt := fun_145(txt, i_initialValue);
3353 then txt;
3354
3355 case ( txt,
3356 _ )
3357 then txt;
3358 end match;
3359 end startString3;
3360
3361 public function startString2Helper
3362 input Tpl.Text in_txt;
3363 input Option<DAE.Exp> in_a_exp;
3364 input DAE.Type in_a_type__;
3365
3366 output Tpl.Text out_txt;
3367 algorithm
3368 out_txt :=
3369 match(in_txt, in_a_exp, in_a_type__)
3370 local
3371 Tpl.Text txt;
3372 DAE.Type a_type__;
3373 DAE.Exp i_e;
3374
3375 case ( txt,
3376 SOME(i_e),
3377 _ )
3378 algorithm
3379 ✗ txt := CodegenUtil.initValXml(txt, i_e, "");
3380 then txt;
3381
3382 case ( txt,
3383 _,
3384 a_type__ )
3385 algorithm
3386 ✗ txt := CodegenUtil.initDefaultValXml(txt, a_type__);
3387 then txt;
3388 end match;
3389 end startString2Helper;
3390
3391 protected function fun_148
3392 input Tpl.Text in_txt;
3393 input Option<DAE.Exp> in_a_minValue;
3394
3395 output Tpl.Text out_txt;
3396 algorithm
3397 out_txt :=
3398 match(in_txt, in_a_minValue)
3399 local
3400 Tpl.Text txt;
3401 DAE.Exp i_e;
3402
3403 case ( txt,
3404 SOME((i_e as DAE.ICONST(integer = _))) )
3405 algorithm
3406 216 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3407 216 txt := Tpl.writeTok(txt, Tpl.ST_STRING("min=\""));
3408 216 txt := CodegenUtil.initValXml(txt, i_e, "");
3409 216 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3410 216 txt := Tpl.popBlock(txt);
3411 then txt;
3412
3413 case ( txt,
3414 SOME((i_e as DAE.RCONST(real = _))) )
3415 algorithm
3416 466 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3417 466 txt := Tpl.writeTok(txt, Tpl.ST_STRING("min=\""));
3418 466 txt := CodegenUtil.initValXml(txt, i_e, "");
3419 466 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3420 466 txt := Tpl.popBlock(txt);
3421 then txt;
3422
3423 case ( txt,
3424 SOME((i_e as DAE.SCONST(string = _))) )
3425 algorithm
3426 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3427 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("min=\""));
3428 ✗ txt := CodegenUtil.initValXml(txt, i_e, "");
3429 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3430 ✗ txt := Tpl.popBlock(txt);
3431 then txt;
3432
3433 case ( txt,
3434 SOME((i_e as DAE.BCONST(bool = _))) )
3435 algorithm
3436 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3437 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("min=\""));
3438 ✗ txt := CodegenUtil.initValXml(txt, i_e, "");
3439 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3440 ✗ txt := Tpl.popBlock(txt);
3441 then txt;
3442
3443 case ( txt,
3444 SOME((i_e as DAE.ENUM_LITERAL(name = _))) )
3445 algorithm
3446 47 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3447 47 txt := Tpl.writeTok(txt, Tpl.ST_STRING("min=\""));
3448 47 txt := CodegenUtil.initValXml(txt, i_e, "");
3449 47 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3450 47 txt := Tpl.popBlock(txt);
3451 then txt;
3452
3453 case ( txt,
3454 _ )
3455 then txt;
3456 end match;
3457 end fun_148;
3458
3459 public function MinString2
3460 input Tpl.Text in_txt;
3461 input SimCodeVar.SimVar in_a_simvar;
3462
3463 output Tpl.Text out_txt;
3464 algorithm
3465 out_txt :=
3466 match(in_txt, in_a_simvar)
3467 local
3468 Tpl.Text txt;
3469 Option<DAE.Exp> i_minValue;
3470
3471 case ( txt,
3472 SimCodeVar.SIMVAR(minValue = i_minValue) )
3473 algorithm
3474 3392 txt := fun_148(txt, i_minValue);
3475 then txt;
3476
3477 case ( txt,
3478 _ )
3479 then txt;
3480 end match;
3481 end MinString2;
3482
3483 protected function fun_150
3484 input Tpl.Text in_txt;
3485 input Option<DAE.Exp> in_a_maxValue;
3486
3487 output Tpl.Text out_txt;
3488 algorithm
3489 out_txt :=
3490 match(in_txt, in_a_maxValue)
3491 local
3492 Tpl.Text txt;
3493 DAE.Exp i_e;
3494
3495 case ( txt,
3496 SOME((i_e as DAE.ICONST(integer = _))) )
3497 algorithm
3498 210 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3499 210 txt := Tpl.writeTok(txt, Tpl.ST_STRING("max=\""));
3500 210 txt := CodegenUtil.initValXml(txt, i_e, "");
3501 210 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3502 210 txt := Tpl.popBlock(txt);
3503 then txt;
3504
3505 case ( txt,
3506 SOME((i_e as DAE.RCONST(real = _))) )
3507 algorithm
3508 110 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3509 110 txt := Tpl.writeTok(txt, Tpl.ST_STRING("max=\""));
3510 110 txt := CodegenUtil.initValXml(txt, i_e, "");
3511 110 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3512 110 txt := Tpl.popBlock(txt);
3513 then txt;
3514
3515 case ( txt,
3516 SOME((i_e as DAE.SCONST(string = _))) )
3517 algorithm
3518 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3519 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("max=\""));
3520 ✗ txt := CodegenUtil.initValXml(txt, i_e, "");
3521 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3522 ✗ txt := Tpl.popBlock(txt);
3523 then txt;
3524
3525 case ( txt,
3526 SOME((i_e as DAE.BCONST(bool = _))) )
3527 algorithm
3528 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3529 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("max=\""));
3530 ✗ txt := CodegenUtil.initValXml(txt, i_e, "");
3531 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3532 ✗ txt := Tpl.popBlock(txt);
3533 then txt;
3534
3535 case ( txt,
3536 SOME((i_e as DAE.ENUM_LITERAL(name = _))) )
3537 algorithm
3538 47 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3539 47 txt := Tpl.writeTok(txt, Tpl.ST_STRING("max=\""));
3540 47 txt := CodegenUtil.initValXml(txt, i_e, "");
3541 47 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3542 47 txt := Tpl.popBlock(txt);
3543 then txt;
3544
3545 case ( txt,
3546 _ )
3547 then txt;
3548 end match;
3549 end fun_150;
3550
3551 public function MaxString2
3552 input Tpl.Text in_txt;
3553 input SimCodeVar.SimVar in_a_simvar;
3554
3555 output Tpl.Text out_txt;
3556 algorithm
3557 out_txt :=
3558 match(in_txt, in_a_simvar)
3559 local
3560 Tpl.Text txt;
3561 Option<DAE.Exp> i_maxValue;
3562
3563 case ( txt,
3564 SimCodeVar.SIMVAR(maxValue = i_maxValue) )
3565 algorithm
3566 3392 txt := fun_150(txt, i_maxValue);
3567 then txt;
3568
3569 case ( txt,
3570 _ )
3571 then txt;
3572 end match;
3573 end MaxString2;
3574
3575 protected function fun_152
3576 input Tpl.Text in_txt;
3577 input Option<DAE.Exp> in_a_nominalValue;
3578
3579 output Tpl.Text out_txt;
3580 algorithm
3581 out_txt :=
3582 match(in_txt, in_a_nominalValue)
3583 local
3584 Tpl.Text txt;
3585 DAE.Exp i_e;
3586
3587 case ( txt,
3588 SOME((i_e as DAE.RCONST(real = _))) )
3589 algorithm
3590 147 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3591 147 txt := Tpl.writeTok(txt, Tpl.ST_STRING("nominal=\""));
3592 147 txt := CodegenUtil.initValXml(txt, i_e, "");
3593 147 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3594 147 txt := Tpl.popBlock(txt);
3595 then txt;
3596
3597 case ( txt,
3598 _ )
3599 then txt;
3600 end match;
3601 end fun_152;
3602
3603 public function NominalString2
3604 input Tpl.Text in_txt;
3605 input SimCodeVar.SimVar in_a_simvar;
3606
3607 output Tpl.Text out_txt;
3608 algorithm
3609 out_txt :=
3610 match(in_txt, in_a_simvar)
3611 local
3612 Tpl.Text txt;
3613 Option<DAE.Exp> i_nominalValue;
3614
3615 case ( txt,
3616 SimCodeVar.SIMVAR(nominalValue = i_nominalValue) )
3617 algorithm
3618 3310 txt := fun_152(txt, i_nominalValue);
3619 then txt;
3620
3621 case ( txt,
3622 _ )
3623 then txt;
3624 end match;
3625 end NominalString2;
3626
3627 protected function fun_154
3628 input Tpl.Text in_txt;
3629 input String in_a_unit;
3630
3631 output Tpl.Text out_txt;
3632 algorithm
3633 out_txt :=
3634 match(in_txt, in_a_unit)
3635 local
3636 Tpl.Text txt;
3637 String i_unit;
3638 String ret_0;
3639
3640 case ( txt,
3641 "" )
3642 then txt;
3643
3644 case ( txt,
3645 i_unit )
3646 algorithm
3647 1066 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3648 1066 txt := Tpl.writeTok(txt, Tpl.ST_STRING("unit=\""));
3649 1066 ret_0 := Util.escapeModelicaStringToXmlString(i_unit);
3650 1066 txt := Tpl.writeStr(txt, ret_0);
3651 1066 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3652 1066 txt := Tpl.popBlock(txt);
3653 then txt;
3654 end match;
3655 end fun_154;
3656
3657 protected function fun_155
3658 input Tpl.Text in_txt;
3659 input String in_a_displayUnit;
3660
3661 output Tpl.Text out_txt;
3662 algorithm
3663 out_txt :=
3664 match(in_txt, in_a_displayUnit)
3665 local
3666 Tpl.Text txt;
3667 String i_displayUnit;
3668 String ret_0;
3669
3670 case ( txt,
3671 "" )
3672 then txt;
3673
3674 case ( txt,
3675 i_displayUnit )
3676 algorithm
3677 129 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3678 129 txt := Tpl.writeTok(txt, Tpl.ST_STRING("displayUnit=\""));
3679 129 ret_0 := Util.escapeModelicaStringToXmlString(i_displayUnit);
3680 129 txt := Tpl.writeStr(txt, ret_0);
3681 129 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3682 129 txt := Tpl.popBlock(txt);
3683 then txt;
3684 end match;
3685 end fun_155;
3686
3687 public function UnitString2
3688 input Tpl.Text in_txt;
3689 input SimCodeVar.SimVar in_a_simvar;
3690
3691 output Tpl.Text out_txt;
3692 algorithm
3693 out_txt :=
3694 match(in_txt, in_a_simvar)
3695 local
3696 Tpl.Text txt;
3697 String i_displayUnit;
3698 String i_unit;
3699 Tpl.Text l_displayUnitString;
3700 Tpl.Text l_unitString;
3701
3702 case ( txt,
3703 SimCodeVar.SIMVAR(unit = i_unit, displayUnit = i_displayUnit) )
3704 algorithm
3705 2286 l_unitString := fun_154(Tpl.emptyTxt, i_unit);
3706 2286 l_displayUnitString := fun_155(Tpl.emptyTxt, i_displayUnit);
3707 2286 txt := Tpl.writeText(txt, l_unitString);
3708 then txt;
3709
3710 case ( txt,
3711 _ )
3712 then txt;
3713 end match;
3714 end UnitString2;
3715
3716 protected function fun_157
3717 input Tpl.Text in_txt;
3718 input String in_a_unit;
3719
3720 output Tpl.Text out_txt;
3721 algorithm
3722 out_txt :=
3723 match(in_txt, in_a_unit)
3724 local
3725 Tpl.Text txt;
3726 String i_unit;
3727 String ret_0;
3728
3729 case ( txt,
3730 "" )
3731 then txt;
3732
3733 case ( txt,
3734 i_unit )
3735 algorithm
3736 825 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3737 825 txt := Tpl.writeTok(txt, Tpl.ST_STRING("unit=\""));
3738 825 ret_0 := Util.escapeModelicaStringToXmlString(i_unit);
3739 825 txt := Tpl.writeStr(txt, ret_0);
3740 825 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3741 825 txt := Tpl.popBlock(txt);
3742 then txt;
3743 end match;
3744 end fun_157;
3745
3746 protected function fun_158
3747 input Tpl.Text in_txt;
3748 input Boolean in_mArg;
3749 input String in_a_displayUnit;
3750
3751 output Tpl.Text out_txt;
3752 algorithm
3753 out_txt :=
3754 match(in_txt, in_mArg, in_a_displayUnit)
3755 local
3756 Tpl.Text txt;
3757 String a_displayUnit;
3758 String ret_0;
3759
3760 case ( txt,
3761 true,
3762 _ )
3763 then txt;
3764
3765 case ( txt,
3766 _,
3767 a_displayUnit )
3768 algorithm
3769 53 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3770 53 txt := Tpl.writeTok(txt, Tpl.ST_STRING("displayUnit=\""));
3771 53 ret_0 := Util.escapeModelicaStringToXmlString(a_displayUnit);
3772 53 txt := Tpl.writeStr(txt, ret_0);
3773 53 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
3774 53 txt := Tpl.popBlock(txt);
3775 then txt;
3776 end match;
3777 end fun_158;
3778
3779 public function UnitString3
3780 input Tpl.Text in_txt;
3781 input SimCodeVar.SimVar in_a_simvar;
3782 input SimCode.SimCode in_a_simCode;
3783
3784 output Tpl.Text out_txt;
3785 algorithm
3786 out_txt :=
3787 match(in_txt, in_a_simvar, in_a_simCode)
3788 local
3789 Tpl.Text txt;
3790 SimCode.SimCode a_simCode;
3791 String i_displayUnit;
3792 String i_unit;
3793 Boolean ret_3;
3794 Tpl.Text txt_2;
3795 Tpl.Text l_displayUnitString;
3796 Tpl.Text l_unitString;
3797
3798 case ( txt,
3799 SimCodeVar.SIMVAR(unit = i_unit, displayUnit = i_displayUnit),
3800 a_simCode )
3801 algorithm
3802 1024 l_unitString := fun_157(Tpl.emptyTxt, i_unit);
3803 1024 txt_2 := declaredDisplayUnit(Tpl.emptyTxt, i_unit, i_displayUnit, a_simCode);
3804 1024 ret_3 := Tpl.isEmpty(txt_2);
3805 1024 l_displayUnitString := fun_158(Tpl.emptyTxt, ret_3, i_displayUnit);
3806 1024 txt := Tpl.writeText(txt, l_unitString);
3807 1024 txt := Tpl.writeText(txt, l_displayUnitString);
3808 then txt;
3809
3810 case ( txt,
3811 _,
3812 _ )
3813 then txt;
3814 end match;
3815 end UnitString3;
3816
3817 protected function lm_160
3818 input output Tpl.Text txt;
3819 input list<SimCode.UnitDefinition> items;
3820 input String a_unit;
3821 algorithm
3822
2/2
✓ Branch 0 taken 16351 times.
✓ Branch 1 taken 1024 times.
17375 for lstElt_160 in items loop
3823 txt := match lstElt_160
3824 local
3825 SimCode.UnitDefinition i_u;
3826
3827 case i_u
3828 algorithm
3829 16351 txt := unitDimensionsNamed(txt, i_u, a_unit);
3830 then txt;
3831 end match;
3832 end for;
3833 end lm_160;
3834
3835 protected function lm_161
3836 input output Tpl.Text txt;
3837 input list<SimCode.UnitDefinition> items;
3838 input String a_displayUnit;
3839 algorithm
3840
2/2
✓ Branch 0 taken 16351 times.
✓ Branch 1 taken 1024 times.
17375 for lstElt_161 in items loop
3841 txt := match lstElt_161
3842 local
3843 SimCode.UnitDefinition i_u;
3844
3845 case i_u
3846 algorithm
3847 16351 txt := unitDimensionsNamed(txt, i_u, a_displayUnit);
3848 then txt;
3849 end match;
3850 end for;
3851 end lm_161;
3852
3853 protected function fun_162
3854 input Tpl.Text in_txt;
3855 input Boolean in_mArg;
3856
3857 output Tpl.Text out_txt;
3858 algorithm
3859 out_txt :=
3860 match(in_txt, in_mArg)
3861 local
3862 Tpl.Text txt;
3863
3864 case ( txt,
3865 false )
3866 then txt;
3867
3868 case ( txt,
3869 _ )
3870 algorithm
3871 53 txt := Tpl.writeTok(txt, Tpl.ST_STRING("declared"));
3872 then txt;
3873 end match;
3874 end fun_162;
3875
3876 protected function fun_163
3877 input Tpl.Text in_txt;
3878 input SimCode.SimCode in_a_simCode;
3879 input String in_a_unit;
3880 input String in_a_displayUnit;
3881
3882 output Tpl.Text out_txt;
3883 algorithm
3884 out_txt :=
3885 match(in_txt, in_a_simCode, in_a_unit, in_a_displayUnit)
3886 local
3887 Tpl.Text txt;
3888 String a_unit;
3889 String a_displayUnit;
3890 list<SimCode.UnitDefinition> i_unitDefinitions;
3891 Boolean ret_8;
3892 Boolean ret_7;
3893 Boolean ret_6;
3894 Boolean ret_5;
3895 Boolean ret_4;
3896 Boolean ret_3;
3897 Boolean ret_2;
3898 Tpl.Text l_displayDims;
3899 Tpl.Text l_dims;
3900
3901 case ( txt,
3902 SimCode.SIMCODE(modelInfo = SimCode.MODELINFO(unitDefinitions = i_unitDefinitions)),
3903 a_unit,
3904 a_displayUnit )
3905 algorithm
3906 1024 l_dims := lm_160(Tpl.emptyTxt, i_unitDefinitions, a_unit);
3907 1024 l_displayDims := lm_161(Tpl.emptyTxt, i_unitDefinitions, a_displayUnit);
3908
3/4
✓ Branch 1 taken 199 times.
✓ Branch 2 taken 825 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 199 times.
1024 ret_2 := stringEq(Tpl.textString(l_dims), "");
3909 1024 ret_3 := boolNot(ret_2);
3910
3/4
✓ Branch 2 taken 253 times.
✓ Branch 3 taken 771 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 253 times.
1024 ret_4 := stringEq(Tpl.textString(l_dims), Tpl.textString(l_displayDims));
3911
4/4
✓ Branch 0 taken 220 times.
✓ Branch 1 taken 804 times.
✓ Branch 3 taken 20 times.
✓ Branch 4 taken 200 times.
1024 ret_5 := stringEq(a_unit, a_displayUnit);
3912 1024 ret_6 := boolNot(ret_5);
3913 1024 ret_7 := boolAnd(ret_4, ret_6);
3914 1024 ret_8 := boolAnd(ret_3, ret_7);
3915 1024 txt := fun_162(txt, ret_8);
3916 then txt;
3917
3918 case ( txt,
3919 _,
3920 _,
3921 _ )
3922 then txt;
3923 end match;
3924 end fun_163;
3925
3926 public function declaredDisplayUnit
3927 input Tpl.Text txt;
3928 input String a_unit;
3929 input String a_displayUnit;
3930 input SimCode.SimCode a_simCode;
3931
3932 output Tpl.Text out_txt;
3933 algorithm
3934 1024 out_txt := fun_163(txt, a_simCode, a_unit, a_displayUnit);
3935 end declaredDisplayUnit;
3936
3937 protected function fun_165
3938 input Tpl.Text in_txt;
3939 input Boolean in_mArg;
3940 input SimCode.BaseUnit in_a_baseUnit;
3941
3942 output Tpl.Text out_txt;
3943 algorithm
3944 out_txt :=
3945 match(in_txt, in_mArg, in_a_baseUnit)
3946 local
3947 Tpl.Text txt;
3948 SimCode.BaseUnit a_baseUnit;
3949
3950 case ( txt,
3951 false,
3952 _ )
3953 then txt;
3954
3955 case ( txt,
3956 _,
3957 a_baseUnit )
3958 algorithm
3959 879 txt := baseUnitDimensions(txt, a_baseUnit);
3960 then txt;
3961 end match;
3962 end fun_165;
3963
3964 public function unitDimensionsNamed
3965 input Tpl.Text in_txt;
3966 input SimCode.UnitDefinition in_a_unitDefinition;
3967 input String in_a_wanted;
3968
3969 output Tpl.Text out_txt;
3970 algorithm
3971 out_txt :=
3972 match(in_txt, in_a_unitDefinition, in_a_wanted)
3973 local
3974 Tpl.Text txt;
3975 String a_wanted;
3976 SimCode.BaseUnit i_baseUnit;
3977 String i_unitName;
3978 Boolean ret_0;
3979
3980 case ( txt,
3981 SimCode.UNITDEFINITION(name = i_unitName, baseUnit = i_baseUnit),
3982 a_wanted )
3983 algorithm
3984
4/4
✓ Branch 0 taken 3599 times.
✓ Branch 1 taken 29103 times.
✓ Branch 3 taken 2720 times.
✓ Branch 4 taken 879 times.
32702 ret_0 := stringEq(i_unitName, a_wanted);
3985 32702 txt := fun_165(txt, ret_0, i_baseUnit);
3986 then txt;
3987
3988 case ( txt,
3989 _,
3990 _ )
3991 then txt;
3992 end match;
3993 end unitDimensionsNamed;
3994
3995 protected function fun_167
3996 input Tpl.Text in_txt;
3997 input Boolean in_a_relativeQuantity;
3998
3999 output Tpl.Text out_txt;
4000 algorithm
4001 out_txt :=
4002 match(in_txt, in_a_relativeQuantity)
4003 local
4004 Tpl.Text txt;
4005
4006 case ( txt,
4007 true )
4008 algorithm
4009 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" relativeQuantity=\"true\""));
4010 then txt;
4011
4012 case ( txt,
4013 _ )
4014 then txt;
4015 end match;
4016 end fun_167;
4017
4018 public function relativeQuantity
4019 input Tpl.Text in_txt;
4020 input SimCodeVar.SimVar in_a_simvar;
4021
4022 output Tpl.Text out_txt;
4023 algorithm
4024 out_txt :=
4025 match(in_txt, in_a_simvar)
4026 local
4027 Tpl.Text txt;
4028 Boolean i_relativeQuantity;
4029
4030 case ( txt,
4031 SimCodeVar.SIMVAR(relativeQuantity = i_relativeQuantity) )
4032 algorithm
4033 3310 txt := fun_167(txt, i_relativeQuantity);
4034 then txt;
4035
4036 case ( txt,
4037 _ )
4038 then txt;
4039 end match;
4040 end relativeQuantity;
4041
4042 protected function fun_169
4043 input Tpl.Text in_txt;
4044 input Boolean in_mArg;
4045
4046 output Tpl.Text out_txt;
4047 algorithm
4048 out_txt :=
4049 match(in_txt, in_mArg)
4050 local
4051 Tpl.Text txt;
4052
4053 case ( txt,
4054 false )
4055 algorithm
4056 36 txt := Tpl.writeTok(txt, Tpl.ST_STRING("1"));
4057 then txt;
4058
4059 case ( txt,
4060 _ )
4061 algorithm
4062 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("0"));
4063 then txt;
4064 end match;
4065 end fun_169;
4066
4067 protected function fun_170
4068 input Tpl.Text in_txt;
4069 input SimCodeVar.SimVar in_a_var;
4070
4071 output Tpl.Text out_txt;
4072 algorithm
4073 out_txt :=
4074 match(in_txt, in_a_var)
4075 local
4076 Tpl.Text txt;
4077 DAE.ComponentRef i_name;
4078 Boolean ret_1;
4079 Tpl.Text txt_0;
4080
4081 case ( txt,
4082 SimCodeVar.SIMVAR(name = i_name) )
4083 algorithm
4084 36 txt_0 := CodegenUtil.crefStr(Tpl.emptyTxt, i_name);
4085
1/4
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
36 ret_1 := stringEq(Tpl.textString(txt_0), "$dummy");
4086 36 txt := fun_169(txt, ret_1);
4087 then txt;
4088
4089 case ( txt,
4090 _ )
4091 then txt;
4092 end match;
4093 end fun_170;
4094
4095 protected function lm_171
4096 input output Tpl.Text txt;
4097 input list<SimCodeVar.SimVar> items;
4098 algorithm
4099
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 36 times.
72 for lstElt_171 in items loop
4100 txt := match lstElt_171
4101 local
4102 SimCodeVar.SimVar i_var;
4103
4104 case i_var
4105 algorithm
4106 36 txt := fun_170(txt, i_var);
4107 36 txt := Tpl.nextIter(txt);
4108 then txt;
4109 end match;
4110 end for;
4111 end lm_171;
4112
4113 public function statesnumwithDummy
4114 input Tpl.Text txt;
4115 input list<SimCodeVar.SimVar> a_vars;
4116
4117 output Tpl.Text out_txt;
4118 algorithm
4119 36 out_txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4120 36 out_txt := lm_171(out_txt, a_vars);
4121 36 out_txt := Tpl.popIter(out_txt);
4122 end statesnumwithDummy;
4123
4124 public function xsdateTime
4125 input Tpl.Text in_txt;
4126 input Util.DateTime in_a_dt;
4127
4128 output Tpl.Text out_txt;
4129 algorithm
4130 out_txt :=
4131 match(in_txt, in_a_dt)
4132 local
4133 Tpl.Text txt;
4134 Integer i_sec;
4135 Integer i_min;
4136 Integer i_hour;
4137 Integer i_mday;
4138 Integer i_mon;
4139 Integer i_year;
4140 String ret_4;
4141 String ret_3;
4142 String ret_2;
4143 String ret_1;
4144 String ret_0;
4145
4146 case ( txt,
4147 Util.DATETIME(year = i_year, mon = i_mon, mday = i_mday, hour = i_hour, min = i_min, sec = i_sec) )
4148 algorithm
4149 91 txt := Tpl.writeStr(txt, intString(i_year));
4150 91 txt := Tpl.writeTok(txt, Tpl.ST_STRING("-"));
4151 91 ret_0 := SimCodeFunctionUtil.twodigit(i_mon);
4152 91 txt := Tpl.writeStr(txt, ret_0);
4153 91 txt := Tpl.writeTok(txt, Tpl.ST_STRING("-"));
4154 91 ret_1 := SimCodeFunctionUtil.twodigit(i_mday);
4155 91 txt := Tpl.writeStr(txt, ret_1);
4156 91 txt := Tpl.writeTok(txt, Tpl.ST_STRING("T"));
4157 91 ret_2 := SimCodeFunctionUtil.twodigit(i_hour);
4158 91 txt := Tpl.writeStr(txt, ret_2);
4159 91 txt := Tpl.writeTok(txt, Tpl.ST_STRING(":"));
4160 91 ret_3 := SimCodeFunctionUtil.twodigit(i_min);
4161 91 txt := Tpl.writeStr(txt, ret_3);
4162 91 txt := Tpl.writeTok(txt, Tpl.ST_STRING(":"));
4163 91 ret_4 := SimCodeFunctionUtil.twodigit(i_sec);
4164 91 txt := Tpl.writeStr(txt, ret_4);
4165 91 txt := Tpl.writeTok(txt, Tpl.ST_STRING("Z"));
4166 then txt;
4167
4168 case ( txt,
4169 _ )
4170 then txt;
4171 end match;
4172 end xsdateTime;
4173
4174 protected function fun_174
4175 input Tpl.Text in_txt;
4176 input SimCode.ModelInfo in_a_modelInfo;
4177
4178 output Tpl.Text out_txt;
4179 algorithm
4180 out_txt :=
4181 match(in_txt, in_a_modelInfo)
4182 local
4183 Tpl.Text txt;
4184 list<SimCode.UnitDefinition> i_unitDefinitions;
4185
4186 case ( txt,
4187 SimCode.MODELINFO(unitDefinitions = i_unitDefinitions) )
4188 algorithm
4189 88 txt := UnitDefinitionsHelper(txt, i_unitDefinitions);
4190 then txt;
4191
4192 case ( txt,
4193 _ )
4194 then txt;
4195 end match;
4196 end fun_174;
4197
4198 public function UnitDefinitions
4199 input Tpl.Text in_txt;
4200 input SimCode.SimCode in_a_simCode;
4201
4202 output Tpl.Text out_txt;
4203 algorithm
4204 out_txt :=
4205 match(in_txt, in_a_simCode)
4206 local
4207 Tpl.Text txt;
4208 SimCode.ModelInfo i_modelInfo;
4209
4210 case ( txt,
4211 SimCode.SIMCODE(modelInfo = i_modelInfo) )
4212 algorithm
4213 88 txt := fun_174(txt, i_modelInfo);
4214 then txt;
4215
4216 case ( txt,
4217 _ )
4218 then txt;
4219 end match;
4220 end UnitDefinitions;
4221
4222 protected function lm_176
4223 input output Tpl.Text txt;
4224 input list<SimCode.UnitDefinition> items;
4225 input list<SimCode.UnitDefinition> a_unitDefinitions;
4226 algorithm
4227
2/2
✓ Branch 0 taken 215 times.
✓ Branch 1 taken 19 times.
234 for lstElt_176 in items loop
4228 txt := match lstElt_176
4229 local
4230 SimCode.UnitDefinition i_unitDefinition;
4231
4232 case i_unitDefinition
4233 algorithm
4234 215 txt := UnitDefinitionsHelper1(txt, i_unitDefinition, a_unitDefinitions);
4235 215 txt := Tpl.nextIter(txt);
4236 then txt;
4237 end match;
4238 end for;
4239 end lm_176;
4240
4241 public function UnitDefinitionsHelper
4242 input Tpl.Text in_txt;
4243 input list<SimCode.UnitDefinition> in_a_unitDefinitions;
4244
4245 output Tpl.Text out_txt;
4246 algorithm
4247 out_txt :=
4248 match(in_txt, in_a_unitDefinitions)
4249 local
4250 Tpl.Text txt;
4251 list<SimCode.UnitDefinition> i_unitDefinitions;
4252
4253 case ( txt,
4254 {} )
4255 then txt;
4256
4257 case ( txt,
4258 i_unitDefinitions )
4259 algorithm
4260 19 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<UnitDefinitions>\n"));
4261 19 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
4262 19 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4263 19 txt := lm_176(txt, i_unitDefinitions, i_unitDefinitions);
4264 19 txt := Tpl.popIter(txt);
4265 19 txt := Tpl.softNewLine(txt);
4266 19 txt := Tpl.popBlock(txt);
4267 19 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</UnitDefinitions>"));
4268 then txt;
4269 end match;
4270 end UnitDefinitionsHelper;
4271
4272 public function UnitDefinitionsHelper1
4273 input Tpl.Text in_txt;
4274 input SimCode.UnitDefinition in_a_unitDefinition;
4275 input list<SimCode.UnitDefinition> in_a_allUnits;
4276
4277 output Tpl.Text out_txt;
4278 algorithm
4279 out_txt :=
4280 match(in_txt, in_a_unitDefinition, in_a_allUnits)
4281 local
4282 Tpl.Text txt;
4283 list<SimCode.UnitDefinition> a_allUnits;
4284 SimCode.BaseUnit i_baseUnit;
4285 String i_name;
4286
4287 case ( txt,
4288 SimCode.UNITDEFINITION(name = i_name, baseUnit = i_baseUnit),
4289 a_allUnits )
4290 algorithm
4291 215 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Unit "));
4292 215 txt := unitDefinitionAttribute(txt, i_name);
4293 215 txt := Tpl.writeTok(txt, Tpl.ST_LINE(">\n"));
4294 215 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
4295 215 txt := baseUnitAttributes(txt, i_baseUnit);
4296 215 txt := displayUnits(txt, i_name, i_baseUnit, a_allUnits);
4297 215 txt := Tpl.softNewLine(txt);
4298 215 txt := Tpl.popBlock(txt);
4299 215 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</Unit>"));
4300 then txt;
4301
4302 case ( txt,
4303 _,
4304 _ )
4305 then txt;
4306 end match;
4307 end UnitDefinitionsHelper1;
4308
4309 protected function lm_179
4310 input output Tpl.Text txt;
4311 input list<SimCode.UnitDefinition> items;
4312 input Real a_unitOffset;
4313 input Real a_unitFactor;
4314 input Tpl.Text a_dims;
4315 input String a_unitName;
4316 algorithm
4317
2/2
✓ Branch 0 taken 3313 times.
✓ Branch 1 taken 215 times.
3528 for lstElt_179 in items loop
4318 txt := match lstElt_179
4319 local
4320 SimCode.UnitDefinition i_other;
4321
4322 case i_other
4323 algorithm
4324 3313 txt := displayUnit(txt, a_unitName, Tpl.textString(a_dims), a_unitFactor, a_unitOffset, i_other);
4325 then txt;
4326 end match;
4327 end for;
4328 end lm_179;
4329
4330 protected function fun_180
4331 input Tpl.Text in_txt;
4332 input SimCode.BaseUnit in_a_baseUnit;
4333 input String in_a_unitName;
4334 input list<SimCode.UnitDefinition> in_a_allUnits;
4335
4336 output Tpl.Text out_txt;
4337 algorithm
4338 out_txt :=
4339 match(in_txt, in_a_baseUnit, in_a_unitName, in_a_allUnits)
4340 local
4341 Tpl.Text txt;
4342 String a_unitName;
4343 list<SimCode.UnitDefinition> a_allUnits;
4344 Real i_unitOffset;
4345 Real i_unitFactor;
4346 SimCode.BaseUnit i_baseUnit;
4347 Tpl.Text l_dims;
4348
4349 case ( txt,
4350 (i_baseUnit as SimCode.BASEUNIT(factor = i_unitFactor, offset = i_unitOffset)),
4351 a_unitName,
4352 a_allUnits )
4353 algorithm
4354 215 l_dims := baseUnitDimensions(Tpl.emptyTxt, i_baseUnit);
4355 215 txt := lm_179(txt, a_allUnits, i_unitOffset, i_unitFactor, l_dims, a_unitName);
4356 then txt;
4357
4358 case ( txt,
4359 _,
4360 _,
4361 _ )
4362 then txt;
4363 end match;
4364 end fun_180;
4365
4366 public function displayUnits
4367 input Tpl.Text txt;
4368 input String a_unitName;
4369 input SimCode.BaseUnit a_baseUnit;
4370 input list<SimCode.UnitDefinition> a_allUnits;
4371
4372 output Tpl.Text out_txt;
4373 algorithm
4374 215 out_txt := fun_180(txt, a_baseUnit, a_unitName, a_allUnits);
4375 end displayUnits;
4376
4377 protected function fun_182
4378 input Tpl.Text in_txt;
4379 input Boolean in_mArg;
4380 input Real in_a_displayOffset;
4381 input Real in_a_unitOffset;
4382 input Real in_a_displayFactor;
4383 input Real in_a_unitFactor;
4384 input String in_a_otherName;
4385
4386 output Tpl.Text out_txt;
4387 algorithm
4388 out_txt :=
4389 match(in_txt, in_mArg, in_a_displayOffset, in_a_unitOffset, in_a_displayFactor, in_a_unitFactor, in_a_otherName)
4390 local
4391 Tpl.Text txt;
4392 Real a_displayOffset;
4393 Real a_unitOffset;
4394 Real a_displayFactor;
4395 Real a_unitFactor;
4396 String a_otherName;
4397 Real ret_3;
4398 Real ret_2;
4399 Real ret_1;
4400 String ret_0;
4401
4402 case ( txt,
4403 false,
4404 _,
4405 _,
4406 _,
4407 _,
4408 _ )
4409 then txt;
4410
4411 case ( txt,
4412 _,
4413 a_displayOffset,
4414 a_unitOffset,
4415 a_displayFactor,
4416 a_unitFactor,
4417 a_otherName )
4418 algorithm
4419 120 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
4420 120 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<DisplayUnit name=\""));
4421 120 ret_0 := Util.escapeModelicaStringToXmlString(a_otherName);
4422 120 txt := Tpl.writeStr(txt, ret_0);
4423 120 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" factor=\""));
4424
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 ret_1 := realDiv(a_unitFactor, a_displayFactor);
4425 120 txt := Tpl.writeStr(txt, realString(ret_1));
4426 120 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" offset=\""));
4427 120 ret_2 := realSub(a_unitOffset, a_displayOffset);
4428 120 ret_3 := realDiv(ret_2, a_displayFactor);
4429 120 txt := Tpl.writeStr(txt, realString(ret_3));
4430 120 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"/>"));
4431 then txt;
4432 end match;
4433 end fun_182;
4434
4435 protected function fun_183
4436 input Tpl.Text in_txt;
4437 input SimCode.UnitDefinition in_a_other;
4438 input String in_a_unitName;
4439 input String in_a_dims;
4440 input Real in_a_unitFactor;
4441 input Real in_a_unitOffset;
4442
4443 output Tpl.Text out_txt;
4444 algorithm
4445 out_txt :=
4446 match(in_txt, in_a_other, in_a_unitName, in_a_dims, in_a_unitFactor, in_a_unitOffset)
4447 local
4448 Tpl.Text txt;
4449 String a_unitName;
4450 String a_dims;
4451 Real a_unitFactor;
4452 Real a_unitOffset;
4453 Real i_displayOffset;
4454 Real i_displayFactor;
4455 String i_otherName;
4456 SimCode.BaseUnit i_otherBase;
4457 Boolean ret_4;
4458 Boolean ret_3;
4459 Boolean ret_2;
4460 Boolean ret_1;
4461 Tpl.Text txt_0;
4462
4463 case ( txt,
4464 SimCode.UNITDEFINITION(name = i_otherName, baseUnit = (i_otherBase as SimCode.BASEUNIT(factor = i_displayFactor, offset = i_displayOffset))),
4465 a_unitName,
4466 a_dims,
4467 a_unitFactor,
4468 a_unitOffset )
4469 algorithm
4470 3313 txt_0 := baseUnitDimensions(Tpl.emptyTxt, i_otherBase);
4471
4/4
✓ Branch 1 taken 1737 times.
✓ Branch 2 taken 1576 times.
✓ Branch 5 taken 1402 times.
✓ Branch 6 taken 335 times.
3313 ret_1 := stringEq(a_dims, Tpl.textString(txt_0));
4472
4/4
✓ Branch 0 taken 739 times.
✓ Branch 1 taken 2574 times.
✓ Branch 3 taken 524 times.
✓ Branch 4 taken 215 times.
3313 ret_2 := stringEq(a_unitName, i_otherName);
4473 3313 ret_3 := boolNot(ret_2);
4474 3313 ret_4 := boolAnd(ret_1, ret_3);
4475 3313 txt := fun_182(txt, ret_4, i_displayOffset, a_unitOffset, i_displayFactor, a_unitFactor, i_otherName);
4476 then txt;
4477
4478 case ( txt,
4479 _,
4480 _,
4481 _,
4482 _,
4483 _ )
4484 then txt;
4485 end match;
4486 end fun_183;
4487
4488 public function displayUnit
4489 input Tpl.Text txt;
4490 input String a_unitName;
4491 input String a_dims;
4492 input Real a_unitFactor;
4493 input Real a_unitOffset;
4494 input SimCode.UnitDefinition a_other;
4495
4496 output Tpl.Text out_txt;
4497 algorithm
4498 3313 out_txt := fun_183(txt, a_other, a_unitName, a_dims, a_unitFactor, a_unitOffset);
4499 end displayUnit;
4500
4501 public function baseUnitDimensions
4502 input Tpl.Text in_txt;
4503 input SimCode.BaseUnit in_a_baseUnit;
4504
4505 output Tpl.Text out_txt;
4506 algorithm
4507 out_txt :=
4508 match(in_txt, in_a_baseUnit)
4509 local
4510 Tpl.Text txt;
4511 Integer i_cd;
4512 Integer i_mol;
4513 Integer i_K;
4514 Integer i_A;
4515 Integer i_kg;
4516 Integer i_m;
4517 Integer i_s;
4518
4519 case ( txt,
4520 SimCode.BASEUNIT(s = i_s, m = i_m, kg = i_kg, A = i_A, K = i_K, mol = i_mol, cd = i_cd) )
4521 algorithm
4522 4407 txt := Tpl.writeStr(txt, intString(i_s));
4523 4407 txt := Tpl.writeTok(txt, Tpl.ST_STRING("."));
4524 4407 txt := Tpl.writeStr(txt, intString(i_m));
4525 4407 txt := Tpl.writeTok(txt, Tpl.ST_STRING("."));
4526 4407 txt := Tpl.writeStr(txt, intString(i_kg));
4527 4407 txt := Tpl.writeTok(txt, Tpl.ST_STRING("."));
4528 4407 txt := Tpl.writeStr(txt, intString(i_A));
4529 4407 txt := Tpl.writeTok(txt, Tpl.ST_STRING("."));
4530 4407 txt := Tpl.writeStr(txt, intString(i_K));
4531 4407 txt := Tpl.writeTok(txt, Tpl.ST_STRING("."));
4532 4407 txt := Tpl.writeStr(txt, intString(i_mol));
4533 4407 txt := Tpl.writeTok(txt, Tpl.ST_STRING("."));
4534 4407 txt := Tpl.writeStr(txt, intString(i_cd));
4535 then txt;
4536
4537 case ( txt,
4538 _ )
4539 then txt;
4540 end match;
4541 end baseUnitDimensions;
4542
4543 protected function fun_186
4544 input Tpl.Text in_txt;
4545 input String in_a_unitName;
4546
4547 output Tpl.Text out_txt;
4548 algorithm
4549 out_txt :=
4550 match(in_txt, in_a_unitName)
4551 local
4552 Tpl.Text txt;
4553 String i_unitName;
4554
4555 case ( txt,
4556 "" )
4557 then txt;
4558
4559 case ( txt,
4560 i_unitName )
4561 algorithm
4562 215 txt := Tpl.writeTok(txt, Tpl.ST_STRING("name=\""));
4563 215 txt := Tpl.writeStr(txt, i_unitName);
4564 215 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
4565 then txt;
4566 end match;
4567 end fun_186;
4568
4569 public function unitDefinitionAttribute
4570 input Tpl.Text txt;
4571 input String a_unitName;
4572
4573 output Tpl.Text out_txt;
4574 protected
4575 Tpl.Text l_unitString;
4576 algorithm
4577 215 l_unitString := fun_186(Tpl.emptyTxt, a_unitName);
4578 215 out_txt := Tpl.writeText(txt, l_unitString);
4579 end unitDefinitionAttribute;
4580
4581 protected function fun_188
4582 input Tpl.Text in_txt;
4583 input Boolean in_mArg;
4584 input Integer in_a_s;
4585
4586 output Tpl.Text out_txt;
4587 algorithm
4588 out_txt :=
4589 match(in_txt, in_mArg, in_a_s)
4590 local
4591 Tpl.Text txt;
4592 Integer a_s;
4593
4594 case ( txt,
4595 false,
4596 a_s )
4597 algorithm
4598 145 txt := Tpl.writeTok(txt, Tpl.ST_STRING("s=\""));
4599 145 txt := Tpl.writeStr(txt, intString(a_s));
4600 145 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" "));
4601 then txt;
4602
4603 case ( txt,
4604 _,
4605 _ )
4606 then txt;
4607 end match;
4608 end fun_188;
4609
4610 protected function fun_189
4611 input Tpl.Text in_txt;
4612 input Boolean in_mArg;
4613 input Integer in_a_m;
4614
4615 output Tpl.Text out_txt;
4616 algorithm
4617 out_txt :=
4618 match(in_txt, in_mArg, in_a_m)
4619 local
4620 Tpl.Text txt;
4621 Integer a_m;
4622
4623 case ( txt,
4624 false,
4625 a_m )
4626 algorithm
4627 118 txt := Tpl.writeTok(txt, Tpl.ST_STRING("m=\""));
4628 118 txt := Tpl.writeStr(txt, intString(a_m));
4629 118 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" "));
4630 then txt;
4631
4632 case ( txt,
4633 _,
4634 _ )
4635 then txt;
4636 end match;
4637 end fun_189;
4638
4639 protected function fun_190
4640 input Tpl.Text in_txt;
4641 input Boolean in_mArg;
4642 input Integer in_a_kg;
4643
4644 output Tpl.Text out_txt;
4645 algorithm
4646 out_txt :=
4647 match(in_txt, in_mArg, in_a_kg)
4648 local
4649 Tpl.Text txt;
4650 Integer a_kg;
4651
4652 case ( txt,
4653 false,
4654 a_kg )
4655 algorithm
4656 95 txt := Tpl.writeTok(txt, Tpl.ST_STRING("kg=\""));
4657 95 txt := Tpl.writeStr(txt, intString(a_kg));
4658 95 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" "));
4659 then txt;
4660
4661 case ( txt,
4662 _,
4663 _ )
4664 then txt;
4665 end match;
4666 end fun_190;
4667
4668 protected function fun_191
4669 input Tpl.Text in_txt;
4670 input Boolean in_mArg;
4671 input Integer in_a_A;
4672
4673 output Tpl.Text out_txt;
4674 algorithm
4675 out_txt :=
4676 match(in_txt, in_mArg, in_a_A)
4677 local
4678 Tpl.Text txt;
4679 Integer a_A;
4680
4681 case ( txt,
4682 false,
4683 a_A )
4684 algorithm
4685 13 txt := Tpl.writeTok(txt, Tpl.ST_STRING("A=\""));
4686 13 txt := Tpl.writeStr(txt, intString(a_A));
4687 13 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" "));
4688 then txt;
4689
4690 case ( txt,
4691 _,
4692 _ )
4693 then txt;
4694 end match;
4695 end fun_191;
4696
4697 protected function fun_192
4698 input Tpl.Text in_txt;
4699 input Boolean in_mArg;
4700 input Integer in_a_K;
4701
4702 output Tpl.Text out_txt;
4703 algorithm
4704 out_txt :=
4705 match(in_txt, in_mArg, in_a_K)
4706 local
4707 Tpl.Text txt;
4708 Integer a_K;
4709
4710 case ( txt,
4711 false,
4712 a_K )
4713 algorithm
4714 15 txt := Tpl.writeTok(txt, Tpl.ST_STRING("K=\""));
4715 15 txt := Tpl.writeStr(txt, intString(a_K));
4716 15 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" "));
4717 then txt;
4718
4719 case ( txt,
4720 _,
4721 _ )
4722 then txt;
4723 end match;
4724 end fun_192;
4725
4726 protected function fun_193
4727 input Tpl.Text in_txt;
4728 input Boolean in_mArg;
4729 input Integer in_a_mol;
4730
4731 output Tpl.Text out_txt;
4732 algorithm
4733 out_txt :=
4734 match(in_txt, in_mArg, in_a_mol)
4735 local
4736 Tpl.Text txt;
4737 Integer a_mol;
4738
4739 case ( txt,
4740 false,
4741 a_mol )
4742 algorithm
4743 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("mol=\""));
4744 1 txt := Tpl.writeStr(txt, intString(a_mol));
4745 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" "));
4746 then txt;
4747
4748 case ( txt,
4749 _,
4750 _ )
4751 then txt;
4752 end match;
4753 end fun_193;
4754
4755 protected function fun_194
4756 input Tpl.Text in_txt;
4757 input Boolean in_mArg;
4758 input Integer in_a_cd;
4759
4760 output Tpl.Text out_txt;
4761 algorithm
4762 out_txt :=
4763 match(in_txt, in_mArg, in_a_cd)
4764 local
4765 Tpl.Text txt;
4766 Integer a_cd;
4767
4768 case ( txt,
4769 false,
4770 a_cd )
4771 algorithm
4772 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("cd=\""));
4773 ✗ txt := Tpl.writeStr(txt, intString(a_cd));
4774 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" "));
4775 then txt;
4776
4777 case ( txt,
4778 _,
4779 _ )
4780 then txt;
4781 end match;
4782 end fun_194;
4783
4784 protected function fun_195
4785 input Tpl.Text in_txt;
4786 input Boolean in_mArg;
4787 input Real in_a_factor;
4788
4789 output Tpl.Text out_txt;
4790 algorithm
4791 out_txt :=
4792 match(in_txt, in_mArg, in_a_factor)
4793 local
4794 Tpl.Text txt;
4795 Real a_factor;
4796
4797 case ( txt,
4798 false,
4799 a_factor )
4800 algorithm
4801 18 txt := Tpl.writeTok(txt, Tpl.ST_STRING("factor=\""));
4802 18 txt := Tpl.writeStr(txt, realString(a_factor));
4803 18 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" "));
4804 then txt;
4805
4806 case ( txt,
4807 _,
4808 _ )
4809 then txt;
4810 end match;
4811 end fun_195;
4812
4813 protected function fun_196
4814 input Tpl.Text in_txt;
4815 input Boolean in_mArg;
4816 input Real in_a_offset;
4817
4818 output Tpl.Text out_txt;
4819 algorithm
4820 out_txt :=
4821 match(in_txt, in_mArg, in_a_offset)
4822 local
4823 Tpl.Text txt;
4824 Real a_offset;
4825
4826 case ( txt,
4827 false,
4828 a_offset )
4829 algorithm
4830 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("offset=\""));
4831 4 txt := Tpl.writeStr(txt, realString(a_offset));
4832 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" "));
4833 then txt;
4834
4835 case ( txt,
4836 _,
4837 _ )
4838 then txt;
4839 end match;
4840 end fun_196;
4841
4842 public function baseUnitAttributes
4843 input Tpl.Text in_txt;
4844 input SimCode.BaseUnit in_a_baseUnit;
4845
4846 output Tpl.Text out_txt;
4847 algorithm
4848 out_txt :=
4849 match(in_txt, in_a_baseUnit)
4850 local
4851 Tpl.Text txt;
4852 Real i_offset;
4853 Real i_factor;
4854 Integer i_cd;
4855 Integer i_mol;
4856 Integer i_K;
4857 Integer i_A;
4858 Integer i_kg;
4859 Integer i_m;
4860 Integer i_s;
4861 Boolean ret_17;
4862 Tpl.Text l_offset__Value;
4863 Boolean ret_15;
4864 Tpl.Text l_factor__Value;
4865 Boolean ret_13;
4866 Tpl.Text l_cd__Value;
4867 Boolean ret_11;
4868 Tpl.Text l_mol__Value;
4869 Boolean ret_9;
4870 Tpl.Text l_K__Value;
4871 Boolean ret_7;
4872 Tpl.Text l_A__Value;
4873 Boolean ret_5;
4874 Tpl.Text l_kg__Value;
4875 Boolean ret_3;
4876 Tpl.Text l_m__Value;
4877 Boolean ret_1;
4878 Tpl.Text l_s__Value;
4879
4880 case ( txt,
4881 SimCode.BASEUNIT(s = i_s, m = i_m, kg = i_kg, A = i_A, K = i_K, mol = i_mol, cd = i_cd, factor = i_factor, offset = i_offset) )
4882 algorithm
4883 215 ret_1 := intEq(i_s, 0);
4884 215 l_s__Value := fun_188(Tpl.emptyTxt, ret_1, i_s);
4885 215 ret_3 := intEq(i_m, 0);
4886 215 l_m__Value := fun_189(Tpl.emptyTxt, ret_3, i_m);
4887 215 ret_5 := intEq(i_kg, 0);
4888 215 l_kg__Value := fun_190(Tpl.emptyTxt, ret_5, i_kg);
4889 215 ret_7 := intEq(i_A, 0);
4890 215 l_A__Value := fun_191(Tpl.emptyTxt, ret_7, i_A);
4891 215 ret_9 := intEq(i_K, 0);
4892 215 l_K__Value := fun_192(Tpl.emptyTxt, ret_9, i_K);
4893 215 ret_11 := intEq(i_mol, 0);
4894 215 l_mol__Value := fun_193(Tpl.emptyTxt, ret_11, i_mol);
4895 215 ret_13 := intEq(i_cd, 0);
4896 215 l_cd__Value := fun_194(Tpl.emptyTxt, ret_13, i_cd);
4897 215 ret_15 := realAlmostEq(i_factor, 1.0, 1e-6);
4898 215 l_factor__Value := fun_195(Tpl.emptyTxt, ret_15, i_factor);
4899 215 ret_17 := realAlmostEq(i_offset, 0.0, 1e-6);
4900 215 l_offset__Value := fun_196(Tpl.emptyTxt, ret_17, i_offset);
4901 215 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<BaseUnit "));
4902 215 txt := Tpl.writeText(txt, l_mol__Value);
4903 215 txt := Tpl.writeText(txt, l_cd__Value);
4904 215 txt := Tpl.writeText(txt, l_m__Value);
4905 215 txt := Tpl.writeText(txt, l_s__Value);
4906 215 txt := Tpl.writeText(txt, l_A__Value);
4907 215 txt := Tpl.writeText(txt, l_K__Value);
4908 215 txt := Tpl.writeText(txt, l_kg__Value);
4909 215 txt := Tpl.writeText(txt, l_factor__Value);
4910 215 txt := Tpl.writeText(txt, l_offset__Value);
4911 215 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
4912 then txt;
4913
4914 case ( txt,
4915 SimCode.NOBASEUNIT() )
4916 then txt;
4917
4918 case ( txt,
4919 _ )
4920 then txt;
4921 end match;
4922 end baseUnitAttributes;
4923
4924 protected function fun_198
4925 input Tpl.Text in_txt;
4926 input SimCode.ModelInfo in_a_modelInfo;
4927 input String in_a_FMUVersion;
4928 input SimCode.SimCode in_a_simCode;
4929
4930 output Tpl.Text out_txt;
4931 algorithm
4932 out_txt :=
4933 match(in_txt, in_a_modelInfo, in_a_FMUVersion, in_a_simCode)
4934 local
4935 Tpl.Text txt;
4936 String a_FMUVersion;
4937 SimCode.SimCode a_simCode;
4938 SimCodeVar.SimVars i_vars;
4939 list<SimCodeVar.SimVar> ret_0;
4940
4941 case ( txt,
4942 SimCode.MODELINFO(vars = (i_vars as SimCodeVar.SIMVARS(stateVars = _))),
4943 a_FMUVersion,
4944 a_simCode )
4945 algorithm
4946 75 ret_0 := SimCodeCodegenUtil.getEnumerationTypes(i_vars);
4947 75 txt := TypeDefinitionsHelper(txt, a_simCode, ret_0, a_FMUVersion);
4948 then txt;
4949
4950 case ( txt,
4951 _,
4952 _,
4953 _ )
4954 then txt;
4955 end match;
4956 end fun_198;
4957
4958 public function fmiTypeDefinitions
4959 input Tpl.Text in_txt;
4960 input SimCode.SimCode in_a_simCode;
4961 input String in_a_FMUVersion;
4962
4963 output Tpl.Text out_txt;
4964 algorithm
4965 out_txt :=
4966 match(in_txt, in_a_simCode, in_a_FMUVersion)
4967 local
4968 Tpl.Text txt;
4969 String a_FMUVersion;
4970 SimCode.SimCode i_simCode;
4971 SimCode.ModelInfo i_modelInfo;
4972
4973 case ( txt,
4974 (i_simCode as SimCode.SIMCODE(modelInfo = i_modelInfo)),
4975 a_FMUVersion )
4976 algorithm
4977 75 txt := fun_198(txt, i_modelInfo, a_FMUVersion, i_simCode);
4978 then txt;
4979
4980 case ( txt,
4981 _,
4982 _ )
4983 then txt;
4984 end match;
4985 end fmiTypeDefinitions;
4986
4987 protected function fun_200
4988 input Tpl.Text in_txt;
4989 input Boolean in_mArg;
4990 input SimCode.SimCode in_a_simCode;
4991
4992 output Tpl.Text out_txt;
4993 algorithm
4994 out_txt :=
4995 match(in_txt, in_mArg, in_a_simCode)
4996 local
4997 Tpl.Text txt;
4998 SimCode.SimCode a_simCode;
4999
5000 case ( txt,
5001 false,
5002 _ )
5003 then txt;
5004
5005 case ( txt,
5006 _,
5007 a_simCode )
5008 algorithm
5009 5 txt := TypeDefinitionsClocks(txt, a_simCode);
5010 then txt;
5011 end match;
5012 end fun_200;
5013
5014 protected function fun_201
5015 input Tpl.Text in_txt;
5016 input Boolean in_mArg;
5017 input SimCode.SimCode in_a_simCode;
5018
5019 output Tpl.Text out_txt;
5020 algorithm
5021 out_txt :=
5022 match(in_txt, in_mArg, in_a_simCode)
5023 local
5024 Tpl.Text txt;
5025 SimCode.SimCode a_simCode;
5026 Boolean ret_0;
5027
5028 case ( txt,
5029 false,
5030 a_simCode )
5031 algorithm
5032 72 ret_0 := Flags.getConfigBool(Flags.EXPORT_CLOCKS_IN_MODELDESCRIPTION);
5033 72 txt := fun_200(txt, ret_0, a_simCode);
5034 then txt;
5035
5036 case ( txt,
5037 _,
5038 _ )
5039 then txt;
5040 end match;
5041 end fun_201;
5042
5043 protected function lm_202
5044 input output Tpl.Text txt;
5045 input list<SimCodeVar.SimVar> items;
5046 input String a_FMUVersion;
5047 algorithm
5048
2/2
✓ Branch 0 taken 23 times.
✓ Branch 1 taken 18 times.
41 for lstElt_202 in items loop
5049 txt := match lstElt_202
5050 local
5051 SimCodeVar.SimVar i_var;
5052
5053 case i_var
5054 algorithm
5055 23 txt := TypeDefinition(txt, i_var, a_FMUVersion);
5056 23 txt := Tpl.nextIter(txt);
5057 then txt;
5058 end match;
5059 end for;
5060 end lm_202;
5061
5062 protected function fun_203
5063 input Tpl.Text in_txt;
5064 input Boolean in_mArg;
5065 input Tpl.Text in_a_clocks;
5066 input String in_a_FMUVersion;
5067 input list<SimCodeVar.SimVar> in_a_vars;
5068
5069 output Tpl.Text out_txt;
5070 algorithm
5071 out_txt :=
5072 match(in_txt, in_mArg, in_a_clocks, in_a_FMUVersion, in_a_vars)
5073 local
5074 Tpl.Text txt;
5075 Tpl.Text a_clocks;
5076 String a_FMUVersion;
5077 list<SimCodeVar.SimVar> a_vars;
5078
5079 case ( txt,
5080 false,
5081 _,
5082 _,
5083 _ )
5084 then txt;
5085
5086 case ( txt,
5087 _,
5088 a_clocks,
5089 a_FMUVersion,
5090 a_vars )
5091 algorithm
5092 18 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<TypeDefinitions>\n"));
5093 18 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
5094 18 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
5095 18 txt := lm_202(txt, a_vars, a_FMUVersion);
5096 18 txt := Tpl.popIter(txt);
5097 18 txt := Tpl.softNewLine(txt);
5098 18 txt := Tpl.writeText(txt, a_clocks);
5099 18 txt := Tpl.softNewLine(txt);
5100 18 txt := Tpl.popBlock(txt);
5101 18 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</TypeDefinitions>"));
5102 then txt;
5103 end match;
5104 end fun_203;
5105
5106 public function TypeDefinitionsHelper
5107 input Tpl.Text txt;
5108 input SimCode.SimCode a_simCode;
5109 input list<SimCodeVar.SimVar> a_vars;
5110 input String a_FMUVersion;
5111
5112 output Tpl.Text out_txt;
5113 protected
5114 Boolean ret_6;
5115 Boolean ret_5;
5116 Boolean ret_4;
5117 Boolean ret_3;
5118 Integer ret_2;
5119 Boolean ret_1;
5120 Tpl.Text l_clocks;
5121 algorithm
5122 75 ret_1 := FMI.isFMIVersion10(a_FMUVersion);
5123 75 l_clocks := fun_201(Tpl.emptyTxt, ret_1, a_simCode);
5124 75 ret_2 := listLength(a_vars);
5125 75 ret_3 := intGt(ret_2, 0);
5126
3/4
✓ Branch 1 taken 70 times.
✓ Branch 2 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 70 times.
75 ret_4 := stringEq(Tpl.textString(l_clocks), "");
5127 75 ret_5 := boolNot(ret_4);
5128 75 ret_6 := boolOr(ret_3, ret_5);
5129 75 out_txt := fun_203(txt, ret_6, l_clocks, a_FMUVersion, a_vars);
5130 end TypeDefinitionsHelper;
5131
5132 public function TypeDefinition
5133 input Tpl.Text in_txt;
5134 input SimCodeVar.SimVar in_a_simVar;
5135 input String in_a_FMUVersion;
5136
5137 output Tpl.Text out_txt;
5138 algorithm
5139 out_txt :=
5140 match(in_txt, in_a_simVar, in_a_FMUVersion)
5141 local
5142 Tpl.Text txt;
5143 String a_FMUVersion;
5144 DAE.Type i_type__;
5145
5146 case ( txt,
5147 SimCodeVar.SIMVAR(type_ = i_type__),
5148 a_FMUVersion )
5149 algorithm
5150 23 txt := TypeDefinitionType(txt, i_type__, a_FMUVersion);
5151 then txt;
5152
5153 case ( txt,
5154 _,
5155 _ )
5156 then txt;
5157 end match;
5158 end TypeDefinition;
5159
5160 protected function lm_206
5161 input output Tpl.Text txt;
5162 input list<String> items;
5163 algorithm
5164 ✗ for lstElt_206 in items loop
5165 txt := match lstElt_206
5166 local
5167 String i_name;
5168
5169 case i_name
5170 algorithm
5171 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Item name=\""));
5172 ✗ txt := Tpl.writeStr(txt, i_name);
5173 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"/>"));
5174 ✗ txt := Tpl.nextIter(txt);
5175 then txt;
5176 end match;
5177 end for;
5178 end lm_206;
5179
5180 protected function lm_207
5181 input output Tpl.Text txt;
5182 input list<String> items;
5183 algorithm
5184
2/2
✓ Branch 0 taken 99 times.
✓ Branch 1 taken 23 times.
122 for lstElt_207 in items loop
5185 txt := match lstElt_207
5186 local
5187 Integer x_i0;
5188 String i_name;
5189
5190 case i_name
5191 algorithm
5192 99 x_i0 := Tpl.getIteri_i0(txt);
5193 99 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Item name=\""));
5194 99 txt := Tpl.writeStr(txt, i_name);
5195 99 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" value=\""));
5196 99 txt := Tpl.writeStr(txt, intString(x_i0));
5197 99 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"/>"));
5198 99 txt := Tpl.nextIter(txt);
5199 then txt;
5200 end match;
5201 end for;
5202 end lm_207;
5203
5204 protected function fun_208
5205 input Tpl.Text in_txt;
5206 input Boolean in_mArg;
5207 input list<String> in_a_names;
5208 input Absyn.Path in_a_path;
5209
5210 output Tpl.Text out_txt;
5211 algorithm
5212 out_txt :=
5213 match(in_txt, in_mArg, in_a_names, in_a_path)
5214 local
5215 Tpl.Text txt;
5216 list<String> a_names;
5217 Absyn.Path a_path;
5218 String ret_1;
5219 String ret_0;
5220
5221 case ( txt,
5222 false,
5223 a_names,
5224 a_path )
5225 algorithm
5226 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Type name=\""));
5227 ✗ ret_0 := AbsynUtil.pathString(a_path, ".", false, false);
5228 ✗ txt := Tpl.writeStr(txt, ret_0);
5229 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5230 "\">\n",
5231 " <EnumerationType>\n"
5232 }, true));
5233 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
5234 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
5235 ✗ txt := lm_206(txt, a_names);
5236 ✗ txt := Tpl.popIter(txt);
5237 ✗ txt := Tpl.softNewLine(txt);
5238 ✗ txt := Tpl.popBlock(txt);
5239 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5240 " </EnumerationType>\n",
5241 "</Type>"
5242 }, false));
5243 then txt;
5244
5245 case ( txt,
5246 _,
5247 a_names,
5248 a_path )
5249 algorithm
5250 23 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<SimpleType name=\""));
5251 23 ret_1 := AbsynUtil.pathString(a_path, ".", false, false);
5252 23 txt := Tpl.writeStr(txt, ret_1);
5253 23 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5254 "\">\n",
5255 " <Enumeration>\n"
5256 }, true));
5257 23 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
5258 23 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(1, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
5259 23 txt := lm_207(txt, a_names);
5260 23 txt := Tpl.popIter(txt);
5261 23 txt := Tpl.softNewLine(txt);
5262 23 txt := Tpl.popBlock(txt);
5263 23 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5264 " </Enumeration>\n",
5265 "</SimpleType>"
5266 }, false));
5267 then txt;
5268 end match;
5269 end fun_208;
5270
5271 public function TypeDefinitionType
5272 input Tpl.Text in_txt;
5273 input DAE.Type in_a_type__;
5274 input String in_a_FMUVersion;
5275
5276 output Tpl.Text out_txt;
5277 algorithm
5278 out_txt :=
5279 match(in_txt, in_a_type__, in_a_FMUVersion)
5280 local
5281 Tpl.Text txt;
5282 String a_FMUVersion;
5283 list<String> i_names;
5284 Absyn.Path i_path;
5285 Boolean ret_0;
5286
5287 case ( txt,
5288 DAE.T_ENUMERATION(path = i_path, names = i_names),
5289 a_FMUVersion )
5290 algorithm
5291 23 ret_0 := FMI.isFMIVersion20(a_FMUVersion);
5292 23 txt := fun_208(txt, ret_0, i_names, i_path);
5293 then txt;
5294
5295 case ( txt,
5296 _,
5297 _ )
5298 then txt;
5299 end match;
5300 end TypeDefinitionType;
5301
5302 public function DefaultExperiment
5303 input Tpl.Text in_txt;
5304 input Option<SimCode.SimulationSettings> in_a_simulationSettingsOpt;
5305 input String in_a_FMUVersion;
5306
5307 output Tpl.Text out_txt;
5308 algorithm
5309 out_txt :=
5310 match(in_txt, in_a_simulationSettingsOpt, in_a_FMUVersion)
5311 local
5312 Tpl.Text txt;
5313 String a_FMUVersion;
5314 SimCode.SimulationSettings i_v;
5315
5316 case ( txt,
5317 SOME(i_v),
5318 a_FMUVersion )
5319 algorithm
5320 75 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<DefaultExperiment "));
5321 75 txt := DefaultExperimentAttribute(txt, i_v, a_FMUVersion);
5322 75 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
5323 then txt;
5324
5325 case ( txt,
5326 _,
5327 _ )
5328 then txt;
5329 end match;
5330 end DefaultExperiment;
5331
5332 protected function fun_211
5333 input Tpl.Text in_txt;
5334 input Boolean in_mArg;
5335 input Real in_a_stepSize;
5336 input Real in_a_tolerance;
5337 input Real in_a_stopTime;
5338 input Real in_a_startTime;
5339
5340 output Tpl.Text out_txt;
5341 algorithm
5342 out_txt :=
5343 match(in_txt, in_mArg, in_a_stepSize, in_a_tolerance, in_a_stopTime, in_a_startTime)
5344 local
5345 Tpl.Text txt;
5346 Real a_stepSize;
5347 Real a_tolerance;
5348 Real a_stopTime;
5349 Real a_startTime;
5350
5351 case ( txt,
5352 false,
5353 _,
5354 a_tolerance,
5355 a_stopTime,
5356 a_startTime )
5357 algorithm
5358 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("startTime=\""));
5359 3 txt := Tpl.writeStr(txt, realString(a_startTime));
5360 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" stopTime=\""));
5361 3 txt := Tpl.writeStr(txt, realString(a_stopTime));
5362 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" tolerance=\""));
5363 3 txt := Tpl.writeStr(txt, realString(a_tolerance));
5364 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
5365 then txt;
5366
5367 case ( txt,
5368 _,
5369 a_stepSize,
5370 a_tolerance,
5371 a_stopTime,
5372 a_startTime )
5373 algorithm
5374 72 txt := Tpl.writeTok(txt, Tpl.ST_STRING("startTime=\""));
5375 72 txt := Tpl.writeStr(txt, realString(a_startTime));
5376 72 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" stopTime=\""));
5377 72 txt := Tpl.writeStr(txt, realString(a_stopTime));
5378 72 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" tolerance=\""));
5379 72 txt := Tpl.writeStr(txt, realString(a_tolerance));
5380 72 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" stepSize=\""));
5381 72 txt := Tpl.writeStr(txt, realString(a_stepSize));
5382 72 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
5383 then txt;
5384 end match;
5385 end fun_211;
5386
5387 public function DefaultExperimentAttribute
5388 input Tpl.Text in_txt;
5389 input SimCode.SimulationSettings in_a_simulationSettings;
5390 input String in_a_FMUVersion;
5391
5392 output Tpl.Text out_txt;
5393 algorithm
5394 out_txt :=
5395 match(in_txt, in_a_simulationSettings, in_a_FMUVersion)
5396 local
5397 Tpl.Text txt;
5398 String a_FMUVersion;
5399 Real i_stepSize;
5400 Real i_tolerance;
5401 Real i_stopTime;
5402 Real i_startTime;
5403 Boolean ret_0;
5404
5405 case ( txt,
5406 SimCode.SIMULATION_SETTINGS(startTime = i_startTime, stopTime = i_stopTime, tolerance = i_tolerance, stepSize = i_stepSize),
5407 a_FMUVersion )
5408 algorithm
5409 75 ret_0 := FMI.isFMIVersion20(a_FMUVersion);
5410 75 txt := fun_211(txt, ret_0, i_stepSize, i_tolerance, i_stopTime, i_startTime);
5411 then txt;
5412
5413 case ( txt,
5414 _,
5415 _ )
5416 then txt;
5417 end match;
5418 end DefaultExperimentAttribute;
5419
5420 protected function lm_213
5421 input output Tpl.Text txt;
5422 input list<tuple<String, String>> items;
5423 algorithm
5424
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 5 times.
10 for lstElt_213 in items loop
5425 txt := match lstElt_213
5426 local
5427 String i_value;
5428 String i_name;
5429
5430 case (i_name, i_value)
5431 algorithm
5432 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
5433 5 txt := Tpl.writeStr(txt, i_name);
5434 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" : \""));
5435 5 txt := Tpl.writeStr(txt, i_value);
5436 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
5437 5 txt := Tpl.nextIter(txt);
5438 then txt;
5439 end match;
5440 end for;
5441 end lm_213;
5442
5443 public function fmuSimulationFlagsFile
5444 input Tpl.Text in_txt;
5445 input SimCode.FmiSimulationFlags in_a_fmiSimulationFlags;
5446
5447 output Tpl.Text out_txt;
5448 algorithm
5449 out_txt :=
5450 match(in_txt, in_a_fmiSimulationFlags)
5451 local
5452 Tpl.Text txt;
5453 list<tuple<String, String>> i_flags_nameValueTuples;
5454 Tpl.Text l_fileContent;
5455
5456 case ( txt,
5457 SimCode.FMI_SIMULATION_FLAGS(nameValueTuples = i_flags_nameValueTuples) )
5458 algorithm
5459 5 l_fileContent := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_LINE(",\n")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
5460 5 l_fileContent := lm_213(l_fileContent, i_flags_nameValueTuples);
5461 5 l_fileContent := Tpl.popIter(l_fileContent);
5462 5 txt := Tpl.writeTok(txt, Tpl.ST_LINE("{\n"));
5463 5 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
5464 5 txt := Tpl.writeText(txt, l_fileContent);
5465 5 txt := Tpl.softNewLine(txt);
5466 5 txt := Tpl.popBlock(txt);
5467 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("}"));
5468 then txt;
5469
5470 case ( txt,
5471 _ )
5472 then txt;
5473 end match;
5474 end fmuSimulationFlagsFile;
5475
5476 protected function fun_215
5477 input Tpl.Text in_txt;
5478 input Boolean in_mArg;
5479
5480 output Tpl.Text out_txt;
5481 algorithm
5482 out_txt :=
5483 match(in_txt, in_mArg)
5484 local
5485 Tpl.Text txt;
5486
5487 case ( txt,
5488 false )
5489 then txt;
5490
5491 case ( txt,
5492 _ )
5493 algorithm
5494 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5495 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("head -n20 Makefile > ../resources/$(FMIPLATFORM).summary"));
5496 then txt;
5497 end match;
5498 end fun_215;
5499
5500 protected function fun_216
5501 input Tpl.Text in_txt;
5502 input Boolean in_mArg;
5503
5504 output Tpl.Text out_txt;
5505 algorithm
5506 out_txt :=
5507 match(in_txt, in_mArg)
5508 local
5509 Tpl.Text txt;
5510
5511 case ( txt,
5512 false )
5513 algorithm
5514 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t$(MAKE) distclean"));
5515 then txt;
5516
5517 case ( txt,
5518 _ )
5519 then txt;
5520 end match;
5521 end fun_216;
5522
5523 protected function fun_217
5524 input Tpl.Text in_txt;
5525 input String in_a_platform;
5526 input String in_a_libsPos2;
5527 input String in_a_libsPos1;
5528 input String in_a_dirExtra;
5529 input String in_a_modelNamePrefix;
5530 input String in_a_fmuTargetName;
5531 input String in_a_fileNamePrefix;
5532
5533 output Tpl.Text out_txt;
5534 algorithm
5535 out_txt :=
5536 match(in_txt, in_a_platform, in_a_libsPos2, in_a_libsPos1, in_a_dirExtra, in_a_modelNamePrefix, in_a_fmuTargetName, in_a_fileNamePrefix)
5537 local
5538 Tpl.Text txt;
5539 String a_libsPos2;
5540 String a_libsPos1;
5541 String a_dirExtra;
5542 String a_modelNamePrefix;
5543 String a_fmuTargetName;
5544 String a_fileNamePrefix;
5545 String i_platform;
5546 Boolean ret_2;
5547 Boolean ret_1;
5548 Integer ret_0;
5549
5550 case ( txt,
5551 (i_platform as "win32"),
5552 a_libsPos2,
5553 a_libsPos1,
5554 a_dirExtra,
5555 a_modelNamePrefix,
5556 a_fmuTargetName,
5557 a_fileNamePrefix )
5558 algorithm
5559 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5560 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("_FMU: nozip\n"));
5561 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5562 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("cd .. && rm -f ../"));
5563 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5564 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".fmu && zip -r ../"));
5565 ✗ txt := Tpl.writeStr(txt, a_fmuTargetName);
5566 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5567 ".fmu *\n",
5568 "nozip: "
5569 }, false));
5570 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5571 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("_functions.h "));
5572 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5573 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("_literals.h $(OFILES) $(RUNTIMEFILES) $(FMISUNDIALSFILES)\n"));
5574 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5575 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$(CXX) -shared -I. -o "));
5576 ✗ txt := Tpl.writeStr(txt, a_modelNamePrefix);
5577 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$(DLLEXT) $(RUNTIMEFILES) $(FMISUNDIALSFILES) $(OFILES) $(CPPFLAGS) "));
5578 ✗ txt := Tpl.writeStr(txt, a_dirExtra);
5579 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
5580 ✗ txt := Tpl.writeStr(txt, a_libsPos1);
5581 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
5582 ✗ txt := Tpl.writeStr(txt, a_libsPos2);
5583 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" $(CFLAGS) $(LDFLAGS) -llis -Wl,--kill-at\n"));
5584 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5585 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("mkdir.exe -p ../binaries/"));
5586 ✗ txt := Tpl.writeStr(txt, i_platform);
5587 ✗ txt := Tpl.softNewLine(txt);
5588 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5589 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("dlltool -d "));
5590 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5591 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".def --dllname "));
5592 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5593 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$(DLLEXT) --output-lib "));
5594 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5595 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(".lib --kill-at\n"));
5596 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5597 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("cp "));
5598 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5599 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$(DLLEXT) "));
5600 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5601 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".lib "));
5602 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5603 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("_FMU.libs ../binaries/"));
5604 ✗ txt := Tpl.writeStr(txt, i_platform);
5605 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("/\n"));
5606 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5607 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("rm -f *.o "));
5608 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5609 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("$(DLLEXT) $(OFILES) $(RUNTIMEFILES) $(FMISUNDIALSFILES)\n"));
5610 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5611 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("cd .. && rm -f ../"));
5612 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5613 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".fmu && zip -r ../"));
5614 ✗ txt := Tpl.writeStr(txt, a_fmuTargetName);
5615 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5616 ".fmu *\n",
5617 "\n"
5618 }, true));
5619 then txt;
5620
5621 case ( txt,
5622 (i_platform as "win64"),
5623 a_libsPos2,
5624 a_libsPos1,
5625 a_dirExtra,
5626 a_modelNamePrefix,
5627 a_fmuTargetName,
5628 a_fileNamePrefix )
5629 algorithm
5630 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5631 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("_FMU: nozip\n"));
5632 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5633 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("cd .. && rm -f ../"));
5634 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5635 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".fmu && zip -r ../"));
5636 ✗ txt := Tpl.writeStr(txt, a_fmuTargetName);
5637 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5638 ".fmu *\n",
5639 "nozip: "
5640 }, false));
5641 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5642 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("_functions.h "));
5643 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5644 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("_literals.h $(OFILES) $(RUNTIMEFILES) $(FMISUNDIALSFILES)\n"));
5645 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5646 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$(CXX) -shared -I. -o "));
5647 ✗ txt := Tpl.writeStr(txt, a_modelNamePrefix);
5648 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$(DLLEXT) $(RUNTIMEFILES) $(FMISUNDIALSFILES) $(OFILES) $(CPPFLAGS) "));
5649 ✗ txt := Tpl.writeStr(txt, a_dirExtra);
5650 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
5651 ✗ txt := Tpl.writeStr(txt, a_libsPos1);
5652 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
5653 ✗ txt := Tpl.writeStr(txt, a_libsPos2);
5654 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" $(CFLAGS) $(LDFLAGS) -llis -Wl,--kill-at\n"));
5655 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5656 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("mkdir.exe -p ../binaries/"));
5657 ✗ txt := Tpl.writeStr(txt, i_platform);
5658 ✗ txt := Tpl.softNewLine(txt);
5659 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5660 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("dlltool -d "));
5661 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5662 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".def --dllname "));
5663 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5664 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$(DLLEXT) --output-lib "));
5665 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5666 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(".lib --kill-at\n"));
5667 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5668 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("cp "));
5669 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5670 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$(DLLEXT) "));
5671 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5672 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".lib "));
5673 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5674 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("_FMU.libs ../binaries/"));
5675 ✗ txt := Tpl.writeStr(txt, i_platform);
5676 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("/\n"));
5677 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5678 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("rm -f *.o "));
5679 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5680 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("$(DLLEXT) $(OFILES) $(RUNTIMEFILES) $(FMISUNDIALSFILES)\n"));
5681 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5682 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("cd .. && rm -f ../"));
5683 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5684 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".fmu && zip -r ../"));
5685 ✗ txt := Tpl.writeStr(txt, a_fmuTargetName);
5686 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5687 ".fmu *\n",
5688 "\n"
5689 }, true));
5690 then txt;
5691
5692 case ( txt,
5693 _,
5694 a_libsPos2,
5695 a_libsPos1,
5696 a_dirExtra,
5697 a_modelNamePrefix,
5698 a_fmuTargetName,
5699 a_fileNamePrefix )
5700 algorithm
5701 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5702 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("_FMU: nozip\n"));
5703 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5704 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("cd .. && rm -f ../"));
5705 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5706 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".fmu && zip -r ../"));
5707 ✗ txt := Tpl.writeStr(txt, a_fmuTargetName);
5708 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5709 ".fmu *\n",
5710 "nozip: "
5711 }, false));
5712 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5713 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("_functions.h "));
5714 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5715 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("_literals.h $(OFILES) $(RUNTIMEFILES) $(FMISUNDIALSFILES)\n"));
5716 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5717 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5718 "mkdir -p ../binaries/$(FMIPLATFORM)\n",
5719 "ifeq (@LIBTYPE_DYNAMIC@,1)\n"
5720 }, true));
5721 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5722 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$(LD) -o "));
5723 ✗ txt := Tpl.writeStr(txt, a_modelNamePrefix);
5724 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$(DLLEXT) $(OFILES) $(RUNTIMEFILES) $(FMISUNDIALSFILES) "));
5725 ✗ txt := Tpl.writeStr(txt, a_dirExtra);
5726 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
5727 ✗ txt := Tpl.writeStr(txt, a_libsPos1);
5728 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
5729 ✗ txt := Tpl.writeStr(txt, a_libsPos2);
5730 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" @BDYNAMIC@ $(LDFLAGS)\n"));
5731 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5732 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("cp "));
5733 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5734 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$(DLLEXT) "));
5735 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5736 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5737 "_FMU.libs ../binaries/$(FMIPLATFORM)/\n",
5738 "endif\n"
5739 }, true));
5740 ✗ ret_0 := Flags.getConfigEnum(Flags.FMI_FILTER);
5741 ✗ ret_1 := intLt(ret_0, 4);
5742 ✗ txt := fun_215(txt, ret_1);
5743 ✗ txt := Tpl.softNewLine(txt);
5744 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("ifeq (@LIBTYPE_STATIC@,1)\n"));
5745 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5746 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("rm -f "));
5747 ✗ txt := Tpl.writeStr(txt, a_modelNamePrefix);
5748 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(".a\n"));
5749 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5750 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$(AR) -rsu "));
5751 ✗ txt := Tpl.writeStr(txt, a_modelNamePrefix);
5752 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(".a $(OFILES) $(RUNTIMEFILES) $(FMISUNDIALSFILES)\n"));
5753 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5754 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("cp "));
5755 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5756 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".a "));
5757 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5758 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5759 "_FMU.libs ../binaries/$(FMIPLATFORM)/\n",
5760 "endif\n"
5761 }, true));
5762 ✗ ret_2 := Flags.isSet(Flags.GEN_DEBUG_SYMBOLS);
5763 ✗ txt := fun_216(txt, ret_2);
5764 ✗ txt := Tpl.softNewLine(txt);
5765 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("distclean: clean\n"));
5766 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5767 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5768 "rm -f Makefile config.status config.log\n",
5769 "clean:\n"
5770 }, true));
5771 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\t"));
5772 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("rm -f "));
5773 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5774 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".def "));
5775 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5776 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".o "));
5777 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5778 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".a "));
5779 ✗ txt := Tpl.writeStr(txt, a_fileNamePrefix);
5780 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$(DLLEXT) $(MAINOBJ) $(OFILES) $(RUNTIMEFILES) $(FMISUNDIALSFILES)"));
5781 then txt;
5782 end match;
5783 end fun_217;
5784
5785 public function getPlatformString2
5786 input Tpl.Text txt;
5787 input String a_modelNamePrefix;
5788 input String a_platform;
5789 input String a_fileNamePrefix;
5790 input String a_fmuTargetName;
5791 input String a_dirExtra;
5792 input String a_libsPos1;
5793 input String a_libsPos2;
5794 input String a_omhome;
5795 input String a_FMUVersion;
5796
5797 output Tpl.Text out_txt;
5798 protected
5799 String ret_1;
5800 Tpl.Text l_fmudirname;
5801 algorithm
5802 ✗ ret_1 := Util.hashFileNamePrefix(a_fileNamePrefix);
5803 ✗ l_fmudirname := Tpl.writeStr(Tpl.emptyTxt, ret_1);
5804 ✗ l_fmudirname := Tpl.writeTok(l_fmudirname, Tpl.ST_STRING(".fmutmp"));
5805 ✗ out_txt := fun_217(txt, a_platform, a_libsPos2, a_libsPos1, a_dirExtra, a_modelNamePrefix, a_fmuTargetName, a_fileNamePrefix);
5806 end getPlatformString2;
5807
5808 protected function fun_219
5809 input Tpl.Text in_txt;
5810 input Boolean in_mArg;
5811 input String in_a_fileNamePrefix;
5812
5813 output Tpl.Text out_txt;
5814 algorithm
5815 out_txt :=
5816 match(in_txt, in_mArg, in_a_fileNamePrefix)
5817 local
5818 Tpl.Text txt;
5819 String a_fileNamePrefix;
5820
5821 case ( txt,
5822 false,
5823 _ )
5824 then txt;
5825
5826 case ( txt,
5827 _,
5828 a_fileNamePrefix )
5829 algorithm
5830 11 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5831 ";***************************************************\n",
5832 "; Experimetnal function for FMI for ModelExchange\n",
5833 ";****************************************************\n"
5834 }, true));
5835 11 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5836 11 txt := Tpl.writeTok(txt, Tpl.ST_STRING("_fmiGetSpecificDerivatives @45"));
5837 then txt;
5838 end match;
5839 end fun_219;
5840
5841 protected function fun_220
5842 input Tpl.Text in_txt;
5843 input Boolean in_mArg;
5844 input String in_a_fileNamePrefix;
5845
5846 output Tpl.Text out_txt;
5847 algorithm
5848 out_txt :=
5849 match(in_txt, in_mArg, in_a_fileNamePrefix)
5850 local
5851 Tpl.Text txt;
5852 String a_fileNamePrefix;
5853 Boolean ret_0;
5854
5855 case ( txt,
5856 false,
5857 a_fileNamePrefix )
5858 algorithm
5859 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("EXPORTS\n"));
5860 3 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
5861 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5862 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiCompletedIntegratorStep @1\n"));
5863 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5864 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiEventUpdate @2\n"));
5865 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5866 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiFreeModelInstance @3\n"));
5867 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5868 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetBoolean @4\n"));
5869 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5870 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetContinuousStates @5\n"));
5871 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5872 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetDerivatives @6\n"));
5873 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5874 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetEventIndicators @7\n"));
5875 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5876 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetInteger @8\n"));
5877 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5878 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetModelTypesPlatform @9\n"));
5879 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5880 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetNominalContinuousStates @10\n"));
5881 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5882 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetReal @11\n"));
5883 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5884 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetStateValueReferences @12\n"));
5885 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5886 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetString @13\n"));
5887 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5888 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetVersion @14\n"));
5889 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5890 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiInitialize @15\n"));
5891 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5892 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiInstantiateModel @16\n"));
5893 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5894 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetBoolean @17\n"));
5895 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5896 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetContinuousStates @18\n"));
5897 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5898 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetDebugLogging @19\n"));
5899 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5900 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetExternalFunction @20\n"));
5901 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5902 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetInteger @21\n"));
5903 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5904 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetReal @22\n"));
5905 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5906 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetString @23\n"));
5907 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5908 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetTime @24\n"));
5909 3 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5910 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("_fmiTerminate @25"));
5911 3 txt := Tpl.popBlock(txt);
5912 then txt;
5913
5914 case ( txt,
5915 _,
5916 a_fileNamePrefix )
5917 algorithm
5918 72 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5919 "EXPORTS\n",
5920 " ;***************************************************\n",
5921 " ;Common Functions\n",
5922 " ;****************************************************\n"
5923 }, true));
5924 72 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
5925 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5926 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetTypesPlatform @1\n"));
5927 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5928 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetVersion @2\n"));
5929 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5930 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetDebugLogging @3\n"));
5931 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5932 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiInstantiate @4\n"));
5933 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5934 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiFreeInstance @5\n"));
5935 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5936 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetupExperiment @6\n"));
5937 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5938 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiEnterInitializationMode @7\n"));
5939 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5940 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiExitInitializationMode @8\n"));
5941 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5942 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiTerminate @9\n"));
5943 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5944 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiReset @10\n"));
5945 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5946 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetReal @11\n"));
5947 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5948 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetInteger @12\n"));
5949 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5950 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetBoolean @13\n"));
5951 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5952 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetString @14\n"));
5953 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5954 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetReal @15\n"));
5955 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5956 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetInteger @16\n"));
5957 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5958 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetBoolean @17\n"));
5959 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5960 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetString @18\n"));
5961 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5962 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetFMUstate @19\n"));
5963 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5964 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetFMUstate @20\n"));
5965 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5966 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiFreeFMUstate @21\n"));
5967 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5968 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSerializedFMUstateSize @22\n"));
5969 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5970 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSerializeFMUstate @23\n"));
5971 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5972 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiDeSerializeFMUstate @24\n"));
5973 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5974 72 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5975 "_fmiGetDirectionalDerivative @25\n",
5976 ";***************************************************\n",
5977 ";Functions for FMI for Model Exchange\n",
5978 ";****************************************************\n"
5979 }, true));
5980 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5981 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiEnterEventMode @26\n"));
5982 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5983 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiNewDiscreteStates @27\n"));
5984 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5985 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiEnterContinuousTimeMode @28\n"));
5986 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5987 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiCompletedIntegratorStep @29\n"));
5988 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5989 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetTime @30\n"));
5990 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5991 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetContinuousStates @31\n"));
5992 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5993 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetDerivatives @32\n"));
5994 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5995 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetEventIndicators @33\n"));
5996 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5997 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetContinuousStates @34\n"));
5998 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
5999 72 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
6000 "_fmiGetNominalsOfContinuousStates @35\n",
6001 ";***************************************************\n",
6002 ";Functions for FMI for Co-Simulation\n",
6003 ";****************************************************\n"
6004 }, true));
6005 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6006 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiSetRealInputDerivatives @36\n"));
6007 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6008 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetRealOutputDerivatives @37\n"));
6009 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6010 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiDoStep @38\n"));
6011 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6012 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiCancelStep @39\n"));
6013 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6014 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetStatus @40\n"));
6015 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6016 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetRealStatus @41\n"));
6017 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6018 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetIntegerStatus @42\n"));
6019 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6020 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetBooleanStatus @43\n"));
6021 72 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6022 72 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmiGetStringStatus @44\n"));
6023 72 ret_0 := Flags.isSet(Flags.FMU_EXPERIMENTAL);
6024 72 txt := fun_219(txt, ret_0, a_fileNamePrefix);
6025 72 txt := Tpl.popBlock(txt);
6026 then txt;
6027 end match;
6028 end fun_220;
6029
6030 protected function fun_221
6031 input Tpl.Text in_txt;
6032 input Boolean in_mArg;
6033 input String in_a_fileNamePrefix;
6034 input String in_a_FMUVersion;
6035
6036 output Tpl.Text out_txt;
6037 algorithm
6038 out_txt :=
6039 match(in_txt, in_mArg, in_a_fileNamePrefix, in_a_FMUVersion)
6040 local
6041 Tpl.Text txt;
6042 String a_fileNamePrefix;
6043 String a_FMUVersion;
6044 Boolean ret_0;
6045
6046 case ( txt,
6047 false,
6048 a_fileNamePrefix,
6049 a_FMUVersion )
6050 algorithm
6051 75 ret_0 := FMI.isFMIVersion20(a_FMUVersion);
6052 75 txt := fun_220(txt, ret_0, a_fileNamePrefix);
6053 then txt;
6054
6055 case ( txt,
6056 _,
6057 a_fileNamePrefix,
6058 _ )
6059 algorithm
6060 16 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
6061 "EXPORTS\n",
6062 " ;***************************************************\n",
6063 " ;Common Functions\n",
6064 " ;****************************************************\n"
6065 }, true));
6066 16 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6067 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6068 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetVersion\n"));
6069 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6070 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetDebugLogging\n"));
6071 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6072 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3InstantiateModelExchange\n"));
6073 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6074 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3InstantiateCoSimulation\n"));
6075 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6076 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3InstantiateScheduledExecution\n"));
6077 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6078 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3FreeInstance\n"));
6079 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6080 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3EnterInitializationMode\n"));
6081 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6082 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3ExitInitializationMode\n"));
6083 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6084 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3EnterEventMode\n"));
6085 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6086 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3Terminate\n"));
6087 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6088 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3Reset\n"));
6089 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6090 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetFloat32\n"));
6091 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6092 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetFloat64\n"));
6093 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6094 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetInt8\n"));
6095 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6096 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetUInt8\n"));
6097 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6098 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetInt16\n"));
6099 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6100 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetUInt16\n"));
6101 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6102 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetInt32\n"));
6103 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6104 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetUInt32\n"));
6105 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6106 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetInt64\n"));
6107 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6108 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetUInt64\n"));
6109 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6110 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetBoolean\n"));
6111 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6112 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetString\n"));
6113 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6114 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetBinary\n"));
6115 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6116 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetClock\n"));
6117 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6118 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetFloat32\n"));
6119 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6120 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetFloat64\n"));
6121 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6122 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetInt8\n"));
6123 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6124 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetUInt8\n"));
6125 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6126 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetInt16\n"));
6127 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6128 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetUInt16\n"));
6129 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6130 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetInt32\n"));
6131 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6132 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetUInt32\n"));
6133 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6134 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetInt64\n"));
6135 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6136 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetUInt64\n"));
6137 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6138 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetBoolean\n"));
6139 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6140 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetString\n"));
6141 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6142 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetBinary\n"));
6143 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6144 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetClock\n"));
6145 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6146 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetNumberOfVariableDependencies\n"));
6147 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6148 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetVariableDependencies\n"));
6149 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6150 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetFMUState\n"));
6151 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6152 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetFMUState\n"));
6153 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6154 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3FreeFMUState\n"));
6155 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6156 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SerializedFMUStateSize\n"));
6157 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6158 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SerializeFMUState\n"));
6159 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6160 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3DeserializeFMUState\n"));
6161 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6162 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetDirectionalDerivative\n"));
6163 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6164 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetAdjointDerivative\n"));
6165 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6166 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3EnterConfigurationMode\n"));
6167 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6168 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3ExitConfigurationMode\n"));
6169 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6170 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetIntervalDecimal\n"));
6171 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6172 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetIntervalFraction\n"));
6173 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6174 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetShiftDecimal\n"));
6175 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6176 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetShiftFraction\n"));
6177 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6178 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetIntervalDecimal\n"));
6179 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6180 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetIntervalFraction\n"));
6181 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6182 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetShiftDecimal\n"));
6183 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6184 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetShiftFraction\n"));
6185 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6186 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3EvaluateDiscreteStates\n"));
6187 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6188 16 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
6189 "_fmi3UpdateDiscreteStates\n",
6190 ";***************************************************\n",
6191 ";Functions for Model Exchange\n",
6192 ";****************************************************\n"
6193 }, true));
6194 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6195 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3EnterContinuousTimeMode\n"));
6196 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6197 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3CompletedIntegratorStep\n"));
6198 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6199 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetTime\n"));
6200 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6201 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3SetContinuousStates\n"));
6202 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6203 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetContinuousStateDerivatives\n"));
6204 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6205 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetEventIndicators\n"));
6206 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6207 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetContinuousStates\n"));
6208 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6209 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetNominalsOfContinuousStates\n"));
6210 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6211 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetNumberOfEventIndicators\n"));
6212 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6213 16 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
6214 "_fmi3GetNumberOfContinuousStates\n",
6215 ";***************************************************\n",
6216 ";Functions for Co-Simulation\n",
6217 ";****************************************************\n"
6218 }, true));
6219 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6220 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3EnterStepMode\n"));
6221 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6222 16 txt := Tpl.writeTok(txt, Tpl.ST_LINE("_fmi3GetOutputDerivatives\n"));
6223 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6224 16 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
6225 "_fmi3DoStep\n",
6226 ";***************************************************\n",
6227 ";Functions for Scheduled Execution\n",
6228 ";****************************************************\n"
6229 }, true));
6230 16 txt := Tpl.writeStr(txt, a_fileNamePrefix);
6231 16 txt := Tpl.writeTok(txt, Tpl.ST_STRING("_fmi3ActivateModelPartition"));
6232 16 txt := Tpl.popBlock(txt);
6233 then txt;
6234 end match;
6235 end fun_221;
6236
6237 public function fmudeffile
6238 input Tpl.Text in_txt;
6239 input SimCode.SimCode in_a_simCode;
6240 input String in_a_FMUVersion;
6241
6242 output Tpl.Text out_txt;
6243 algorithm
6244 out_txt :=
6245 match(in_txt, in_a_simCode, in_a_FMUVersion)
6246 local
6247 Tpl.Text txt;
6248 String a_FMUVersion;
6249 String i_fileNamePrefix;
6250 Boolean ret_0;
6251
6252 case ( txt,
6253 SimCode.SIMCODE(modelInfo = SimCode.MODELINFO(name = _), makefileParams = SimCodeFunction.MAKEFILE_PARAMS(ccompiler = _), simulationSettingsOpt = _, fileNamePrefix = i_fileNamePrefix),
6254 a_FMUVersion )
6255 algorithm
6256 91 ret_0 := FMI.isFMIVersion30(a_FMUVersion);
6257 91 txt := fun_221(txt, ret_0, i_fileNamePrefix, a_FMUVersion);
6258 then txt;
6259
6260 case ( txt,
6261 _,
6262 _ )
6263 then txt;
6264 end match;
6265 end fmudeffile;
6266
6267 annotation(__OpenModelica_Interface="codegen_fmu");
6268 end CodegenFMUCommon;
6269