Getting started

Configuring the OpenModelica Compiler

MDT need to be able to locate the binary of the OpenModelica Compiler. It uses the environment variable OPENMODELICAHOME to do so.
If you have problems using MDT make sure that OPENMODELICAHOME is set to the folder where the Open Modelica Compiler is installed. In other words OPENMODELICAHOME must point to the folder that contais the OpenModelica compiler binary. It is named omc.exe on Windows platforms and omc on Unix platforms.

Accessing the Modelica Perspective

The most convenient way to work with Modelica projects is to use to the Modelica perspective. To switch to the Modelica perspective, choose the Window menu item, pick Open Perspective followed by Other... Select the Modelica option from the dialog presented and click OK. Not Cancel. Or any other button.

Making a project

To start a new project, use the New Modelica Project Wizard. It is accessible through File > New > Modelica Project. After creating a project you can add files and folders to the project by selecting the corresponding wizard found in the File > New menu subsection. Files having an extension of .mo will be treated as Modelica source code files by MDT.

Importing a project

To import an existing Modelica project you need to create an empty Modelica project and populate it with existing files. Create a new Modelica project with the wizard. Use the file system import wizard on that project to copy the files to the project's folder. The import wizard is available by right clicking on the project in the Modelica Projects view and choosing the Import... alternative.

Making a package

To create a new Modelica package, use the New Modelica Package Wizard. You can access it by going through File > New > Modelica Package or by right-clicking in a project and selecting New > Modelica Package. Enter the desired name of the package and a description about what it contains.

Making a class

To make a new Modelica class, select where in the hierarchy that you want to add your new class and select File > New > Modelica Class. When creating a Modelica class you can add different restrictions on what the class can contain. These can for example be model, connector, block, record, or function. When you have selected your desired class type, you can select modifiers that add code blocks to the generated code. Include initial code block will for example add the line initial equation to the class.

Syntax checking

Whenever a Modelica (.mo) file is saved in the Modelica Editor, it is checked for syntactical errors. Any errors that are found are added to the Problems view and also marked in the source code editor. Errors are marked in the editor as a red circle with a white cross, a squiggly red line under the problematic construct, and as a red marker in the right-hand side of the editor. If you want to reach the problem, you can either click the item in the Problems view or select the red box in the right-hand side of the editor.
Note: If you're using TABs to indent your Modelica code, the error markers will be confused. This arises because OMC thinks TABs are 8 characters while Eclipse sees a TAB character as a single character.

Code completion

MDT will try to help you with writing code. Code completion starts at strategic positions in the code (when you type a dot (.)) or when you type Ctrl+Space.
If you for example type Modelica. , a list with packages and classes that are available in the Modelica package will be displayed. You can narrow down the matches by typing in the first characters of the class or package that you want to type in. So if you've first typed Modelica. you can then continue typing Me and MDT will propose Mechanics and Media as completions. You can always backtrack the narrowing by erasing characters.