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 drop-down menu 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.
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.
Use the toolbar to perform the following specific operations:
- Undo/Redo to undo or restore changes,
- Search for code snippets,
- Find and replace code snippets (follow the instructions on the screen)
To make the code more readable, you also can choose your favorite display mode.
Modelon Impact automatically saves every 3 seconds and when you switch to Diagram View. Modelon Impact keeps the original formatting from duplicated or imported models. This is relevant as certain tools will register a change in format as a new version even when the content is the same.
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.
Link to Source 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.
- Failed compilation results in an error message displayed below the navigation bar.
- 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.