Skip to content

Commit 469a679

Browse files
author
Jens Frenkel
committed
- remove last idea for dynamic state selection
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@12189 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent ed5eb02 commit 469a679

File tree

1 file changed

+3
-74
lines changed

1 file changed

+3
-74
lines changed

Compiler/BackEnd/IndexReduction.mo

Lines changed: 3 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,9 +1380,8 @@ algorithm
13801380
case (_,_,_,_,_,_,_,_)
13811381
equation
13821382
(orgeqns,eqnslst,eqnindxlst) = getOrgEqn(orgEqnsLst,{},{},{});
1383-
cvars1 = BackendEquation.equationsLstVars(eqnslst, hov, BackendDAEUtil.emptyVars());
13841383
eqns = BackendDAEUtil.listEquation(eqnslst);
1385-
(hov_1,dummyStates,lov,syst,shared) = selectDummyDerivatives(cvars1,BackendVariable.numVariables(cvars1),eqns,BackendDAEUtil.equationSize(eqns),eqnindxlst,hov1,inDummyStates,isyst,ishared,BackendDAEUtil.emptyVars());
1384+
(hov_1,dummyStates,lov,syst,shared) = selectDummyDerivatives(cvars,BackendVariable.numVariables(cvars),eqns,BackendDAEUtil.equationSize(eqns),eqnindxlst,hov1,inDummyStates,isyst,ishared,BackendDAEUtil.emptyVars());
13861385
// get derivatives one order less
13871386
lov = lowerOrderDerivatives(lov,BackendVariable.daeVars(isyst),so);
13881387
// call again with original equations of derived equations
@@ -1678,39 +1677,6 @@ algorithm
16781677
list<BackendDAE.Var> varlst;
16791678
list<tuple<DAE.ComponentRef, Integer>> states,dstates;
16801679
list<Integer> unassigned;
1681-
case(_,_,_,_,_,_,_,_,_,_,_,_)
1682-
equation
1683-
m = incidenceMatrixfromEnhanced2(me);
1684-
mT = incidenceMatrixfromEnhanced2(meT);
1685-
Debug.fcall(Flags.BLT_DUMP, BackendDump.dumpEqSystem, BackendDAE.EQSYSTEM(vars,eqns,SOME(m),SOME(mT),BackendDAE.NO_MATCHING()));
1686-
Matching.matchingExternalsetIncidenceMatrix(eqnsSize,varSize,mT);
1687-
BackendDAEEXT.matching(eqnsSize,varSize,3,-1,1.0,1);
1688-
vec1 = arrayCreate(eqnsSize,-1);
1689-
vec2 = arrayCreate(varSize,-1);
1690-
BackendDAEEXT.getAssignment(vec2,vec1);
1691-
Debug.fcall(Flags.BLT_DUMP, BackendDump.dumpMatching,vec1);
1692-
Debug.fcall(Flags.BLT_DUMP, BackendDump.dumpMatching,vec2);
1693-
/* (states,_) = checkAssignment(1,varSize,vec2,vars,{},{});
1694-
Debug.fcall(Flags.BLT_DUMP, print, ("Select as dummyStates:\n"));
1695-
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst,((states,BackendDAETransform.dumpStates,"\n","\n")));
1696-
rang = eqnsSize-listLength(states);
1697-
true = intEq(rang,0);
1698-
Debug.fcall(Flags.BLT_DUMP, BackendDump.debugStrIntStrIntStr, ("Select ",varSize-eqnsSize," from ",varSize-rang,"\n"));
1699-
(hov1,lov,dummystates) = selectDummyStates(states,1,eqnsSize,vars,hov,inLov,inDummyStates);
1700-
then
1701-
(hov1,dummystates,lov,isyst,ishared);
1702-
*/
1703-
(dstates,states) = checkAssignment(1,varSize,vec2,vars,{},{});
1704-
{} = Matching.getUnassigned(eqnsSize, vec1, {});
1705-
1706-
Debug.fcall(Flags.BLT_DUMP, print, ("dummyStates:\n"));
1707-
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst,((dstates,BackendDAETransform.dumpStates,"\n","\n")));
1708-
Debug.fcall(Flags.BLT_DUMP, print, ("States:\n"));
1709-
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst,((states,BackendDAETransform.dumpStates,"\n","\n")));
1710-
1711-
(hov1,dummystates,lov,syst,shared) = selectDummyDerivatives2(dstates,states,{},me,meT,vars,varSize,eqns,eqnsSize,eqnindxlst,hov,inDummyStates,isyst,ishared,inLov);
1712-
then
1713-
(hov1,dummystates,lov,syst,shared);
17141680
case(_,_,_,_,_,_,_,_,_,_,_,_)
17151681
equation
17161682
m = incidenceMatrixfromEnhanced(me);
@@ -1853,12 +1819,14 @@ algorithm
18531819

