Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
niklwors committed Aug 18, 2015
2 parents 6f5626c + a183840 commit 0f4a303
Show file tree
Hide file tree
Showing 19 changed files with 225 additions and 659 deletions.
1 change: 1 addition & 0 deletions openmodelica/cppruntime/Makefile
Expand Up @@ -4,6 +4,7 @@ TESTFILES = \
tearnonlin1.mos \
WhenStatement1.mos \
BouncingBall.mos \
recordTupleReturnTest.mos \
solveTest.mos

FAILINGTESTFILES=
Expand Down
8 changes: 6 additions & 2 deletions openmodelica/cppruntime/libraries/msl32/Makefile
Expand Up @@ -21,6 +21,10 @@ Modelica.StateGraph.Examples.FirstExample.mos \
Modelica.Thermal.HeatTransfer.Examples.ControlledTemperature.mos \
Modelica.Thermal.HeatTransfer.Examples.TwoMasses.mos \
Modelica.Electrical.Digital.Examples.Counter.mos \
Modelica.Utilities.Examples.readRealParameterModel.mos \

# tested features:
# readRealParameterModel: string handling, variable name string

# Run make failingtest
FAILINGTESTFILES=\
Expand All @@ -47,7 +51,7 @@ test:
@echo
@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) "
@$(TEST) $(TESTFILES)

# Cleans all files that are not listed as dependencies
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
Expand All @@ -64,7 +68,7 @@ getdeps:
@echo $(CLEAN) | sed -r 's/deps.txt|deps.tmp//g' | sed 's/ / \\\n/g' > deps.txt
@echo Dependency list saved in deps.txt.
@echo Copy the list from deps.txt and add it to the Makefile @DEPENDENCIES

