Skip to content

Commit

Permalink
- BackendDAECreate.lower3: add missing case for DAE.INITIALDEFINE
Browse files Browse the repository at this point in the history
- SimCodeUtil.createNonlinearResidualExp: add case for Enumerations
- Expression.expAdd,expSub: add case for Enumerations

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14216 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Dec 3, 2012
1 parent 581555f commit 2d4c3d8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Compiler/BackEnd/BackendDAECreate.mo
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,13 @@ algorithm
then
(inVars,inKnVars,inExVars,eqns,inREqnsLst,inIEqnsLst,inConstraintLst,inClassAttributeLst,inWhenClauseLst,inExtObjClasses,iAliaseqns);

// a initial solved equation
case (DAE.INITIALDEFINE(componentRef = _),_,_,_,_,_,_,_,_,_,_,_,_)
equation
ieqns = lowerEqn(inElement,functionTree,inIEqnsLst);
then
(inVars,inKnVars,inExVars,inEqnsLst,inREqnsLst,ieqns,inConstraintLst,inClassAttributeLst,inWhenClauseLst,inExtObjClasses,iAliaseqns);

// complex equations
case (DAE.COMPLEX_EQUATION(lhs = _),_,_,_,_,_,_,_,_,_,_,_,_)
equation
Expand Down
7 changes: 7 additions & 0 deletions Compiler/BackEnd/SimCodeUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4277,6 +4277,13 @@ algorithm
(res,_) = ExpressionSimplify.simplify(res);
then
res;
case(_,_)
equation
ty = Expression.typeof(iExp1);
true = Types.isEnumeration(ty);
res = Expression.expSub(iExp1,iExp2);
then
res;
case(_,_)
equation
ty = Expression.typeof(iExp1);
Expand Down
16 changes: 14 additions & 2 deletions Compiler/FrontEnd/Expression.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2782,7 +2782,13 @@ algorithm
b = DAEUtil.expTypeArray(tp) " array_elt_type(tp) => tp\'" ;
op = Util.if_(b,DAE.ADD_ARR(tp),DAE.ADD(tp));
then
DAE.BINARY(e1,op,e2);
DAE.BINARY(e1,op,e2);
case (_,_)
equation
tp = typeof(e1);
true = Types.isEnumeration(tp);
then
DAE.BINARY(e1,DAE.ADD(tp),e2);
end matchcontinue;
end expAdd;

Expand Down Expand Up @@ -2847,7 +2853,13 @@ algorithm
b = DAEUtil.expTypeArray(tp);
op = Util.if_(b,DAE.SUB_ARR(tp),DAE.SUB(tp));
then
DAE.BINARY(e1,op,e2);
DAE.BINARY(e1,op,e2);
case (_,_)
equation
tp = typeof(e1);
true = Types.isEnumeration(tp);
then
DAE.BINARY(e1,DAE.SUB(tp),e2);
end matchcontinue;
end expSub;

Expand Down

0 comments on commit 2d4c3d8

Please sign in to comment.