Skip to content

Commit

Permalink
added testcase for inlineCalls with tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
vruge committed Oct 25, 2015
1 parent 243f70d commit bfdc85c
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
1 change: 1 addition & 0 deletions simulation/modelica/nonlinear_system/Makefile
Expand Up @@ -2,6 +2,7 @@ TEST = ../../../rtest -v

TESTFILES = \
bug_2841.mos \
bug_3527.mos \
nanTest.mos \
nonlinear.mos \
nonlinear_kinsol.mos \
Expand Down
95 changes: 95 additions & 0 deletions simulation/modelica/nonlinear_system/bug_3527.mos
@@ -0,0 +1,95 @@
// name: bug_3527
// keywords: nonlinear system solver inline function
// status: correct
// cflags:

setDebugFlags("backenddaeinfo"); getErrorString();

loadString("
model inlineFunctionLoop
function f2
input Real x1;
input Real x2;
output Real y1;
output Real y2;
algorithm
y1 := cos(x1 + x2);
y2 := sin(x1);
annotation(Inline = true);
end f2;

Real x(start=0), z, y(start =-1);
equation
(x, z) = f2(x+time, y+cos(time));
z = sin(cos(time+1) * x);
end inlineFunctionLoop;
"); getErrorString();

simulate(inlineFunctionLoop, stopTime=1.0); getErrorString();

val(x,{0,1});
val(y,{0,1});
val(z,{0,1});


// Result:
// true
// ""
// true
// ""
// record SimulationResult
// resultFile = "inlineFunctionLoop_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'inlineFunctionLoop', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// "Notification: Model statistics after passing the front-end and creating the data structures used by the back-end:
// * Number of equations: 3
// * Number of variables: 3
// Notification: Model statistics after passing the back-end for initialization:
// * Number of independent subsystems: 1
// * Number of states: 0 ('+d=stateselection' for list of states)
// * Number of discrete variables: 0 ('+d=discreteinfo' for list of discrete vars)
// * Number of discrete states: 0 ('+d=discreteinfo' for list of discrete states)
// * Top-level inputs: 0
// Notification: Strong component statistics for initialization (2):
// * Single equations (assignments): 0
// * Array equations: 0
// * Algorithm blocks: 0
// * Record equations: 0
// * When equations: 0
// * If-equations: 0
// * Equation systems (linear and non-linear blocks): 1
// * Torn equation systems: 1
// * Mixed (continuous/discrete) equation systems: 0
// Notification: Equation system details:
// * Constant Jacobian: 0
// * Linear Jacobian (size,density): 0
// * Non-linear Jacobian: 1 {1}
// * Without analytic Jacobian: 0
// Notification: Torn system details:
// * Linear torn systems: 0
// * Non-linear torn systems: 1 {1 1}
// Notification: Model statistics after passing the back-end for simulation:
// * Number of independent subsystems: 1
// * Number of states: 0 ('+d=stateselection' for list of states)
// * Number of discrete variables: 0 ('+d=discreteinfo' for list of discrete vars)
// * Number of discrete states: 0 ('+d=discreteinfo' for list of discrete states)
// * Top-level inputs: 0
// Notification: Strong component statistics for simulation (2):
// * Single equations (assignments): 1
// * Array equations: 0
// * Algorithm blocks: 0
// * Record equations: 0
// * When equations: 0
// * If-equations: 0
// * Equation systems (linear and non-linear blocks): 0
// * Torn equation systems: 1
// * Mixed (continuous/discrete) equation systems: 0
// Notification: Torn system details:
// * Linear torn systems: 0
// * Non-linear torn systems: 1 {1 1}
// "
// {0.0,-0.7061414637186959}
// {0.5707963267948966,1.520669413132999}
// {0.0,0.2896475060211959}
// endResult

0 comments on commit bfdc85c

Please sign in to comment.