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

where does 'import' look for packages

where does 'import' look for packages

In a directory  i put a model file (Apollo12a.mo).

In a subdirectory named 'Core' i put the package files. package.mo, Body.mo, CelestialBody.mo, Rocket.mo.

In de file Apollo12a.mo i put the import Core; statement.

When i run the command 'omc Moonlanding.mos' i get the error message 'Class Core.CelestialBody not found'.
----
mos file:
loadFile("Moonlanding.mo");
simulate(MoonLanding, stopTime=230);
plot({apollo.altitude,apollo.thrust});

----


package file in the Core directory
------
within ;

encapsulated package Core "Contains the Core classes and models"

end Core;

------

Q: Where does omc look for the 'import Core' statement.

Re: where does 'import' look for packages

Hi,

Read more here:
https://modelica.org/documents/ModelicaSpec33.pdf
Chapter 13: Packages

Cheers,
Adrian Pop/

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