Skip to content

Commit

Permalink
added special zerofunctions for > and < relation
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17675 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
niklwors committed Oct 14, 2013
1 parent 9b38273 commit 747b923
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Compiler/Template/CodegenCpp.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7007,15 +7007,27 @@ template giveZeroFunc3(Integer index1, Exp relation, Text &varDecls /*BUFP*/,Tex
let e2 = daeExp(exp2, contextOther, &preExp /*BUFC*/, &varDecls /*BUFD*/,simCode)
match rel.operator

case LESS(__)
case LESS(__) then
<<
if(_conditions[<%zerocrossingIndex%>])
f[<%index1%>]=(<%e1%> -EPSILON - <%e2%>);
else
f[<%index1%>]=(<%e2%> - <%e1%> - 10*EPSILON);
>>
case LESSEQ(__) then
<<
if(_conditions[<%zerocrossingIndex%>])
f[<%index1%>]=(<%e1%> - EPSILON - <%e2%>);
else
f[<%index1%>]=(<%e2%> - <%e1%> - EPSILON);
>>
case GREATER(__)
case GREATER(__) then
<<
if(_conditions[<%zerocrossingIndex%>])
f[<%index1%>]=(<%e2%> - <%e1%> - EPSILON);
else
f[<%index1%>]=(<%e1%> -10*EPSILON - <%e2%>);
>>
case GREATEREQ(__) then
<<
if(_conditions[<%zerocrossingIndex%>])
Expand Down

0 comments on commit 747b923

Please sign in to comment.