Skip to content

Commit

Permalink
- Initialization: collect discrete States, check when inline when if …
Browse files Browse the repository at this point in the history
…pre(var) is used in the time equations and var and pre(var) are used in the initial equations, if not set var fixed and report warning

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14552 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Dec 28, 2012
1 parent d248ee7 commit 2eff515
Show file tree
Hide file tree
Showing 2 changed files with 416 additions and 124 deletions.
21 changes: 17 additions & 4 deletions Compiler/BackEnd/IndexReduction.mo
Original file line number Diff line number Diff line change
Expand Up @@ -6180,19 +6180,32 @@ algorithm
array<Integer> vec1,vec2,vec3,mapIncRowEqn;
array<Boolean> eqnsflag;
BackendDAE.EqSystem syst;
case (BackendDAE.EQSYSTEM(matching=BackendDAE.NO_MATCHING()),_,NONE(),_)
equation
vars = BackendVariable.daeVars(isyst);
eqns = BackendEquation.daeEqns(isyst);
(_,m,mt) = BackendDAEUtil.getIncidenceMatrix(isyst,BackendDAE.NORMAL());
mapIncRowEqn = listArray(List.intRange(arrayLength(m)));
graph = GraphML.getGraph("G",false);
((_,graph)) = BackendVariable.traverseBackendDAEVars(vars,addVarGraph,(1,graph));
//neqns = BackendDAEUtil.equationArraySize(eqns);
neqns = BackendDAEUtil.equationSize(eqns);
eqnsids = List.intRange(neqns);
graph = List.fold2(eqnsids,addEqnGraph,eqns,mapIncRowEqn,graph);
((_,_,graph)) = List.fold(eqnsids,addEdgesGraph,(1,m,graph));
GraphML.dumpGraph(graph,filename);
then
();
case (BackendDAE.EQSYSTEM(m=SOME(m),mT=SOME(mt),matching=BackendDAE.NO_MATCHING()),_,NONE(),_)
// case (BackendDAE.EQSYSTEM(matching=BackendDAE.NO_MATCHING()),_,NONE(),_)
equation
vars = BackendVariable.daeVars(isyst);
eqns = BackendEquation.daeEqns(isyst);
//(_,m,mt) = BackendDAEUtil.getIncidenceMatrix(isyst,BackendDAE.NORMAL());
//mapIncRowEqn = listArray(List.intRange(arrayLength(m)));
(_,m,mt,_,mapIncRowEqn) = BackendDAEUtil.getIncidenceMatrixScalar(isyst,BackendDAE.NORMAL());
graph = GraphML.getGraph("G",false);
((_,graph)) = BackendVariable.traverseBackendDAEVars(vars,addVarGraph,(1,graph));
//neqns = BackendDAEUtil.equationArraySize(eqns);
neqns = BackendDAEUtil.equationSize(eqns);
eqnsids = List.intRange(neqns);
mapIncRowEqn = listArray(List.intRange(arrayLength(m)));
graph = List.fold2(eqnsids,addEqnGraph,eqns,mapIncRowEqn,graph);
((_,_,graph)) = List.fold(eqnsids,addEdgesGraph,(1,m,graph));
GraphML.dumpGraph(graph,filename);
Expand Down

0 comments on commit 2eff515

Please sign in to comment.