About Knowledge Handling Features in Dymola Behavior Modeling

You can work with Knowledge in Dymola Behavior Modeling. This concept lists the features available, where they are documented, and in some cases also how you can apply them.

For basic information about Knowledge, see Knowledge Basics Users Guide.

This page discusses:

Exposing Modelica Parameters to Knowledge Parameters and Creating Modelica Parameters from Knowledge Parameters

You can expose Modelica parameters to Knowledge parameters, and create Modelica parameters from Knowledge parameters. You can expose Modelica parameters from both the Parameter and Variable Editor and the dialog box for Modelica parameters.

For more information, see:

Rules, Checks, Actions, and Other Generic Knowledge Tools

You can use rules, checks, actions, and other generic Knowledge tools available in the Engineering Rules Capture app by launching this app when you work in Dymola Behavior Modeling.

For how to use these tools, see Engineering Rules Capture Users Guide.

Notes:
  • Resource tables can be created directly in Dymola Behavior Modeling, without launching Engineering Rules Capture. See Resource Tables below.
  • To work with rules, checks, actions, and other generic tools, the Modelica library to work with must be unlocked.

Rules, Checks, and other features you create are displayed in the tree, under a Relations.1 node. There can be only one such node for each Dymola Behavior Modeling library.

For an example of creating and using an action, see next section.

Enterprise Knowledge Language (EKL) Scripting

When you use rules, checks, actions, and other generic Knowledge tools available in the Engineering Rules Capture app, you use Enterprise Knowledge Language (EKL) scripting.

Importing Modelica Files Using EKL Scripting

You can import Modelica files in session using EKL scripting. The files are located at root level.

The global Knowledge function ImportModelicaFile(filepath) allows you to import a Modelica file in session. See Importing Modelica Files Using EKL Scripting.

Modifying Modelica Models From EKL Scripting

You can create and modify different parts of the Modelica text in a model. The full text of the class can be created or modified, including the declaration and termination of the class.

A number of Knowledge types are available to modify the Modelica text of different Modelica classes. Each type of class has its own Knowledge type, for example, ModelicaFunction for Modelica classes of type function. The available types are:

Type Comment
ModelicaAllTypes General type, the other types, except ModelicaComponent, inherits attributes from this type.
ModelicaBlock For blocks
ModelicaClass For classes
ModelicaComponent For components. The attributes for this type are different from the other types, see below.
ModelicaConnector For connectors
ModelicaFunction For functions
ModelicaModel For models
ModelicaPackage For packages
ModelicaRecord For records
ModelicaType For types

The Knowledge types, except ModelicaComponent, have the following attributes that specify what part of the Modelica Text is edited:

Attribute Use
ModelicaText Create or edit the full Modelica text of a class.
ModelicaFullDocumentation Create or edit the documentation of a class.
ModelicaClassName Edit the class name.
ModelicaDescription Edit the description of a class.
ModelicaFullPath Display the full path of a class.
ModelicaComponentName Display the component name of a class (read-only).
ModelicaUseOfClass Display the uses annotations (read-only).
Important: Edit here means "replace", you cannot do any editing of present content in any type of editor.

For ModelicaComponent, the following attributes exist:

Attribute Use
McaComponentEnclosingClass Display the enclosing class of the component (read-only).
McaComponentDescription Edit the component description.
McaComponentName Edit the component name.
McaComponentReferenceClass Display the reference class of the component (read-only).
Important: Edit here means "replace", you cannot do any editing of present content in any type of editor.

For most users, the most usable Knowledge type and related attribute is ModelicaModel.ModelicaText for modifying the full Modelica text of a Modelica model. For an example of how to use this type, see Modifying the Modelica Text of a Modelica Class Using EKL Scripting.

Simulating Modelica Models Using EKL Scripting and Retrieving the Results

You can simulate models using EKL scripting and retrieve the simulation results for further scripting, using the global Knowledge functions SimulateBehaviorModel and GetSimulationResult.

For more information, see Simulating Models Using EKL Scripting and Retrieving the Results.

Generating a Modelica Model from a Kinematic Mechanism Using EKL Scripting

You can generate a Modelica model from a Kinematic Mechanism using the EKL scripting method GenerateBehaviorModelFromMechanism. This method is available for the Knowledge type ModelicaPackage.

For more information, including available attributes, see Generate a Modelica Model from a Kinematic Mechanism, Using a Scripting Method.

Generating a Modelica Model from a 3D Piping Model Using EKL Scripting

You can generate a Modelica model from a 3D piping model using the EKL scripting methods. GenerateBehaviorModelFromMechanism.

The scripting methods are:

  • GenerateBehaviorModelFromPiping for generation from a 3D piping model
  • GenerateBehaviorModelFromSinglePipingObject for generation from a single piping object
This method is available for the Knowledge type ModelicaPackage.

For more information, including available attributes, see Generating a Modelica Model from an Engineering Model, in a Behavior, Using a Scripting Method.

Design Tables

You can create design tables containing Knowledge parameters. In Dymola Behavior Modeling, Knowledge parameters are Modelica parameters exposed to Knowledge.

See Creating and Using Design Tables.

Resource Tables

In general, you can use resource tables to define resources that can be used in the Knowledge expressions. In Dymola Behavior Modeling, you can use resource tables to reference data files for Modelica models.

You can only have one resource table for each Modelica library.

For an example, see Creating and Using Resource Tables.