In this blog post I look at the Dymola setup settings, how you edit them and where they are stored. There are lots of options available to personalise your Dymola setup; I won’t cover the detail of all the settings here, but by knowing where to edit them and where they are stored you will be able to explore the options yourself.
What Happens When I Open Dymola?
The setup settings are stored in files that are executed when Dymola is opened, but the files used have changed as Dymola has developed:
- Prior to Dymola 2017 FD01 the setup was stored in a shared script file setup.mos
- Starting in Dymola 2017 FD01 the setup was stored in a shared setup.dymx file
- After Dymola 2018 FD01, a startup.mos was used to apply personalised setup in addition to the shared setup.dymx
- From Dymola 2020x the setup is stored in a Dymola version specific setup.dymx file and a personal startup.mos
For the rest of the post I will focus on the the recent Dymola 2020x version.
When you open Dymola it will first execute the file setup.dymx, followed by the file startup.mos. When settings are present in both files, Dymola will use the value stored in the startup.mos file.
The majority of the setup settings are stored in the setup.dymx file. In Dymola you can change many setup settings in the Options dialog. You can open this from Tools > Options in Dymola 2020x as shown below.
Information on the settings available in the Options are given in the Dymola 2020x User Manual 1B . We have previous blog posts going into details on the settings for version control and Boolean advanced flags. There is also a past post on modifying the setup.dymx for advanced flags.
The Settings tab of the Options dialog allows you to specify additional settings to save to the setup.dymx file. This can include recent command history, Modelica Path, variables added in bus declaration and the startup directory.
From Dymola 2020x, there is a setup.dymx file for each Dymola version, rather than a shared file used for older Dymola versions. This change allows different settings to be specified for different Dymola versions, such as different compiler selections. For Dymola 2020x on Windows, you can typically find the setup.dymx file in C:\Users\<user>\AppData\Roaming\DassaultSystemes\Dymola\2020x.
The setup.dymx is an XML file, so you can open this file in any text editor to check what settings are being stored.
When you first install Dymola 2020x, Dymola will copy any previous setup.dymx or setup.mos to the new version specific file. However any customisations, such as opening libraries, won’t be copied to the new setup.dymx file, so you will need to add these to your personalised setup.
You can store your own customised setup in the startup.mos file.
This script is stored in the default working directory automatically created by Dymola; on Windows this is usually C:\Users\<user>\Documents\Dymola. If you also use this location as your working directory, be careful not to delete the startup.mos script when clearing out your old simulation results. To get around this I use a different location for my working directory, or you could save a copy of the startup.mos elsewhere as a backup.
The video below shows you how to open the startup.mos script for editing in Dymola 2020x; if it does not exist already this process will create one.
You can store a variety of customisations in your startup.mos file. The image below shows my own script, which contains a couple of common customisations you may want to use yourself.
The first line of the script opens my own library of tools every time I open Dymola. This library contains functions to load different sets of libraries from specific locations depending on what projects I am working on. A similar function is described in the post Creating a function for loading libraries.
The middle lines are commands from the simulation setup which I want changing from the default.
The final line is to change the working directory from the default.
This is only a small example of customisation you can apply in your personal setup; if you can script it you should be able to include it in your startup.mos script.
By using the setup settings available in the setup.dymx and startup.mos files, you are able to have a totally customised Dymola setup to make using the tool far easier.
 Dassault Systèmes AB (2019), Dymola User Manual Volume 1B,
Written by: Hannah Hammond-Scott – Modelica Project Leader