This document provides instructions on how to use Simulink External Mode with imperix ACG SDK.

This feature has been integrated in ACG SDK version 3.5.0.0. which is available from https://imperix.com/downloads.

Simulink External Mode establishes a communication channel between a Simulink model and the corresponding code running in a B-Box or B-Board power electronics controller. It allows to:

  • Modify or tune block parameters in real-time. When the parameter is changed in the model, Simulink downloads the new values to the executing target application.

  • Monitor and save signal data from the executing target application.

ext_mode_clip.mp4

Enabling External Mode

To enable External Mode on a Simulink model:

  • Go in Model Configuration Parameters (Ctrl+E) -> Code Generation -> Interface

  • Check External mode (in older MATLAB version: select External mode as the Interface)

  • Make sure tcpip is selected as the Transport layer. If the option is not shown then close the configuration window and use the command sl_refresh_customizations in MATLAB Command Window.

  • In the MEX-file arguments field enter the B-Box or B-Board IP in single quotation marks, for instance ‘10.10.10.112’

  • Static memory allocation should be checked and Static memory buffer size kept at its default value

  • Click “OK”

For parameters tuning to work, the option Code GenerationOptimization Default parameter behavior must be set as tunable.

The external mode signal monitoring execution has been capped to a 1 kHz rate to limit the Ethernet traffic. Since ACG SDK version 3.6, this limit can be lifted in Model Configuration Parameters (Ctrl+E) -> Code Generation -> External Mode.

Build and Connect

When Simulink External Mode is enabled, building the model (Ctrl+B) integrates External Mode code to the executable. Once the code runs on the B-Box RCP or B-Board PRO power electronics controller, the Simulink model can be connected to the target.

MATLAB R2019b and below

Use the simulation stop time to define the size of the scope graphs.

In order to use the external mode, the simulation must be configured as External using the drop-down menu, then the Connect To Target button can be used.



The start and stop buttons have no effect.


MATLAB R2020a

In MATLAB R2020a, the connection can be managed from within the Control Panel.

Troubleshooting

Not enough memory on the target

When using a lot of scopes, the memory dedicated to the Simulink External Mode may not be enough and the message "Not enough memory on the target to process the packet: EXT_SELECT_SIGNALS" may appear.

To fix this issue:

  • Open the Control panel
  • Click on the Signal & Triggering... button
  • Under the Trigger options, reduce the Duration

External Mode and Multi-tasking

External Mode is not compatible with MultiTasking (see PN145: Multi-rate control with Simulink). As such, when MultiTasking and External Mode are enabled at the same time, there must be no Simulink scope used in a sub-task. Using scopes in the main control task still works.

  • No labels