-
Notifications
You must be signed in to change notification settings - Fork 298
/
17_TestSwitch.mos
67 lines (63 loc) · 4.03 KB
/
17_TestSwitch.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
// name: 17_TestSwitch
// status: correct
//
// Simulation Results
// Examples to the Tutorial "Mathematical Aspects of Object-Oriented Modeling and Simulation"
//
loadModel(Modelica, {"3.2.2"}); getErrorString();
loadFile("TestSwitch1.mo"); getErrorString();
loadFile("TestSwitch2.mo"); getErrorString();
loadFile("IdealSwitchStiff.mo"); getErrorString();
loadFile("IdealSwitchDummy.mo"); getErrorString();
simulate(TestSwitch1, stopTime=2); getErrorString();
res := OpenModelica.Scripting.compareSimulationResults("TestSwitch1_res.mat",
"ReferenceFiles/TestSwitch1.mat",
"TestSwitch1_diff.csv", 0.01, 0.0001,
{"S.v", "S.i"}); getErrorString();
simulate(TestSwitch2, stopTime=2); getErrorString();
res := OpenModelica.Scripting.compareSimulationResults("TestSwitch2_res.mat",
"ReferenceFiles/TestSwitch2.mat",
"TestSwitch2_diff.csv", 0.01, 0.0001,
{"S.v", "S.i"}); getErrorString();
// Result:
// true
// ""
// true
// ""
// true
// ""
// true
// ""
// true
// ""
// record SimulationResult
// resultFile = "TestSwitch1_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'TestSwitch1', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// "
// end SimulationResult;
// "[Modelica 3.2.2+maint.om/Electrical/Analog/Sources.mo:284:5-284:68:writable] Warning: Parameter U.freqHz has no value, and is fixed during initialization (fixed=true), using available start value (start=1.0) as default value.
// [Modelica 3.2.2+maint.om/Electrical/Analog/Sources.mo:282:5-282:61:writable] Warning: Parameter U.V has no value, and is fixed during initialization (fixed=true), using available start value (start=1.0) as default value.
// [Modelica 3.2.2+maint.om/Electrical/Analog/Basic.mo:304:5-304:52:writable] Warning: Parameter I.L has no value, and is fixed during initialization (fixed=true), using available start value (start=1.0) as default value.
// Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions(\"-d=initialization\").
// "
// {"Files Equal!"}
// "Warning: 'compareSimulationResults' is deprecated. It is recommended to use 'diffSimulationResults' instead.
// "
// record SimulationResult
// resultFile = "TestSwitch2_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'TestSwitch2', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// "
// end SimulationResult;
// "[Modelica 3.2.2+maint.om/Electrical/Analog/Sources.mo:284:5-284:68:writable] Warning: Parameter U.freqHz has no value, and is fixed during initialization (fixed=true), using available start value (start=1.0) as default value.
// [Modelica 3.2.2+maint.om/Electrical/Analog/Sources.mo:282:5-282:61:writable] Warning: Parameter U.V has no value, and is fixed during initialization (fixed=true), using available start value (start=1.0) as default value.
// [Modelica 3.2.2+maint.om/Electrical/Analog/Basic.mo:304:5-304:52:writable] Warning: Parameter I.L has no value, and is fixed during initialization (fixed=true), using available start value (start=1.0) as default value.
// Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions(\"-d=initialization\").
// "
// {"Files Equal!"}
// "Warning: 'compareSimulationResults' is deprecated. It is recommended to use 'diffSimulationResults' instead.
// "
// endResult