Software resources
Objective statement
This note presents a possible approach in order to apply a pre-recorded setpoint/reference profile, assuming the following constraints:
The profile may be more complex than a simple succession of steps.
It should be possible to apply the profile using BB Control in order to log the system response during run-time.
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 BB Control.
Inside BB Control, 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 at 0 at the end of the window. Meanwhile, the profile is repeated if needed.