Coordinate Multiple Controllers at Different Operating Points

Chemical reactors can exhibit strongly nonlinear behavior due to the exponential effect of temperature on reaction rate. If the primary reaction is exothermic, an increase in reaction rate causes an increase in reactor temperature. This positive feedback can lead to open-loop unstable behavior.

Reactors operate in either a continuous or a batch mode. In batch mode, operating conditions can change dramatically during a batch as the reactants disappear. Although continuous reactors typically operate at steady state, they must often move to a new steady state. In other words, both batch and continuous reactors need to operate safely and efficiently over a range of conditions.

If the reactor behaves nonlinearly, a single linear controller might not be able to manage such transitions. One approach is to develop linear models that cover the anticipated operating range, design a controller based on each model, and then define a criterion by which the control system switches from one such controller to another. Gain scheduling is an established technique. The challenge is to move the reactor operating conditions from an initial steady-state point to a much different condition. The transition passes through a region in which the plant is open-loop unstable. This example illustrates an alternative — coordination of multiple MPC controllers. The solution uses the Simulink® Multiple MPC Controller block to coordinate the use of three controllers, each of which has been designed for a particular operating region.

The subject process is a constant-volume continuous stirred-tank reactor (CSTR). The model consists of two nonlinear ordinary differential equations (see [1]). The model states are the reactor temperature and the rate-limiting reactant concentration. For the purposes of this example, both are assumed to be measured plant outputs.

There are three inputs:

  • Concentration of the limiting reactant in the reactor feed stream, kmol/m3

  • The reactor feed temperature, K

  • The coolant temperature, K

The control system can adjust the coolant temperature in order to regulate the reactor state and the rate of the exothermic main reaction. The other two inputs are independent unmeasured disturbances.

The Simulink diagram for this example appears below. The CSTR model is a masked subsystem. The feed temperature and composition are constants. As discussed above, the control system adjusts the coolant temperature (the Tc input on the CSTR block).

The two CSTR outputs are the reactor temperature and composition respectively. These are being sent to a scope display and to the control system as feedback.

The reference signal (i.e. setpoint) is coming from variable CSTR_Setpoints, which is in the base workspace. As there is only one manipulated variable (the coolant temperature) the control objective is to force the reactor concentration to track a specified trajectory. The concentration setpoint also goes to the Plant State scope for plotting. The control system receives a setpoint for the reactor temperature too but the controller design ignores it.

In that case why supply the temperature measurement to the controller? The main reason is to improve state estimation. If this were not done, the control system would have to infer the temperature value from the concentration measurement, which would introduce an estimation error and degrade the model's predictive accuracy.

The rationale for the Switch 1 and Switch 2 blocks appears below.

The figure below shows the Multi MPC Controller mask. The block is coordinating three controllers (MPC1, MPC2 and MPC3 in that sequence). It is also receiving the setpoint signal from the workspace, and the Look ahead option is active. This allows the controller to anticipate future setpoint values and usually improves setpoint tracking.

In order to designate which one of the three controllers is active at each time instant, we send the Multi MPC Controllers block a switching signal (connected to its switch input port). If it is 1, MPC1 is active. If it is 2, MPC2 is active, and so on.

In the diagram, Switch 1 and Switch 2 perform the controller selection function as follows:

  • If the reactor concentration is 8 kmol/m3 or greater, Switch 1 sends the constant 1 to its output. Otherwise it sends the constant 2.

  • If the reactor concentration is 3 kmol/m3 or greater, Switch 2 passes through the signal coming from Switch 1 (either 1 or 2). Otherwise is sends the constant 3.

Thus, each controller handles a particular composition range. The simulation begins with the reactor at an initial steady state of 311K and 8.57 kmol/m3. The feed concentration is 10 kmol/m3 so this is a conversion of about 15%, which is low. The control objective is to transition smoothly to 80% conversion with the reactor concentration at 2 kmol/m3. The simulation will start with MPC1 active, transition to MPC2, and end with MPC3.

