This post describes how to configure Dymola so that on startup you can set the directory, load a library and set other features.
When Dymola is started the dymola.mos file is run at startup (i.e. <Dymola installation directory>insertdymola.mos). By default the script should look something like this:
The RunScript command runs displayunit.mos script which is used to control the unit conversions in Dymola, for more information goto here . By uncommenting the line // RunScript(“$DYMOLA/insert/displayunit_us.mos”,true); the US units will be loaded.
A number of useful tasks and setting can be added to this script:
- Setting the current directory
Add cd(<pathName>) where pathName is the path that you want to start in.
- Set the number of files to store in Recent Files
Add Advanced.MaxRecentFiles = 9;
- Enable the Autoformating feature
Add Advanced.AutoFormatting = true; This activates the automatic formatting so that when you press Ctrl+L the code is automatically formatted and should look easier to read.
- Open a model
For example add openModel(“C:/Users/Public/Documents/ClaytexLibraries/Engines/package.moe”);
- Run .mos scripts
Use RunScript(<scriptName>) to run a script.
Note that when changing the dymola.mos file you may find that the Windows will not allow you to change modify the dymola.mos file. A workaround that is to save the modified dymola.mos file to the Desktop and then to replace the script in <Dymola installation directory>insert directory. If this does not work then please consult your IT personnel.
An example of a modified dymola.mos is below:
Changing the default font size
Adding additional units