18541820
Debug.fcall(Flags.BLT_DUMP, print, ("StatesSet:\n"));
18551821
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst,((crset,ComponentReference.printComponentRefStr,"\n","\n")));
1822+
18561823
// get Partial derivative of system for states
18571824
eqn = BackendDAEUtil.equationNth(eqns, 0);
18581825
BackendDAE.RESIDUAL_EQUATION(exp=exp) = BackendEquation.equationToResidualForm(eqn);
18591826
explst = List.map1(crstates,differentiateExp,exp);
18601827
Debug.fcall(Flags.BLT_DUMP, print, ("Partial Derivaives:\n"));
18611828
Debug.fcall(Flags.BLT_DUMP, BackendDump.debuglst,((explst,ExpressionDump.printExpStr,"\n","\n")));
1829+
18621830
// generate condition equation
18631831
contExp = generateCondition(1,listLength(states),listArray(explst));
18641832
((contstartExp,_)) = Expression.traverseExp(contExp, changeVarToStartValue, BackendVariable.daeVars(isyst));
@@ -2299,45 +2267,6 @@ algorithm
22992267
end match;
23002268
end incidenceMatrixElementElementfromEnhanced1;
23012269

2302-
protected function incidenceMatrixfromEnhanced2
2303-
"function: incidenceMatrixfromEnhanced2
2304-
author: Frenkel TUD 2012-05
2305-
converts an AdjacencyMatrixEnhanced into a IncidenceMatrix"
2306-
input BackendDAE.AdjacencyMatrixEnhanced me;
2307-
output BackendDAE.IncidenceMatrix m;
2308-
algorithm
2309-
m := Util.arrayMap(me,incidenceMatrixElementfromEnhanced2);
2310-
end incidenceMatrixfromEnhanced2;
2311-
2312-
protected function incidenceMatrixElementfromEnhanced2
2313-
"function: incidenceMatrixElementfromEnhanced2
2314-
author: Frenkel TUD 2012-05
2315-
helper for incidenceMatrixfromEnhanced2"
2316-
input BackendDAE.AdjacencyMatrixElementEnhanced iRow;
2317-
output BackendDAE.IncidenceMatrixElement oRow;
2318-
algorithm
2319-
// oRow := List.map(List.sort(iRow,AdjacencyMatrixElementEnhancedCMP), incidenceMatrixElementElementfromEnhanced);
2320-
oRow := List.fold(iRow, incidenceMatrixElementElementfromEnhanced2, {});
2321-
oRow := listReverse(oRow);
2322-
end incidenceMatrixElementfromEnhanced2;
2323-
2324-
protected function incidenceMatrixElementElementfromEnhanced2
2325-
"function: incidenceMatrixElementElementfromEnhanced2
2326-
author: Frenkel TUD 2012-05
2327-
converts an AdjacencyMatrix entry into a IncidenceMatrix entry"
2328-
input tuple<Integer, BackendDAE.Solvability> inTpl;
2329-
input list<Integer> iRow;
2330-
output list<Integer> oRow;
2331-
algorithm
2332-
oRow := match(inTpl,iRow)
2333-
local Integer i;
2334-
case ((i,BackendDAE.SOLVABILITY_SOLVED()),_) then i::iRow;
2335-
case ((i,BackendDAE.SOLVABILITY_CONSTONE()),_) then i::iRow;
2336-
case ((i,BackendDAE.SOLVABILITY_CONST()),_) then i::iRow;
2337-
else then iRow;
2338-
end match;
2339-
end incidenceMatrixElementElementfromEnhanced2;
2340-
23412270
protected function checkAssignment
23422271
"function: checkAssignment
23432272
author: Frenkel TUD 2012-05

0 commit comments

Comments
 (0)