Skip to content

Commit 7135e1c

Browse files
author
Volker Waurich
committed
- add initial equations for duplicated tasks
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@21006 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 368966f commit 7135e1c

File tree

3 files changed

+135
-69
lines changed

3 files changed

+135
-69
lines changed

Compiler/BackEnd/BackendVarTransform.mo

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,24 @@ algorithm
12061206
end matchcontinue;
12071207
end replaceExp;
12081208

1209+
public function replaceCref"replaces a cref.
1210+
author: Waurich TUD 2014-06"
1211+
input DAE.ComponentRef crefIn;
1212+
input VariableReplacements replIn;
1213+
output DAE.ComponentRef crefOut;
1214+
output Boolean changedOut;
1215+
algorithm
1216+
(crefOut,changedOut) := matchcontinue(crefIn,replIn)
1217+
case(_,_)
1218+
equation
1219+
true = hasReplacement(replIn,crefIn);
1220+
DAE.CREF(componentRef=crefOut) = getReplacement(replIn,crefIn);
1221+
then (crefOut,true);
1222+
else
1223+
then (crefIn,false);
1224+
end matchcontinue;
1225+
end replaceCref;
1226+
12091227
protected function replaceCrefSubs
12101228
input DAE.ComponentRef inCref;
12111229
input VariableReplacements repl;

Compiler/BackEnd/HpcOmScheduler.mo

Lines changed: 55 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,15 +1680,15 @@ algorithm
16801680
HpcOmTaskGraph.TASKGRAPHMETA(inComps=inComps,varCompMapping=varCompMapping,eqCompMapping=eqCompMapping,rootNodes=rootNodes,nodeNames=nodeNames,nodeDescs=nodeDescs,exeCosts=exeCosts,commCosts=commCosts,nodeMark=nodeMark) = iTaskGraphMeta;
16811681

16821682
//dumping stuff-------------------------
1683-
print("the simEqSysts1: \n"+&stringDelimitList(List.map(odes,SimCodeUtil.dumpSimEqSystemLst),"\n")+&"\n");
1684-
SimCodeUtil.dumpVarLst(algVars,"algVars1");
1683+
print("simCode1 \n");
1684+
SimCodeUtil.dumpSimCode(iSimCode);
16851685
print("sccSimEqMap1\n");
16861686
HpcOmSimCodeMain.dumpSccSimEqMapping(iSccSimEqMapping);
16871687
print("inComps1\n");
16881688
HpcOmSimCodeMain.dumpSccSimEqMapping(inComps);
16891689
//--------------------------------------
16901690

