Skip to content

Commit

Permalink
- Backend refactoring: Moved Inc.Matrices into the EQSYSTEM (it's pas…
Browse files Browse the repository at this point in the history
…sed with the dae instead of extra arguments now)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9671 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Aug 23, 2011
1 parent 2f1855c commit 828a4fe
Show file tree
Hide file tree
Showing 15 changed files with 599 additions and 859 deletions.
2 changes: 2 additions & 0 deletions Compiler/BackEnd/BackendDAE.mo
Expand Up @@ -252,6 +252,8 @@ uniontype EqSystem "An independent system of equations (and their corresponding
Variables orderedVars "orderedVars ; ordered Variables, only states and alg. vars" ;
EquationArray orderedEqs "orderedEqs ; ordered Equations" ;
EquationArray initialEqs "initialEqs ; Initial equations" ;
Option<IncidenceMatrix> m;
Option<IncidenceMatrixT> mT;
end EQSYSTEM;
end EqSystem;

Expand Down
18 changes: 7 additions & 11 deletions Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -135,7 +135,7 @@ algorithm
algarr := listArray(algs);
einfo := Inline.inlineEventInfo(BackendDAE.EVENT_INFO(whenclauses_1,{}),(SOME(functionTree),{DAE.NORM_INLINE()}));
aliasVars := BackendDAEUtil.emptyAliasVariables();
outBackendDAE := BackendDAE.DAE(BackendDAE.EQSYSTEM(vars_1,eqnarr,ieqnarr)::{},BackendDAE.SHARED(knvars,extVars,aliasVars,reqnarr,arr_md_eqns,algarr,einfo,extObjCls));
outBackendDAE := BackendDAE.DAE(BackendDAE.EQSYSTEM(vars_1,eqnarr,ieqnarr,NONE(),NONE())::{},BackendDAE.SHARED(knvars,extVars,aliasVars,reqnarr,arr_md_eqns,algarr,einfo,extObjCls));
BackendDAEUtil.checkBackendDAEWithErrorMsg(outBackendDAE);
end lower;

Expand Down Expand Up @@ -2573,14 +2573,9 @@ public function expandDerOperator
dependent variables, which is only available in BackendDAE."
input BackendDAE.BackendDAE inDAE;
input DAE.FunctionTree inFunctionTree;
input Option<BackendDAE.IncidenceMatrix> inM;
input Option<BackendDAE.IncidenceMatrix> inMT;
output BackendDAE.BackendDAE outDAE;
output Option<BackendDAE.IncidenceMatrix> outM;
output Option<BackendDAE.IncidenceMatrix> outMT;
algorithm
(outDAE,outM,outMT):=
match (inDAE,inFunctionTree,inM,inMT)
(outDAE) := match (inDAE,inFunctionTree)
local
DAE.FunctionTree funcs;
Option<BackendDAE.IncidenceMatrix> m,mT;
Expand All @@ -2591,14 +2586,14 @@ algorithm
array<DAE.Algorithm> algorithms,algorithms1;
BackendDAE.EventInfo einfo;
BackendDAE.ExternalObjectClasses eoc;
case (BackendDAE.DAE(BackendDAE.EQSYSTEM(vars,eqns,inieqns)::{},BackendDAE.SHARED(knvars,exobj,av,remeqns,arreqns,algorithms,einfo,eoc)),funcs,m,mT)
case (BackendDAE.DAE(BackendDAE.EQSYSTEM(vars,eqns,inieqns,m,mT)::{},BackendDAE.SHARED(knvars,exobj,av,remeqns,arreqns,algorithms,einfo,eoc)),funcs)
equation
(eqns1,(vars1,_)) = BackendEquation.traverseBackendDAEEqnsWithUpdate(eqns,traverserexpandDerEquation,(vars,funcs));
(inieqns1,(vars2,_)) = BackendEquation.traverseBackendDAEEqnsWithUpdate(inieqns,traverserexpandDerEquation,(vars1,funcs));
(arreqns1,(vars3,_)) = BackendDAEUtil.traverseBackendDAEArrayNoCopyWithUpdate(arreqns,traverserexpandDerExp,BackendEquation.traverseBackendDAEExpsArrayEqnWithUpdate,1,arrayLength(arreqns),(vars2,funcs));
(algorithms1,(vars4,_)) = BackendDAEUtil.traverseBackendDAEArrayNoCopyWithUpdate(algorithms,traverserexpandDerExp,BackendEquation.traverseBackendDAEExpsAlgortihmWithUpdate,1,arrayLength(algorithms),(vars3,funcs));
then
(BackendDAE.DAE(BackendDAE.EQSYSTEM(vars4,eqns1,inieqns1)::{},BackendDAE.SHARED(knvars,exobj,av,remeqns,arreqns1,algorithms1,einfo,eoc)),m,mT);
(BackendDAE.DAE(BackendDAE.EQSYSTEM(vars4,eqns1,inieqns1,m,mT)::{},BackendDAE.SHARED(knvars,exobj,av,remeqns,arreqns1,algorithms1,einfo,eoc)));
end match;
end expandDerOperator;

Expand Down Expand Up @@ -2904,7 +2899,8 @@ algorithm
list<DAE.Algorithm> algs_lst,algs_lst1;
list<BackendDAE.ZeroCrossing> zero_crossings;
BackendDAE.EqSystems eqs;
case (BackendDAE.DAE(BackendDAE.EQSYSTEM(vars,eqns,inieqns)::{},BackendDAE.SHARED(knvars,exobj,av,remeqns,arreqns,algorithms,einfo as BackendDAE.EVENT_INFO(whenClauseLst=whenclauses),eoc)))
Option<BackendDAE.IncidenceMatrix> m,mT;
case (BackendDAE.DAE(BackendDAE.EQSYSTEM(vars,eqns,inieqns,m,mT)::{},BackendDAE.SHARED(knvars,exobj,av,remeqns,arreqns,algorithms,einfo as BackendDAE.EVENT_INFO(whenClauseLst=whenclauses),eoc)))
equation
eqs_lst = BackendDAEUtil.equationList(eqns);
arreqns_lst = arrayList(arreqns);
Expand All @@ -2915,7 +2911,7 @@ algorithm
algorithms1 = listArray(algs_lst1);
einfo1 = BackendDAE.EVENT_INFO(whenclauses1,zero_crossings);
then
(BackendDAE.DAE(BackendDAE.EQSYSTEM(vars,eqns1,inieqns)::{},BackendDAE.SHARED(knvars,exobj,av,remeqns,arreqns1,algorithms1,einfo1,eoc)));
(BackendDAE.DAE(BackendDAE.EQSYSTEM(vars,eqns1,inieqns,m,mT)::{},BackendDAE.SHARED(knvars,exobj,av,remeqns,arreqns1,algorithms1,einfo1,eoc)));
end match;
end findZeroCrossings;

Expand Down
397 changes: 153 additions & 244 deletions Compiler/BackEnd/BackendDAEOptimize.mo

Large diffs are not rendered by default.

0 comments on commit 828a4fe

Please sign in to comment.