-
Notifications
You must be signed in to change notification settings - Fork 49
/
ASSCExample.lua
44 lines (35 loc) · 1.42 KB
/
ASSCExample.lua
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
-- status: correct
-- teardown_command: rm -rf Example_res.mat Example.log
-- linux: yes
-- ucrt64: yes
-- win: yes
oms_setCommandLineOption("--suppressPath=true --stripRoot=true")
oms_setTempDirectory("./ASSCExample-lua/")
oms_newModel("Example")
oms_addSystem("Example.root", oms_system_wc)
-- instantiate FMUs
oms_addSubModel("Example.root.Class1", "../resources/ASSCExample.Class1.fmu")
oms_addSubModel("Example.root.Class2", "../resources/ASSCExample.Class2.fmu")
-- add connections
oms_addConnection("Example.root.Class1.max", "Example.root.Class2.max")
oms_setStopTime("Example", 6.0)
oms_setSolver("Example", oms_solver_wc_assc)
oms_setVariableStepSize("Example", 0.05, 0.05, 0.5)
oms_addEventIndicator("Example.root.Class1.max")
oms_addTimeIndicator("Example.root.Class1.eventTime")
oms_addStaticValueIndicator("Example.root.Class2.signalwiththreshold", 4.5, 5.0, 0.1)
oms_addDynamicValueIndicator("Example.root.Class2.signalwiththreshold", "Class1.closeToMax", "Class1.max", 0.05)
oms_instantiate("Example")
oms_initialize("Example")
oms_simulate("Example")
oms_terminate("Example")
oms_delete("Example")
if 1 == oms_compareSimulationResults("Example_res.mat", "../references/SSC.mat", "Class2.signalwiththreshold", 0.0, 0.0) then
print("info: Results are equal")
else
print("warning: Results are not equal")
end
-- Result:
-- info: Result file: Example_res.mat (bufferSize=10)
-- info: Results are equal
-- endResult