This document provides instructions on how to implement a multi-rate task execution within a PLECS model, using the imperix ACG SDK. It allows running part of the control at a slower rate, without impacting the real-time control, running at the base rate. This is typically useful for implementing a finite state machine or running a tracking algorithm.
An example of use is presented in TN117: Maximum Power Point Tracking (MPPT).
This feature has been integrated in ACG SDK version 220.127.116.11. which is available from https://imperix.com/downloads.
First of all, the task parameters must be defined:
Go in the Coder -> Coder Options… (or use the shortcut Ctrl+Alt+B)
Select Controller in the left panel
In the tab Scheduling, set the tasking mode to multi-tasking and the task configuration to specify.
Add a new task and select the sample time. It can be a variable defined in the simulation parameters.
Now that the task is defined in the Coder Options, it can be used in the model:
Add the Task block from PLECS library.
Double click on it, and select the previously defined task.
Everything that is placed in this task will now run at the defined period.
An example of use is presented in TN117: Maximum Power Point Tracking (MPPT). It shows how one part of the control (in the MPPT task below) can be executed at a slower rate than the main control code.