Flux-Simulink co-simulation: Preparation of the Flux project

Introduction

Co-simulation requires that the standard description (geometry, mesh, physics) of the Flux project has been done. To prepare the coupling between Flux and Simulink, it is necessary to define, in Flux, the desired input and output parameters, in order to generate a coupling component file.

Flux Inputs

Several types of quantities can appear amongst the input parameters:

  • electrical quantities (ex. resistance, voltage, current…)
  • mechanical quantities (ex. torque, speed, position,…)
  • geometric (air gap,…)

As the coupling between Flux and Matlab-Simulink uses multiphysics co-simulation, the input parameters must be defined as I/O Parameters of multiphysics type.

Flux Outputs

We can find the exact same quantity types as with the input parameters; namely the electrical, mechanical and geometric quantities.

The output parameters must not be of the multiphysics type.

An output parameter can be:

  • a geometric parameter
  • a I/O non multiphysics parameter
  • a predefined parameter of a mechanical assembly
  • a sensor

The coupling component

The coupling component file is necessary in order to ensure the transfer of information from the Flux project to Simulink. This component data is described in the *.F2MS file.

Once the necessary input and output parameters for the coupling have become available, the user must generate a component:

  • by clicking on the Generate component for Matlab Simulink coupling in the Solve menu

The dialogue box " Generate component for Matlab Simulink coupling" is presented below:

Having generated the coupling component:

  • A file [ComponentName].F2MS is created by default in the current directory.
  • A Flux project [ComponentName]F2MS.FLU is created and it should have the same name as the .FLU accessed from Simulink during the solving process.

Upon launching of the solving process via Simulink, the corresponding project Flux is registered with the following name:

[ComponentName]F2MS_SOLVED.FLU

*.F2MS file

This file contains the information necessary for Simulink to be able to automatically detect:

  • the version of Flux
  • the version of F2MS
  • the dimension

the inputs and the outputs

Solving Scenario

No solving scenario defined in Flux will be taken into consideration by Simulink. It is Simulink that manages the time steps of the simulation imposing them to Flux during the co – simulation.