Applying pre-recorded profiles as setpoints

This note presents a possible approach to apply pre-recorded profiles as setpoints for a control algorithm developed on Simulink with ACG SDK. It assumes the following constraints:

  • The profile may be more complex than a simple succession of steps.
  • It should be possible to apply/launch the profile using Cockpit in order to log the system response during run-time.

This approach is used, for example, in the example of motor control of an electric vehicle, to apply a WLTP speed profile as speed reference.

Software resources

Proposed solution

The proposed solution mainly uses a 1D lookup table in Simulink, in combination with an enabled subsystem containing a discrete counter.

This solution operates as follows:

  • The counter produces the indices, which are used inside the lookup table to access a pre-recorded vector of data (e.g. mytable).
  • The counter is located inside an enabled subsystem, so that the counter is normally reset, and only starts counting when desired.
  • The variable that is used to enable the subsystem can be triggered from within Cockpit.
Direct lookup table dialog
Setpoint profile example in Simulink

Inside Cockpit, the profile can be activated by properly configuring the datalogger:

  • The length of the scoping window should be configured at least as long as the pre-recorded profile (here 1000 points, while the pre-recorded profile is 400 samples long).
  • The transient generator can be used to set the apply_profile variable to 1 at the beginning of the window, and back to 0 at the end of the window. Meanwhile, the profile is repeated if needed.