Skip to content

Commit 033aecd

Browse files
author
Willi Braun
committed
update tests, so that val() could get wrong result
1 parent befd014 commit 033aecd

File tree

2 files changed

+14
-30
lines changed

2 files changed

+14
-30
lines changed

openmodelica/fmi/ModelExchange/1.0/testChangeParam.mos

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,14 @@ importFMU("test_ChangeParam.fmu");
3434
loadFile("test_ChangeParam_me_FMU.mo");
3535
getErrorString();
3636

37-
simulate(test_ChangeParam_me_FMU);
37+
simulate(test_ChangeParam_me_FMU, numberOfIntervals=1);
3838
val(x, 1);
3939
val(a, 1);
4040
val(y, 1);
4141
getErrorString();
4242

43-
system("./test_ChangeParam_me_FMU -override a=-2,i=-10,b=false,s=\"bar\"");
44-
echo(false);
45-
readSimulationResult("test_ChangeParam_me_FMU_res.mat", {x,a,y});
46-
echo(true);
47-
val(x, 1);
48-
val(a, 1);
49-
val(y, 1);
43+
system("./test_ChangeParam_me_FMU -override a=-2,i=-10,b=false,s=\"bar\" -r test_ChangeParam.mat");
44+
readSimulationResult("test_ChangeParam.mat", {x,a,y}, 6);
5045
getErrorString();
5146

5247

@@ -62,23 +57,20 @@ getErrorString();
6257
// ""
6358
// record SimulationResult
6459
// resultFile = "test_ChangeParam_me_FMU_res.mat",
65-
// simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'test_ChangeParam_me_FMU', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
60+
// simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 1, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'test_ChangeParam_me_FMU', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
6661
// messages = "[<interactive>:14:7-14:43:writable]
6762
// stdout | info | Simulation call terminate() at time 1.000000
6863
// | | | | Message : Simulation done by foo
6964
// "
7065
// end SimulationResult;
71-
// 7.389089930122212
66+
// 7.389089930122227
7267
// 2.0
73-
// 6.389089930122212
68+
// 6.389089930122227
7469
// ""
7570
// [<interactive>:14:7-14:43:writable]
7671
// stdout | info | Simulation call terminate() at time 1.000000
7772
// | | | | Message : Simulation done by bar
7873
// 0
79-
// true
80-
// 0.135336321156737
81-
// 2.0
82-
// -10.13533632115674
74+
// {{1.0,1.0,1.0,0.1353363211567342,0.1353363211567342,0.1353363211567342},{-2.0,-2.0,-2.0,-2.0,-2.0,-2.0},{-11.0,-11.0,-11.0,-10.13533632115674,-10.13533632115674,-10.13533632115674}}
8375
// ""
8476
// endResult

openmodelica/fmi/ModelExchange/2.0/testChangeParam.mos

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,14 @@ importFMU("test_ChangeParam.fmu");
3434
loadFile("test_ChangeParam_me_FMU.mo");
3535
getErrorString();
3636

37-
simulate(test_ChangeParam_me_FMU);
37+
simulate(test_ChangeParam_me_FMU, numberOfIntervals=1);
3838
val(x, 1);
3939
val(a, 1);
4040
val(y, 1);
4141
getErrorString();
4242

43-
system("./test_ChangeParam_me_FMU -override a=-2,i=-10,b=false,s=\"bar\"");
44-
echo(false);
45-
readSimulationResult("test_ChangeParam_me_FMU_res.mat", {x,a,y});
46-
echo(true);
47-
val(x, 1);
48-
val(a, 1);
49-
val(y, 1);
43+
system("./test_ChangeParam_me_FMU -override a=-2,i=-10,b=false,s=\"bar\" -r test_ChangeParam.mat");
44+
readSimulationResult("test_ChangeParam.mat", {x,a,y}, 6);
5045
getErrorString();
5146

5247

@@ -62,23 +57,20 @@ getErrorString();
6257
// ""
6358
// record SimulationResult
6459
// resultFile = "test_ChangeParam_me_FMU_res.mat",
65-
// simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'test_ChangeParam_me_FMU', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
60+
// simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 1, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'test_ChangeParam_me_FMU', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
6661
// messages = "[<interactive>:14:7-14:43:writable]
6762
// stdout | info | Simulation call terminate() at time 1.000000
6863
// | | | | Message : Simulation done by foo
6964
// "
7065
// end SimulationResult;
71-
// 7.389089930122212
66+
// 7.389089930122227
7267
// 2.0
73-
// 6.389089930122212
68+
// 6.389089930122227
7469
// ""
7570
// [<interactive>:14:7-14:43:writable]
7671
// stdout | info | Simulation call terminate() at time 1.000000
7772
// | | | | Message : Simulation done by bar
7873
// 0
79-
// true
80-
// 0.135336321156737
81-
// 2.0
82-
// -10.13533632115674
74+
// {{1.0,1.0,1.0,0.1353363211567342,0.1353363211567342,0.1353363211567342},{-2.0,-2.0,-2.0,-2.0,-2.0,-2.0},{-11.0,-11.0,-11.0,-10.13533632115674,-10.13533632115674,-10.13533632115674}}
8375
// ""
8476
// endResult

0 commit comments

Comments
 (0)