Skip to content

Commit

Permalink
- improved some rules in ExpressionSolve
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@21753 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Vitalij Ruge committed Aug 5, 2014
1 parent 81cb9ea commit 9bc1926
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Compiler/BackEnd/ExpressionSolve.mo
Expand Up @@ -385,9 +385,9 @@ algorithm
case (_,_,DAE.CREF(componentRef = cr),_)
equation
false = hasOnlyFactors(inExp1,inExp2);
({},_) = List.split1OnTrue(Expression.factors(inExp1),isCrefInIFEXP,cr); // check: differentiateExpSolve is allowed
({},_) = List.split1OnTrue(Expression.factors(inExp2),isCrefInIFEXP,cr); // check: differentiateExpSolve is allowed
e = Expression.makeDiff(inExp1,inExp2);
(e,_) = ExpressionSimplify.simplify(e);
({},_) = List.split1OnTrue(Expression.factors(e),isCrefInIFEXP,cr); // check: differentiateExpSolve is allowed
dere = Differentiate.differentiateExpSolve(e, cr);
(dere,_) = ExpressionSimplify.simplify(dere);
false = Expression.isZero(dere);
Expand Down Expand Up @@ -532,13 +532,14 @@ algorithm
asserts2 = listAppend(asserts,asserts1);
then
(res,asserts2);
// f(a) = 0 => simplify(f(a)) = 0.0
case(_,DAE.RCONST(real = 0.0),DAE.CREF(componentRef = cr),_)
// f(a) = b => simplify1(f(a)) = b
case(_,_,DAE.CREF(componentRef = cr),_)
equation
true = Expression.expHasCref(inExp1, cr);
false = Expression.expHasCref(inExp2, cr);
(lhs,true) = ExpressionSimplify.simplify(inExp1);
(res,asserts) = solve(lhs,inExp2,inExp3);
(lhs,true) = ExpressionSimplify.simplify1(inExp1);
(rhs,_) = ExpressionSimplify.simplify1(inExp2);
(res,asserts) = solve(lhs,rhs,inExp3);
then (res, asserts);


Expand Down

0 comments on commit 9bc1926

Please sign in to comment.