diff --git a/Compiler/BackEnd/ExpressionSolve.mo b/Compiler/BackEnd/ExpressionSolve.mo index ddfd7afab0b..6622fd8f7bd 100644 --- a/Compiler/BackEnd/ExpressionSolve.mo +++ b/Compiler/BackEnd/ExpressionSolve.mo @@ -556,6 +556,14 @@ algorithm lhs = Expression.makeDiff(e2, lhs); (res,asserts) = solve(lhs,rhs,inExp3); then(res, asserts); + // -f(a) = b => f(a) = -b + case(DAE.UNARY(DAE.UMINUS(ty=tp), e1),_,DAE.CREF(componentRef = cr),_) + equation + true = Expression.expHasCref(e1, cr); + false = Expression.expHasCref(inExp2, cr); + e2 = DAE.UNARY(DAE.UMINUS(tp),inExp2); + (res,asserts) = solve(e1,e2,inExp3); + then(res, asserts); // 0 = a*(b-c) solve for b case (_,_,DAE.CREF(componentRef = _),_)