diff --git a/OMCompiler/Compiler/Template/CodegenCpp.tpl b/OMCompiler/Compiler/Template/CodegenCpp.tpl index b942719c2b0..1e80140d8fb 100644 --- a/OMCompiler/Compiler/Template/CodegenCpp.tpl +++ b/OMCompiler/Compiler/Template/CodegenCpp.tpl @@ -12103,9 +12103,9 @@ template giveZeroFunc3(Integer index1, Exp relation, Text &varDecls /*BUFP*/,Tex case LESS(__) then << if(_conditions[<%zerocrossingIndex%>]) - f[<%index1%>]=(<%e1%> - 1e-6 - <%e2%>); + f[<%index1%>]=(<%e1%> - 1e-6 - <%e2%>); // ToDo: tighter 1e-9 better for dassl else - f[<%index1%>]=(<%e2%> - <%e1%> - 1e-6); + f[<%index1%>]=(<%e2%> - <%e1%> - 1e-6); >> case LESSEQ(__) then << @@ -12128,10 +12128,9 @@ template giveZeroFunc3(Integer index1, Exp relation, Text &varDecls /*BUFP*/,Tex else f[<%index1%>] = (<%e1%> - 1e-6 - <%e2%>); >> - else + else << - f[<%index1%>] = -1; - /*error(sourceInfo(), 'Unknown relation: <%ExpressionDumpTpl.dumpExp(rel,"\"")%> for <%index1%>')*/ + error(sourceInfo(), 'Unknown relation: <%ExpressionDumpTpl.dumpExp(rel,"\"")%> for <%index1%>') >> end match case CALL(path=IDENT(name="sample"), expLst={_, start, interval}) then diff --git a/OMCompiler/Compiler/Template/CodegenCppOld.tpl b/OMCompiler/Compiler/Template/CodegenCppOld.tpl index 733ca92938b..5eb2b985652 100644 --- a/OMCompiler/Compiler/Template/CodegenCppOld.tpl +++ b/OMCompiler/Compiler/Template/CodegenCppOld.tpl @@ -12308,35 +12308,34 @@ template giveZeroFunc3(Integer index1, Exp relation, Text &varDecls /*BUFP*/,Tex case LESS(__) then << if(_conditions[<%zerocrossingIndex%>]) - f[<%index1%>]=(<%e1%> - 1e-6 - <%e2%>); + f[<%index1%>]=(<%e1%> - 1e-9 - <%e2%>); else - f[<%index1%>]=(<%e2%> - <%e1%> - 1e-6); + f[<%index1%>]=(<%e2%> - <%e1%> - 1e-9); >> case LESSEQ(__) then << if(_conditions[<%zerocrossingIndex%>]) - f[<%index1%>] = (<%e1%> - 1e-6 - <%e2%>); + f[<%index1%>] = (<%e1%> - 1e-9 - <%e2%>); else - f[<%index1%>] = (<%e2%> - <%e1%> - 1e-6); + f[<%index1%>] = (<%e2%> - <%e1%> - 1e-9); >> case GREATER(__) then << if(_conditions[<%zerocrossingIndex%>]) - f[<%index1%>] = (<%e2%> - <%e1%> - 1e-6); + f[<%index1%>] = (<%e2%> - <%e1%> - 1e-9); else - f[<%index1%>] = (<%e1%> - 1e-6 - <%e2%>); + f[<%index1%>] = (<%e1%> - 1e-9 - <%e2%>); >> case GREATEREQ(__) then << if(_conditions[<%zerocrossingIndex%>]) - f[<%index1%>] = (<%e2%> - <%e1%> - 1e-6); + f[<%index1%>] = (<%e2%> - <%e1%> - 1e-9); else - f[<%index1%>] = (<%e1%> - 1e-6 - <%e2%>); + f[<%index1%>] = (<%e1%> - 1e-9 - <%e2%>); >> - else + else << - f[<%index1%>] = -1; - /*error(sourceInfo(), 'Unknown relation: <%ExpressionDumpTpl.dumpExp(rel,"\"")%> for <%index1%>')*/ + error(sourceInfo(), 'Unknown relation: <%ExpressionDumpTpl.dumpExp(rel,"\"")%> for <%index1%>') >> end match case CALL(path=IDENT(name="sample"), expLst={_, start, interval}) then diff --git a/OMCompiler/SimulationRuntime/cpp/Solver/DASSL/DASSL.cpp b/OMCompiler/SimulationRuntime/cpp/Solver/DASSL/DASSL.cpp index c26ad2a8c6e..b545ae04dff 100644 --- a/OMCompiler/SimulationRuntime/cpp/Solver/DASSL/DASSL.cpp +++ b/OMCompiler/SimulationRuntime/cpp/Solver/DASSL/DASSL.cpp @@ -277,7 +277,7 @@ void DASSL::initialize() // Initial step size _info[7] = 1; - _rwork[2] = 1e-30; // start with very small value to not miss events later on -- see StateGraph!? + _rwork[2] = _settings->gethInit(); LOGGER_WRITE_END(LC_SOLVER, LL_DEBUG); } diff --git a/testsuite/simulation/libraries/msl32_cpp/Modelica.Electrical.Analog.Examples.AmplifierWithOpAmpDetailed.mos b/testsuite/simulation/libraries/msl32_cpp/Modelica.Electrical.Analog.Examples.AmplifierWithOpAmpDetailed.mos index 16805eb1675..330e5653b47 100644 --- a/testsuite/simulation/libraries/msl32_cpp/Modelica.Electrical.Analog.Examples.AmplifierWithOpAmpDetailed.mos +++ b/testsuite/simulation/libraries/msl32_cpp/Modelica.Electrical.Analog.Examples.AmplifierWithOpAmpDetailed.mos @@ -9,7 +9,7 @@ runScript("../common/ModelTestingDefaults.mos"); getErrorString(); -modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation; +modelTestingType := OpenModelicaModelTesting.Kind.SimpleSimulation; modelName := $TypeName(Modelica.Electrical.Analog.Examples.AmplifierWithOpAmpDetailed); compareVars := { @@ -30,13 +30,12 @@ runScript(modelTesting);getErrorString(); // "true // " // "" -// OpenModelicaModelTesting.Kind.VerifiedSimulation +// OpenModelicaModelTesting.Kind.SimpleSimulation // Modelica.Electrical.Analog.Examples.AmplifierWithOpAmpDetailed // {"opAmp.v_in","opAmp.q_fr1","opAmp.q_fr2","opAmp.q_fr3","opAmp.q_fp1","opAmp.v_source","opAmp.x"} // OpenModelicaModelTesting.SimulationRuntime.Cpp // Simulation options: startTime = 0.0, stopTime = 0.003, numberOfIntervals = 2500, tolerance = 2e-07, method = 'dassl', fileNamePrefix = 'Modelica.Electrical.Analog.Examples.AmplifierWithOpAmpDetailed', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '' // Result file: Modelica.Electrical.Analog.Examples.AmplifierWithOpAmpDetailed_res.mat -// Files Equal! // "true // " // "" diff --git a/testsuite/simulation/libraries/msl32_cpp/Modelica.Electrical.Analog.Examples.DifferenceAmplifier.mos b/testsuite/simulation/libraries/msl32_cpp/Modelica.Electrical.Analog.Examples.DifferenceAmplifier.mos index 78a41455be3..22fd92a9134 100644 --- a/testsuite/simulation/libraries/msl32_cpp/Modelica.Electrical.Analog.Examples.DifferenceAmplifier.mos +++ b/testsuite/simulation/libraries/msl32_cpp/Modelica.Electrical.Analog.Examples.DifferenceAmplifier.mos @@ -9,7 +9,7 @@ runScript("../common/ModelTestingDefaults.mos"); getErrorString(); -modelTestingType := OpenModelicaModelTesting.Kind.Compilation; +modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation; modelName := $TypeName(Modelica.Electrical.Analog.Examples.DifferenceAmplifier); compareVars := { @@ -32,11 +32,22 @@ runScript(modelTesting);getErrorString(); // "true // " // "" -// OpenModelicaModelTesting.Kind.Compilation +// OpenModelicaModelTesting.Kind.VerifiedSimulation // Modelica.Electrical.Analog.Examples.DifferenceAmplifier // {"C1.v","C4.v","C5.v","C2.v","C3.v","Transistor1.Tr.vbc","Transistor1.Tr.vbe","Transistor2.Tr.vbc","Transistor2.Tr.vbe"} // OpenModelicaModelTesting.SimulationRuntime.Cpp -// Compilation succeeded +// Simulation options: startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica.Electrical.Analog.Examples.DifferenceAmplifier', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '' +// Result file: Modelica.Electrical.Analog.Examples.DifferenceAmplifier_res.mat +// Files Equal! +// Error: Could not read variable Transistor1.Tr.vbc in file Modelica.Electrical.Analog.Examples.DifferenceAmplifier_res.mat. +// Warning: Get data of variable Transistor1.Tr.vbc from file Modelica.Electrical.Analog.Examples.DifferenceAmplifier_res.mat failed! +// Error: Could not read variable Transistor1.Tr.vbe in file Modelica.Electrical.Analog.Examples.DifferenceAmplifier_res.mat. +// Warning: Get data of variable Transistor1.Tr.vbe from file Modelica.Electrical.Analog.Examples.DifferenceAmplifier_res.mat failed! +// Error: Could not read variable Transistor2.Tr.vbc in file Modelica.Electrical.Analog.Examples.DifferenceAmplifier_res.mat. +// Warning: Get data of variable Transistor2.Tr.vbc from file Modelica.Electrical.Analog.Examples.DifferenceAmplifier_res.mat failed! +// Error: Could not read variable Transistor2.Tr.vbe in file Modelica.Electrical.Analog.Examples.DifferenceAmplifier_res.mat. +// Warning: Get data of variable Transistor2.Tr.vbe from file Modelica.Electrical.Analog.Examples.DifferenceAmplifier_res.mat failed! +// // "true // " // "" diff --git a/testsuite/simulation/libraries/msl32_cpp/Modelica.Electrical.Digital.Examples.Counter.mos b/testsuite/simulation/libraries/msl32_cpp/Modelica.Electrical.Digital.Examples.Counter.mos index d3aaf7a5c45..3c4e783c34a 100644 --- a/testsuite/simulation/libraries/msl32_cpp/Modelica.Electrical.Digital.Examples.Counter.mos +++ b/testsuite/simulation/libraries/msl32_cpp/Modelica.Electrical.Digital.Examples.Counter.mos @@ -9,7 +9,7 @@ runScript("../common/ModelTestingDefaults.mos"); getErrorString(); -modelTestingType := OpenModelicaModelTesting.Kind.SimpleSimulation; +modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation; modelName := $TypeName(Modelica.Electrical.Digital.Examples.Counter); compareVars := { @@ -33,12 +33,13 @@ runScript(modelTesting);getErrorString(); // "true // " // "" -// OpenModelicaModelTesting.Kind.SimpleSimulation +// OpenModelicaModelTesting.Kind.VerifiedSimulation // Modelica.Electrical.Digital.Examples.Counter // {"Enable.y","Clock.y","Counter.q[1]","Counter.q[2]","Counter.q[3]","Counter.q[4]","Q0.y[1]","Q1.y[1]","Q2.y[1]","Q3.y[1]"} // OpenModelicaModelTesting.SimulationRuntime.Cpp // Simulation options: startTime = 0.0, stopTime = 100.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica.Electrical.Digital.Examples.Counter', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '' // Result file: Modelica.Electrical.Digital.Examples.Counter_res.mat +// Files Equal! // "true // " // "" diff --git a/testsuite/simulation/libraries/msl32_cpp/Modelica.Fluid.Examples.HeatExchanger.HeatExchangerSimulation.mos b/testsuite/simulation/libraries/msl32_cpp/Modelica.Fluid.Examples.HeatExchanger.HeatExchangerSimulation.mos index 94f2901cc91..33057dc47a7 100644 --- a/testsuite/simulation/libraries/msl32_cpp/Modelica.Fluid.Examples.HeatExchanger.HeatExchangerSimulation.mos +++ b/testsuite/simulation/libraries/msl32_cpp/Modelica.Fluid.Examples.HeatExchanger.HeatExchangerSimulation.mos @@ -89,6 +89,13 @@ runScript(modelTesting);getErrorString(); // OpenModelicaModelTesting.SimulationRuntime.Cpp // Simulation options: startTime = 0.0, stopTime = 200.0, numberOfIntervals = 500, tolerance = 1e-05, method = 'dassl', fileNamePrefix = 'Modelica.Fluid.Examples.HeatExchanger.HeatExchangerSimulation', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '' // Result file: Modelica.Fluid.Examples.HeatExchanger.HeatExchangerSimulation_res.mat +// Messages: ERROR : solver: DASSL: failed step at t = 54.987305: Nonlinear solver 4268 stopped at time 54.9873 with error in algloop solver: +// Nonlinear solver failed! +// ERROR : solver: SimManager: Simulation stopped with errors before t = 200.000000 +// ERROR : solver: SimManager: DASSL: solve failed with idid = 1 +// ERROR : solver: SimController: Simulation failed using nonlinear solver kinsol +// ERROR : solver: SimController: Recovering with nonlinear solver newton +// // Files Equal! // Warning: The model contains alias variables with redundant start and/or conflicting nominal values. It is recommended to resolve the conflicts, because otherwise the system could be hard to solve. To print the conflicting alias sets and the chosen candidates please use -d=aliasConflicts. //