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

DIVIDE BY ZERO

DIVIDE BY ZERO

Hi,

Trying to simulate a model which worked perfectly using Dymola, I got the error:
Divide by zero
:

equation
  der(H3) = omega;
  der(H2) = Vx * Modelica.Math.sin(theta)+ X * Modelica.Math.cos(theta) * omega;
  der(H1) = Vx* Modelica.Math.cos(theta)+ X * Modelica.Math.sin(theta) * omega;
  Vx = Y * omega;
  Vy = - omega * X ;

  der(theta) = (-Vx) / X;
  der(X) = Modelica.Math.cos(theta) * Vx- Modelica.Math.sin(theta) * Vy;
  der(Y) = Modelica.Math.sin(theta) * Vx+ Modelica.Math.cos(theta) * Vy;
  (-Modelica.Math.sin(theta) * der(X)) + X * der(theta) = 0;

end AUT;

Re: DIVIDE BY ZERO

When does the error occur? When you start the simulation or while the simulation is running.
If its on start, you could try to provide start values.
for example

model AUT
Real X(start=1);
.
...
.
end model;

But it doesn't necessarily need to be the variable X, it could also come from another equation, that is transformed in order to solve the system.

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