1691-
// create new variables and equations for the duplicated tasks
1691+
// prepare everything in order to create new variables and equations for the duplicated tasks
16921692
sizeTasks = List.fold(List.map(clusters,listLength),intAdd,0);
16931693
taskAss = arrayCreate(sizeTasks,-1);
16941694
procAss = arrayCreate(listLength(clusters),{});
@@ -1697,34 +1697,25 @@ algorithm
16971697
taskDuplAss = arrayCreate(sizeTasks,-1); // the original task for every task (for not duplicated tasks, its itself)
16981698
threadTask = arrayCreate(numProc,{});
16991699
schedule = HpcOmSimCode.THREADSCHEDULE(threadTask,{});
1700-
duplSccSimEqMap = {};
1701-
duplComps = {};
1700+
duplSccSimEqMap = {}; // a list that is later appended to the sccSimEqMapping
1701+
duplComps = {}; // a list that is later appended to the inComps
17021702
threadIdx = 1;
1703-
compIdx = List.fold(List.flatten(arrayList(inComps)),intMax,0) +1;
1703+
compIdx = arrayLength(iSccSimEqMapping)+1; // the next available component index
17041704
taskIdx = arrayLength(iTaskGraph)+1;
1705-
simVarIdx = List.fold(List.map(algVars,SimCodeUtil.varIndex),intMax,0)+1;
1706-
simEqSysIdx = SimCodeUtil.getMaxSimEqSystemIndex(iSimCode)+1;
1707-
lsIdx = List.fold(List.map(List.flatten(odes),SimCodeUtil.getLSindex),intMax,0)+1;
1708-
nlsIdx = List.fold(List.map(List.flatten(odes),SimCodeUtil.getNLSindex),intMax,0)+1;
1709-
mIdx = List.fold(List.map(List.flatten(odes),SimCodeUtil.getMixedindex),intMax,0)+1;
1710-
1711-
print("TG before");
1712-
HpcOmTaskGraph.printTaskGraph(iTaskGraph);
1705+
simVarIdx = List.fold(List.map(algVars,SimCodeUtil.varIndex),intMax,0)+1;// the next available simVar index
1706+
simEqSysIdx = SimCodeUtil.getMaxSimEqSystemIndex(iSimCode)+1;// the next available simEqSys index
1707+
print("highest simEqSysIdx: "+&intString(simEqSysIdx)+&"\n");
1708+
lsIdx = List.fold(List.map(List.flatten(odes),SimCodeUtil.getLSindex),intMax,0)+1;// the next available linear system index
1709+
nlsIdx = List.fold(List.map(List.flatten(odes),SimCodeUtil.getNLSindex),intMax,0)+1;// the next available nonlinear system index
1710+
mIdx = List.fold(List.map(List.flatten(odes),SimCodeUtil.getMixedindex),intMax,0)+1;// the next available mixed system index
1711+
1712+
//traverse the clusters and duplicate tasks if needed
17131713
(taskAss,procAss,taskGraph,taskDuplAss,_,simCode,schedule,duplSccSimEqMap,duplComps) = createTDSduplicateTasks(clusters,taskAss,procAss,(threadIdx,taskIdx,compIdx,simVarIdx,simEqSysIdx,lsIdx,nlsIdx,mIdx),iTaskGraph,taskGraph,taskDuplAss,iTaskGraphMeta,iSimCode,schedule,iSccSimEqMapping,duplSccSimEqMap,duplComps);
1714-
print("TG after");
1715-
HpcOmTaskGraph.printTaskGraph(taskGraph);
17161714

17171715
//update stuff
17181716
numDupl = List.fold(List.map(duplComps,listLength),intAdd,0);
17191717
procAss = Util.arrayMap(procAss,listReverse);
1720-
print("duplSccSimEqMap\n");
1721-
HpcOmSimCodeMain.dumpSccSimEqMapping(listArray(duplSccSimEqMap));
1722-
print("iSccSimEqMapping\n");
1723-
HpcOmSimCodeMain.dumpSccSimEqMapping(iSccSimEqMapping);
17241718
sccSimEqMap = Util.arrayAppend(iSccSimEqMapping,listArray(listReverse(duplSccSimEqMap)));
1725-
print("sccSimEqMap\n");
1726-
HpcOmSimCodeMain.dumpSccSimEqMapping(sccSimEqMap);
1727-
17281719
comps = Util.arrayAppend(inComps,listArray(listReverse(duplComps)));
17291720
varCompMapping = Util.arrayAppend(varCompMapping,arrayCreate(numDupl,(0,0,0)));
17301721
eqCompMapping = Util.arrayAppend(eqCompMapping,arrayCreate(numDupl,(0,0,0)));
@@ -1735,10 +1726,8 @@ algorithm
17351726
meta = HpcOmTaskGraph.TASKGRAPHMETA(comps,varCompMapping,eqCompMapping,rootNodes,nodeNames,nodeDescs,exeCosts,commCosts,nodeMark);
17361727

17371728
//dumping stuff-------------------------
1738-
SimCode.SIMCODE(modelInfo = SimCode.MODELINFO(vars=simVars), odeEquations=odes) = simCode;
1739-
print("the simEqSysts2: \n"+&stringDelimitList(List.map(odes,SimCodeUtil.dumpSimEqSystemLst),"\n")+&"\n");
1740-
SimCode.SIMVARS(algVars=algVars) = simVars;
1741-
SimCodeUtil.dumpVarLst(algVars,"algVars2");
1729+
print("simCode 2\n");
1730+
SimCodeUtil.dumpSimCode(simCode);
17421731
print("sccSimEqMap2\n");
17431732
HpcOmSimCodeMain.dumpSccSimEqMapping(sccSimEqMap);
17441733
print("inComps2\n");
@@ -1902,9 +1891,6 @@ algorithm
19021891
odes = List.map1r(odes,replaceSimEqSystemLstWithSameIndex,simEqSysts);
19031892
simCode = SimCodeUtil.replaceODEandALLequations(allEqs,odes,simCodeIn);
19041893

