Dahmani Merzaka
Dahmani Merzaka

Reputation: 163

Create a package in Modelica

I am using Modelica in my work, where I have modeled a system that contains many models. I want to make it simple to use by creating a package using " within" so this package contains all the models. What I want is to open the package instead of opening many models, which takes time.

Upvotes: 3

Views: 1295

Answers (2)

Dahmani Merzaka
Dahmani Merzaka

Reputation: 163

According to this website http://omwebbook.openmodelica.org/ A package is simply a container or namespace for names of classes, functions, constants, and other allowed definitions. The package name is prefixed to all definitions in the package using standard dot notation. An import language construct is provided for Modelica packages.

the package can help us to gather components that build the main model together in same place inside it , just by clicking on the package you open all your components inside it. to open a package in Modelica we follow the follwing instructions:

enter image description here enter image description here enter image description here enter image description here enter image description here

After creationg the package you will get a folder with the package name in the place that you chosed to saved it in it , when you open the folder you click on package in order to open your package . hope this can be helpfull

Upvotes: 1

marco
marco

Reputation: 6655

Instead of doing everything by hand, I suggest to create your packages with a Modelica tool (OpenModelica, Dymola, SimulationX, ...).

The tool will automatically create the folder structure and the within lines in the .mo files for you. Doing it manually is not much fun.

You could e.g. use OMEdit (part of OpenModelica) to create your package structure as follow:

  • create your top-level package via File > New Modelica Class
  • insert sub-models and sub-packages in existing packages via right-click > New Modelica Class

Upvotes: 6

Related Questions