This example shows a bumpless transfer between manual and automatic operation. The context is a Simulink® simulation involving the MPC Controller block and a single-input, single-output, LTI plant.
During startup of a continuous plant, the operators often adjust key actuators manually until the plant is near the desired operating point, and then switch to automatic control. If not done correctly, the transfer can cause a bump, i.e., large actuator movements.
A Model Predictive Controller must monitor all known plant signals even when it is not in control of the actuators. This improves its state estimates and allows a bumpless transfer to automatic operation.
Open the Simulink model.
Simulink Block Diagram for the MPC Bumpless Transfer Example
Create the plant model.
num=[1 1]; den=[1 3 2 0.5]; sys=tf(num,den);
The plant is a stable single-input single-output system as seen in its step response.
Create an MPC controller.
Ts=0.5; % sampling time p=15; % prediction horizon m=2; % control horizon MPC1=mpc(sys,Ts,p,m); MPC1.Weights.Output=0.01; MPC1.MV=struct('Min',-1,'Max',1,'RateMin',-1e5); Tstop=250;
The MPC controller object, MPC1, uses a sampling period of 0.5 seconds. In the dialog for the MPC Controller block, specify MPC1 in the MPC controller box.
As shown in MPC Block Configuration Settings, the block's optional input port for externally supplied manipulated variables is selected. This adds the inport labeled ext.mv to the block (Simulink Block Diagram for the MPC Bumpless Transfer Example shows how this is connnected).
The optional input port for switching off the optimization is also selected, which adds the inport labeled QP switch to the block (see Simulink Block Diagram for the MPC Bumpless Transfer Example).
The example tests the effect of switching the controller from automatic to manual and back. To simulate this, a Pulse Generator block labeled switching signal sends either one or zero to a switch. When it sends zero, the system is in automatic mode, and the MPC block's output goes to the plant. Otherwise, the system is in manual mode, and the signal from the Operator Commands block goes to the plant.
In both cases the actual plant input feeds back to the controller, as shown in Simulink Block Diagram for the MPC Bumpless Transfer Example (unless the plant input saturates at –1 or 1). The controller also monitors the plant output at all times. Thus, the controller can update its estimate of the plant state even when in manual.
The example also employs the optimization switching option. When the system switches to manual, a nonzero signal enters the controller's QP Switch inport, turning off the optimization calculations, thereby reducing computational effort. The benefit is small in this trivial example but it could be significant in a demanding real-time application.
As shown in Output, Reference and Switching Signal, the system is in automatic mode for the first 90 time units (switching signal is zero). During this time the controller smoothly drives the controlled plant output from its initial value, 0, to the desired reference value, –0.5.
At time 90, manual operation begins (switching signal goes from zero to one). This causes the Switch element to send the operator commands to the plant instead of the controller output.
Simultaneously, the nonzero signal entering the controller's QP Switch inport turns off the optimization calculations and the controller output goes to zero (see Manipulated Variable (Actuator) Adjustments).
Once in manual mode, the operator commands set the manipulated variable to –0.5 for 10 time units, and then to 0. Output, Reference and Switching Signal shows the open-loop response between times 90 and 180 when the controller is deactivated.
At time 180, the system switches back to automatic mode. Output, Reference and Switching Signal shows that the output returns to the reference value smoothly, and Manipulated Variable (Actuator) Adjustments shows similarly smooth adjustments in the controller output.
Note that the controller's state estimator has default zero initial conditions, which are appropriate when this simulation begins. Thus, there is no bump at startup. In general you should start the system running in manual mode for long enough to allow the controller to acquire an accurate state estimate before switching to automatic mode.
Now consider the situation shown in External Manipulated Variable Feedback Turned Off. The external manipulated variable feedback has been turned off. This causes the controller to assume that its adjustments are always going to the plant, which is incorrect whenever the system switches to manual mode.
The controller's QP Switch is also turned off.
As shown in Output Response with Manipulated Variable Feedback and QP Switching Turned Off and Manipulated Variable Adjustments with Manipulated Variable Feedback Disconnected and QP Switching Manipulated Variable Feedback and QP Switching Turned Off, the behavior is identical to the original case for the first 90 time units (compare to Output, Reference and Switching Signal and Manipulated Variable (Actuator) Adjustments).
When the system switches to manual between 90 and 180, the plant behavior is the same as before but the controller tries in vain to hold the plant at the setpoint. Consequently, its output increases and eventually saturates. It assumes this output is going to the plant, so its state estimates become inaccurate. Thus, when the system switches to automatic mode at time 180, there is a large bump.
The benefits of bumpless transfer are evident.