1905-
print("the simEqSysts "+&SimCodeUtil.dumpSimEqSystemLst(simEqSysts)+&"\n");
1906-
print("the simEqSysts after cluster: "+&intString(threadIdx)+&"_"+&intString(node)+&" \n"+&stringDelimitList(List.map(odes,SimCodeUtil.dumpSimEqSystemLst),"\n")+&"\n");
1907-
19081894
task = HpcOmSimCode.CALCTASK(1,node,0.0,-1.0,threadIdx,simEqs);
19091895
thread = task::threadIn;
19101896
taskDuplAss = arrayUpdate(taskDuplAssIn,node,node);
@@ -1941,8 +1927,8 @@ protected function createTDSduplicateTasks2"sets the information about the new t
19411927
output list<list<Integer>> duplCompsOut;
19421928
protected
19431929
String crefAppend;
1944-
Integer threadIdx,compIdx,simVarIdx,simVarIdx2,simEqSysIdx,simEqSysIdx2,numVars,numEqs,taskIdx,lsIdx,nlsIdx,mIdx;
1945-
list<Integer> comps,simEqSysIdcs,simVarSysIdcs,simEqSysIdcs2,simVarSysIdcs2,thread,origSuccTasks,clSuccTasks;
1930+
Integer threadIdx,compIdx,simVarIdx,simVarIdx2,simEqSysIdx,simEqSysIdx2,simEqSysIdx3,numVars,numEqs,numInitEqs,taskIdx,lsIdx,nlsIdx,mIdx;
1931+
list<Integer> comps,simEqSysIdcs,simVarSysIdcs,simEqSysIdcs2,simEqSysIdcsInit,simVarSysIdcs2,thread,origSuccTasks,clSuccTasks;
19461932
list<list<Integer>> simEqIdxLst,simVarIdxLst;
19471933
array<list<Integer>> inComps;
19481934
BackendVarTransform.VariableReplacements repl;
@@ -1951,11 +1937,13 @@ protected
19511937
SimCode.ModelInfo modelinfo;
19521938
SimCode.SimVars simVars;
19531939
SimCode.SimCode simCode;
1940+
list<BackendDAE.Equation> eqs;
1941+
list<BackendDAE.Var> vars;
19541942
list<DAE.ComponentRef> crefs,crefsDupl;
19551943
list<list<DAE.ComponentRef>> crefLst;
19561944
list<DAE.Exp> crefsDuplExp;
19571945
list<SimCode.SimVar> simVarLst,simVarDupl,algVars;
1958-
list<SimCode.SimEqSystem> simEqSysts,simEqSystsDupl;
1946+
list<SimCode.SimEqSystem> simEqSysts,simEqSystsDupl,initEqs;
19591947
list<list<SimCode.SimEqSystem>> odes;
19601948
algorithm
19611949
HpcOmTaskGraph.TASKGRAPHMETA(inComps=inComps) := iTaskGraphMeta;
@@ -2000,21 +1988,30 @@ algorithm
20001988
//BackendVarTransform.dumpReplacements(repl);
20011989
numEqs := listLength(simEqSysts);
20021990
simEqSysIdcs2 := List.intRange2(simEqSysIdx,simEqSysIdx+numEqs-1);
2003-
1991+
print("simEqSysIdcs2 :"+&intListString(simEqSysIdcs2)+&"\n");
20041992
(simEqSystsDupl,_) := List.map1_2(simEqSysts,replaceExpsInSimEqSystem,repl);// replace the exps and crefs
20051993
(simEqSystsDupl,(lsIdx,nlsIdx,mIdx)) := List.mapFold(simEqSystsDupl,replaceSystemIndex,(lsIdx,nlsIdx,mIdx));// udpate the indeces of th systems
20061994
simEqSystsDupl := List.threadMap(simEqSystsDupl,simEqSysIdcs2,SimCodeUtil.replaceSimEqSysIndex);
20071995
print("the simEqSystsDupl "+&SimCodeUtil.dumpSimEqSystemLst(simEqSystsDupl)+&"\n");
2008-
simCode := List.fold1(simEqSystsDupl,SimCodeUtil.addSimEqSysToODEquations,1,simCode);
20091996
simEqSysIdx2 := simEqSysIdx + numEqs;
2010-
print("simEqSysIdcs2 :"+&intListString(simEqSysIdcs2)+&"\n");
2011-
2012-
SimCode.SIMCODE(odeEquations=odes) := simCode;
2013-
print("the simEqSysts after cluster: "+&intString(threadIdx)+&"_"+&intString(node)+&" \n"+&stringDelimitList(List.map(odes,SimCodeUtil.dumpSimEqSystemLst),"\n")+&"\n");
1997+
// update sccSimEqmapping for the duplicated
1998+
duplSccSimEqMapOut := listAppend(List.map(simEqSysIdcs2,List.create),duplSccSimEqMapIn);
1999+
simCode := List.fold1(simEqSystsDupl,SimCodeUtil.addSimEqSysToODEquations,1,simCode);
2000+
// set task in thread
2001+
threadOut := HpcOmSimCode.CALCTASK(1,taskIdx,0.0,-1.0,threadIdx,simEqSysIdcs2)::threadIn;
2002+
// add init eqs to simCode
2003+
numInitEqs := listLength(crefs);
2004+
simEqSysIdcsInit := List.intRange2(simEqSysIdx2,simEqSysIdx2+numInitEqs-1);
2005+
initEqs := List.thread3Map(crefsDupl,crefs,simEqSysIdcsInit,makeSEScrefAssignment);
2006+
print("the initEqs "+&SimCodeUtil.dumpSimEqSystemLst(initEqs)+&"\n");
2007+
simCode := List.fold(initEqs,SimCodeUtil.addSimEqSysToInitialEquations,simCode);
2008+
simEqSysIdx3 := simEqSysIdx2 + numInitEqs;
2009+
2010+
SimCode.SIMCODE(odeEquations=odes) := simCode;
2011+
print("the simEqSysts after cluster: "+&intString(threadIdx)+&"_"+&intString(node)+&" \n"+&stringDelimitList(List.map(odes,SimCodeUtil.dumpSimEqSystemLst),"\n")+&"\n");
20142012

