0

I am working on a model in Dymola and use the Dymola S-block in Simulink to compile the model and then run the model in Simulink. After a few compilations, the interface stops working with the error in the Matlab workspace as

Error using ddereq

The first argument 'channel' is not valid.

Error in newDymolaGuiJava

Error in newDymolaGuiJava

Error in newDymolaGui Error while evaluating UIControl Callback.

I have to restart Matlab every time I encounter this to make it work. And it happens very frequently. I'm not sure what the problem is.

marco
  • 5,944
  • 10
  • 22
  • Is there any specific reason for using the Dymola-Simulink interface? FMI seems to be the more flexible solution (https://fmi-standard.org/) and as you have Dymola, you should be able to generate FMUs and use them in Simulink with FMIKit (https://github.com/CATIA-Systems/FMIKit-Simulink). – Markus A. May 04 '20 at 06:10
  • Hey Markus, the problem is I'm not able to setup the FMU block in simulink. I've tried to set the environment variable to the license file I received from Dymola, but it still keeps throwing the error "The license file was not found. Use the environment variable "DYMOLA_RUNTIME_LICENSE" to specify your Dymola license file." in FMU log. I looked in multiple forums and found one solution as to add the dymola.lic in dynasim folder, but mine doesn't have it. So this is the only working solution at the moment. – Rahul Chaturvedi May 06 '20 at 23:43
  • You can check the path of the license file in Dymola -> Tools -> License Setup -> Setup Tab -> File name. The default is #path#=`C:\Users\#UserName#\AppData\Roaming\DassaultSystemes\Dymola\dymola.LIC`. If you have the path, it can be set using the environment variable via windows settings UI (which is a bit uncomfortable), dos-box using `setx DYMOLA_RUNTIME_LICENSE=#path#` (given a recent Windows version), or from MATLAB with 'setenv(‘DYMOLA_RUNTIME_LICENSE’, ‘#path#’)'. Likely the last one is the most straight forward. – Markus A. May 07 '20 at 07:30
  • Hey thanks for the solution, but it didn't work. I'm running MATLAB 2018a and Dymola 2020x on Windows 10. I checked the documentation, where I found that Code export should be enabled. I added the environment variable both through Matlab and windows (dymola.lic was in the directory you mentioned.) and verified through 'getenv' command. But none worked. Could there be a problem with the license file? – Rahul Chaturvedi May 08 '20 at 21:35
  • @MarkusA., also to add, I'm using Visual Studio 2017 compiler to export models. – Rahul Chaturvedi May 08 '20 at 21:42
  • In case you have the binary model export option (which adds cost on top of the standar license) then enabling it in Dymola -> Tools -> License Setup -> Details -> Disable code export (needs to be unchecked) should help. This basically makes the FMU executable on any system, independent if there is a Dymola license. This in turn makes the environment variable superfluous. – Markus A. May 11 '20 at 06:46
  • 1
    Hey Marcus, thanks a lot for your responses. I finally have it working. The issue was that since I was using dymola remotely, I did not have a proper license. For model exchange in the same pc, you need to have a node unlocked license (if working remotely). – Rahul Chaturvedi Sep 26 '20 at 06:51

0 Answers0