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
  • Index
  • » Users
  • » rolffankhauser
  • » Profile

Posts

Posts

Hi Loni,

Did you try:

der(TotalInfected) =  Incubating;

if you integrate both sides, you get TotalInfected = Integral(Incubating)

TotalInfected is the integral over the function Incubating, but I am not sure if that is really what you want because the end value is higher than the total population.
Isn't the maximum of Incubating the value you are looking for?

Best regards,

Rolf

Jun-06-10 19:10:31
Is it possible to use the Bondlib library in OpenModelica?

Maybe you can find some hints on the following site:

http://people.inf.ethz.ch/fcellier/Soft/Soft_index.html

I didn't use bond graphs but I found this site when I was looking for something else.

Kind regards,

Rolf

Maybe you have chosen a height and velocity of the satellite which did not result in elliptical curve.

The total energy of the satellite is E = 0.5*m*v^2 - G*M*m/(R + h). It must be negativ for an elliptical curve.

So, velocity v < sqrt(G*M/(R + h)). But if you choose v too small the elliptical curve will lie inside the earth, that means the satellite will crash into the earth.

For example for h = 10 km you get v < 5330 m/s. If you choose v = 5000 m/s you will get an elliptical curve which is near a circle. You can see that if you plot x1 and x2 vs. time ( plot({x1, x2}) )

The theoretical value of the semimajor axis should be a = G*M (R + h) / (2*G*M - v^2*(R + h)) = 14.6 E06. Thus, the width of the ellipse is 29.2 E06 which is close to the value in the plot.

Here is the code I used:

model orbit
 
  Real x1(start = 6.37E06);
  Real x2(start = 0.0);
  Real x3(start = 0.0);
  Real x4(start = 10.4E03);
  parameter Real m_E = 6.97E24;
  parameter Real G = 6.672E-11;

equation

  der(x1) = x3;
  der(x2) = x4;
  der(x3) = -G*m_E*x1/(x1^2 + x2^2)^1.5;
  der(x4) = -G*m_E*x2/(x1^2 + x2^2)^1.5;

end orbit;

simulate(orbit, startTime = 0.0, stopTime = 20000.0)

plotParametric(x1, x2)

As you can see, you have simulated 1/4 from an ellipse. So you have to simulate 4 times longer or 5 times longer to be sure that you simulate more than 360 degrees.

M_E should be 6.97e24, not 5.97e24, the rest of code seems to be ok.

I used x1(start = 6.37E06) and x4(start = 10.4E03)
and 20000 time steps. With these settings I get a perfect ellipse but the simulation takes some time (30s).

I guess that your start values should work too.

Have you tried:

plotParametric(x1, x2)

The label of the x-axis is wrong in my example, it's written "time" but the values are ok.

I found this command in OpenModelicaUsersGuide.pdf on page 31.  You can download this document from openmodelica.org under Home / User Documentation / Users Guide.

Regards,

Rolf

  • Index
  • » Users
  • » rolffankhauser
  • » Profile
You are here: