-
Notifications
You must be signed in to change notification settings - Fork 297
/
resetWithLoops.mos
73 lines (65 loc) · 2.24 KB
/
resetWithLoops.mos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// keywords: fmu export import reset
// status: correct
// teardown_command: rm -rf resetWithLoops-fmu/ model_res.mat resetWithLoops.lua resetWithLoops.fmu resetWithLoops.log resetWithLoops_systemCall.log temp-resetWithLoops
loadModel(Modelica, {"3.2.3"}); getErrorString();
system("mkdir -p resetWithLoops-fmu");
echo(false); cd("resetWithLoops-fmu"); echo(true);
buildModelFMU(Modelica.Electrical.Analog.Examples.Rectifier, fileNamePrefix="Modelica.Electrical.Analog.Examples.Rectifier"); getErrorString();
echo(false); cd(".."); echo(true);
writeFile("resetWithLoops.lua","
oms_setCommandLineOption(\"--suppressPath=true\")
oms_setTempDirectory(\"./temp-resetWithLoops/\")
oms_newModel(\"model\")
oms_addSystem(\"model.root\", oms_system_sc)
-- instantiate FMUs
oms_addSubModel(\"model.root.system1\", \"resetWithLoops-fmu/Modelica.Electrical.Analog.Examples.Rectifier.fmu\")
print(\"Instantiate\")
oms_instantiate(\"model\")
-- initialize FMU
print(\"Initialize\")
oms_initialize(\"model\")
-- reset FMU
print(\"Reset\")
oms_reset(\"model\")
-- Simualte FMU
print(\"Initialize\")
oms_initialize(\"model\")
print(\"Simulate\")
oms_simulate(\"model\")
print(\"Terminate and Delete\")
oms_terminate(\"model\")
oms_delete(\"model\")
print(\"Success\")
"); getErrorString();
system(getInstallationDirectoryPath() + "/bin/OMSimulator resetWithLoops.lua", "resetWithLoops_systemCall.log");
readFile("resetWithLoops_systemCall.log");
// Result:
// true
// ""
// 0
// true
// "Modelica.Electrical.Analog.Examples.Rectifier.fmu"
// ""
// true
// true
// ""
// 0
// "Instantiate
// Initialize
// info: maximum step size for 'model.root': 0.001000
// info: Result file: model_res.mat (bufferSize=10)
// Reset
// info: Final Statistics for 'model.root':
// NumSteps = 0 NumRhsEvals = 0 NumLinSolvSetups = 0
// NumNonlinSolvIters = 0 NumNonlinSolvConvFails = 0 NumErrTestFails = 0
// Initialize
// info: maximum step size for 'model.root': 0.001000
// info: Result file: model_res.mat (bufferSize=10)
// Simulate
// Terminate and Delete
// info: Final Statistics for 'model.root':
// NumSteps = 23 NumRhsEvals = 42 NumLinSolvSetups = 14
// NumNonlinSolvIters = 41 NumNonlinSolvConvFails = 0 NumErrTestFails = 4
// Success
// "
// endResult