Skip to content

Commit

Permalink
SimCodeCSharp.tpl - changes to zeroCrossing template - the domain zc …
Browse files Browse the repository at this point in the history
…approach

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9536 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jan Silar committed Jul 26, 2011
1 parent c8f6880 commit d42e30e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Compiler/susan_codegen/SimCode/SimCodeCSharp.tpl
Expand Up @@ -721,12 +721,12 @@ template zeroCrossing(Exp it, Integer index, SimCode simCode) ::=
<%preExp%>
gout[<%index%>] = <%
match operator
case LESS(__)
case LESSEQ(__) then '<%e1%> - <%e2%>' //space is mandatory here ... (X--1) must be (X - -1)
case GREATER(__)
case LESSEQ(__) then '<%e1%> - <%e2%>' //space is mandatory here ... (X--1) must be (X - -1)
case LESS(__)
case GREATEREQ(__) then '<%e2%> - <%e1%>'
case EQUAL(__) then '/*HACK*/(<%e2%> == <%e1%>) ? 0.0 : 1.0' //'<%e2%> == <%e1%>'
case NEQUAL(__) then '/*HACK*/(<%e2%> != <%e1%>) ? 0.0 : 1.0' //'<%e2%> != <%e1%>'
case EQUAL(__)
case NEQUAL(__) then '/*BE AWARE*/Math.Abs(<%e1%> - <%e2%>)' // maybe a HACK, but mathematically correct against the domain change test: (gout > 0) <> (gout_old > 0)
else "!!!unsupported ZC operator!!!"
%>;
>>
Expand Down

0 comments on commit d42e30e

Please sign in to comment.