- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Workaround for "Divison by zero"
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.
- sjoelund.se
- 1700 Posts
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.
- sjoelund.se
- 1700 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Workaround for "Divison by zero"