I have a control system where a voltage demand (parameter ManualDemand_V) sets a voltage which is sent to a plant model that converts the voltage to a speed in rpm.
There is also a PI controller block which tracks the manual demand voltage for a bumpless transition from manual control to PI control.
The PI controller is enabled by setting a flag (parameter EnablePI). When this flag is set, I have an algorithm to capture the speed output of the plant model, using a rising edge detect and sample and hold.
This captures the speed of the plant model when the PI controller is enabled, so that the PI controller setpoint matches the speed at the time when the PI controller was enabled.
I need the PI controller setpoint (parameter SpeedDemand_rpm) to be updated with this sample and hold value that was captured when the PI controller was enabled, but I don’t know how to do this.
Is it possible to update this parameter and if so how ? I did have a look at the ‘parameter writer’ block but not sure if this is suitable and I don’t know how to implement it.
All these parameters are configured as Simulink parameters, so they appear in the a2l file and can be used with Vector CANape where the Simulink code will be running on a dSpace Micro Auto Box (obviously without the plant model).
When the parameter is updated with the sample and hold value, I would expect to see the value of this parameter change in CANape. Once it has changed, the user should be able to modify the parameter so that the setpoint can be changed for the PI controller.
Below are the Simulink parameters defined in the model shown above…
SpeedDemand_rpm:
EnablePI:
ManualDemand_V: