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

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

asked 2018-04-06 03:21:40 -0500

SFreu gravatar image

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:

Error using load
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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-04-10 16:24:06 -0500

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.

edit flag offensive delete link more


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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer


Question Tools


Asked: 2018-04-06 03:21:40 -0500

Seen: 24 times

Last updated: Apr 10