Generating a Modelica Model from an Engineering Model, in a Stand-Alone Package, Using a Command
You can generate a Modelica model from an engineering model in a stand-alone Modelica package, using a command.
The following apply:
- The engineering model objects and the related parameters must be mapped to Modelica libraries. See Mapping Engineering Model Objects and Parameters to Modelica Libraries.
- The Modelica libraries used for the mapping must be installed.
- Make sure that you have
access to the following apps:
- For the generation of 3D Piping, both the Dymola Behavior Modeling app and the Piping & Tubing 3D Design app.
- For the generation of 3D HVAC, both the Dymola Behavior Modeling app and the HVAC 3D Design app.
- For the generation of schematic P&ID, both the Dymola Behavior Modeling app and the Functional & Logical Design app.
-
From the top bar, search the source model in the
following way, depending on the model:
- If the model contains a physical product, you can search for
that physical product. For example, you can search for a physical
product with the name
Piping_Product
by typing prd:*Piping_* in the Search field and click Search . - If the model contains only a logical part, that is the case for
some schematic P&ID models, you can search for the logical part.
For example, you can search for a logical part with the name
My_P_ID_Model
by typing log:*My_P_ID_Model* in the Search field and click Search .
For more information about searching, see 3DEXPERIENCE Native Apps: Native Apps Top Bar.
The Search Results panel appears. - If the model contains a physical product, you can search for
that physical product. For example, you can search for a physical
product with the name
-
To open the product, right-click it in the Search Results
panel and select Open With > Smart Open in RFLP
.
The product is opened in authoring mode.Notes:
- For a 3D piping product, if the product is not opened in Piping & Tubing 3D Design, open that app from the Compass.
- For a 3D HVAC product, if the product is not opened in HVAC 3D Design, open that app from the Compass.
- Optional:
If you are to generate Modelica code for a subsystem of the 3D piping
or HVAC model, select the piping or HVAC objects in the subsystem the
following way:
Important: For a schematic P&ID model, use instead the filtering in the mapping to select subsystem. - Expand the tree for the physical product to see the piping objects.
- In the tree, select the piping or HVAC objects in the subsystem.
-
To store the generated model, create a new Dymola Behavior library,
with the name
MyGeneratedModels. See
Create a Dymola Behavior Library.
The result is:
- You enter Dymola Behavior Modeling in a new tab.
- A Dymola Behavior Library MyGeneratedModels is created in the new tab.
Tip: To work more comfortably between the apps, make both tabs visible on the screen. - In Dymola Behavior Modeling, open the Modelica libraries that you have stored your mapping tables in.
-
To generate the Modelica model, from the
Behavior Tools section of the action bar, click Generate from
Engineering Model
.
The Generate Modelica from Engineering Model dialog box appears.Note: If you already have an active model that is generated by this command, the dialog is prefilled with the setup used for generating this model.
-
Click the Engineering Model field and select any
of:
- For a piping or HVAC model: In the tab where the model is seen, under the Physical node of the tree, select any part of the model to be used for the Modelica model generation.
- For a schematic P&ID model: In the tab where the model is
seen, in the tree, select the relevant logical
schematic view to be used for the Modelica model generation.
Important: Select the same logical view as the logical view selected as the working model for the mapping.
The name of the model appears in the Engineering Model field. -
Select the parent class where the generated model should be
inserted the following way:
- Click the Insert in field.
- In Dymola Behavior Modeling, from the Package Browser, or in the tree, click the package where you want to insert the Modelica representation. In this scenario, click the library you created.
- Click the Output class name field and enter a name for the Modelica model to be created. In this scenario, enter MyGeneratedPipingModel.
-
Select Mapping to use for the model generation.
Note: You can select from:
- The default mapping tables.
- Mapping tables that you have saved in Modelica libraries that are open in session.
- If you have mapping tables saved in the database in older versions than 3DEXPERIENCE R2022x GA, they are available as well.
- Optional: Click More >> to see optional selections.
- Optional:
To generate Modelica code for a subsystem, do the following:
Important: In the 3D piping or HVAC model, you must select subsystems before using the Generate from Engineering Model command. See Step 3. Important: For a schematic P&ID model, use instead the filtering in the mapping to select subsystem. -
Activate
Advanced Selection.
By default, this option is not activated.
The following is the result:- A
Multi-Selection dialog box appears.
Important: The Multi-Selection is grayed and is not used when selecting subsystems this way when you have the piping model in a separate tab. Compare with the next task where you use behaviors instead. - The selection of Engineering Model is reset.
- A
Multi-Selection dialog box appears.
- Reselect the piping or HVAC model, see Step 7.
You have selected subsystems to generate Modelica code for. -
Activate
Advanced Selection.
- Optional:
To rebuild the model when performing any general update command, that
is, any of the commands Update or
Update Assistant, activate the
Rebuild at PLMUpdate.
By default, this option is activated.
A reason for clearing this option can be if you want to compare two alternatives of a model without risking that an update command updates the wrong model.
- Optional:
To use thumbnail pictures from the 3D model, activate
Generated Icons from Model.
By default, this option is activated.
If this option is cleared, the icons of the components from the 2D diagram are used instead.
Note: The selection is kept when closing and opening the dialog box, unlike for the other options. When you start a new session, the default setting is used. - Optional:
Select Layout algorithm:
- Force-based (default selection for generation from a 3D Piping or HVAC model)
- Projection
- From Schematics (default selection for generation from a schematic P&ID model)
- No Diagram
For information about the alternatives, see Generated Diagram Layer and 3D Representation.
-
Click
OK to start the model generation.
The following is displayed in the Package Browser under the selected target package MyGeneratedModels:
- A package
InternalGenerated that contains a
package MyGeneratedPipingModel. This
package contains:
- A base class
MyGeneratedPipingModel that
is the generated main model. The class is represented by
the icon . Under this base
class, there is a subpackage containing the media of the
model.Notes:
- Do not edit this class. It is for internal use.
- If you have selected to generate Modelica code for subsystems, the generated main model contains the subsystems.
- A number of subpackages containing the
generated Modelica component classes corresponding to
the engineering model components. These components can
be used to build new models. The components also include
records containing data from the physical model; this
means that this data can be used in new models.Note: These classes are by default hidden. For information on how to display these classes, and how to use them, see Overview with Protected Classes Displayed, For Advanced Users.
- A base class
MyGeneratedPipingModel that
is the generated main model. The class is represented by
the icon . Under this base
class, there is a subpackage containing the media of the
model.
- An extended class
MyGeneratedPipingModel. The class is
represented by the same icon as the base class: . Note: This is the class that you can edit to, for example, extend the model or replace components. It is by default opened when the model is generated.
Tip: For more information about the features of the generated classes, see About Generating a Modelica Representation of an Engineering Model. Examples of such features are: - Modifying the mapping from a selected class in the generated model
- Handling animation
- Replacing of components
- Using generated components in other models
- Reusing data from the physical model in other models
- A package
InternalGenerated that contains a
package MyGeneratedPipingModel. This
package contains:
-
To prepare the generated main model for testing, do the following:
Important: This step describes how you can set up a very simple generated main model for simulation. For more information about creating simulation models from more realistically generated models and components, see Building a Simulation Model. Note: Usually generated components are just components. You must connect them to test them.- In MyGeneratedModels, create a new model TestMyGeneratedPipingModel. See Create a New Class or Extend from an Existing Class Using the New Class Command.
-
To instantiate
MyGeneratedPipingModel, drag it into the
TestMyGeneratedPipingModel model.
Important: Drag the right model, the top-level model, do not drag the model inside the InternalGenerated package. -
Connect the parameters that need connection.
You might need to drag other components into the model and connect them, depending on the model.
The MyGeneratedPipingModel model is now connected to a simple "test rig" to test it.Note: The structure of libraries is often more elaborate. For example, it is common to have a separate library for some generated models, and another library to use them in customer models.Tip: It is useful to view the diagram of the generated model. As an example, you can see if connections between components are missing. - Simulate the model. See Simulating a Behavior.