1

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:

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.

SFreu's avatar
13
SFreu
asked 2018-04-06 03:21:40 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

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.

Michael Wetter's avatar
1.7k
Michael Wetter
answered 2018-04-10 16:24:06 -0500
edit flag offensive 0 remove flag delete link

Comments

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

SFreu's avatar SFreu (2018-04-11 07:59:58 -0500) edit
add a comment see more comments