Importing Modelica Files Using EKL Scripting

You can import Modelica files using Enterprise Knowledge Language (EKL) scripts. You use the global function ImportModelicaFile.

In this scenario you import the Modelica model MyModelX in session.


Before you begin:
  • You are working in the Dymola Behavior Modeling app.
  • The Modelica model to import, MyModelX.mo, is located in the folder E:\MyExperiments.
See Also
About Knowledge Handling Features in Dymola Behavior Modeling
Dymola Behavior Modeling Methods Functions: ImportModelicaFile
  1. From the Compass, click My 3D Modeling Apps , and select Engineering Rules Capture.
  2. From the action bar, click Action .

    For full information about actions, see Engineering Rules Capture Users Guide: Working with Actions: Creating an Action.

  3. In the Action Editor, do the following:
    1. Click the text pane to enter it.
    2. Press Enter to go to a new line.
    3. Click Language Browser.
    4. In the Language Browser, the Search box, start typing import.
      The hits are displayed dynamically as you type.
    5. Double-click the search result ImportModelicaFile.
      ImportModelicaFile() is added in the Action Editor pane.
    6. Click in the bracket of the above function and type the file path with quotes.
      The full text is now:ImportModelicaFile("E:\MyExperiments\MyModelX.mo")
    7. Click OK.
    The result is:
    • The action is created.
    • In the tree, under the Relations.1 node, the action is displayed with an icon .
  4. In the tree, under the Relations.1 node, right-click Action 1 and select Action.1 object > Run.
  5. In the Insert Object dialog box, click OK.
    The Modelica file MyModelX is imported in session, at root level.
  6. From the Compass, click My 3D Modeling Apps , and select Behavior Modeling.

Note: You can now edit and run the action directly without changing app. You can edit the action by double-clicking the action in the tree.