20152013
//update duplSccSimEqMap, duplComps, taskAss, procAss for the new duplicates
2016-
duplSccSimEqMapOut := listAppend(List.map(simEqSysIdcs2,List.create),duplSccSimEqMapIn);
2017-
taskAssOut := arrayUpdate(taskAssIn,taskIdx,threadIdx);
2014+
taskAssOut := arrayUpdate(taskAssIn,taskIdx,threadIdx);
20182015
thread := arrayGet(procAssIn,threadIdx);
20192016
thread := taskIdx::thread;
20202017
procAssOut := arrayUpdate(procAssIn,threadIdx,thread);
@@ -2023,9 +2020,6 @@ algorithm
20232020
compIdx := compIdx+listLength(comps);
20242021
duplCompsOut := comps::duplCompsIn;
20252022

2026-
// set task in thread
2027-
threadOut := HpcOmSimCode.CALCTASK(1,taskIdx,0.0,-1.0,threadIdx,simEqSysIdcs2)::threadIn;
2028-
20292023
// update taskGraph and taskDuplAss
20302024
taskDuplAssOut := arrayUpdate(taskDuplAssIn,taskIdx,node);
20312025
origSuccTasks := arrayGet(taskGraphIn,node);
@@ -2034,11 +2028,23 @@ algorithm
20342028
taskGraph := arrayUpdate(taskGraphIn,node,origSuccTasks);
20352029
taskGraphOut := arrayUpdate(taskGraph,taskIdx,clSuccTasks);
20362030

