Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

if else command when rounding numbers

if else command when rounding numbers

I have a problem using modelica.. I am supposed to enter an equation in order to round to whole numbers using an if else command but i can't seem to figure it out on my own..
Can anyone help me?
My suggestion was something like this, but it doesn't work

if (omega_help(t_sol) > 0) then integer(floor(omega_help(t_sol) + 0.5)) else integer(ceil(omega_help(t_sol) - 0.5));

thank you in advance!

Re: if else command when rounding numbers

What is the issue? It seems to work for me.
https://openmodelica.org/images/agorapro/attachments/3214/mini_Unbenannt.PNG

Edited by: lochel - Jun-27-17 11:21:31
Attachments:

Re: if else command when rounding numbers


https://openmodelica.org/images/agorapro/attachments/5832/mini_Unbenannt.PNG

(line 452)
I don't know why it doesn't work..

Attachments:
There are 0 guests and 0 other users also viewing this topic
You are here: