Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit f7f4c35

Browse files
Willi BraunOpenModelica-Hudson
authored andcommitted
[DAEmode] get rid of the old implementation
- the new one is further developed anyway - make ida as default solver if DAE mode is chosen - mark simulation flag -daeMode as deprecated Belonging to [master]: - #2302 - OpenModelica/OpenModelica-testsuite#890
1 parent 05a951b commit f7f4c35

File tree

7 files changed

+27
-845
lines changed

7 files changed

+27
-845
lines changed

Compiler/BackEnd/BackendDAEUtil.mo

Lines changed: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -7271,130 +7271,6 @@ algorithm
72717271
//fcall2(Flags.DUMP_EQNINORDER, BackendDump.dumpEqnsSolved, outDAE, "system for jacobians");
72727272
end getSolvedSystemforJacobians;
72737273

7274-
public function getOptimizesDAEModeSystem
7275-
"Run the equation system pipeline."
7276-
input BackendDAE.BackendDAE inDAE;
7277-
input String fileNamePrefix;
7278-
input Option<list<String>> strPreOptModules = NONE();
7279-
input Option<String> strmatchingAlgorithm = NONE();
7280-
input Option<String> strdaeHandler = NONE();
7281-
input Option<list<String>> strPostOptModules = NONE();
7282-
output BackendDAE.BackendDAE outSimDAE;
7283-
output BackendDAE.BackendDAE outInitDAE;
7284-
output Option<BackendDAE.InlineData > outInlineData;
7285-
output list<BackendDAE.Equation> outRemovedInitialEquationLst;
7286-
protected
7287-
BackendDAE.BackendDAE dae, simDAE;
7288-
list<tuple<BackendDAEFunc.optimizationModule, String>> preOptModules;
7289-
list<tuple<BackendDAEFunc.optimizationModule, String>> postOptModules;
7290-
tuple<BackendDAEFunc.StructurallySingularSystemHandlerFunc, String, BackendDAEFunc.stateDeselectionFunc, String> daeHandler;
7291-
tuple<BackendDAEFunc.matchingAlgorithmFunc, String> matchingAlgorithm;
7292-
BackendDAE.InlineData inlineData;
7293-
BackendDAE.Variables globalKnownVars;
7294-
Integer numCheckpoints;
7295-
DAE.FunctionTree funcTree;
7296-
algorithm
7297-
numCheckpoints:=ErrorExt.getNumCheckpoints();
7298-
try
7299-
StackOverflow.clearStacktraceMessages();
7300-
preOptModules := getPreOptModules(strPreOptModules);
7301-
postOptModules := getPostOptModules(strPostOptModules);
7302-
matchingAlgorithm := getMatchingAlgorithm(strmatchingAlgorithm);
7303-
daeHandler := getIndexReductionMethod(strdaeHandler);
7304-
7305-
if Flags.isSet(Flags.DUMP_DAE_LOW) then
7306-
BackendDump.dumpBackendDAE(inDAE, "dumpdaelow");
7307-
if Flags.isSet(Flags.ADDITIONAL_GRAPHVIZ_DUMP) then
7308-
BackendDump.graphvizIncidenceMatrix(inDAE, "dumpdaelow");
7309-
end if;
7310-
end if;
7311-
7312-
// pre-optimization phase
7313-
dae := preOptimizeDAE(inDAE, preOptModules);
7314-
7315-
execStat("pre-optimization done (n="+String(daeSize(dae))+")");
7316-
// transformation phase (matching and sorting using index reduction method)
7317-
dae := causalizeDAE(dae, NONE(), matchingAlgorithm, daeHandler, true);
7318-
execStat("matching and sorting (n="+String(daeSize(dae))+")");
7319-
7320-
// synchronous features post-phase
7321-
dae := SynchronousFeatures.synchronousFeatures(dae);
7322-
if Flags.isSet(Flags.OPT_DAE_DUMP) then
7323-
BackendDump.dumpBackendDAE(dae, "synchronousFeatures");
7324-
end if;
7325-
7326-
if Flags.isSet(Flags.GRAPHML) then
7327-
BackendDump.dumpBipartiteGraphDAE(dae, fileNamePrefix);
7328-
end if;
7329-
7330-
if Flags.isSet(Flags.BLT_DUMP) then
7331-
BackendDump.bltdump("bltdump", dae);
7332-
end if;
7333-
7334-
if Flags.isSet(Flags.EVAL_OUTPUT_ONLY) then
7335-
// prepare the equations
7336-
dae := BackendDAEOptimize.evaluateOutputsOnly(dae);
7337-
end if;
7338-
7339-
// generate system for initialization
7340-
(outInitDAE, _, outRemovedInitialEquationLst, globalKnownVars) := Initialization.solveInitialSystem(dae);
7341-
7342-
// use function tree from initDAE further for simDAE
7343-
simDAE := BackendDAEUtil.setFunctionTree(dae, BackendDAEUtil.getFunctions(outInitDAE.shared));
7344-
7345-
// Set updated globalKnownVars
7346-
simDAE := setDAEGlobalKnownVars(simDAE, globalKnownVars);
7347-
7348-
simDAE := BackendDAEOptimize.addInitialStmtsToAlgorithms(simDAE, false);
7349-
simDAE := Initialization.removeInitializationStuff(simDAE);
7350-
7351-
// generate inline solver
7352-
outInlineData := SymbolicImplicitSolver.symSolver(simDAE);
7353-
7354-
// post-optimization phase
7355-
simDAE := postOptimizeDAE(simDAE, postOptModules, matchingAlgorithm, daeHandler);
7356-
7357-
// sort the globalKnownVars
7358-
simDAE := sortGlobalKnownVarsInDAE(simDAE);
7359-
execStat("sort global known variables");
7360-
7361-
// remove unused functions
7362-
funcTree := BackendDAEOptimize.copyRecordConstructorAndExternalObjConstructorDestructor(BackendDAEUtil.getFunctions(simDAE.shared));
7363-
funcTree := BackendDAEOptimize.removeUnusedFunctions(outInitDAE.eqs, outInitDAE.shared, outRemovedInitialEquationLst, BackendDAEUtil.getFunctions(simDAE.shared), funcTree);
7364-
funcTree := BackendDAEOptimize.removeUnusedFunctions(simDAE.eqs, simDAE.shared, {}, BackendDAEUtil.getFunctions(simDAE.shared), funcTree);
7365-
outSimDAE := BackendDAEUtil.setFunctionTree(simDAE, funcTree);
7366-
execStat("remove unused functions");
7367-
7368-
if Flags.isSet(Flags.DUMP_INDX_DAE) then
7369-
BackendDump.dumpBackendDAE(outSimDAE, "dumpindxdae");
7370-
if Flags.isSet(Flags.ADDITIONAL_GRAPHVIZ_DUMP) then
7371-
BackendDump.graphvizBackendDAE(outSimDAE, "dumpindxdae");
7372-
end if;
7373-
end if;
7374-
if Flags.isSet(Flags.DUMP_TRANSFORMED_MODELICA_MODEL) then
7375-
BackendDump.dumpBackendDAEToModelica(outSimDAE, "dumpindxdae");
7376-
end if;
7377-
if Flags.isSet(Flags.DUMP_BACKENDDAE_INFO) or Flags.isSet(Flags.DUMP_STATESELECTION_INFO) or Flags.isSet(Flags.DUMP_DISCRETEVARS_INFO) then
7378-
BackendDump.dumpCompShort(outSimDAE);
7379-
end if;
7380-
if Flags.isSet(Flags.DUMP_EQNINORDER) then
7381-
BackendDump.dumpEqnsSolved(outSimDAE, "indxdae: eqns in order");
7382-
end if;
7383-
if Flags.isSet(Flags.DUMP_LOOPS) then
7384-
BackendDump.dumpLoops(outSimDAE);
7385-
end if;
7386-
checkBackendDAEWithErrorMsg(outSimDAE);
7387-
return;
7388-
else
7389-
setGlobalRoot(Global.stackoverFlowIndex, NONE());
7390-
ErrorExt.rollbackNumCheckpoints(ErrorExt.getNumCheckpoints()-numCheckpoints);
7391-
Error.addInternalError("Stack overflow in "+getInstanceName()+"...\n"+stringDelimitList(StackOverflow.readableStacktraceMessages(), "\n"), sourceInfo());
7392-
/* Do not fail or we can loop too much */
7393-
StackOverflow.clearStacktraceMessages();
7394-
end try annotation(__OpenModelica_stackOverflowCheckpoint=true);
7395-
fail();
7396-
end getOptimizesDAEModeSystem;
7397-
73987274
public function sortGlobalKnownVarsInDAE "
73997275
author: ptaeuber
74007276
This function sorts the globalKnownVars"

