|
| 1 | +// keywords: fmu export import |
| 2 | +// status: correct |
| 3 | +// teardown_command: rm -rf setstartTime.fmu setstartTime.log setstartTime_systemCall.log/ |
| 4 | + |
| 5 | +loadModel(Modelica); getErrorString(); |
| 6 | + |
| 7 | +loadString(" |
| 8 | +model setstartTime |
| 9 | + import Modelica.Blocks.Sources; |
| 10 | + import Modelica.Blocks.Types; |
| 11 | + parameter Real x_0 = 5; |
| 12 | + Real x(start=x_0, fixed=true); |
| 13 | + Real t; |
| 14 | + Real u; |
| 15 | + Sources.CombiTimeTable scheme( |
| 16 | + smoothness=Types.Smoothness.ConstantSegments, |
| 17 | + extrapolation = Types.Extrapolation.HoldLastPoint, |
| 18 | + table=[0,0; 1.0,1; 2.0,2; 1003,3; 1004,4; 1005,5; 1006,6; 1007,7; 1008,8; 1009,9]); |
| 19 | +equation |
| 20 | + t = time; |
| 21 | + u = scheme.y[1]; |
| 22 | + der(x) = -x; |
| 23 | +end setstartTime; |
| 24 | +"); getErrorString(); |
| 25 | + |
| 26 | +buildModelFMU(setstartTime, version="2.0", fmuType="me_cs", platforms={"static"}); getErrorString(); |
| 27 | + |
| 28 | +system(getInstallationDirectoryPath() + "/bin/OMSimulator setstartTime.fmu --startTime=2.5 --stopTime=5 -r=start_time_res.mat", "setstartTime_systemCall.log"); |
| 29 | +readFile("setstartTime_systemCall.log"); |
| 30 | + |
| 31 | +val(t, 2.5, "start_time_res.mat"); |
| 32 | +val(u, 2.5, "start_time_res.mat"); |
| 33 | + |
| 34 | +// Result: |
| 35 | +// true |
| 36 | +// "" |
| 37 | +// true |
| 38 | +// "" |
| 39 | +// "setstartTime.fmu" |
| 40 | +// "" |
| 41 | +// 0 |
| 42 | +// "info: maximum step size for 'model.root': 0.002000 |
| 43 | +// info: Result file: start_time_res.mat (bufferSize=1) |
| 44 | +// info: Parameter model.root.setstartTime.scheme.fileName will not be stored in the result file, because the signal type is not supported |
| 45 | +// info: Parameter model.root.setstartTime.scheme.tableName will not be stored in the result file, because the signal type is not supported |
| 46 | +// info: Final Statistics for 'model.root': |
| 47 | +// NumSteps = 1252 NumRhsEvals = 1255 NumLinSolvSetups = 65 |
| 48 | +// NumNonlinSolvIters = 1254 NumNonlinSolvConvFails = 0 NumErrTestFails = 0 |
| 49 | +// " |
| 50 | +// 2.5 |
| 51 | +// 2.0 |
| 52 | +// endResult |
0 commit comments