Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page

# GenOpt - Starting dymosim.exe with .mat file as input file

Deary erveryone,

I have some issues using GenOpt together with Dymola. In my case I want to start the dymosim.exe with a .mat file as input file and not with a .txt file (typical dsin.txt). I have changed the entries in the initialization file for the template and input file from dsin.txt to the given .mat file and changed the command for calling the dymosim.exe with the .mat file. When I run the dymosim.exe with the .mat file from the command line it works.

However, when GenOpt copies the .mat file into the temporary folder (tmp-genopt-run-) the file seems to be corrupted somehow. The log file shows the following error:

... Error message from dymosim.exe
Error reading matrix header from file "dymosim_input.mat":
End-Of-File reached.

If I try to open the copied .mat.file with Matlab I get an error as well:

Number of columns on line 2 of ASCII file
C:\...\dymosim_input.mat must be the same as previous lines.

Does anyone have an idea why the copied .mat file is corrupted? I would highly appreciate any suggestions.

edit retag close merge delete

Sort by » oldest newest most voted

The problem seems to be caused because for GenOpt, the .mat file is not an input file. For GenOpt, input files are text files in which a text substitution needs to be done, while .mat is a binary file. To get your setup to work, you can specify the .mat file in the  SimulationStart { Command = "..." }  section. See for example example/quad/Fibonacci which uses CallParameter { Prefix="..."} to pass a file name to the command that starts the simulation.

more

Thank you, Michael! The clue to use CallParameter did solve the problem and now it works.

( 2018-04-11 07:59:58 -0500 )edit