We decide to design the controllers around linear models derived at the following three reactor compositions (and the corresponding steady-state temperature): 8.5, 5.5, and 2 kmol/m3.

In practice, you would probably obtain the three models from data. This example linearizes the nonlinear model at the above three conditions (for details see "Using Simulink to Develop LTI Models" in the Getting Started Guide).

    Note   As shown later, we need to retain at the unmeasured plant inputs in the model. This prevents us from using the Model Predictive Control Toolbox™ automatic linearization feature. In the current toolbox, the automatic linearization feature can linearize with respect to manipulated variable and measured disturbance inputs only.

The following code obtains the linear models and designs the three controllers

[sys, xp] = CSTR_INOUT([],[],[],'sizes');
up = [10 298.15 298.15]';
yp = xp;
Ts = 1;
Nc = 3;
Controllers = cell(1,3);
Concentrations = [8.5 5.5 2];
Y = yp;
for i = 1:Nc
    clear Model
    Y(2) = Concentrations(i);
    [X,U,Y,DX]=trim('CSTR_INOUT',xp(:),up(:),Y(:),[],[1,2]',2)
	[a,b,c,d]=linmod('CSTR_INOUT', X, U );
    Plant = ss(a,b,c,d);
    Plant.InputGroup.MV = 3;
    Plant.InputGroup.UD = [1,2];
   	Model.Plant = Plant;
	Model.Nominal.U = [0; 0; up(3)];
    Model.Nominal.X = xp;
    Model.Nominal.Y = yp;
    MPCobj = mpc(Model, Ts);
    MPCobj.Weight.OV = [0 1];
    D = ss(getindist(MPCobj));
    D.b = D.b*10;
    set(D,'InputName',[],'OutputName',[],'InputGroup',[], ...
		'OutputGroup',[]);
    setindist(MPCobj, 'model', D);
    Controllers{i} = MPCobj;
end
MPC1 = Controllers{1};
MPC2 = Controllers{2};
MPC3 = Controllers{3}

The key points regarding the designs are as follows:

  • All three controllers use the same nominal condition, the values of the plant inputs and outputs at the initial steady-state. Exception: all unmeasured disturbance inputs must have zero nominal values.

  • Each controller employs a different prediction model. The model structure is the same in each case (input and outputs are identical in number and type) but each model represents a particular steady-state reactor composition.

  • It turns out that the MPC2 plant model obtained at 5 kmol/m3 is open-loop unstable. We must use a model structure that promotes a stable Kalman state estimator. If we include the unmeasured disturbance inputs in the prediction model, the default estimator assumes integrated white noise at each such input, which produces a stable estimator in this case.

  • The default estimator signal-to-noise settings are inappropriate, however. If you use them and monitor the state estimates (not shown), the internally estimated temperature and composition can be far from the measured values. To overcome this, we increase the signal-to-noise ratio in each disturbance channel. See the use of getindist and setindist above. The default signal to noise is being increased by a factor of 10.

  • We are using a zero weight on the measured temperature. See the above discussion of control objectives for the rationale.

The above plots show the simulation results. The Multi MPC Controller block uses the three controllers sequentially as expected (see the switching signal). Tracking of the concentration setpoint is excellent and the reactor temperature is also controlled well.

To achieve this, the control system starts by increasing the coolant temperature, causing the reaction rate to increase. Once the reaction has achieved a high rate, it generates substantial heat and the coolant temperature must decrease to keep the reactor temperature under control. As the reactor concentration depletes, the reaction rate slows and the control system must again raise the coolant temperature, finally settling at 305 K, about 7 K above the initial condition.

For comparison the plots below show the results for the same scenario if we force MPC3 to be active for the entire simulation. The CSTR evenually stabilizes at the desired steady-state but both the reactor temperature and composition exhibit large excursions away from the desired conditions.

Was this topic helpful?