Compiler/Script/CevalScriptBackend.mo

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,11 @@ protected
466466
algorithm
467467
UseOtimica := Config.acceptOptimicaGrammar() or Flags.getConfigBool(Flags.GENERATE_DYN_OPTIMIZATION_PROBLEM);
468468
GlobalScript.SIMULATION_OPTIONS(startTime, stopTime, numberOfIntervals, stepSize, tolerance, method, _, options, outputFormat, variableFilter, cflags, simflags) := inSimOpt;
469-
method := if UseOtimica then DAE.SCONST("optimization") else method;
469+
if UseOtimica then
470+
method := DAE.SCONST("optimization");
471+
elseif Flags.getConfigEnum(Flags.DAE_MODE) > 1 then
472+
method := DAE.SCONST("ida");
473+
end if;
470474
numberOfIntervals := if UseOtimica then DAE.ICONST(50) else numberOfIntervals;
471475
outSimOpt := GlobalScript.SIMULATION_OPTIONS(startTime, stopTime, numberOfIntervals, stepSize, tolerance, method, DAE.SCONST(inFileNamePrefix), options, outputFormat, variableFilter, cflags, simflags);
472476
end setFileNamePrefixInSimulationOptions;
@@ -3264,7 +3268,7 @@ protected function callTranslateModel
32643268
output String outFileDir;
32653269
output list<tuple<String,Values.Value>> resultValues;
32663270
algorithm
3267-
if Flags.getConfigEnum(Flags.DAE_MODE) > 3 then
3271+
if Flags.getConfigEnum(Flags.DAE_MODE) > 1 then
32683272
(outCache, outStringLst, outFileDir, resultValues) :=
32693273
SimCodeMain.translateModelDAEMode(inCache,inEnv,className,inFileNamePrefix,
32703274
inSimSettingsOpt,Absyn.FUNCTIONARGS({},{}));

0 commit comments

Comments
 (0)