Perform co-simulation with Matlab

How to perform co-simulation with Matlab. VISION allows to set up co-simulation process using Matlab API block.

To begin this task, you will need:
  • A licence of VISION System Architect. See Installation and licence setup.
  • To have followed the tutorial Perform Transient simulation
  • To have MATLAB software installed (version 2021a or newer)
  • To have extracted 'data_example.zip' archive that is in the VISION installation folder.

  • To have VISION toolbox for Matlab folder available on demand from AMCAD engineering team.

The basic steps to perform co-simulation with Matlab are:

  1. Set the path of the VISION toolbox for Matlab in VISION as described in the following picture.

  2. From the schematic created following the tutorial Perform Transient simulation, drag and drop the MATLAB_API block from the palette window in Cosimulation section to the schematic editor window.

  3. Double-click on the MATLAB_API block to open the Parameters window. Set the parameters as following :

    Matlab startup directory corresponds to the folder 'demo-EVM' included in 'demo_example' folder.
  4. New inputs and outputs appears after clicking OK.

  5. In Matlab_API block, click on Matlab server tab and click on Start server to start co-simulation process. For more information about Matlab server, see MATLAB API .

  6. Matlab software opens as presented in the following picture.

  7. Connect REF and OUT Matlab_API inputs to corresponding HPA block input and output. To measure output data from the Matlab_API block, drag and drop the Waveform block from the palette window in Scope section to the schematic window. Double-click on the Waveform block to open the Parameters window:
    • Change the number of channels to 2.
    • Edit the Probe name to "EVM" for example.
    • Choose Real and imaginary for Result Display parameter.
    • Edit the Channel names to "rmsEVM ; maxEVM".
    Click on OK button to validate and close the parameters window. Connect the Waveform inputs to the corresponding Matlab_API outputs as following.

  8. Double-click on the EQN equation block and set the value of each parameters as following :

  9. Double-click on the SIMCTRLR block to open the Parameters window. In the Solver tab, choose the Solver Type by selecting Data Flow. Note that Matlab API is only compatible with Data Flow solver.
  10. In the menu bar of the workspace window, click on Simulate>Run simulation or on the shortcut