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

Complie error: Error occured while flattening model

Complie error: Error occured while flattening model

I'm copying the moon landing class from the ModelicaTutorialFritzson.pdf which comes with the program, page 25-26.
However, when I use the simulate function (also copied from the slides), an error occurred.
Please help.

This is the original code, I didn't modify anything:

Code:


>>class CelestialBody
constant Real g = 6.672e-11;
parameter Real radius;
parameter String name;
parameter Real mass;
end CelestialBody;

{CelestialBody}


>>class MoonLanding
parameter Real force1 = 36350;
parameter Real force2 = 1308;
protected
parameter Real thrustEndTime = 210;
parameter Real thrustDecreaseTime = 43.2;
public
Rocket apollo(name="apollo13");
CelestialBody moon(name="moon",mass=7.382e22,radius=1.738e6);
equation
apollo.thrust = if (time < thrustDecreaseTime) then force1
else if (time < thrustEndTime) then force2
else 0;
apollo.gravity=moon.g*moon.mass/(apollo.altitude+moon.radius)^2;
end MoonLanding;

{MoonLanding}

>>simulate(MoonLanding, stopTime=230)
record SimulationResult
    resultFile = "Simulation failed.
[b]Error: Error occured while flattening model MoonLanding[/b]
"
end SimulationResult;

Re: Complie error: Error occured while flattening model

Where is the Rocket class? You need that too.
What OpenModelica version/revision are you using?

Cheers,
Adrian Pop/

Re: Complie error: Error occured while flattening model

Thanks! I was careless to include Rocket class.
I am using OpenModelica 1.5.0.

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