[250] | 1 | <html> |
---|
| 2 | <title>Modelica Development Tooling Help</title> |
---|
| 3 | <body> |
---|
| 4 | <h1>Getting started</h1> |
---|
| 5 | |
---|
| 6 | <h2 id = "configurate_omc">Configuring the OpenModelica Compiler</h2> |
---|
| 7 | |
---|
| 8 | MDT need to be able to locate the binary of the OpenModelica Compiler. It uses the |
---|
| 9 | environment variable OPENMODELICAHOME to do so.<br> |
---|
| 10 | If you have problems using MDT make sure that OPENMODELICAHOME is set to the |
---|
| 11 | folder where the Open Modelica Compiler is installed. In other words |
---|
| 12 | OPENMODELICAHOME must point to the folder that contais Open Modelica compiler |
---|
| 13 | binary. It is named omc.exe on Windows Platform and omc on Unix platforms. |
---|
| 14 | |
---|
| 15 | <h2 id = "using_modelica_perspective">Accessing the Modelica Perspective</h2> |
---|
| 16 | |
---|
| 17 | <p> |
---|
| 18 | The most convenient way to work with Modelica projects is to use to the |
---|
| 19 | Modelica perspective. To switch to the Modelica perspective, choose the |
---|
| 20 | <b>Window</b> menu item, pick <b>Open Perspective</b> |
---|
| 21 | followed by <b>Other...</b> |
---|
| 22 | Select the <b>Modelica</b> option from the dialog presented and click <b>OK</b>. |
---|
| 23 | Not <b>Cancel</b>. Or any other button. |
---|
| 24 | </p> |
---|
| 25 | |
---|
| 26 | <h2 id = "making_a_project">Making a project</h2> |
---|
| 27 | <p> |
---|
| 28 | To start a new project, use the <b>New Modelica Project</b> Wizard. It is |
---|
| 29 | accessible through <b>File > New > Modelica Project</b>. |
---|
| 30 | After creating a project you can add files and folders to the project by selecting |
---|
| 31 | the corresponding wizard found in <b>File > New</b> menu subsection. |
---|
| 32 | Files having an extension <i>.mo</i> will be treated as Modelica source code files by MDT. |
---|
| 33 | </p> |
---|
| 34 | <img src="pix/new_modelica_project.png"> |
---|
| 35 | |
---|
| 36 | <h2 id = "importing_a_project">Importing a project</h2> |
---|
| 37 | <p> |
---|
| 38 | To import an existing modelica project you need to create an empty modelica project and populate it |
---|
| 39 | with existing files. Create a new modelica project with the wizard. Use the file system import wizard |
---|
| 40 | on that project to copy the files to the project's folder. The import wizard is available by right |
---|
| 41 | clicking on the project in the <b>Modelica Projects</b> view and choosing <b>Import...</b> alternative. |
---|
| 42 | </p> |
---|
| 43 | |
---|
| 44 | <h2 = "making_a_package">Making a package</h2> |
---|
| 45 | <p> |
---|
| 46 | To create a new Modelica package, use the <b>New Modelica Package</b> Wizard. |
---|
| 47 | You can access it by going through <b>File > New > Modelica Package</b> or by |
---|
| 48 | right-clicking in a project and selecting <b>New > Modelica Package</b>. |
---|
| 49 | Enter the desired name of the package and a description about what it contains. |
---|
| 50 | </p> |
---|
| 51 | <img src="pix/new_modelica_package.png"> |
---|
| 52 | |
---|
| 53 | <h2 = "making_a_class">Making a class</h2> |
---|
| 54 | <p> |
---|
| 55 | To make a new Modelica class, select where in the hierarchy that you want to add |
---|
| 56 | your new class and select <b>File > New > Modelica Class</b>. When creating a |
---|
| 57 | Modelica class you can add different restrictions on what the class can contain. |
---|
| 58 | These can for example be <i>model</i>, <i>connector</i>, <i>block</i>, |
---|
| 59 | <i>record</i>, or <i>function</i>. |
---|
| 60 | When you have selected your desired class type, you can select modifiers that |
---|
| 61 | add code blocks to the generated code. <i>Include initial code block</i> will for |
---|
| 62 | example add the line <b>initial equation</b> to the class. |
---|
| 63 | </p> |
---|
| 64 | <img src="pix/new_modelica_class.png"> |
---|
| 65 | |
---|
| 66 | <h2 = "syntax_checking">Syntax checking</h2> |
---|
| 67 | <p> |
---|
| 68 | Whenever a Modelica (.mo) file is saved in the Modelica Editor, it is checked |
---|
| 69 | for syntactical errors. Any errors that are found are added to the Problems view |
---|
| 70 | and also marked in the source code editor. Errors are marked in the editor as a |
---|
| 71 | red circle with a white cross, a squiggly red line under the problematic |
---|
| 72 | construct, and as a red marker in the right-hand side of the editor. If you want |
---|
| 73 | to reach the problem, you can either click the item in the Problems view or |
---|
| 74 | select the red box in the right-hand side of the editor. |
---|
| 75 | </p> |
---|
| 76 | <img src="pix/error.png"> |
---|
| 77 | |
---|
| 78 | <h2 = "code_completion">Code completion</h2> |
---|
| 79 | <p> |
---|
| 80 | If you type a dot (.) after anything that is loaded into OMC, code completion |
---|
| 81 | will kick in. If you for example type <b>Modelica.</b>, a list with packages |
---|
| 82 | and classes that are available in the Modelica package will be displayed. You |
---|
| 83 | can narrow down the matches by typing in the first characters of the class or |
---|
| 84 | package that you want to type in. So if you've first typed <b>Modelica.</b> you |
---|
| 85 | can the continue typing <b>Me</b> and MDT will propose <b>Mechanics</b> and |
---|
| 86 | <b>Media</b> as completions. You can always backtrack the narrowing by erasing |
---|
| 87 | characters.<br> |
---|
| 88 | <b>Note:</b> As of now, you have to have the Modelica System Library loaded for |
---|
| 89 | code completion on the system library to work. This can right now be |
---|
| 90 | accomplished by browsing the Modelica System Library in the projects view before |
---|
| 91 | trying to use code completion. |
---|
| 92 | </p> |
---|
| 93 | |
---|
| 94 | </body> |
---|
| 95 | </html> |
---|