-
Notifications
You must be signed in to change notification settings - Fork 298
/
HelloFMIWorld.mos
43 lines (39 loc) · 1.53 KB
/
HelloFMIWorld.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
// name: HelloFMIWorld
// keywords: fmu export import
// status: correct
// teardown_command: rm -rf binaries/ sources/ resources/ modelDescription.xml HelloFMI20World.fmu HelloFMI20World* HelloFMI20World/* output.log
loadString("
model HelloFMI20World
Real x(start=1);
parameter Real a=2;
equation
der(x) = a * x;
end HelloFMI20World;
"); getErrorString();
translateModelFMU(HelloFMI20World, version="2.0"); getErrorString();
importFMU("HelloFMI20World.fmu"); getErrorString();
loadFile("HelloFMI20World_me_FMU.mo"); getErrorString();
simulate(HelloFMI20World_me_FMU); getErrorString();
val(x, 0); // 1.0
val(x, 1); // 7.3945
// Result:
// true
// ""
// "HelloFMI20World.fmu"
// "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\").
// "
// "HelloFMI20World_me_FMU.mo"
// ""
// true
// ""
// record SimulationResult
// resultFile = "HelloFMI20World_me_FMU_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'HelloFMI20World_me_FMU', 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;
// ""
// 1.0
// 7.389089928644395
// endResult