Skip to content

Commit

Permalink
- reverting the commit by Jens and mine with tabs removal: r14251 and…
Browse files Browse the repository at this point in the history
… r14248 to see who broke what :)

Revision: 14251
Author: adrpo
Date: den 6 december 2012 02:04:56
Message:
- squash tabs in RemoveSimpleEquations.mo
----
Modified : /trunk/Compiler/BackEnd/RemoveSimpleEquations.mo

Revision: 14248
Author: jfrenkel
Date: den 6 december 2012 00:48:31
Message:
- fix potential bug for simplified if equations in old remove simple equations
- add new file RemoveSimpleEquations.mo
- add new tests for singular systems
----
Modified : /trunk/Compiler/BackEnd/BackendDAEOptimize.mo
Added : /trunk/Compiler/BackEnd/RemoveSimpleEquations.mo
Modified : /trunk/Compiler/Makefile.common
Modified : /trunk/testsuite/openmodelica/bootstrapping/LoadCompilerSources.mos
Added : /trunk/testsuite/simulation/modelica/indexreduction/SingularSystem.mo
Added : /trunk/testsuite/simulation/modelica/indexreduction/SingularSystem.mos



git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14252 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Dec 6, 2012
1 parent b08ace6 commit b7955d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1,883 deletions.
31 changes: 12 additions & 19 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2555,18 +2555,15 @@ algorithm
BackendDAE.BackendDAEType btp;
BackendDAE.EqSystems systs,systs1;
list<BackendDAE.Var> ordvarslst,varlst;
list<BackendDAE.Equation> eqnslst;
case (false,_,_) then inDAE;
case (true,BackendDAE.DAE(systs,BackendDAE.SHARED(knvars,exobj,aliasVars,inieqns,remeqns,constrs,clsAttrs,cache,env,funcTree,BackendDAE.EVENT_INFO(whenClauseLst,zeroCrossingLst,sampleLst,relationsLst,numberOfRealtions,numMathFunctions),eoc,btp,symjacs)),_)
equation
// replace moved vars in knvars,remeqns
(aliasVars,(_,varlst)) = BackendVariable.traverseBackendDAEVarsWithUpdate(aliasVars,replaceAliasVarTraverser,(repl,{}));
aliasVars = List.fold(varlst,fixAliasConstBindings,aliasVars);
(knvars1,_) = BackendVariable.traverseBackendDAEVarsWithUpdate(knvars,replaceVarTraverser,repl);
((_,eqnslst)) = BackendEquation.traverseBackendDAEEqns(inieqns,replaceEquationTraverser,(repl,{}));
inieqns = BackendEquation.listEquation(eqnslst);
((_,eqnslst)) = BackendEquation.traverseBackendDAEEqns(remeqns,replaceEquationTraverser,(repl,{}));
remeqns1 = BackendEquation.listEquation(eqnslst);
(inieqns,_) = BackendEquation.traverseBackendDAEEqnsWithUpdate(inieqns,replaceEquationTraverser,repl);
(remeqns1,_) = BackendEquation.traverseBackendDAEEqnsWithUpdate(remeqns,replaceEquationTraverser,repl);
(whenClauseLst1,_) = BackendVarTransform.replaceWhenClauses(whenClauseLst, repl, SOME(BackendVarTransform.skipPreChangeEdgeOperator));
systs1 = removeSimpleEquationsShared1(systs,{},repl);
// remove asserts with condition=true from removed equations
Expand Down Expand Up @@ -2596,17 +2593,15 @@ algorithm
local
BackendDAE.EqSystems rest,systs;
BackendDAE.Variables v;
BackendDAE.EquationArray eqns;
BackendDAE.EquationArray eqns,eqns1;
Option<BackendDAE.IncidenceMatrix> m;
Option<BackendDAE.IncidenceMatrixT> mT;
BackendDAE.Matching matching;
list<BackendDAE.Equation> eqnslst;
case ({},_,_) then inSysts1;
case (BackendDAE.EQSYSTEM(v,eqns,m,mT,matching)::rest,_,_)
equation
((_,eqnslst)) = BackendEquation.traverseBackendDAEEqns(eqns,replaceEquationTraverser,(repl,{}));
eqns = BackendEquation.listEquation(eqnslst);
systs = BackendDAE.EQSYSTEM(v,eqns,m,mT,matching)::inSysts1;
(eqns1,_) = BackendEquation.traverseBackendDAEEqnsWithUpdate(eqns,replaceEquationTraverser,repl);
systs = BackendDAE.EQSYSTEM(v,eqns1,m,mT,matching)::inSysts1;
then
removeSimpleEquationsShared1(rest,systs,repl);
end match;
Expand Down Expand Up @@ -2696,20 +2691,18 @@ end replaceVarTraverser;

protected function replaceEquationTraverser
"Help function to e.g. removeSimpleEquations"
input tuple<BackendDAE.Equation,tuple<BackendVarTransform.VariableReplacements,list<BackendDAE.Equation>>> inTpl;
output tuple<BackendDAE.Equation,tuple<BackendVarTransform.VariableReplacements,list<BackendDAE.Equation>>> outTpl;
input tuple<BackendDAE.Equation,BackendVarTransform.VariableReplacements> inTpl;
output tuple<BackendDAE.Equation,BackendVarTransform.VariableReplacements> outTpl;
algorithm
outTpl:=
match (inTpl)
local
BackendDAE.Equation e;
local
BackendDAE.Equation e,e1;
BackendVarTransform.VariableReplacements repl;
list<BackendDAE.Equation> eqns,eqns1;
case ((e,(repl,eqns)))
case ((e,repl))
equation
(eqns1,_) = BackendVarTransform.replaceEquations({e},repl,SOME(BackendVarTransform.skipPreChangeEdgeOperator));
eqns = listAppend(eqns1,eqns);
then ((e,(repl,eqns)));
({e1},_) = BackendVarTransform.replaceEquations({e},repl,SOME(BackendVarTransform.skipPreChangeEdgeOperator));
then ((e1,repl));
end match;
end replaceEquationTraverser;

Expand Down

0 comments on commit b7955d1

Please sign in to comment.