Skip to content

Commit

Permalink
Add test case from ticket 2673
Browse files Browse the repository at this point in the history
Test mat-file import of parameters.
  • Loading branch information
lochel authored and OpenModelica-Hudson committed Nov 9, 2015
1 parent a1668c7 commit e44ed5c
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions simulation/modelica/initialization/Makefile
Expand Up @@ -9,6 +9,7 @@ bug_2504.mos \
bug_2566.mos \
bug_2583.mos \
bug_2673.mos \
bug_2673b.mos \
bug_2830.mos \
bug_2990.mos \
bug_2994.mos \
Expand Down
62 changes: 62 additions & 0 deletions simulation/modelica/initialization/bug_2673b.mos
@@ -0,0 +1,62 @@
// name: bug_2673b
// keywords: initialization
// status: correct

loadString("
package Test
model M
parameter Real p(fixed = false);
initial equation
20 = p*10 + 10;
end M;

model Q
M m;
end Q;
end Test;
"); getErrorString();

simulate(Test.Q, fileNamePrefix="Test.Q_xxx"); getErrorString();
val(m.p, {0.0, 0.5});

simulate(Test.Q, simflags="-iim=none -iif=Test.Q_xxx_res.mat -iit=1.0 -lv=LOG_INIT"); getErrorString();
val(m.p, {0.0, 0.5});

// Result:
// true
// ""
// record SimulationResult
// resultFile = "Test.Q_xxx_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Test.Q_xxx', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// ""
// {1.0,1.0}
// record SimulationResult
// resultFile = "Test.Q_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Test.Q', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-iim=none -iif=Test.Q_xxx_res.mat -iit=1.0 -lv=LOG_INIT'",
// messages = "LOG_INIT | info | ### START INITIALIZATION ###
// LOG_INIT | info | updating min-values
// LOG_INIT | info | updating max-values
// LOG_INIT | info | updating nominal-values
// LOG_INIT | info | updating start-values
// LOG_INIT | info | import start values
// | | | | file: Test.Q_xxx_res.mat
// | | | | time: 1
// LOG_INIT | info | import real variables
// LOG_INIT | info | import real parameters
// LOG_INIT | info | | m.p(start=1)
// LOG_INIT | info | import real discrete
// LOG_INIT | info | import integer parameters
// LOG_INIT | info | import boolean parameters
// LOG_INIT | info | initialization method: none [sets all variables to their start values and skips the initialization process]
// LOG_INIT | info | parameter values
// | | | | | real parameters
// | | | | | | [1] parameter Real m.p(start=1, fixed=false) = 1
// LOG_SOTI | info | ### SOLUTION OF THE INITIALIZATION ###
// LOG_INIT | info | ### END INITIALIZATION ###
// "
// end SimulationResult;
// ""
// {1.0,1.0}
// endResult

0 comments on commit e44ed5c

Please sign in to comment.