2037-
idcsOut := (threadIdx,taskIdx+1,compIdx,simVarIdx2,simEqSysIdx2,lsIdx,nlsIdx,mIdx);
2031+
idcsOut := (threadIdx,taskIdx+1,compIdx,simVarIdx2,simEqSysIdx3,lsIdx,nlsIdx,mIdx);
20382032
simCodeOut := simCode;
20392033
replOut := repl;
20402034
end createTDSduplicateTasks2;
20412035

2036+
protected function makeSEScrefAssignment
2037+
input DAE.ComponentRef lhs;
2038+
input DAE.ComponentRef rhs;
2039+
input Integer idx;
2040+
output SimCode.SimEqSystem sesOut;
2041+
protected
2042+
DAE.Type ty;
2043+
algorithm
2044+
ty := ComponentReference.crefType(rhs);
2045+
sesOut := SimCode.SES_SIMPLE_ASSIGN(idx,lhs,DAE.CREF(rhs,ty),DAE.emptyElementSource);
2046+
end makeSEScrefAssignment;
2047+
20422048
protected function replaceSimEqSystemLstWithSameIndex
20432049
input list<SimCode.SimEqSystem> eqSystsIn;
20442050
input list<SimCode.SimEqSystem> eqSysLstIn;
@@ -2206,17 +2212,17 @@ algorithm
22062212
then (simEqSys,changed);
22072213
case(SimCode.SES_WHEN(index=idx,conditions=crefs,initialCall=ic,left=cref,right=exp,elseWhen=NONE(),source=source),_)
22082214
equation
2209-
(crefs,bLst) = List.map1_2(crefs,replaceCref,replIn);
2210-
(cref,changed) = replaceCref(cref,replIn);
2215+
(crefs,bLst) = List.map1_2(crefs,BackendVarTransform.replaceCref,replIn);
2216+
(cref,changed) = BackendVarTransform.replaceCref(cref,replIn);
22112217
changed = List.fold(bLst,boolOr,changed);
22122218
(exp,changed1) = BackendVarTransform.replaceExp(exp,replIn,NONE());
22132219
changed = boolOr(changed,changed1);
22142220
simEqSys = SimCode.SES_WHEN(idx,crefs,ic,cref,exp,NONE(),source);
22152221
then (simEqSys,changed);
22162222
case(SimCode.SES_WHEN(index=idx,conditions=crefs,initialCall=ic,left=cref,right=exp,elseWhen=SOME(simEqSys),source=source),_)
22172223
equation
2218-
(crefs,bLst) = List.map1_2(crefs,replaceCref,replIn);
2219-
(cref,changed) = replaceCref(cref,replIn);
2224+
(crefs,bLst) = List.map1_2(crefs,BackendVarTransform.replaceCref,replIn);
2225+
(cref,changed) = BackendVarTransform.replaceCref(cref,replIn);
22202226
changed = List.fold(bLst,boolOr,changed);
22212227
(exp,changed1) = BackendVarTransform.replaceExp(exp,replIn,NONE());
22222228
changed = boolOr(changed,changed1);
@@ -2231,24 +2237,6 @@ algorithm
22312237
end matchcontinue;
22322238
end replaceExpsInSimEqSystem;
22332239

2234-
protected function replaceCref"replaces a cref.
2235-
author: Waurich TUD 2014-06"
2236-
input DAE.ComponentRef crefIn;
2237-
input BackendVarTransform.VariableReplacements replIn;
2238-
output DAE.ComponentRef crefOut;
2239-
output Boolean changedOut;
2240-
algorithm
2241-
(crefOut,changedOut) := matchcontinue(crefIn,replIn)
2242-
case(_,_)
2243-
equation
2244-
true = BackendVarTransform.hasReplacement(replIn,crefIn);
2245-
DAE.CREF(componentRef=crefOut) = BackendVarTransform.getReplacement(replIn,crefIn);
2246-
then (crefOut,true);
2247-
else
2248-
then (crefIn,false);
2249-
end matchcontinue;
2250-
end replaceCref;
2251-
22522240
protected function replaceCrefInSimVar"performs replacements on a simVar structure.
22532241
author: Waurich TUD 2014-06"
22542242
input SimCode.SimVar simVarIn;

