Skip to content

Commit

Permalink
ExressionSolve.solve2:
Browse files Browse the repository at this point in the history
- added more cases for if() and semiLinear()
(new rules, which need tmp vars)
- added rule for abs(f(x)) = g(y) w.r.t. x
- added rule for pow(f(x),y) = z w.r.t. x



git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23722 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Vitalij Ruge committed Dec 10, 2014
1 parent 645b24a commit cf82a10
Show file tree
Hide file tree
Showing 4 changed files with 289 additions and 49 deletions.
11 changes: 6 additions & 5 deletions Compiler/BackEnd/BackendEquation.mo
Expand Up @@ -1524,6 +1524,7 @@ public function equationToScalarResidualForm "author: Frenkel TUD 2012-06
input BackendDAE.Equation inEquation;
output list<BackendDAE.Equation> outEquations;
algorithm

outEquations := match (inEquation)
local
DAE.Exp e, e1, e2, exp;
Expand Down Expand Up @@ -2138,11 +2139,11 @@ algorithm
BackendDAE.EquationAttributes eqAttr;

case (BackendDAE.EQUATION(exp=e1, scalar=e2, source=source, attr=eqAttr), _, _) equation
(res, _) = ExpressionSolve.solve2(e1, e2, crefExp, functions);
(res, _, {}, {}) = ExpressionSolve.solve2(e1, e2, crefExp, functions, NONE());
then (BackendDAE.EQUATION(crefExp, res, source, eqAttr));

case (BackendDAE.ARRAY_EQUATION(left=e1, right=e2, source=source, attr=eqAttr), _, _) equation
(res, _) = ExpressionSolve.solve2(e1, e2, crefExp, functions);
(res, _, {}, {}) = ExpressionSolve.solve2(e1, e2, crefExp, functions, NONE());
then (BackendDAE.EQUATION(crefExp, res, source, eqAttr));

case (BackendDAE.SOLVED_EQUATION(componentRef=cref, exp=e2, source=source, attr=eqAttr), _,_) equation
Expand All @@ -2154,16 +2155,16 @@ algorithm
cr = Expression.expCref(crefExp);
false = ComponentReference.crefEqual(cref, cr);
e1 = Expression.crefExp(cref);
(res, _) = ExpressionSolve.solve2(e1, e2, crefExp, functions);
(res, _, {}, {}) = ExpressionSolve.solve2(e1, e2, crefExp, functions, NONE());
then (BackendDAE.EQUATION(crefExp, res, source, eqAttr));

case (BackendDAE.RESIDUAL_EQUATION(exp=e2, source=source, attr=eqAttr), _, _) equation
e1 = Expression.makeConstZero(Expression.typeof(e2));
(res, _) = ExpressionSolve.solve2(e2, e1, crefExp, functions);
(res, _, {}, {}) = ExpressionSolve.solve2(e2, e1, crefExp, functions, NONE());
then (BackendDAE.EQUATION(crefExp, res, source, eqAttr));

case (BackendDAE.COMPLEX_EQUATION(left=e1, right=e2, source=source, attr=eqAttr), _, _) equation
(res, _) = ExpressionSolve.solve2(e1, e2, crefExp, functions);
(res, _, {}, {}) = ExpressionSolve.solve2(e1, e2, crefExp, functions, NONE());
then (BackendDAE.EQUATION(crefExp, res, source, eqAttr));
/*
case (eq as BackendDAE.ALGORITHM(alg=_), _)
Expand Down

0 comments on commit cf82a10

Please sign in to comment.