|
| 1 | +// name: InverseAlgorithm4 |
| 2 | +// keywords: inverse algorithm |
| 3 | +// status: correct |
| 4 | + |
| 5 | +loadString(" |
| 6 | +model InverseAlgorithm4 |
| 7 | + Real x; |
| 8 | + Real w; |
| 9 | + Integer y,z; |
| 10 | +equation |
| 11 | + der(x) = y; |
| 12 | + when sample(0,0.1) then |
| 13 | + w = x+sin(time); |
| 14 | + y = integer(sin(x)*w+10); |
| 15 | + z = integer(y); |
| 16 | + end when; |
| 17 | +initial algorithm |
| 18 | + y := integer(sin(2*w)+10); |
| 19 | + z := integer(y); |
| 20 | +end InverseAlgorithm4; |
| 21 | +"); getErrorString(); |
| 22 | + |
| 23 | +simulate(InverseAlgorithm4, simflags="-lv=LOG_SOTI"); getErrorString(); |
| 24 | + |
| 25 | +// Result: |
| 26 | +// true |
| 27 | +// "" |
| 28 | +// record SimulationResult |
| 29 | +// resultFile = "InverseAlgorithm4_res.mat", |
| 30 | +// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'InverseAlgorithm4', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-lv=LOG_SOTI'", |
| 31 | +// messages = "LOG_SOTI | info | ### SOLUTION OF THE INITIALIZATION ### |
| 32 | +// | | | | | states variables |
| 33 | +// | | | | | | [1] Real x(start=0, nominal=1) = 0 (pre: 0) |
| 34 | +// | | | | | derivatives variables |
| 35 | +// | | | | | | [2] Real der(x) = 10 (pre: 0) |
| 36 | +// | | | | | other real variables |
| 37 | +// | | | | | | [3] Real w(start=0, nominal=1) = 0 (pre: 0) |
| 38 | +// | | | | | integer variables |
| 39 | +// | | | | | | [1] Integer y(start=0) = 10 (pre: 10) |
| 40 | +// | | | | | | [2] Integer z(start=0) = 0 (pre: 0) |
| 41 | +// | | | | | boolean variables |
| 42 | +// | | | | | | [1] Boolean $whenCondition1(start=true) = false (pre: true) |
| 43 | +// LOG_SUCCESS | info | The initialization finished successfully without homotopy method. |
| 44 | +// LOG_SUCCESS | info | The simulation finished successfully. |
| 45 | +// " |
| 46 | +// end SimulationResult; |
| 47 | +// "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"). |
| 48 | +// " |
| 49 | +// endResult |
0 commit comments