-
Notifications
You must be signed in to change notification settings - Fork 298
/
simulateSimpleOMSU.mos
45 lines (38 loc) · 1.63 KB
/
simulateSimpleOMSU.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
// name: simulateSimpleOMSU
// keywords: omsi omsic fmu fmi
// status: correct
// teardown_command: rm -rf helloWorldOMSU.fmutmp helloWorldOMSU.fmu helloWorldOMSU_systemCall.log helloWorldOMSU-tmp helloWorldOMSU_res.mat
// cflags: -d=-newInst
//
// Tests simulating OMSIC OMSU/FMU with OMSimulator
//
//
loadFile("helloWorldOMSU.mo"); getErrorString(); getErrorString();
// Build omsic FMU
setCommandLineOptions("--simCodeTarget=omsic"); getErrorString();
buildModelFMU(helloWorldOMSU); getErrorString();
// Simulate with OMSimulator
system(getInstallationDirectoryPath() + "/bin/OMSimulator helloWorldOMSU.fmu --intervals=500 --resultFile=\"helloWorldOMSU_res.mat\" --suppressPath=true --tempDir=\"helloWorldOMSU-tmp\"", "helloWorldOMSU_systemCall.log"); getErrorString();
readFile("helloWorldOMSU_systemCall.log");
val(x, {0.0,1.0}, "helloWorldOMSU_res.mat");
val(der(x), {0.0,1.0}, "helloWorldOMSU_res.mat");
// Result:
// true
// ""
// ""
// true
// ""
// "helloWorldOMSU.fmu"
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->Show additional information from the initialization process, in OMNotebook call setCommandLineOptions(\"-d=initialization\").
// "
// 0
// ""
// "info: maximum step size for 'model.root': 0.002000
// info: Result file: helloWorldOMSU_res.mat (bufferSize=1)
// info: Final Statistics for 'model.root':
// NumSteps = 505 NumRhsEvals = 510 NumLinSolvSetups = 30
// NumNonlinSolvIters = 509 NumNonlinSolvConvFails = 0 NumErrTestFails = 1
// "
// {1.0,7.389140833856468}
// {2.0,14.778281667712935}
// endResult