Question

Is there a way to pass Dymola a command from the Windows command prompt? I want to pass it commands like Simulate(), openModel etc.

Was it helpful?

Solution

Well, you could write a script file (.mos) file instead. if are really interested in opening model/simulating a model using a .bat file, then you could also create a .bat file to write a script(.mos) file and then run the script file. I can provide an example for the same.

You could use the following line of code in a batch file and try running the same:

SET var=%cd%
cd %var%
echo openModel("%var%\test_case.mo", true) > filename.txt
echo simulateModel("test_case", method="dassl", resultFile="test_case") >> filename.txt
copy "filename.txt" "script.txt"
rename "script.txt" "script.mos"
script.mos

I am writing a script file (script.mos) first and then running the same. please note that I am referring to the current directory.

I am not sure if I have answered your question exactly, please feel free to suggest on the same.

OTHER TIPS

From the Dymola release notes: "A new Java interface for Dymola is available in Dymola 2014 FD01, containing a number of functions to perform operations such as simulating, setting variables, plotting, and exporting data." There is also a old version of this interface, that as far as I know is the only way to drive Dymola from another application. If you want to do it from command prompt I think that the only way is to develop a java application that works as a bridge.

I hope this helps, Marco

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top