Claytex logo
Dymola

Dymola and Simulink

There are two different ways that models developed in Dymola can be used with other models developed in Simulink.  You can either export the Dymola model to Simulink or you can import the Simulink model in to Dymola.  These methods enable the powerful component orientated physical modelling capabilities of Dymola to be coupled up to the established control system orientated modelling approach used in Simulink.

The Simulink Interface

This Dymola option enables models developed in Dymola to be compiled as C-Mex S-functions for use in Simulink.  This enables the powerful physical modelling capabilities of Dymola to be combined with the controls orientated approach of Simulink.

The first step to enable the generation of an S-function is to add input and output signals to the top-level of the Dymola model. These signals define the information that will be exchanged with the rest of the Simulink model.

Once the model is built, you switch to Simulink and open the Dymola Block library.  This contains the Dymola interface block which is simply dragged in to the Simulink model.  Double clicking on the block produces a dialog box which enables the user to select the model from Dymola and compile it as an S-function.

This same dialog also allows the user to change the parameters and initial conditions once the model has been compiled.  These can be changed without having to re-compile the s-function.

Example showing a Dymola model within a Simulink model as an s-function

Functional Mock-up Interface

Dymola supports the import of FMI compliant models and provides the necessary Real-time workshop target to compile a Simulink model to be FMI compliant.  This enables existing Simulink models to be compiled and used within Dymola.

The first version of the FMI for model exchange has been defined as part of the MODELISAR project and is designed to allow models from several tools to be compiled with a standard api so that they can be easily coupled together for co-simulation.  The consortium plans to publish further parts of the FMI, especially for coupling of different simulation tools and for coupling of simulators with applications like testing, optimization, and product lifecycle management.