Skip to content

Commit

Permalink
- bugfix for generate dynamic state selection jacobians
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14656 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Jan 3, 2013
1 parent 0f47e0f commit bf017ba
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Compiler/BackEnd/RemoveSimpleEquations.mo
Expand Up @@ -3223,12 +3223,44 @@ algorithm
ovars = replaceOtherStateSetVars(ovars,vars,aliasVars,{});
(eqns,b) = BackendVarTransform.replaceEquations(eqns,repl,SOME(BackendVarTransform.skipPreChangeEdgeOperator));
(oeqns,b1) = BackendVarTransform.replaceEquations(oeqns,repl,SOME(BackendVarTransform.skipPreChangeEdgeOperator));
oeqns = List.fold(oeqns,removeEqualLshRshEqns,{});
oeqns = listReverse(oeqns);
(stateSets,b,oStatesetrepl) = removeAliasVarsStateSets(stateSets,SOME(repl),vars,aliasVars,BackendDAE.STATESET(rang,states,crA,varA,statescandidates,ovars,eqns,oeqns,crJ,varJ)::iAcc,b or b1);
then
(stateSets,b,oStatesetrepl);
end match;
end removeAliasVarsStateSets;

protected function removeEqualLshRshEqns
"function: removeEqualLshRshEqns
author: Frenkel TUD 2012-12"
input BackendDAE.Equation iEqn;
input list<BackendDAE.Equation> iEqns;
output list<BackendDAE.Equation> oEqns;
algorithm
oEqns := matchcontinue(iEqn,iEqns)
local
DAE.Exp rhs,lhs;
Boolean b;
case (BackendDAE.EQUATION(exp=lhs,scalar=rhs),_)
equation
b = Expression.expEqual(lhs,rhs);
then
List.consOnTrue(not b,iEqn,iEqns);
case (BackendDAE.ARRAY_EQUATION(left=lhs,right=rhs),_)
equation
b = Expression.expEqual(lhs,rhs);
then
List.consOnTrue(not b,iEqn,iEqns);
case (BackendDAE.COMPLEX_EQUATION(left=lhs,right=rhs),_)
equation
b = Expression.expEqual(lhs,rhs);
then
List.consOnTrue(not b,iEqn,iEqns);
else then iEqn::iEqns;
end matchcontinue;
end removeEqualLshRshEqns;

protected function replaceOtherStateSetVars
"function: replaceOtherStateSetVars
author: Frenkel TUD 2012-12"
Expand Down

0 comments on commit bf017ba

Please sign in to comment.