Compiler/BackEnd/SimCodeUtil.mo

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7474,16 +7474,22 @@ end dumpSimEqSystem;
74747474
public function dumpSimCode
74757475
input SimCode.SimCode simCode;
74767476
protected
7477-
list<SimCode.SimEqSystem> allEquations,jacobianEquations,equationsForZeroCrossings,algorithmAndEquationAsserts;
7477+
list<SimCode.SimEqSystem> allEquations,jacobianEquations,equationsForZeroCrossings,algorithmAndEquationAsserts,initialEquations;
7478+
SimCode.SimVars simVars;
74787479
list<list<SimCode.SimEqSystem>> odeEquations, algebraicEquations;
74797480
algorithm
7480-
SimCode.SIMCODE(allEquations = allEquations, odeEquations=odeEquations, algebraicEquations=algebraicEquations, algorithmAndEquationAsserts=algorithmAndEquationAsserts, equationsForZeroCrossings=equationsForZeroCrossings, jacobianEquations=jacobianEquations) := simCode;
7481+
SimCode.SIMCODE(modelInfo = SimCode.MODELINFO(vars=simVars),allEquations = allEquations, odeEquations=odeEquations, algebraicEquations=algebraicEquations, algorithmAndEquationAsserts=algorithmAndEquationAsserts,
7482+
equationsForZeroCrossings=equationsForZeroCrossings, jacobianEquations=jacobianEquations,initialEquations=initialEquations) := simCode;
74817483
print("allEquations: \n-----------------------\n");
74827484
print(dumpSimEqSystemLst(allEquations)+&"\n");
74837485
print("odeEquations ("+&intString(listLength(odeEquations))+&" systems): \n-----------------------\n");
74847486
print(stringDelimitList(List.map(odeEquations,dumpSimEqSystemLst),"\n--------------\n")+&"\n");
74857487
print("algebraicEquations: \n-----------------------\n");
74867488
print(stringDelimitList(List.map(algebraicEquations,dumpSimEqSystemLst),"\n")+&"\n");
7489+
print("initialEquations: \n-----------------------\n");
7490+
print(dumpSimEqSystemLst(initialEquations)+&"\n");
7491+
print("SIMVARS: \n-----------------------\n");
7492+
dumpSimVars(simVars);
74877493
/*
74887494
print("algorithmAndEquationAsserts: \n-----------------------\n");
74897495
print(dumpSimEqSystemLst(algorithmAndEquationAsserts)+&"\n");
@@ -12956,6 +12962,58 @@ algorithm
1295612962
end match;
1295712963
end addSimEqSysToODEquations;
1295812964

12965+
public function addSimEqSysToInitialEquations"adds the given simEqSys to both to the initialEquations"
12966+
input SimCode.SimEqSystem simEqSys;
12967+
input SimCode.SimCode simCodeIn;
12968+
output SimCode.SimCode simCodeOut;
12969+
protected
12970+
SimCode.ModelInfo modelInfo;
12971+
list<DAE.Exp> literals;
12972+
list<SimCode.RecordDeclaration> recordDecls;
12973+
list<String> externalFunctionIncludes;
12974+
list<list<SimCode.SimEqSystem>> eqsTmp;
12975+
list<list<SimCode.SimEqSystem>> odeEquations, algebraicEquations;
12976+
list<SimCode.SimEqSystem> allEquations, residualEquations, startValueEquations, nominalValueEquations, minValueEquations, maxValueEquations, parameterEquations, removedEquations, algorithmAndEquationAsserts, jacobianEquations, equationsForZeroCrossings;
12977+
list<SimCode.StateSet> stateSets;
12978+
Boolean useSymbolicInitialization, useHomotopy;
12979+
list<SimCode.SimEqSystem> initialEquations, odes;
12980+
list<DAE.Constraint> constraints;
12981+
list<DAE.ClassAttributes> classAttributes;
12982+
list<BackendDAE.ZeroCrossing> zeroCrossings, relations;
12983+
list<SimCode.SimWhenClause> whenClauses;
12984+
list<DAE.ComponentRef> discreteModelVars;
12985+
SimCode.ExtObjInfo extObjInfo;
12986+
SimCode.MakefileParams makefileParams;
12987+
SimCode.DelayedExpression delayedExps;
12988+
list<SimCode.JacobianMatrix> jacobianMatrixes;
12989+
list<String> labels;
12990+
Option<SimCode.SimulationSettings> simulationSettingsOpt;
12991+
list<BackendDAE.TimeEvent> timeEvents;
12992+
String fileNamePrefix;
12993+
SimCode.HashTableCrefToSimVar crefToSimVarHT;
12994+
Absyn.Path name;
12995+
String description,directory;
12996+
SimCode.VarInfo varInfo;
12997+
SimCode.SimVars vars;
12998+
list<SimCode.Function> functions;
12999+
SimCode.Files files;
13000+
Option<HpcOmSimCode.Schedule> hpcOmSchedule;
13001+
Option<SimCode.BackendMapping> backendMapping;
13002+
Option<HpcOmSimCode.MemoryMap> hpcOmMemory;
13003+
algorithm
13004+
simCodeOut := match(simEqSys,simCodeIn)
13005+
case (_,SimCode.SIMCODE(modelInfo, literals, recordDecls, externalFunctionIncludes, allEquations, odeEquations, algebraicEquations, residualEquations, useSymbolicInitialization, useHomotopy, initialEquations, startValueEquations, nominalValueEquations, minValueEquations, maxValueEquations,
13006+
parameterEquations, removedEquations, algorithmAndEquationAsserts, equationsForZeroCrossings, jacobianEquations, stateSets, constraints, classAttributes, zeroCrossings, relations, timeEvents, whenClauses,
13007+
discreteModelVars, extObjInfo, makefileParams, delayedExps, jacobianMatrixes, simulationSettingsOpt, fileNamePrefix, hpcOmSchedule, hpcOmMemory, crefToSimVarHT, backendMapping))
13008+
equation
13009+
initialEquations = listAppend(initialEquations,{simEqSys});
13010+
then
13011+
SimCode.SIMCODE(modelInfo, literals, recordDecls, externalFunctionIncludes, allEquations, odeEquations, algebraicEquations, residualEquations, useSymbolicInitialization, useHomotopy, initialEquations, startValueEquations, nominalValueEquations, minValueEquations, maxValueEquations,
13012+
parameterEquations, removedEquations, algorithmAndEquationAsserts, equationsForZeroCrossings, jacobianEquations, stateSets, constraints, classAttributes, zeroCrossings, relations, timeEvents, whenClauses,
13013+
discreteModelVars, extObjInfo, makefileParams, delayedExps, jacobianMatrixes, simulationSettingsOpt, fileNamePrefix, hpcOmSchedule, hpcOmMemory, crefToSimVarHT,backendMapping);
13014+
end match;
13015+
end addSimEqSysToInitialEquations;
13016+
1295913017
public function replaceODEandALLequations"replaces both allEquations and odeEquations"
1296013018
input list<SimCode.SimEqSystem> allEqs;
1296113019
input list<list<SimCode.SimEqSystem>> odeEqs;
@@ -13108,6 +13166,8 @@ algorithm
1310813166
idx := Debug.bcallret3(isNotEmpty,List.fold,List.map(startValueEquations,eqIndex),intMax,idx,idx);
1310913167
isNotEmpty := List.isNotEmpty(initialEquations) or not isNotEmpty;
1311013168
idx := Debug.bcallret3(isNotEmpty,List.fold,List.map(initialEquations,eqIndex),intMax,idx,idx);
13169+
isNotEmpty := List.isNotEmpty(allEquations) or not isNotEmpty;
13170+
idx := Debug.bcallret3(isNotEmpty,List.fold,List.map(allEquations,eqIndex),intMax,idx,idx);
1311113171
idxOut := idx;
1311213172
end getMaxSimEqSystemIndex;
1311313173

0 commit comments

Comments
 (0)