Documentation

Bumpless Transfer Between Manual and Automatic Operations

This example shows how to bumplessly transfer between manual and automatic operations of a plant.

During startup of a manufacturing process, operators adjust key actuators manually until the plant is near the desired operating point before switching to automatic control. If not done correctly, the transfer can cause a bump, that is, large actuator movement.

In this example, you simulate a Simulink® model that contains a single-input single-output LTI plant and an MPC Controller block.

A model predictive controller monitors all known plant signals, even when it is not in control of the actuators. This monitoring improves its state estimates and allows a bumpless transfer to automatic operation.

Open Simulink Model

Open the Simulink model.

open_system('mpc_bumpless');

To simulate switching between manual and automatic operation, the Switching block sends either 1 or 0 to control a switch. When it sends 0, the system is in automatic mode, and the output from the MPC Controller block 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 ext.mv inport, unless the plant input saturates at –1 or 1. The controller constantly monitors the plant output and updates its estimate of the plant state, even when in manual operation.

This model also shows the optimization switching option. When the system switches to manual operation, a nonzero signal enters the switch inport of the controller block. The signal turns off the optimization calculations, which reduces computational effort.

Define Plant and MPC Controller

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.

step(sys)

Create an MPC controller.

Ts=0.5;     % sampling time (seconds)
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);
Tstop=250;

Configure MPC Block Settings

Open the Function Block Parameters: MPC Controller dialog box.

  • Specify MPC1 in the MPC Controller box.

  • Verify that the External Manipulated Variable (ext.mv) option in the General tab is selected. This option adds the ext.mv inport to the block to enable the use of external manipulated variables.

  • Verify that the Use external signal to enable or disable optimization (switch) option in the Others tab is selected. This option adds the switch inport to the controller block to enable switching off the optimization calculations.

Click OK.

Examine Switching Between Manual and Automatic Operation

Click Run in the Simulink model window to simulate the model.

For the first 90 time units, the Switching Signal is 0, which makes the system operate in automatic mode. During this time, the controller smoothly drives the controlled plant output from its initial value, 0, to the desired reference value, –0.5.

The controller state estimator has zero initial conditions as a default, which is appropriate when this simulation begins. Thus, there is no bump at startup. In general, start the system running in manual mode long enough for the controller to acquire an accurate state estimate before switching to automatic mode.

At time 90, the Switching Signal changes to 1. This change switches the system to manual operation and sends the operator commands to the plant. Simultaneously, the nonzero signal entering the switch inport of the controller turns off the optimization calculations. While the optimization is turned off, the MPC Controller block passes the current ext.mv signal to the Controller Output.

Once in manual mode, the operator commands set the manipulated variable to –0.5 for 10 time units, and then to 0. The Plant Output plot 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. As a result, the plant output returns to the reference value smoothly, and a similar smooth adjustment occurs in the controller output.

Turn off Manipulated Variable Feedback

Delete the signals entering the ext.mv and switch inports of the controller block.

Delete the Unit Delay block and the signal line entering its inport.

Open the Function Block Parameters: MPC Controller dialog box.

Deselect the External Manipulated Variable (ext.mv) option in the General tab to remove the ext.mv inport from the controller block.

Deselect the Use external signal to enable or disable optimization (switch) option in the Others tab to remove the switch inport from the controller block.

Click OK. The Simulink model now resembles the following figure.

Click Run to simulate the model.

The behavior is identical to the original case for the first 90 time units.

When the system switches to manual mode at time 90, the plant behavior is the same as before. However, the controller tries to hold the plant at the setpoint. So, its output increases and eventually saturates, as seen in Controller Output. Since the controller assumes that this output is going to the plant, its state estimates become inaccurate. Therefore, when the system switches back to automatic mode at time 180, there is a large bump in the Plant Output.

Such a bump creates large actuator movements within the plant. By smoothly transferring from manual to automatic operation, a model predictive controller eliminates such undesired movements.

Related Examples

Was this topic helpful?