Skip to content

Commit

Permalink
add test for Clock parameter evaluation
Browse files Browse the repository at this point in the history
update tests to agree with the flattening
  • Loading branch information
adrpo authored and OpenModelica-Hudson committed Mar 23, 2017
1 parent ac7e1a7 commit bb605cd
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 6 deletions.
3 changes: 2 additions & 1 deletion flattening/modelica/synchronous/HoldTest.mo
Expand Up @@ -20,6 +20,7 @@ end HoldTest;
// Real z[2];
// equation
// x = /*Real*/(hold(3));
// y = hold({z[1], z[2]});
// y[1] = hold(z[1]);
// y[2] = hold(z[2]);
// end HoldTest;
// endResult
8 changes: 5 additions & 3 deletions flattening/modelica/synchronous/IntervalTest.mo
Expand Up @@ -3,7 +3,7 @@
// status: correct

model IntervalTest
Real y, u[2];
Real y[2], u[2];
Integer x(start=0);
equation
x = previous(x);
Expand All @@ -12,12 +12,14 @@ end IntervalTest;

// Result:
// class IntervalTest
// Real y;
// Real y[1];
// Real y[2];
// Real u[1];
// Real u[2];
// Integer x(start = 0);
// equation
// x = previous(x);
// y = interval({u[1], u[2]});
// y[1] = interval(u[1]);
// y[2] = interval(u[2]);
// end IntervalTest;
// endResult
6 changes: 4 additions & 2 deletions flattening/modelica/synchronous/NoClockTest.mo
Expand Up @@ -24,7 +24,9 @@ end NoClockTest;
// output Integer yy[2];
// equation
// x = /*Real*/(noClock(3));
// y = noClock({z[1], z[2]});
// yy = noClock({3, 4});
// y[1] = noClock(z[1]);
// y[2] = noClock(z[2]);
// yy[1] = noClock(3);
// yy[2] = noClock(4);
// end NoClockTest;
// endResult
1 change: 1 addition & 0 deletions simulation/modelica/synchronous/Makefile
Expand Up @@ -13,6 +13,7 @@ Modelica_Synchronous.Examples.Elementary.BooleanSignals.TimeBasedStep.mos \
Modelica_Synchronous.Examples.Elementary.IntegerSignals.TimeBasedStep.mos \
Modelica_Synchronous.Examples.SimpleControlledDrive.ClockedWithDiscreteTextbookController.mos \
DID.mos \
TestClockParameterEvaluation.mos \


# test that currently fail. Move up when fixed.
Expand Down
34 changes: 34 additions & 0 deletions simulation/modelica/synchronous/TestClockParameterEvaluation.mos
@@ -0,0 +1,34 @@
// name: TestClockParameterEvaluation.mos
// keywords: synchronous features, check that the parameters of Clock are evaluated properly
// status: correct
//

setCommandLineOptions("+std=3.3"); getErrorString();

loadModel(Modelica); getErrorString();
loadModel(Modelica_Synchronous); getErrorString();
simulate(Modelica_Synchronous.Examples.Systems.ControlledMixingUnit); getErrorString();
simulate(Modelica_Synchronous.Examples.SimpleControlledDrive.ClockedWithDiscretizedContinuousController); getErrorString();

// Result:
// true
// ""
// true
// ""
// true
// ""
// record SimulationResult
// resultFile = "Modelica_Synchronous.Examples.Systems.ControlledMixingUnit_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 300.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_Synchronous.Examples.Systems.ControlledMixingUnit', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// ""
// record SimulationResult
// resultFile = "Modelica_Synchronous.Examples.SimpleControlledDrive.ClockedWithDiscretizedContinuousController_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 5.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_Synchronous.Examples.SimpleControlledDrive.ClockedWithDiscretizedContinuousController', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// "Warning: It was not possible to determine if the initialization problem is consistent, because of not evaluable parameters/start values during compile time: PI.y = 0.0 (PI.y_start = 0.0)
// Warning: The initial conditions are over specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
// "
// endResult

0 comments on commit bb605cd

Please sign in to comment.