Skip to content

Commit

Permalink
- bugfix SimCodeUtil.createNonlinearResidualExp for bool and string
Browse files Browse the repository at this point in the history
- bugfix SimCodeUtil.makeSES_RESIDUAL1, use createNonlinearResidualExp instead of Expression.expSub, this works also for bool and string
- CodegenC.daeExpLbinary, report better error message

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13665 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Oct 27, 2012
1 parent 24286ed commit 63415d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Compiler/BackEnd/SimCodeUtil.mo
Expand Up @@ -4270,14 +4270,14 @@ algorithm
equation
ty = Expression.typeof(iExp1);
true = Types.isBooleanOrSubTypeBoolean(ty);
res = DAE.LUNARY(DAE.NOT(ty),DAE.LBINARY(iExp1,DAE.EQUAL(ty),iExp2));
res = DAE.LUNARY(DAE.NOT(ty),DAE.RELATION(iExp1,DAE.EQUAL(ty),iExp2,-1,NONE()));
then
res;
case(_,_)
equation
ty = Expression.typeof(iExp1);
true = Types.isStringOrSubTypeString(ty);
res = DAE.LUNARY(DAE.NOT(ty),DAE.LBINARY(iExp1,DAE.EQUAL(ty),iExp2));
res = DAE.LUNARY(DAE.NOT(ty),DAE.RELATION(iExp1,DAE.EQUAL(ty),iExp2,-1,NONE()));
then
res;
else
Expand Down Expand Up @@ -4474,7 +4474,7 @@ protected
DAE.Exp e1,e2,e;
algorithm
(e1,e2) := inTpl;
e := Expression.expSub(e1,e2);
e := createNonlinearResidualExp(e1,e2);
outSimEqn := SimCode.SES_RESIDUAL(uniqueEqIndex,e,source);
ouniqueEqIndex := uniqueEqIndex +1;
end makeSES_RESIDUAL1;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Template/CodegenC.tpl
Expand Up @@ -6331,7 +6331,7 @@ case LBINARY(__) then
match operator
case AND(__) then '(<%e1%> && <%e2%>)'
case OR(__) then '(<%e1%> || <%e2%>)'
else "daeExpLbinary:ERR"
else error(sourceInfo(),"daeExpLbinary:ERR")
end daeExpLbinary;


Expand Down

0 comments on commit 63415d5

Please sign in to comment.