Jack
Jack

Reputation: 1232

Command manual in Dymola

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.

enter image description here

Upvotes: 3

Views: 1149

Answers (2)

Markus A.
Markus A.

Reputation: 7500

There are multiple sources to find commands which I check - in no special order - when it comes to finding a new command:

  1. 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.
  2. When starting Dymola a library called DymolaCommands will automatically be loaded. This can be searched using the package browser's 'Search' entry (by right-clicking on DymolaCommands -> Search).
  3. 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.
  4. Libraries can also provide useful functions. As an example the Modelica Standard Library provides the package Modelica.Utilities in which e.g. Modelica.Utilities.Streams.print can be used to debug models by plotting strings to the simulation log. Another one that can be pretty useful is the library ModelManagement.

There are multiple possibilities to get the current directory.

  1. cd(): Unfortunately this will only print the directory to the command output and return true. So this is more for manual checks, although the output can be retrieved by getLastError(). Also this is Dmyola specific.
  2. Using the Modelica Standard Library these are the commands that shall be used for managing the working directory: Modelica.Utilities.System.getWorkDirectory() and Modelica.Utilities.System.setWorkDirectory()
  3. In case you want to get the directory of the currently executed script, the function classDirectory() will do that, using Dymola >2021.

Upvotes: 7

Hans Olsson
Hans Olsson

Reputation: 12507

There should be a package called "Dymola Commands" or "DymolaCommands" in the package browser (at least since Dymola 2018).

You can open it as any other package, and either browser through the commands or right-click and use "Search" (tick "Full documentation").

Upvotes: 2

Related Questions