FMI-based Co-Simulation with OpenModelica and Overture

The following example illustrates the co-simulation capabilities of AutoFOCUS 3 and shows how this feature can be leveraged for tool-interoperability. To highlight the potential of the Functional Mock-up Interface (FMI) standard, the following example considers a controlled inverted pendulum. On the one hand, both the pendulum's dynamics and the PID controller are modeled using OpenModelica - a tool dedicated to the development of continuous systems. The input and environment models, on the other hand, have been developed in AutoFOCUS 3 and Overture respectively - both representing models with a discrete notion of time.

Setup

AutoFOCUS 3

  1. Download the following AutoFOCUS 3 model: Input Model
  2. Import the project: 'File → Import AF3-Project'

Overture

  1. Download, unzip and launch Overture
  2. Download the following Overture project: Environment Model
  3. Unzip the archive.
  4. Import the project: 'File → Import... → General → Existing Projects into Workspace'

OpenModelica

  1. Download and install OpenModelica
  2. Install the FMI exporter for Overture following these instructions: FMI support for Overture
  3. Download the following OpenModelica model: System & Controller Models
  4. Import the project: 'File → Open Model/Library Files(s)'

FMU Export

AutoFOCUS 3

  1. Export the Input component as FMU: '[Right click on component] → Export to FMU 2.0'
  2. Set the component to be executed at a frequency of 100 Hz and store it in the root folder of your workspace.

Overture

  1. Export the NoiseGenerator project as FMU: '[Right click on project] → Overture FMU → Export Tool Wrapper FMU'
  2. The FMU will be stored in './generated' within the project directory.

OpenModelica

  1. Export the model as FMU: 'File → Export → FMU'
  2. The location of the newly generated FMU will be displayed in the console.

FMI-based Co-Simulation

AutoFOCUS 3

OpenModelica