Skip to content

Commit

Permalink
- keep the correct type when replacing constant alias vars
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24615 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Volker Waurich committed Feb 17, 2015
1 parent 8d41375 commit e985982
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Compiler/BackEnd/RemoveSimpleEquations.mo
Expand Up @@ -1337,18 +1337,22 @@ algorithm
(_, (false, _, _, _, _, ilst)) = Expression.traverseExpTopDown(exp, traversingTimeVarsFinder, (false, vars, knvars, true, false, {}));
ilst = List.uniqueIntN(ilst, BackendVariable.varsSize(vars));
vlst = List.map1r(ilst, BackendVariable.getVarAt, vars);
ty = Expression.typeof(exp);
e2 = Expression.makeConstZero(ty);
then
// shoulde be ok since solve checks only for iszero
solveTimeIndependentAcausal(vlst, ilst, exp, DAE.RCONST(0.0), eqnAttributes, inTpl);
solveTimeIndependentAcausal(vlst, ilst, exp, e2, eqnAttributes, inTpl);
case (_, _, _, (vars, BackendDAE.SHARED(knownVars=knvars), _, _, _, _, _))
equation
// collect vars and check if variable time not there
(_, (false, _, _, _, _, ilst)) = Expression.traverseExpTopDown(exp, traversingTimeVarsFinder, (false, vars, knvars, false, false, {}));
ilst = List.uniqueIntN(ilst, BackendVariable.varsSize(vars));
vlst = List.map1r(ilst, BackendVariable.getVarAt, vars);
ty = Expression.typeof(exp);
e2 = Expression.makeConstZero(ty);
then
// shoulde be ok since solve checks only for iszero
solveTimeIndependentAcausal(vlst, ilst, exp, DAE.RCONST(0.0), eqnAttributes, inTpl);
solveTimeIndependentAcausal(vlst, ilst, exp, e2, eqnAttributes, inTpl);
// in all other case keep the equation
case (_, _, true, _)
equation
Expand Down

0 comments on commit e985982

Please sign in to comment.