Using Dymola model in Simulink gives error : newDymolaGui

I have a Dymola model which I exported to Simulink as an s-function. In my Simulink model it is shown as a "DymolaBlock". By using the sim command in Matlab I start the model which works without problems. But now i´m trying to run the simulation several times which causes following error after a few simulation runs:
Error evaluating 'InitFcn' callback of SubSystem block (mask)
'DP/DymolaBlock/compmodel'.
Callback string is 'newDymolaGui('DP/DymolaBlock','Verify');'
Trying to recombile the DymolaBlock gives me the following:
Error using ddeexec
The first argument 'channel' is not valid.
Error in newDymolaGuiJava
Error in newDymolaGuiJava
Error in newDymolaGuiJava
Error in newDymolaGuiJava
Error in newDymolaGui
Error while evaluating UIControl Callback.
I have to restart Matlab to get the model to work again. Anyone knows what the cause of this problem is, and how to get rid of it?

 Accepted Answer

I think I found a solution by myself.
In the Matlab console, just klick on the Error Message "InitFcn" and a window will pop up showing settings for the DymolaBlock. In the InitFcn field there is the command 'newDymolaGui('DP/DymolaBlock','Verify');' This command was created automatically by Simulink. I ended up deleting it, so that the InitFcn field is just empty.
After that I could simulate my model multiple times in the same script without getting the error message. I still dont know if deleting this command has a effect to the model/simulation. So far it works and the simulation output seems to be unaffected by that.

More Answers (0)

Products

Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!