Skip to content

Commit caa8811

Browse files
author
Volker Waurich
committed
- added function to output the SimCode.SimEqSys for a given var index
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20258 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent b0600d6 commit caa8811

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Compiler/BackEnd/SimCodeUtil.mo

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12617,6 +12617,41 @@ algorithm
1261712617
simEqs := List.map1(bEqs,getSimEqsForBackendEqs,map);
1261812618
end getSimEqsOfSimVar;
1261912619

12620+
public function getReqSimEqSysForSimVar
12621+
input Integer simVar;
12622+
input SimCode.SimCode simCode;
12623+
output list<SimCode.SimEqSystem> ses;
12624+
protected
12625+
list<Integer> sesIdcs;
12626+
list<SimCode.SimEqSystem> sesLst;
12627+
SimCode.BackendMapping bmap;
12628+
Option<SimCode.BackendMapping> bmapOpt;
12629+
algorithm
12630+
SimCode.SIMCODE(allEquations=sesLst, backendMapping=bmapOpt) := simCode;
12631+
bmap := Util.getOption(bmapOpt);
12632+
sesIdcs := getReqSimEqsForSimVar(simVar,bmap);
12633+
ses := List.map1(sesIdcs,getSimEqSysForIndex,sesLst);
12634+
end getReqSimEqSysForSimVar;
12635+
12636+
protected function getSimEqSysForIndex
12637+
input Integer idx;
12638+
input list<SimCode.SimEqSystem> allSimEqs;
12639+
output SimCode.SimEqSystem outSimEq;
12640+
algorithm
12641+
outSimEq :=List.getMemberOnTrue(idx,allSimEqs,indexIsEqual);
12642+
end getSimEqSysForIndex;
12643+
12644+
protected function indexIsEqual
12645+
input Integer idx;
12646+
input SimCode.SimEqSystem ses;
12647+
output Boolean b;
12648+
protected
12649+
Integer idx2;
12650+
algorithm
12651+
idx2 := equationIndex(ses);
12652+
b := intEq(idx,idx2);
12653+
end indexIsEqual;
12654+
1262012655
public function getReqSimEqsForSimVar"outputs the indeces for the required simEqSys for the indexed SimVar
1262112656
author:Waurich TUD 2014-04"
1262212657
input Integer simVar;

0 commit comments

Comments
 (0)