From 53a0dfdf81d5e0f3e015e34d58ffd8936a3ae9b5 Mon Sep 17 00:00:00 2001 From: Willi Braun Date: Thu, 13 Dec 2018 17:25:40 +0100 Subject: [PATCH] [BE] adjust daeMode flag Belonging to [master]: - OpenModelica/OMCompiler#2831 - OpenModelica/OpenModelica-testsuite#1090 --- Compiler/Script/CevalScriptBackend.mo | 4 ++-- Compiler/Template/CodegenC.tpl | 4 ++-- Compiler/Util/Flags.mo | 10 +++------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Compiler/Script/CevalScriptBackend.mo b/Compiler/Script/CevalScriptBackend.mo index bf73ab703d..8ace7832ff 100644 --- a/Compiler/Script/CevalScriptBackend.mo +++ b/Compiler/Script/CevalScriptBackend.mo @@ -468,7 +468,7 @@ algorithm GlobalScript.SIMULATION_OPTIONS(startTime, stopTime, numberOfIntervals, stepSize, tolerance, method, _, options, outputFormat, variableFilter, cflags, simflags) := inSimOpt; if UseOtimica then method := DAE.SCONST("optimization"); - elseif Flags.getConfigEnum(Flags.DAE_MODE) > 1 then + elseif Flags.getConfigBool(Flags.DAE_MODE) then method := DAE.SCONST("ida"); end if; numberOfIntervals := if UseOtimica then DAE.ICONST(50) else numberOfIntervals; @@ -3331,7 +3331,7 @@ protected function callTranslateModel output String outFileDir; output list> resultValues; algorithm - if Flags.getConfigEnum(Flags.DAE_MODE) > 1 then + if Flags.getConfigBool(Flags.DAE_MODE) then (outCache, outStringLst, outFileDir, resultValues) := SimCodeMain.translateModelDAEMode(inCache,inEnv,className,inFileNamePrefix, inSimSettingsOpt,Absyn.FUNCTIONARGS({},{})); diff --git a/Compiler/Template/CodegenC.tpl b/Compiler/Template/CodegenC.tpl index 011336f919..8ff144ad4d 100644 --- a/Compiler/Template/CodegenC.tpl +++ b/Compiler/Template/CodegenC.tpl @@ -1162,7 +1162,7 @@ template simulationFile(SimCode simCode, String guid, String isModelExchangeFMU) data.modelData = &modelData; data.simulationInfo = &simInfo; measure_time_flag = <% if profileHtml() then "5" else if profileSome() then "1" else if profileAll() then "2" else "0" /* Would be good if this was not a global variable...*/ %>; - compiledInDAEMode = <%intSub(Flags.getConfigEnum(Flags.DAE_MODE), 1)%>; + compiledInDAEMode = <% if Flags.getConfigBool(Flags.DAE_MODE) then 1 else 0%>; compiledWithSymSolver = <% intSub(Flags.getConfigEnum(Flags.SYM_SOLVER), 0) %>; <%mainInit%> <%mainTop(mainBody,"https://trac.openmodelica.org/OpenModelica/newticket")%> @@ -1189,7 +1189,7 @@ end simulationFile; template simulationFileHeader(String fileNamePrefix) "Generates header part of simulation file." ::= - let daeHeader = if intGt(Flags.getConfigEnum(Flags.DAE_MODE), 1) then '#include "<%fileNamePrefix%>_16dae.h"' + let daeHeader = if Flags.getConfigBool(Flags.DAE_MODE) then '#include "<%fileNamePrefix%>_16dae.h"' << #include "<%fileNamePrefix%>_model.h" <%daeHeader%> diff --git a/Compiler/Util/Flags.mo b/Compiler/Util/Flags.mo index 1da9d96ee7..787481eb35 100644 --- a/Compiler/Util/Flags.mo +++ b/Compiler/Util/Flags.mo @@ -1336,13 +1336,9 @@ constant ConfigFlag CT_STATE_MACHINES = CONFIG_FLAG(94, "ctStateMachines", Util.gettext("Experimental: Enable continuous-time state machine prototype")); constant ConfigFlag DAE_MODE = CONFIG_FLAG(95, "daeMode", - NONE(), EXTERNAL(), ENUM_FLAG(1, {("none", 1), ("all",2), ("dynamic",3), ("new",4)}), - SOME(STRING_OPTION({"none", "all", "dynamic"})), - Util.gettext("Generates additional code for DAE mode, where the equations are not causelized, when one of the following option is selected:\n"+ - "all : In this mode all equations are passed to the integrator.\n"+ - "dynamic : In this mode only the equation for the dynamic part of the system are passed to the integrator."+ - "new : This option enables the new daeMode. Currently alpha development status.\n") -); + NONE(), EXTERNAL(), BOOL_FLAG(false), NONE(), + Util.gettext("Generates code to simulate models in DAE mode. The whole system is passed directly to the DAE solver"+ + "SUNDIALS/IDA and no algebraic solver are involed for the simulation process.")); constant ConfigFlag INLINE_METHOD = CONFIG_FLAG(96, "inlineMethod", NONE(), EXTERNAL(), ENUM_FLAG(1, {("replace",1), ("append",2)}),