Skip to content

CODE VIEW🔗

Modelon Impact uses Modelica as a model description language. When building or modifying a model, the information is stored as Modelica code. This code can be viewed and edited in the Code View. Code edits are automatically saved and synchronized with the Library tree because any code change can affect many classes in multiple libraries. The code is saved at least when you leave the Code View and switch back to the Diagram View.

Opening the source Code view🔗

If you are in the modeling mode you can see the Diagram View of your model or class. Using the toggle button in the top bar lets you toggle between Diagram and Code View.

If your model/class is write-protected ("Read-only"), you cannot edit the code. This state is indicated next to the class name above the toolbar.

Editing Source Code🔗

It is possible to edit the Modelica source code for models/classes in your Projects.

Attention

Editing the source code directly is only recommended for experienced Modelica users. The recommendation is to edit the model graphically.

Components placed on the canvas can't be edited. Users must open the specific class specifying the component first using Open Class.

Write your code directly in the text. Modelon Impact automatically checks the syntax and indicates when and where errors occur. You can't change to a different model when you have unsaved code changes.

Use the toolbar to perform the following specific operations:

  • Save the code.
  • Undo/Redo to undo or restore changes.
  • Search for code snippets.
  • Find and replace code snippets (follow the instructions on the screen).

A number of convenient keyboard shortcuts are available and listed here.

Attention

Your temporary edits are only saved in web-browser memory. It is recommended to save often to avoid loosing your work due to the browser or session termination.

To make the code more readable, you also can choose your favorite display mode.

Check Local Balance 🔗

Check local balance informs the user that the equations, algorithms, and variables in the code are balanced meaning that they are solvable. More specifically the local number of unknowns (variables) should be identical to the local equation size (equations and algorithms). Modelon Impact will display errors in the Message Viewer and also provide hyperlinks there that take you directly to the incorrect part of the code.

When a model does not compile, an error message is displayed with a link to the part of the model source code for further investigation.

  1. Failed compilation results in an error message displayed below the navigation bar.
  2. An error message contains a link that when clicked opens the code editor and focuses the view on the relevant code line for further investigation and troubleshooting.