Is there a collection set or a reference manual of commands in Dymola? For example, if I wanna know the current working directory, which command should I use? I tried pwd and dir, but they didn't work.
3
votes
2 Answers
7
votes
There are multiple sources to find commands which I check - in no special order - when it comes to finding a new command:
- In Dymola 2020x the 'User Manual 1B' contains a section '2.5.19 Built-in functions in Dymola' which gives a good overview on the topic.
- When starting Dymola a library called
DymolaCommandswill automatically be loaded. This can be searched using the package browser's 'Search' entry (by right-clicking onDymolaCommands-> Search). - In the Commands window you can call the function
listfunctions()to get an overview of the functions which can be called natively from Dymola's command line. Usually it makes most sense to search the text using CTRL+F afterwards. - Libraries can also provide useful functions. As an example the Modelica Standard Library provides the package
Modelica.Utilitiesin which e.g.Modelica.Utilities.Streams.printcan be used to debug models by plotting strings to the simulation log. Another one that can be pretty useful is the libraryModelManagement.
There are multiple possibilities to get the current directory.
cd(): Unfortunately this will only print the directory to the command output and returntrue. So this is more for manual checks, although the output can be retrieved bygetLastError(). Also this is Dmyola specific.- Using the Modelica Standard Library these are the commands that shall be used for managing the working directory:
Modelica.Utilities.System.getWorkDirectory()andModelica.Utilities.System.setWorkDirectory() - In case you want to get the directory of the currently executed script, the function
classDirectory()will do that, using Dymola >2021.
