Simulink External Mode with ACG SDK
Table of Contents
This document provides instructions on how to use Simulink External Mode with ACG SDK, the software kit for programming imperix targets graphically.
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.
Enabling External Mode
To use Simulink External Mode with ACG SDK, enable External Mode on the 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”

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.


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 Multi-rate control with Simulink (PN145)). 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.