failingtest:
@echo
@echo Running failing tests...
Expand Down
Expand Up @@ -30,33 +30,12 @@ res := OpenModelica.Scripting.compareSimulationResults("Modelica.Utilities.Examp
// ""
// true
// ""
// true
// ""
// Not possible to open file "C:/Projekte/OpenModelica/testsuite/simulation/libraries/msl32/modelica:/Modelica/Resources/Data/Utilities/Examples_readRealParameters.txt" for reading:
// Invalid argument
// Not possible to open file "C:/Projekte/OpenModelica/testsuite/simulation/libraries/msl32/modelica:/Modelica/Resources/Data/Utilities/Examples_readRealParameters.txt" for reading:
// Invalid argument
// Not possible to open file "C:/Projekte/OpenModelica/testsuite/simulation/libraries/msl32/modelica:/Modelica/Resources/Data/Utilities/Examples_readRealParameters.txt" for reading:
// Invalid argument
// Not possible to open file "C:/Projekte/OpenModelica/testsuite/simulation/libraries/msl32/modelica:/Modelica/Resources/Data/Utilities/Examples_readRealParameters.txt" for reading:
// Invalid argument
// Not possible to open file "C:/Projekte/OpenModelica/testsuite/simulation/libraries/msl32/modelica:/Modelica/Resources/Data/Utilities/Examples_readRealParameters.txt" for reading:
// Invalid argument
// Not possible to open file "C:/Projekte/OpenModelica/testsuite/simulation/libraries/msl32/modelica:/Modelica/Resources/Data/Utilities/Examples_readRealParameters.txt" for reading:
// Invalid argument
// Not possible to open file "C:/Projekte/OpenModelica/testsuite/simulation/libraries/msl32/modelica:/Modelica/Resources/Data/Utilities/Examples_readRealParameters.txt" for reading:
// Invalid argument
// Not possible to open file "C:/Projekte/OpenModelica/testsuite/simulation/libraries/msl32/modelica:/Modelica/Resources/Data/Utilities/Examples_readRealParameters.txt" for reading:
// Invalid argument
// Not possible to open file "C:/Projekte/OpenModelica/testsuite/simulation/libraries/msl32/modelica:/Modelica/Resources/Data/Utilities/Examples_readRealParameters.txt" for reading:
// Invalid argument
// record SimulationResult
// resultFile = "",
// simulationOptions = "startTime = 0.0, stopTime = 1.01, numberOfIntervals = 500, tolerance = 0.000001, method = 'dassl', fileNamePrefix = 'Modelica.Utilities.Examples.readRealParameterModel', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = "Simulation execution failed for model: Modelica.Utilities.Examples.readRealParameterModel
// File too large"
// resultFile = "Modelica.Utilities.Examples.readRealParameterModel_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.01, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica.Utilities.Examples.readRealParameterModel', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// "Error: File too large to fit into a MetaModelica string: output.log.
// "
// "Error opening file: Modelica.Utilities.Examples.readRealParameterModel_res.mat"
// ""
// {"Files Equal!"}
// ""
// endResult
67 changes: 67 additions & 0 deletions openmodelica/cppruntime/recordTupleReturnTest.mos
@@ -0,0 +1,67 @@
// name: recordTupleReturnTest
// keywords: return tuple record array
// status: correct
// teardown_command: rm -f *RecordTupleReturn*

setCommandLineOptions("+simCodeTarget=Cpp");

loadModel(Modelica);
loadString("
model RecordTupleReturn
record R // record with array member
Real u;
Real[3] a;
end R;

function f // return two values, one of them a record
input Real u;
output Real y;
output R r;
algorithm
y := 2*u;
r.u := u;
r.a := {1, 2, 3};
end f;

function g // process tuple return with record in a function
input Real u;
output Real y;
output R r;
protected
R r2;
algorithm
(y, r2) := f(u);
r.u := r2.u;
r.a := u*r2.a;
end g;

model Test // process tuple return with a record in a model
input Real u = 0; // prevent presolving
Real y;
R r;
equation
(y, r) = g(u + 1);
end Test;
end RecordTupleReturn;
");
getErrorString();

simulate(RecordTupleReturn.Test);
val(y, 0);
val(r.a[3], 0);
getErrorString();

// Result:
// true
// true
// true
// ""
// record SimulationResult
// resultFile = "RecordTupleReturn.Test_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'RecordTupleReturn.Test', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// 2.0
// 3.0
// ""
// endResult
1 change: 1 addition & 0 deletions openmodelica/cppruntime/solveTest.mos
Expand Up @@ -36,3 +36,4 @@ getErrorString();
// -3.5
// 4.0
// ""
// endResult
Expand Up @@ -416,7 +416,7 @@ readFile("testModel_info.xml");getErrorString();
// <info file=\"\" lineStart=\"0\" lineEnd=\"0\" colStart=\"0\" colEnd=\"0\"/>
// </source>
// </variable>
// <variable name=\"L\" comment=\"\" variability = \"parameter\" isDiscrete = \"false\">
// <variable name=\"L\" comment=\"\" variability = \"parameter\" isDiscrete = \"true\">
// <Real useStart=\"true\" start=\"1.0\" fixed=\"true\" useNominal=\"false\" />
// <source>
// <info file=\"&lt;interactive&gt;\" lineStart=\"7\" lineEnd=\"7\" colStart=\"3\" colEnd=\"21\"/>
Expand All @@ -434,7 +434,7 @@ readFile("testModel_info.xml");getErrorString();
// <type>Real</type>
// </source>
// </variable>
// <variable name=\"a\" comment=\"\" variability = \"parameter\" isDiscrete = \"false\">
// <variable name=\"a\" comment=\"\" variability = \"parameter\" isDiscrete = \"true\">
// <Real useStart=\"true\" start=\"0.7\" fixed=\"true\" useNominal=\"false\" />
// <source>
// <info file=\"&lt;interactive&gt;\" lineStart=\"3\" lineEnd=\"3\" colStart=\"3\" colEnd=\"23\"/>
Expand All @@ -452,7 +452,7 @@ readFile("testModel_info.xml");getErrorString();
// <type>Real</type>
// </source>
// </variable>
// <variable name=\"b\" comment=\"\" variability = \"parameter\" isDiscrete = \"false\">
// <variable name=\"b\" comment=\"\" variability = \"parameter\" isDiscrete = \"true\">
// <Real useStart=\"false\" fixed=\"true\" useNominal=\"false\" />
// <source>
// <info file=\"&lt;interactive&gt;\" lineStart=\"4\" lineEnd=\"4\" colStart=\"3\" colEnd=\"23\"/>
Expand All @@ -470,7 +470,7 @@ readFile("testModel_info.xml");getErrorString();
// <type>Real</type>
// </source>
// </variable>
// <variable name=\"g\" comment=\"\" variability = \"parameter\" isDiscrete = \"false\">
// <variable name=\"g\" comment=\"\" variability = \"parameter\" isDiscrete = \"true\">
// <Real useStart=\"true\" start=\"9.82\" fixed=\"true\" useNominal=\"false\" />
// <source>
// <info file=\"&lt;interactive&gt;\" lineStart=\"6\" lineEnd=\"6\" colStart=\"3\" colEnd=\"24\"/>
Expand All @@ -488,7 +488,7 @@ readFile("testModel_info.xml");getErrorString();
// <type>Real</type>
// </source>
// </variable>
// <variable name=\"m\" comment=\"\" variability = \"parameter\" isDiscrete = \"false\">
// <variable name=\"m\" comment=\"\" variability = \"parameter\" isDiscrete = \"true\">
// <Real useStart=\"true\" start=\"0.5\" fixed=\"true\" useNominal=\"false\" />
// <source>
// <info file=\"&lt;interactive&gt;\" lineStart=\"5\" lineEnd=\"5\" colStart=\"3\" colEnd=\"23\"/>
Expand Down
Expand Up @@ -110,7 +110,7 @@ readFile("testParameters_init.tmp.xml");
// <ScalarVariable
// name = \"a\"
// valueReference = \"1002\"
// variability = \"parameter\" isDiscrete = \"false\"
// variability = \"parameter\" isDiscrete = \"true\"
// causality = \"internal\" isValueChangeable = \"true\"
// alias = \"noAlias\"
// classIndex = \"0\" classType = \"rPar\"
Expand All @@ -121,7 +121,7 @@ readFile("testParameters_init.tmp.xml");
// <ScalarVariable
// name = \"a0\"
// valueReference = \"1003\"
// variability = \"parameter\" isDiscrete = \"false\"
// variability = \"parameter\" isDiscrete = \"true\"
// causality = \"internal\" isValueChangeable = \"true\"
// alias = \"noAlias\"
// classIndex = \"1\" classType = \"rPar\"
Expand All @@ -132,7 +132,7 @@ readFile("testParameters_init.tmp.xml");
// <ScalarVariable
// name = \"b\"
// valueReference = \"1004\"
// variability = \"parameter\" isDiscrete = \"false\"
// variability = \"parameter\" isDiscrete = \"true\"
// causality = \"internal\" isValueChangeable = \"false\"
// alias = \"noAlias\"
// classIndex = \"2\" classType = \"rPar\"
Expand All @@ -143,7 +143,7 @@ readFile("testParameters_init.tmp.xml");
// <ScalarVariable
// name = \"c\"
// valueReference = \"1005\"
// variability = \"parameter\" isDiscrete = \"false\"
// variability = \"parameter\" isDiscrete = \"true\"
// causality = \"internal\" isValueChangeable = \"false\"
// alias = \"noAlias\"
// classIndex = \"3\" classType = \"rPar\"
Expand All @@ -154,7 +154,7 @@ readFile("testParameters_init.tmp.xml");
// <ScalarVariable
// name = \"d\"
// valueReference = \"1006\"
// variability = \"parameter\" isDiscrete = \"false\"
// variability = \"parameter\" isDiscrete = \"true\"
// causality = \"internal\" isValueChangeable = \"false\"
// alias = \"noAlias\"
// classIndex = \"4\" classType = \"rPar\"
Expand Down

0 comments on commit 0f4a303

Please sign in to comment.