| 1 | // name: calculateParametersBug
|
|---|
| 2 | // keywords: parameter
|
|---|
| 3 | // status: correct
|
|---|
| 4 |
|
|---|
| 5 | loadString("
|
|---|
| 6 | model foo
|
|---|
| 7 | final parameter Real p1 = 1;
|
|---|
| 8 | final parameter Real p2 = 2;
|
|---|
| 9 | final parameter Real p3 = 3;
|
|---|
| 10 | final parameter Real p4 = 4;
|
|---|
| 11 | parameter Real q1 (fixed=false);
|
|---|
| 12 | parameter Real q2 (fixed=false);
|
|---|
| 13 | initial equation
|
|---|
| 14 | -p1 = 3 * (p3 * q1 + p4 * q2);
|
|---|
| 15 | -p2 = 3 * (q1 * p4 - p3 * q2);
|
|---|
| 16 | end foo;
|
|---|
| 17 | ");getErrorString();
|
|---|
| 18 |
|
|---|
| 19 | setCommandLineOptions("--initOptModules-=calculateStrongComponentJacobians");
|
|---|
| 20 | simulate(foo);getErrorString();
|
|---|
| 21 |
|
|---|
| 22 | val(p1, 0.0);getErrorString();
|
|---|
| 23 | val(p2, 0.0);getErrorString();
|
|---|
| 24 | val(p3, 0.0);getErrorString();
|
|---|
| 25 | val(p4, 0.0);getErrorString();
|
|---|
| 26 | val(q1, 0.0);getErrorString();
|
|---|
| 27 | val(q2, 0.0);getErrorString();
|
|---|
| 28 |
|
|---|
| 29 | // Correct results:
|
|---|
| 30 | // 1.0
|
|---|
| 31 | // ""
|
|---|
| 32 | // 2.0
|
|---|
| 33 | // ""
|
|---|
| 34 | // 3.0
|
|---|
| 35 | // ""
|
|---|
| 36 | // 4.0
|
|---|
| 37 | // ""
|
|---|
| 38 | // -0.1466666666666667
|
|---|
| 39 | // ""
|
|---|
| 40 | // 0.02666666666666667
|
|---|
| 41 | // ""
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 | // Result:
|
|---|
| 45 | // true
|
|---|
| 46 | // ""
|
|---|
| 47 | // true
|
|---|
| 48 | // record SimulationResult
|
|---|
| 49 | // resultFile = "foo_res.mat",
|
|---|
| 50 | // simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'foo', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
|
|---|
| 51 | // messages = "stdout | warning | The default linear solver fails, the fallback solver with total pivoting is started at time 0.000000. That might raise performance issues, for more information use -lv LOG_LS.
|
|---|
| 52 | // "
|
|---|
| 53 | // end SimulationResult;
|
|---|
| 54 | // ""
|
|---|
| 55 | // 1.0
|
|---|
| 56 | // ""
|
|---|
| 57 | // 2.0
|
|---|
| 58 | // ""
|
|---|
| 59 | // 3.0
|
|---|
| 60 | // ""
|
|---|
| 61 | // 4.0
|
|---|
| 62 | // ""
|
|---|
| 63 | // 0.0
|
|---|
| 64 | // ""
|
|---|
| 65 | // 0.0
|
|---|
| 66 | // ""
|
|---|
| 67 | // endResult
|
|---|