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

Workaround for "Divison by zero"

Workaround for "Divison by zero"

Hi,

Have a look at this following model.

model test
  Real X;
equation
  X = atan(1 / (1 - time));
end test;

I want to get the value of X over a period of time. But as soon as time becomes 1, I get the division by zero error and the simulation fails. Shouldn't atan() be able to valuate any real number? Is there any workaround for this?

Thanks,

Sanjay

Re: Workaround for "Divison by zero"

atan may be able to evaluate any real value. But division does not.

Re: Workaround for "Divison by zero"

Is there any alternative for this ?

Re: Workaround for "Divison by zero"

Yes. Not writing code that triggers division by zero... Using limits and rewriting the expression I suppose. Infinity is not a valid real value in Modelica.

Re: Workaround for "Divison by zero"

Thanks.

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