Multi-rate control on PLECS with ACG SDK
This document provides instructions on how to implement Multi-rate control on PLECS with 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.
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 Maximum Power Point Tracking (MPPT) (TN117). 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.