4

I have been trying to perform simulations of a modelica model by using the Dymola-Python Interface, but after a while waiting for the simulation to get performed, it gives the error

"DymolaConnectionException: Failed to connect to Dymola within the given timeout."

I have tried with both the functions simulateModel and simulateExtendedModel but it gives the same error with both of them. The model seems to be good because if I compute the simulation manually from Dymola it works.

I am using python 3.6 and Dymola 2019.


# Modelica model file with the extension .mo that wants to be simulated.
      mod_name='my_model.mo'

# It is started the interface
      dymola = DymolaInterface()

# Here there is the library that the model uses besides Modelica library
      dir_library = dir_library_simulation


# Here is where the model is and where I want the results
      dir_result = dir_result_simulation


# Opened both models
      dymola.openModel(path=os.path.join(dir_library, 'package.mo'))
      dymola.openModel(path=os.path.join(dir_result, mod_name))


# Translated the model to be simulated
      dymola.translateModel(mod_name.split('.')[0])

# Simulation of the model

      output=dymola.simulateModel(mod_name.split('.')[0], 
                            stopTime=604800, 
                            numberOfIntervals=300, 
                            method="dassl", 
                            tolerance=1e-06, 
                            resultFile=os.path.join(dir_result, 'Results')


      dymola.close()

This is the message that is giving:

DymolaConnectionException: Failed to connect to Dymola within the given timeout.

And the output gives

"False".

Itchydon
  • 2,572
  • 6
  • 19
  • 33
belen
  • 41
  • 3

0 Answers0