You are on page 1of 54

MATLAB&Simulink Sample Model Description

Simulation of Cascade PID Control and Model Predictive Control for a gas
separation plant by membrane separation

Outer Loop
PID

+
Upper
Controller

PID
+

InnerLoop
InnerLoop
InnerLoop

Simulation of Cascade PID Control and Model Predictive Control


for a gas separation plant by membrane separation
1. Introduction

2. About Plant

2.1. Overall Structure of Plant and Control System

2.2. Gas Separator

2.3. About Membrane Separator

3. Introducing Mathematical Model

3.1. Introduction of Mathematical Model of Permeable Juxtamembrane

3.2. Introduction of Mathematical Model for Gas Separator

11

3.3. Mathematical-Based Simulink Model

14

4. System Identification

14

4.1. Introduction

14

4.2. Identification of Inner Loop

15

4.3. Identification of Outer Loop

18

5. Control System Design

28

5.1. Introduction

28

5.2. Inner Control System Design ~ PID Control

30

5.3. Upper Control System Design ~ Cascade PID Control

33

5.4. Outer Control System Design ~ Model Predictive Control

35

5.5. Computing Unit

37

6. Multivariable Model Predictive Control in MATLAB[3]

38

6.1. Model Predictive Control (MPC) Toolbox and MPC Blockset

38

6.2. Control Structure of Model Predictive Control

39

6.3. Operation of Model Predictive Control

41

6.4. Linear Model of Plant

41

6.5. Optimization Problem

42

6.6. Cost Function of Model Predictive Control

44

7. Evaluation of Control System

46

7.1. Introduction

46

7.2. Simulation Model of Cascade PID Control

46

7.3. Simulation Model of Model Predictive Control

46

7.4. Comparison of Cascade PID Control and Model Predictive Control

47

8. Conclusion

51

9. References

52

10. Exemption from Responsibility

52

11. Author

52

1. Introduction
This example demonstrates simulation of membrane separation control using
MATLAB&Simulink where a particular gas is extracted from mixed gas consisting of more than
2 components. The process assumes oxygen enrichment, air as mixed gas, and oxygen as an
extracted gas. The controlled object (plant) is a gas separator. The gas separator has functionality
which extracts only a particular gas through permeable membrane. This process produces specific
gas as a product. It controls pressure of gas separator so that concentration level of the particular gas
tracks given set points. Plant indicates simulation model rather than actual unit in this document.
Figure 1 shows flow of the control system described in this example. This figure is a typical flow of
control system design. Plant models are modeled mathematically in a plant modeling. The main
reason why plant model is created is that parametric model is identified from plant model, and
control system is designed based on parametric model. Control system design requires either
parametric or non-parametric models. Parametric model is identified from transient response data in
system identification. In control system design, PID control is designed for inner control system, and
cascade PID control system and Model Predictive Control are designed for outer control system
based on the parametric model. Performance evaluation of the designed control system is performed
through simulations in the evaluation of the control system.

START

Plant Modeling

System Identification
Control Design
PID Control , Cascade PID Control
Model Predictive Control

Evaluation

END
Figure 1. Flowchart of Control System Design

A schematic diagram of gas separator is shown in figure 2. Gas separator separates oxygen from air
by utilizing pressure differences. Here, gas separator is assumed to be connected at tri-level. Gas

extraction method is permeable membrane method utilizing pressure differences. Gas separator has
permeable membrane in the middle. Permeable membrane is assumed to be more permeable with
oxygen than other gas. The upper portion is where gas is to be flown into, and the lower portion is
where gas is permeated through permeable membrane which separates them. By creating pressure
differences between the two, oxygen concentration level becomes higher in the lower portion. Gas in
the lower portion flows into the next gas separator. By repeating this operation, oxygen
concentration becomes higher after going through each gas separator. Gas extracted after permeation
from the third gas separator is the final product. Positive pressure differences can be created by
controlling gas inlet flow and outlet flow, which results in variance of pressures in the upper and
lower portions.
High
Pressure
Agitator
Flow gas
(A)
Material
Part

(C)
Material Inhalation
gas

(D)

Material Emission
gas
(A)

Permeation
Part

(C)

High
Pressure

Permeation
Inhalation gas

Agitator

(A)

(D)
Permeation
Emission gas

(B)

Material
Part

(C)
(D)
High Pressure

Low
Pressure

Selectively
permeable
membrane

(A)

Selectively
permeable
membrane

(A) Pressure
sensor
(C) Inhalation
Control
Valve
Pump

Agitator

Permeation
Part
(D)

(A)

Low
Pressure

Note

(C)

Material
Part

(B)

(B) Density
sensor
Selectively
permeable
membrane

(D) Emission gas


Control
Valve

Permeation
Part

(C)

(D)

(A)

(C)
(D)

(B)

Manipulated
variable
switcher (refer 5.2.)

Low
Pressure

Figure 2. Schematic Diagram of Gas Separator

Figure 3 shows structure of the control system. This plant controls concentration and pressure. The
upper control system (outer loop) deals with concentration control, while the lower control system
(inner loop) deals with pressure control. The outer and inner controls work in combination to control.
In concentration control, pressure differences are computed for targets for the material and
permeation parts so that emission gas concentration of permeation part of each gas separator tracks

the given set point. Pressure differences are allocated appropriately to set point of pressure in
material and permeation parts by Computing Unit (Refer 5.5.). In pressure control, emission and
inhalation quantities are controlled so that pressure of permeation and material parts tracks set point
given to concentration control. Emission and inhalation quantities vary depending on opening of
each control valve. Computing Unit has functionality to switch between emission and inhalation
whether manipulated value of PID controller that controls whether pressure is positive or negative.
In order to perform this sample model(gas_dyn_mpc.mdl), MATLAB Version 7.9(R2009b),
Simulink 7.4(R2009b) and Model Predictive Control ToolboxTM Version 3.1.1(R2009b) are
required.
Outer Loop

Gas Separator1
Inner Loop
MV1
Outer
Controller
type1:
Cascade PID
type2:
MPC
SV

Computing
Unit

SV1

PID
controller CV

Control Valve

Pressure sensor

MV

MV2

Material Part

MV3

CV

Pressuresensor

PID
controller

+
SV2

MV
Permeation
Part

Control Valve

PV
Density Sensor

Same as above

Gas Separator2

Same as above

Gas Separator3
Inner Loop

Outer Loop

SV: Sepoint - Pressure


MV: Manipulated Variable - Emission or Inhalation
Volume of air
CV: Controlled Variable - Pressure

SV: Setpoint - Oxygen Density


MV: Manipulated Variable - Pressure Difference
CV: Controlled Variable - Oxygen Density

Figure 3. Control System Structure ~Inner Loop and Outer Loop

2. About Plant
2.1. Overall Structure of Plant and Control System
Figure 4 shows overall structure of plant and control system. The plant consists of three-level gas
separators. The control system consists of the outer and inner control systems. The outer control
system and Computing Unit assume a program in calculator module of control system that monitors
and controls this plant. PID controller assumes one loop controller or PID control module. The
Computing Unit assumes sequence logic within PID control module. PID controller of the inner
control system has three PID controllers attached to material part of each gas separator unit, and
three controllers for permeation part. The Computing Unit receives pressure difference as set point

from the outer control system, and allocates them to pressure set point of each PID controller.

Computing
Unit

PtW1
Pressure CV
PtW1_ U

SV

Set point of
Oxygen density

Outer Controller
type1:Cascade PID
type2:MPC

PID
L

Inlet Flow Gas


Volume F1
Density XAF1

PtQ1

Pressure CV

Material
Part

PtW2 U
_SV

L
PID

L
L

PID

PtW2

Pressure CV

Permeation
Part

L
Gas
Separator1 U

YAQ1
Oxygen
Density

PtQ2
Pressure CV

PID
L

PtW1
_SV
PtW3
Pressure CV

PID

L
Gas
Separator2 U

YAQ2
Oxygen
Density

L
PtQ3
Pressure CV

Note

PID
L

Sensor

Controlled variable of
outer control (Density)

L
Manipulated variable of
***_SV U outer control
=Set point of
inner control

Control
Valve

Pump

L
Manipulated
variable switcher
(Refer 5.2.)

Controlled variable of
inner control (Pressure)

Control valve of
inner control

Figure 4. Overall Structure of Plant and Control System

Gas
Separator3

YAQ3
Oxygen
U Density

2.2. Gas Separator


Gas separator assumes as follows (Refer to figure 5).
Gas separator shape is rectangular. Gas assumed to be air that flows into inlet line of gas separator.
Permeable membrane is placed in the middle of gas separator to separate gases. Oxygen in the gas
can penetrate permeable membrane, but nitrogen can not. By crating pressure differences between
material and permeation parts, membrane permeation flow of oxygen in the gas occurs from material
to permeation part. Nitrogen is assumed to be significantly less permeable than oxygen. This makes
mol fraction of oxygen of permeation part higher. Agitator makes gas concentration uniform by
agitating inside. There are pressure sensors to material and permeation parts. Control valves are
attached to each inhalation and emission line to control pressures of material and permeation parts.
Flow of inhalation and emission are controlled by control valve opening. When inhalation and
emission flows change, pressures at both material and permeation parts change. To make it simple,
assume that inhalation and emission capabilities are constant. There is a concentration sensor
attached to permeation part to measure concentration of emission gas.

z
Agitator
Control
Pressure Valve
Sensor

Inlet Flow Gas


Inlet Line
Selectively
permeable
membrane

Pump

Inhalation

Material Part
area

Emission
Pressure Sensor

Permeation Part
h
Inhalation
area

Emission

Density Sensor

Figure 5. Gas Separator

Numerical specification of gas separator is described in table 1.


Table 1. Numerical Specification of Gas Separator
Specification

Value

Unit

Symbol

Cross-section area

m2

Area

Permeable membrane cross-section area

Area

Cubic volume of material and

25

m3

volume ( = h*area)

Height of material and permeation parts

Mass transfer coefficient (oxygen)

0.00001

molm-2s-1-1

Mass transfer coefficient (nitrogen)

0.000001

molm-2s-1-1

permeation parts

2.3. About Membrane Separator


Permeable membrane is barrier diffusion that selectively permeates according to material type.
Concentration difference, pressure difference and difference in potential are used to drive mass
transfer (energy). Practical examples included oxygen enrichment, water purification and salt
manufacturing. [1] Among such examples, gas separation is described in table 2.
Table 2. Description of gas separation [1]
Separation Driving force
Permeable material
method
Residue material
Gas
Concentration
Easy-to-permeate
separation
difference (partial gaseous molecule
pressure
Difficult-to-permeat
difference)
e gaseous molecule

Separation
mechanism
Solution-diffus
ion
mechanism,
Knudsen
diffusion

Practical example
Oxygen enrichment,
Hydrogen separation,
Helium separation,
Uranium concentration
(gas diffusion method)

3. Introducing Mathematical Model


This chapter describes physical environment controlling gas separator, permeable juxtamembrane,
and entire gas separator. Although the actual unit is considered to be quite complex, for the purpose
of modeling, the following assumptions are made:
<Hypothesis>
(1) Gas is ideal gas.
(2) Gas is air. Air consists of two components. Components are component A (oxygen) and
component B (nitrogen).
(3) Mol fraction of component A in the air is 0.2, and that of component B is 0.8.
(4) Ignore friction with gas and container wall and piping, and pressure loss.
(5) Gas is at normal temperature and constant (20 degrees, Celsius).
(6) Gas component distribution within gas separator is uniform.

(7) Mass transfer coefficients of component A and B are constant and do not vary depending on
conditions such as temperature and pressure.
(8) No chemical change of gas.
(9) Ignore diffusion term of fluid.
(10) Dynamics of gas separator is governed by mass balance equation and ideal gas equation.
(11) There is no back flow of gas between gas separator 1, 2 and 3.
(12) Ignore dynamics within piping.
(13) Gas emission and inhalation solely depend on valve opening, and pump does not have any
impact on them.
(14) Pressure in initial state at time 0 within gas separator equals to air pressure.
(15) Mol fraction in initial state at time 0 within gas separator equals to that of air.

3.1. Introduction of Mathematical Model of Permeable Juxtamembrane


The three governing rules of permeable juxtamembrane are as follows. To make it generalized, they
are formulated as component A and B.
<Governing Rules>
(1) Permeable membrane flow rate of component within gas is proportionate to partial pressure
difference of components inside and outside of membrane.
(2) Positive permeable membrane flow rate occurs from higher partial pressure side to lower side.
(3) Component A is easy to penetrate the permeable membrane, whereas component B is not.
Where, permeable membrane flow rates NA of gas component A, and NB of gas component B are
described in the following formula .
[1]

NA KmA(PAW,i PAQ,i ) KmA(PtW xAi PtQ yAi )

(3-1)

NB

(3-2)

K mB ( PBW ,i

PBQ ,i )

K mA ( PtW x Bi

PtQ y Bi )

KmA >> KmB

(W) Material Part


NA:Permeable

PW:Total pressure of gas


PAW:Partial pressure of gas component A

membrane flow rate of


component A

NB:Permeable membrane flow


rate of component B
Selectively
permeable
membrane

PAW,i

[m]

PAQ,i

(Q) Permeation
Part

PQ:Total pressure of gas


PAQ:Partial pressure of gas component A

Figure 6. Diagram of permeable juxtamembrane

[Symbol description]
NA: Permeable membrane flow rate of component A [molm-2s-1]
NB: Permeable membrane flow rate of component B [molm-2s-1]
KmA: Mass transfer coefficient of partial pressure standard within membrane of component A [mol
m-2s-1-1]
KmB: Mass transfer coefficient of partial pressure standard within membrane of component B [mol
m-2s-1-1]
PAW,i: Partial pressure of gas component A [] in the material part. Subscript i means surface of
separation, and this applies the following.
PBW,i: Partial pressure of gas component B [] in the material part
PAQ,i: Partial pressure of gas component A [] in the permeation part
PBQ,i: Partial pressure of gas component B [] in the permeation part
PtW: Total pressure of gas in the material part []
PtQ: Total pressure of gas in the permeation part []
xAi: Mol fraction of component A in the material part
yAi: Mol fraction of component A in the permeation part
PmA: Permeable membrane coefficient [molm-1s-1Pa-1]

10

Note: Although modeling is not provided using this model, mass transfer coefficient is inversely
proportional to film thickness, the following equation holds true using permeable membrane
coefficient.

K mA

(3-3)

PmA /

3.2. Introduction of Mathematical Model for Gas Separator


Dynamics of gas is assumed to be controlled by material balance equation and ideal gas equation.
Material balance equation determines number of mol of total gas, component A (oxygen) and
component B (nitrogen) within gas separator plant. Ideal gas equation determines total pressure, and
partial pressures of component A and B within gas separator plant.
Material balance equation, pressure and mol fraction are described as follows:

Material Part
Inhalation
W:Emission gas quantity
from the material part
per unit time [mols-1]

F[mols-1]
NB:Permeable
membrane flow
rate of
component A
[molm-2s-1]

XAF:
Mol fraction of
component A in F[-]

Selectively
permeable
membrane
Area[m3]

Permeation
Part

Emission
XAW: mol fraction [-]

Inhalation
Q:Emission gas quantity
from the permeation part
per unit time [mols-1]

NA:Permeable
membrane flow
rate of
component A
[molm-2s-1]

Emission
YAQ: mol fraction [-]

Agitator

Figure 7. Diagram of gas separator

[Symbol description]
N: Number of mol in gas
F: material gas quantity flown into the material part per unit time [mols-1]
xAF: Mol fraction of component A in F [-]
W: Emission gas quantity from the material part per unit time [mols-1]
x: mol fraction [-]
y: mol fraction [-]

11

Q: Emission gas quantity from the permeation part per unit time [mols-1]
Area: membrane area [m2]
t: time [s]
P: pressure [Pa]
R: Gas constant 8.314[Jmol-1K-1]
V: Volume in the material part (permeation part) [m3]
[Meaning of subscript]
|t=0: Value at time t=0
tW: All gases in the material part
tQ: All gases in the permeation part
AW: Gas component A in the material part
AQ: Gas component A in the permeation part

(Material balance equation of all gases in the material part)


Changes in number of mol of all gases in the material part per unit time can be expressed by the
following equation.

dN tW
dt

F W

N A * Area

N B * Area

(3-4)

Considering integral from time 0 to t, it can be expressed by the following equation. This is the
number of mol in the material part at time t.

N tW

t
t t

(F W

N A * Area

N B * Area)dt

N tW

t 0

(3-5)

(Material balance equation of gas component A in the material part)


Changes in number of mol of gas component A in the material part per unit time can be expressed by
the following equation.

dN AW
dt

F X AF W X AW

N A Area

(3-6)

Considering integral from time 0 to t, it can be expressed by the following equation. This is the
number of mol of gas component A in the material part at time t.

N AW

t
t t

( F X AF W X AW

N A Area)dt

N AW

(Pressure of all gases in the material part)

It is assumed that the ideal gas equation is approved.


P=nRT/V, instead of PV=nRT

PtW

N tW R T / V

(3-8)

12

t 0

(3-7)

(Mol fraction in the material part)

X AW

N AW / N W

(3-9)

(Material balance equation of all gases in the permeation part)


Change of mol number of all gases in the permeation part per unit time can be expressed by the
following equation.

dN tQ

N A * Area

dt

(3-10)

N B * Area Q

Considering integral from time 0 to t, it can be expressed by the following equation. This is the
number of mol in the permeation part at time t.

N tQ

t
t t

( N A * Area N B * Area Q)dt

N tQ

t 0

(3-11)

(Material balance equation of gas component A in the permeation part)


This can be expressed by the following equation in the same way:

dN AQ

N A Area Q YAQ

dt
N AQ

t
t t

( N A Area Q YAQ )dt

(3-12)

N AQ

(3-13)

t 0

(Pressure of all gases in the permeation part)

It is assumed that the ideal gas equation is approved.


P=nRT/V, instead of PV=nRT

PtQ

N tQ R T / V

(3-14)

(Mol fraction in the permeation part)

X AQ

N AQ / N W

(3-15)

13

3.3. Mathematical-Based Simulink Model


The Simulink model in figure 8 can be obtained by expressing equation (3-1) to (3-15) in block
diagram in Simulink.

Figure 8. Gas separator model in Simulink (gas_dyn_mpc.mdl)

4. System Identification
4.1. Introduction
In designing control system, parametric model or non-parametric model of controlled object (plant)
is necessary. Then, parametric model is acquired by employing system identification method to
Simulink model. As control system design requires both outer and inner loops, system identification
is performed for outer and inner loops. Some of the purposes of model acquisition by system
identification of each loop are described in table 3 (refer to figure 3 for outer and inner loops).

Table 3. Purposes of model acquisition by system identification of the outer and inner loops
Purpose
Inner loop

To construct inner loop which can track rapidly change of pressure set points that
the outer loop outputs.

Outer loop

To improve precision of model used by outer loop in order to enhance control


performance of the outer loop.

14

4.2. Identification of Inner Loop


In this example, model is acquired by linearization and model order reduction for the inner loop
system identification.
PID parameter tuning is performed for the acquired model in the Control System Design of the
next chapter.
Figure 9 summarizes purposes of each operation, procedures and tools used in this example for inner
loop system identification (including PID parameter tuning).

START

Purpose

Linearization of plant

Model order reduction


of plant

Tuning of PID Parameters

Procedure

Tools

Linearization of non linear plant


model

Closed-loop structure of the PID


control is cut, to make it open loop
structure, and linearization.

Simulink+
Simulink
Control
Design TM

Model order reduction


of high order plant
to apply PID parameter tuning
method (Ziegler-Nichols Method)

pole-zero cancellation of transfer


function
Evaluation by pole-zero map
Evaluation by step response in
time domain

Control
System
Toolbox

Evaluation control performance


by above PID parameter
calculated by Ziegler-Nichols
Method

Dynamic simulation by Simulink

Simulink

Simulation

Not OK
Evaluation
OK
END

Figure 9. Purposes of each operation, procedures and tools used in this example

15

TM

Figure 10 shows model used for system identification of the inner loop and PID control parameter
tuning.

Data storing part

Permeation part
PID controller1

Permeation part
PID controller2

Data display part

Permeation part
PID controller3

Material Part
PID controller1

Material Part
PID controller2

Material Part
PID controller3

Signal Builder
Block

Gas Separator1

Gas Separator2

Gas Separator3

Figure 10. Model used in system identification of the inner loop and tuning of PID control parameter
(gas_dynamics3_ident.mdl)
Simulink(R) Control DesignTM is used for linearization in Simulink. It is possible to specify input and
output points and linearize input and output points in the Simulink Control Design. Although the
inner loop is closed loop structure in figure 10, linearization as a closed loop is possible without
disconnecting closed loop structure (refer to figure 11). GUI of the Simulink Control Design is
shown in figure 11. Linearization results are displayed on GUI such as step response, bode diagram,
impulse response, Nichols diagram, Nyquist diagram, pole-zero map and singular value map and so
on. Figure 11 shows step response in parallel before and after linearization.

16

Input point
GUI of the Simulink Control Design

Output point
It means to cut closed loop.

Example.
Permeation part of Gas separator2

Simplify
Output point

Input point
+
Set

Value

PID
Controller

Step response of a model


which is applied model order
reduction by pole-zero
cancellation with linearized
transfer function
(Green)

Plant

Step response of
linearized transfer function
(Blue)

Figure 11. Simulink Control Design

Based on the linearization results from the Simulink Control Design, it is assumed that model
response between input and output points that are order reduced in all loops can be linear
approximation to the some hundredth seconds order, it is considered to be integrated system for
simplicity. Linearized transfer functions of all inner loops are summarized in table 4.

Table 4. Transfer function with input and output points linearized


Input and output points of the inner loop

Transfer Function

Gas separator 1 material part pressure(y)material part valve opening (u)

-0.0008/s

Gas separator 1 permeation part pressure (y)permeation part valve opening

-0.0009/s

(u)
Gas separator 2 material part pressure (y)material part valve opening (u)

-0.0009/s

Gas separator 2 permeation part pressure (y)permeation part valve opening

-0.0008/s

(u)
Gas separator 3 material part pressure(y)material part valve opening (u)

-0.0008/s

Gas separator 3 permeation part pressure(y)permeation part valve opening

-0.0008/s

(u)

17

4.3. Identification of Outer Loop


System identification in the outer loop models impact that pressure differences between the material
and permeation parts of each gas separator unit 1, 2 and 3 have on oxygen concentration in the
permeation part of gas separator 1, 2 and 3. Open loop response between control quantity 1, 2 and 3,
and manipulated variable 1, 2 and 3 in figure 12 are identified. Although set point of pressure
tracking control of material and permeation parts of each plant is performed for the inner loop, the
inner loop shows very high speed set point tracking compared to outer loop dynamics, therefore it is
assumed to be included in low speed dynamics of the outer loop.
CV1

MV1
Gas separator 1
Set point of pressure
difference between
material part
and permeation part

Gas separator 1
Oxygen concentration
of permeation part
CV2

MV2

Outer
control
system

Gas separator 2
Set point of pressure
difference between
material part
and permeation part

MV3

Gas separator 2
Oxygen concentration
of permeation part

Plant
(including inner loop)

Gas separator 3
Set point of pressure
difference between
material part
and permeation part

Inlet flow gas


quantity

DV1

Inlet flow gas


density

DV2

CV3
Gas separator 3
Oxygen concentration
of permeation part

MV: Manipulated Variable


CV: Controlled Variable
DV: Disturbance

Figure 12. Manipulated variable, controlled variable, and disturbance of outer loop

Simulate the model in figure 13, and log impact of changes of each manipulated variable on
responses of each controlled variable as time series data. Extract necessary parts from time series
data, and identify extracted data.

18

Data display part

Data storing part

Permeation part
PID controller1

Permeation part
PID controller2

Permeation part
PID controller3

Material Part
PID controller1

Material Part
PID controller2

Gas Separator1

Gas Separator2

Material Part
PID controller3

Gas Separator3

Signal Builder
Block

Figure 13. Simulink model for outer system identification (gas_dynamics3_mpc_ident.mdl)

Major parts of this model have no significant differences from the model in figure 10, except for the
contents of the Signal Builder Block which create signal for system identification. The settings of the
Signal Builder Block in figure 13 are shown in figure 14.

19

Signal

MV1

MV2

MV3

Name
Gas separator1
Set point of pressure
in material part
Gas separator1
Set point of pressure
in permeation part
Gas separator2
Set point of pressure
in material part
Gas separator2
Set point of pressure
in permeation part
Gas separator3
Set point of pressure
in material part
Gas separator3
Set point of pressure
in permeation part

DV1

Inlet flow gas


quantity

DV2

Inlet flow gas


density

MV1

MV2

MV3

DV1
DV2

Figure 14. Setup Signal for the Signal Builder Block

Table 5 describes what symbols used in Simulink model of this example mean, including figure 14.

20

Table 5. Meaning of symbols in Simulink model


Name

Contents

Symbol

Manipulated

Pressure set point in the material part of plant 1

PTW1_SV

variable 1 (outer)

Pressure set point in the permeation part of plant 1

PTQ1_SV

Manipulated

Pressure set point in the material part of plant 2

PTW2_SV

variable 2 (outer)

Pressure set point in the permeation part of plant 2

PTQ2_SV

Manipulated

Pressure set point in the material part of plant 3

PTW3_SV

variable 3 (outer)

Pressure set point in the permeation part of plant 3

PTQ3_SV

Disturbance

Gas flow quantity of plant 1

F1

Oxygen concentration mol fraction of gas flow quantity

XAF1

of plant 1
Controlled

Oxygen concentration mol fraction in the permeation

variable 1 (outer)

part of plant 1

Controlled

Oxygen concentration mol fraction in the permeation

variable 2 (outer)

part of plant 2

Controlled

Oxygen concentration mol fraction in the permeation

variable 3 (outer)

part of plant 3

Set point (outer)

Oxygen concentration mol fraction in the permeation

YAQ1

YAQ2

YAQ3

YAQ1_SV

part of plant 1
Oxygen concentration mol fraction in the permeation

YAQ2_SV

part of plant 2
Oxygen concentration mol fraction in the permeation

YAQ3_SV

part of plant 3

Figure 15 show each manipulated variable and open loop response of each controlled variable
obtained from simulating the model in figure 13.

21

MV1

MV2

Pressure
difference

MV3

DV1
DV2

Oxygen
density
CV3
CV2
CV1
Impact of MV1

Impact of MV3

Impact of MV2

Impact of DV2

Impact of DV1

Figure 15. Open loop response to each manipulated variable

Figure 16 shows system identification flow of the outer control system using this simulation data.
Items in the flow are described below.
(1) Sampling of simulation data
In this example, system identification is performed from data acquired in simulation not real plant,
the right path is relevant. When acquiring real plant data, the left path is relevant.
(2) Extraction of data
Each manipulated value is considered as step input signal. Extract data should cover proximity of
steady state so that plant transient response is adequately included.
(3) Trimming of abnormal data
Remove essentially impossible data due to noise and so on, so that model should not be impacted by
abnormal data. Abnormal data does not exist such as noise impact in this simulation.
(4) Removal of bias (direct-current component) from data
Remove low frequency disturbance such as bias (direct-current component) which is undesirable for
identification.

22

START
Ex. Transient response by step input
1.Acquiring
real plat data

1.Sampling of
simulation data

2. Extraction of data

Steady state
3. Trimming of
abnormal data

4. Removal of bias
(direct-current component)
from data

Removal
of bias

5. System Identification

END

Figure 16. System identification flow of the outer control system

(5) System Identification


System Identification Toolbox and Simulink Design Optimization are MATLAB&Simulink tools
used for system identification. It is considered that model is approximated by transfer function of
first order delay + dead time system from step input response characteristics in figure 15.

G( s)

K
exp( Ls )
Ts 1

(4-1)

K: gain, T: time constant, L: dead time


or
Transfer function of second order delay system

G( s)

K
s2

2
n
ns

(4-2)

K: gain, : damping ratio, n: eigen frequency


Model identification is possible using either tool, method using the Simulink Design Optimization is
introduced in this guide. Simulink Design Optimization estimates parameter within Simulink model
based on optimization. It is necessary to provide appropriate initial value to estimation value in the

23

same way as general optimization in order to derive highly precise estimate with less number of
estimates.
In this simulation, non-linearity of model, that has time constant varying a few hundred times in
vertical direction of step input, can be observed from figure 15, and although
Upward time constant of step input < Downward time constant of step input
applies, derive upward model of step input.
For example, from simulation results, relationship between manipulated value 2 and control value 2
is shown in figure 17. From figure 17, transfer function is considered to be approximated as first
order delay + dead time system. Initial values of each parameter are gain=0.25(=magnitude of
manipulated value 2(0.1)/magnitude of manipulated value 2(0.4)), time constant=250, and dead time
L=30.

Figure 17. Step response of manipulated variable 2 and controlled variable 2

(1) and (2) in figure 18 are Simulink models used for parameter estimation. (3) in figure 19 is GUI
for the Simulink(R) Design OptimizationTM. (4) is graph of evaluation function with GUI (square sum
error). X-axis denotes number of estimation, and y-axis denotes value of evaluation function. (5) is a
graph indicating calculated values from models of estimation data and estimation parameter with
GUI. (4) and (5) are updated dynamically every time estimation is performed. Estimation finishes
when conditions set as optimization option is satisfied. Conditions include tolerance of evaluation
function, maximum estimation number, etc.

24

(1)
first order delay
+dead time system

(2)
Second order delay
system

Figure 18. Models used for first order delay + dead time system, parameter estimation of second
order delay

25

(4) Cost Function

(3) GUI of Simulink Parameter Estimation

Iterations
(5) Measured and Simulated

Measured
data (gray)

Simulated
data (blue)

Figure 19. Simulink Design Optimization

If 0<<1 for Second order delay system, overview of step response include vibrations as in figure 20,
and the relationship between parameter of second order system , and parameter: time constant T of
first order system n is assumed to be T= 1/ n. =0.6 is assumed in figure 20.
Display simulation data in graph, derive initial value of n by rough estimation. Relatively good
initial values can be provided by determining initial value referencing figure 21.

26

Second order delay system

First order delay system

2
1
Ts 1

1
n

Figure 20. Relationship between first order delay system and second order delay system (01)
(Figure in [4] is partially modified.

2
n

s2
n

Figure 21. Graph of second order delay system (02)

27

2
0.1

2
n

From the above, transfer function matrix of the derived model is shown in (4-3). Step response of the
model is shown in figure 22.

Y 1( s )
Y 2( s )
Y 3( s )
s2

0.182
e ( 3.6 s )
313.2 s + 1
0.2348
736.7s + 1
9.2372 * 10 -7
0.0032s + 3.4489 *10 -6

0
0.2462 ( 43.8 s )
e
205.5s + 1
3.641 * 10 -6
s 2 + 0.0071 s + 1.23 *10 -5

0
0
0.2884 (
e
234.2s + 1
(4-3)

MV2

MV1

MV3

CV1

CV2

CV3

Figure 22. Step Response

5. Control System Design


5.1. Introduction
This example outer and inner control systems work together. As this is multi-inputs and
multi-outputs, control system is multi-variable control. Outer and inner control systems are designed
separately in control system design. Cascade PID control and multi-variable Model Predictive

28

U 1( s )
U 2( s )
41s )

U 3( s)

Control is designed and compared as multi-variable control.


Figure 23 shows why multi-variables Model Predictive Control is adopted. Model Predictive Control
is control rules that are theoretically valid for plant with long time constant and dead time. PID
control design for multi-input multi-output system generally is becoming more complex. Model
Predictive Control is a control rules that optimized control is possible where stress put on plant is
treated as constraints.

Item

Description

Epexegesis

Structure of
control

Cascade
PID Control

A control system is closed


in a gas separator.
It only controls Set Value
tracking.

Improvement of
tracking Set Value

There is no
norm of
control.

It is not an optimizing
control of the entire plant.
The stress given to the
plant is not evaluated
enough.

Entire optimization of
multi variable
control system

incidence

The gas separators in the


back and forth influence
each other because it
connects.

Optimality

Interference

Improvement item
by MPC installation

Expecting effect
by MPC installation
Running cost reduction
Stabilization of control
Reduction of stress to plant

Figure 23. Why multivariable Model Predictive Control is adopted

29

Table 6 summarizes outer and inner control systems.


Table 6. Outer control system and inner control system
Control method

Function

Set point, controlled variable, manipulated


variable

Outer control

Cascade PID control

To track set point of oxygen

Set point: oxygen concentration in emission gas

system

(position type)

concentration in the

in the permeation part

permeation part of each gas

Controlled variable: oxygen concentration in

separator.

emission gas in the permeation part


Manipulated variable: pressure difference
between the material and permeation parts

Multivariable Model

Same as above

Same as above

Predictive Control
Inner control

PID control (position

To control inhalation and

Set point: pressures in the material and

system

type)

emission control valve

permeation parts of gas separator

opening and follow set points

Controlled variable: pressures in the material and

of oxygen concentration in

permeation parts of gas separator

the material and permeation

Manipulated variable: inhalation (emission)

parts of each gas separator.

5.2. Inner Control System Design ~ PID Control


Inner control system is assumed to be loop control by PID controller. Manipulated variable switcher
switches between emission and inhalation, depending on sign of manipulated variables, W and Q
that PID controllers of loop1 and loop2 output.
The function of manipulated variable switcher is assumed as follows.
In the loop 1, total pressure, PtW of pressure sensor is treated as CV (Controlled Variable) , and W
(emission gas flow in the material part) as MV (Manipulated variable). If W is positive, emission gas
value is positive, and emission value control valve is controlled. Inhalation control valve then is fully
closed. If W is negative, emission gas value is negative, and inhalation value control valve is
controlled. Emission value control valve then is fully closed. To match sign of inhalation value and
valve opening, if W is negative, it is absolute value of W.
In the loop 2, total pressure, PtQ of pressure sensor is treated as CV (Controlled Variable), Q
(emission gas flow in the permeation part) as MV(manipulated variable). If Q is positive, emission
gas value is positive, and emission value control valve is controlled. Inhalation value control valve
then is fully closed. If Q is negative, emission gas value is negative, and inhalation value control
valve is controlled. Emission value control valve then is fully closed. Switching between emission
and inhalation is not modeled in Simulink model.

30

In the loop 1, when W (emission gas flow in the material part) increases, total pressure, PtW
decreases, then proportional gain of PID controller is negative. In the loop 2, when Q (emission gas
flow in the permeation part) increases, total pressure, PtQ decreases, then proportional gain of
controller is negative. In the loop 1 and 2, set points are supplied by the outer control system.

Set
point

loop1

Outer Control
System

Set point1

Sign of MV
of PID Controller
1

PID
controller

Manipulated
Variable
Switcher

0
ABS

Set point2

Absolute

Gas separator
Material part
Pressure
Sensor

Inhalation
control valve

W: Emission gas
quantity of
material part [mols-1]

Total Pressure
PtW

F: Inlet gas
quantity [mols-1]

Emission
control
valve

Selectively
permeable membrane

Permeation part

Pressure
Sensor

loop2

Manipulated
Variable
Sign of MV Switcher
of PID Controller
1

PID
controller

0
ABS

Total Pressure
PtQ
Inhalation
control valve
Density
Sensor

Absolute

Q: Emission gas
quantity of
permeation part [mols-1]

Emission
control
valve

Figure 24. PID controller attached to gas separator

In this model, structure of PID control adds rate limits, upper and lower limits to outputs
(manipulated variable) of basic position PID controller (see figure 25). Structure of PID controller is
common for both outer loop and inner loop. Upper and lower limits, and rate limits of all PID
controller are shown in table 7.
Table 7. Upper and lower limits and upper and lower rate limits of PID Controller
Parameter Name

Value [%]

MV upper limit

20

MV lower limit

-20

MV upper rate limit

10

MV lower rate limit

-10

31

Plant

PID Controller

Inside of subsystem
Integral Time
Proportional
Gain

Integrator

Upper and
lower limit

Rate
limiter
Derivative
Time

Appropriate
Differential
Operator

Figure 25. Structure of PID controller

PID control parameter is derived using Ziegler-Nichols Method. An example of PID control
parameter using Ziegler-Nichols Method is displayed in table 8. Additionally, results applying
tuning visually from simulation results are shown in table 9.
Table 8. Example of PID control parameters using Ziegler-Nichols Method [2]
Control law

Proportional gain Kp

Integral time Ti

Derivative time Td

PI Control

0.45*(gain of stability limit)

0.833*(frequency of

stability limit)

Table 9. PID Control Parameter of inner loop


Input and output points

Gas separator 1 material part

Transfer

Proportional

Integral time

Derivative

Function

gain

-0.0008/s

-20

67

-0.0009/s

-17

67

-0.0009/s

-20

67

-0.0008/s

-20

67

time

pressure (y)material part valve


opening (u)
Gas Separator 1 permeation part
pressure (y) permeation part
valve opening (u)
Gas Separator 2 material part
pressure (y)material part valve
opening (u)
Gas Separator 2 pressure in the
permeation part (y)valve

32

opening in the permeation part (u)


Gas Separator 3 material part (y)

-0.0008/s

-30

67

-0.0008/s

-30

67

material part valve opening (u)


Gas Separator 3 permeation part
pressure (y)permeation part
valve opening (u)

5.3. Upper Control System Design ~ Cascade PID Control


When designing multiple loop control using multi-variable control, it is important to determine
appropriately which manipulated variables control which controlled variables, and its combinations.
In this example, based on a basic theory that one manipulated variable controls one controlled
variable, manipulated variable 1controlled variable 1, manipulated variable 2controlled variable
2, manipulated variable 3controlled variable 3.
For simplicity, where equation (4-3) of the outer system model is equation (5-1), Y2(s) is found to
be interfered by U1(s), and Y3(s) is interfered by U1(s) and U2(s). Decoupling can be used for
cancelling interferences, but in this example, each gas separator controls independently each PID
controller (outer) does not have decoupling functionality to avoid mutual interference.

Y 1( s )

G11 (s )

U 1( s )

Y 2( s )

G 21 (s) G 22 ( s )

U 2( s )

Y 3( s )

G31 ( s ) G32 ( s ) G33 ( s ) U 3( s )


(5-1)

Figure 26 shows structure of cascade PID control. PID controller (outer) and PID controller (inner)
are double structure. The outer loop behavior is as follows:
PID controller (outer) outputs pressure difference SV (Set point) as manipulated variable so that
emission concentration in the permeation part of each gas separator is controlled to follows SV(Set
point). Computing unit(refer 5.5.) assigns pressure difference SV(Set point) that PID controller
(outer) outputs as SV(Set point) of pressure for the material and permeation parts of gas separator.
The inner loop behavior:
The inner loop controls emission and inhalation value to control to follow pressure SV (Set point) of
pressure provided from Computing Unit.

33

Outer loop

Y1
SV of density
in gas separator1

SV of pressure
in material part of
gas separator1

Computing unit
U1
PID controller
(outer)

SV of pressure
difference between
material part and
permeation part
In gas separator1

Inner loop
SV of pressure
in permeation part of
gas separator1
PID controller
(inner)
+

+
+

Base pressure
[atm]

Y2

PID controller
(outer)

SV of pressure
in material part of
gas separator2

U2
1/2

SV of pressure
difference between
material part and
permeation part
In gas separator2

+
1.0
+

SV of density
in gas separator3

SV: Set point


CV: Controlled Variable

U3
PID controller
(outer)
SV of pressure
difference between
material part and
permeation part
In gas separator3

PID controller
(inner)

Manipulated
variable
switcher
CV of density
in permeation
part of gas separator1

Manipulated
variable
switcher

1.3
Base pressure
[atm]

Base pressure
[atm]

Y3

1.3
Base pressure
[atm]
1.0

SV of density
in gas separator2

PID controller
(inner)

1/2
+

Manipulated
variable
switcher

SV of pressure
in permeation part of
gas separator2
PID controller
+
(inner)

Manipulated
variable
switcher

SV of pressure
in material part of
gas separator3

Manipulated
variable
switcher

1/2
+

PID controller
(inner)

plant

CV of density
in permeation
part of gas separator2

1.3
Base pressure
[atm]

SV of pressure
in permeation part of
gas separator3
PID controller
+
(inner)

1.0
+

Manipulated
variable
switcher
CV of density
in permeation
part of gas separator3

Base pressure
[atm]

Figure 26. Structure of Cascade PID Control

PID parameters of cascade PID controller are derived from CHR method.
If plant can be expressed as transfer function of first order delay + dead time system, an example of
CHR method parameters are shown in table10.

G( s)

K
exp( Ls )
Ts 1

K: gain, T time constant, L dead time


Table 10. Parameter examples of CHR method [2]
External input

Set point change

Overshoot

None

Control law

PI Control

34

Proportional

Integral

Derivative

gain Kp

time Ti

time Td

0.35T/KL

1.17T

The results obtained from applying CHR method to transfer function of the outer system are shown
in table 11.

Table 11. PID parameter of cascade PID control (host)


PID Parameter
Input and output points

Gas Separator
manipulated value 1 (y)

Transfer Function

Proportional

Integral

Derivative

gain

time

time

0.182
exp( 3.6 s )
313.2s 1

167.3

366.4

0.2462
exp( 43.8s )
205.5s 1

6.67

240.4

0.2884
exp( 41s )
234.2 s 1

6.93

274.0

control value 1 (u)


Gas Separator
manipulated value 2 (y)
control value 2 (u)
Gas Separator
manipulated value 3 (y)
control value 3 (u)

Upper and lower limits, and rate limits of all cascade PID controller (outer) are shown in table 12.
Table 12. Upper and lower limits, and upper and lower rate limits
Value
MV upper limit

MV lower limit

MV upper rate limit

0.05

MV lower rate limit

-0.05

5.4. Outer Control System Design ~ Model Predictive Control


Detailed structure of Model Predictive Control system is shown in figure 27. What differs from
cascade PID control is that cascade PID control is single-input single-output, and Model Predictive
Control system is multi-inputs and multi-outputs.

35

Outer loop

Computing unit
U1

SV of pressure
in material part of
gas separator1
PID controller
(inner)

1/2
+

SV of density
in each
gas separators

SV of pressure
difference between
material part and
permeation part
In gas separator1

Y1

Inner loop
SV of pressure
in permeation part of
gas separator1
PID controller
(inner)
+

+
+

U2

Base pressure
[atm]
+

SV of pressure
in material part of
gas separator2

1/2

Y2

SV of pressure
difference between
material part and
permeation part
In gas separator2

+
+
Base pressure
[atm]
+
1/2
+

Y3

SV of pressure
difference between
material part and
permeation part
In gas separator3

PID controller
(inner)

CV of density
in permeation
part of gas separator1

Manipulated
variable
switcher

SV of pressure
in permeation part of
gas separator2
PID controller
+
(inner)

Manipulated
variable
switcher

SV of pressure
in material part of
gas separator3
PID controller
(inner)
+

Manipulated
variable
switcher

plant

CV of density
in permeation
part of gas separator2

1.3
Base pressure
[atm]

1.0
+

SV: Set point


CV: Controlled Variable

Manipulated
variable
switcher

1.3
Base pressure
[atm]
1.0

U3

1.3
Base pressure
[atm]
1.0

Model
Predictive
Controller

Manipulated
variable
switcher

SV of pressure
in permeation part of
gas separator3
PID controller
+
(inner)

Manipulated
variable
switcher

Base pressure
[atm]

CV of density
in permeation
part of gas separator3

Figure 27. Control structure of Model Predictive Control (Outer system) and PID control (Inner
system)

Design parameters for Model Predictive Control system and its design basis are shown in table 13.
See chapter 6 for details of Model Predictive Control in MATLAB.

Table 13. Design parameters for Model Predictive Control system and its design basis
Time related parameter

Value

Design basis

Control interval

60 [seconds]

As time constant of plant ranges from approximately a


few hundred to kilo seconds order, prediction horizon
is set at 1200 seconds to include generally plant s
dynamics. Control interval is set at 60 seconds as this
does not require high speed control.

Prediction horizon

20 [samples]

For calculation speed-up, control horizon is set at half

Control horizon

10 [samples]

of prediction horizon.

36

Variable

Variable

Weight

type

Rate

Design basis

Weight

Manipul

U12

To make significantly bigger weight factor of

ated

U34

controlled variables than that of manipulated

variables

U56

variables. This evaluates highly set point tracking

Output

YAQ1

10

of controlled variables within the evaluation

variables

YAQ2

1000

function. Manipulated variable can move as long

(Controlled

YAQ3

10000

as it satisfies set point tracking. This calculates u


vector that places more importance on set point

Variables)

tracking than manipulated variable stability.


Furthermore, place weight in set value tracking so
that set point of Y3 (gas concentration of final
product). Apply more loose constraints for
intermediate product (Y2) compared with Y3.
Intermediate product (Y1) is not required to track
setpoint.

Variable type

Variable

Constraints

Design basis

Manipulated

U12

0 <= U12 <= 1

U1, U2 and U3 are operated within the

-0.05 <= U12/rate <= 0.05

upper and lower limits.

0 <= U34 <= 1

U1, U2 and U3 are 1[atm] at

-0.05 <= U34/rate <= 0.05

maximum, 0[atm] at minimum. This

0 <= U56 <= 1

means to define the upper and lower

-0.05 <= U56/rate <= 0.05

limits of stress put on the plant. Rate

variables
U34

U56

limit is to be strict in order to mitigate


stress put on the plant.
Output

YAQ1

No constraints

Upper and lower limits are placed only

variables

YAQ2

No constraints

for the final product, YAQ3, and no

YAQ3

0 <= YAQ3 <= 1

limits are placed for intermediate


product, YAQ1 and YAQ2.

5.5. Computing Unit


Functionalities of Computing Unit are described in figure 28. The Computing Unit allocates half of
the output from the outer control system to both the material and permeation parts. Half of the

37

manipulated variable is added to the base pressure in the material part, and half of the manipulated
variable is subtracted from the base pressure in the permeation part. The base pressure in the
material part is 1.3[atm], and 1.0[atm] in the permeation part. This is because it assumes the case
where outer control system is stopped and control is performed only by the inner control system. For
example, they are transient state such as launching and stopping plant, and malfunction of the outer
control system and maintenance.
Functionalities of Computing Unit are the same for cascade PID control and Model Predictive
Control.

Model Predictive
Controller output
(Manipulated Value)

U
Gas separator
Base pressure
1.3[atm]

Base pressure
1.0[atm]

Material part

Permeation
part

Figure 28. Functions of Computing Unit

6. Multivariable Model Predictive Control in MATLAB[3]


6.1. Model Predictive Control (MPC) Toolbox and MPC Blockset
Model Predictive Control (MPC) Toolbox is a MATLAB product which is used for design and
simulation of Model Predictive Control system. In order to simulate the designed Model Predictive
Control system use the MPC Controller Block provide in this tool. The MPC toolbox provides
function library for command line and mpctool for dedicated GUI. Model Predictive Control
designed in mpctool is MPC object form, and can be treated on MATLAB Workspace. Simulink and
the MPC Toolbox can be seamlessly used by specifying MPC object in the MPC Controller Block.
Examples of Functionalities of mpctool are described in figure 29.

38

(1) in figure 29 sets control structure of Model Predictive Control system to be designed. (2) sets
inequality constraints of Model Predictive Control system to be designed. There are upper and lower
limits and rate limit constraints of manipulated variables, and upper and lower limits of controlled
valriables in inequality constraints. (3) sets control interval of Model Predictive Control system to be
designed, prediction horizon, control horizon and so on. (4) sets weight factor within the cost
function of Model Predictive Control system to be designed.
Model Predictive Control system described in chapter 6 refers to Model Predictive Control (MPC)
Toolbox.
MPC Structure Overview

(2)

Constraints

(1)

Manipulated
Variables
Controlled
Variables

Weight Tuning

Model and Horizons


(3)

(4)

Figure 29. Example of various GUIs for designing mpctool

6.2. Control Structure of Model Predictive Control


Control structure of Model Predictive Control is shown in Fig30. The structure is the same in SISO
(single-input single-output) and MIMO (multi-input multi output). Model Predictive Control is a
kind of feedback control.

39

Figure 30. Block Diagram of a SISO Model Predictive Control Toolbox Application [3]

Description of symbols in Figure 30 is shown in Table14.


Table 14.

Description of Model Predictive Control Toolbox Signals [3]

Symbol
d

Description
Unmeasured disturbance. Unknown but for its effect on the plant output. The controller
provides feedback compensation for such disturbances.

Setpoint (or reference). The target value for the output.

Manipulated variable (or actuator). The signal the controller adjusts in order to achieve
its objectives.

Measured disturbance (optional). The controller provides feedforward compensation for


such disturbances as they occur to minimize their impact on the output.

Output (or controlled variable). The signal to be held at the setpoint. This is the true
value, uncorrupted by measurement noise.

Measured output. Used to estimate the true value, y .

Measurement noise. Represents electrical noise, sampling errors, drifting calibration,


and other effects that impair measurement precision and accuracy.

40

6.3. Operation of Model Predictive Control


Dynamic optimization is performed in Model Predictive Control. (1) and (2) as follows are repeated
in dynamic optimization procedure.
(1) Prediction future controlled variable of the plant as many as p pieces of prediction horizon, p for
every control interval.
(2) Solving manipulated variable rate vector

u (k k ),K u (k m 1 k ) that minimizes quadratic

u (k k ), K u ( k p 1 k ) ,

cost function described by manipulated variable rate vector


manipulated variable vector u (k k ), Ku (k p 1 k)

and controlled variable vector

y (k k ),Ky (k p 1 k ) within the constraints. The procedures for dynamic optimization is shown
to the left in figure 31. To the right, prediction horizon and control horizon are described.

Procedure of MPC
Dynamic optimization

Prediction future controlled variable of the plant


as many as p pieces of prediction horizon,
p for every control interval.

Solving manipulated variable rate vector


that minimizes quadratic cost function
described by manipulated variable rate vector,
manipulated variable vector and controlled
variable vector within the constraints.

Set u(k) to plant

k=k+1Shift sample time )

,M

repeat

present(k)

Figure 31. Behavior overview of Model Predictive Control [3]

6.4. Linear Model of Plant


The linear model used in Model Predictive Control Toolbox for prediction and optimization is
depicted in Figure 32.Inputs of the model are manipulated variables and observable and
non-observable disturbances.

41

Figure 32. Linear Model of a Plant used by MPC Toolbox [3]

The model of the plant is a linear time-invariant system described by the equations (6-1).

x k 1 Ax k Buu k Bv v k Bd d k
ym k Cm x k Dvm v k Ddm d k
yu k Cu x k Dvu v k Ddu d k Duuu k

(6 1)

where x(k) is the nx-dimensional state vector of the plant, u(k) is the nu-dimensional vector of
manipulated variables (MV), i.e., the command inputs, v(k) is the nv-dimensional vector of measured
disturbances (MD), d(k) is the nd-dimensional vector of unmeasured disturbances (UD) entering the
plant, ym(k) is the vector of measured outputs (MO), and yu(k) is the vector of unmeasured outputs
(UO). The overall output vector y(k) collects ym(k) and yu(k).
6.5. Optimization Problem
Assume that the estimates of x(k), xd(k) are available at time k. Model Predictive Control
action at time k is obtained by solving the optimization problem.
where the subscript ( )j denotes the j-th component of a vector, (k+i|k) denotes the value
predicted for time k+i based on the information available at time k; r(k) is the current sample of the
output reference, subject to with respect to the sequence of input increments
{u(k|k),,u(m-1+k|k)} and to the slack variable , and by setting u(k)=u(k-1)+u(k|k)*, where
u(k|k)* is the first element of the optimal sequence.

42

min
u k k ,..., u m 1 k k ,

p 1

y
i 1, j
i 0

nu

ny

y j k i 1k

rj k

i 1

j 1

(6-2)

nu
u
i, j

uj k

ik

u
i, j

j 1

uj k

ik

u jt arg et k

j 1

where the subscript ( )j denotes the j-th component of a vector, (k+i|k)


denotes the value predicted for time k+i based on the information available at
time k; r(k) is the current sample of the output reference, subject to
u

u j min i
V j min i u j k i k u j max i
V j max i
u
u
u j min i
V j min i
uj k ik
u j max i
V j max i
y
y
y j min i
V j min i y j k i 1 k y j max i
V j max i
u j k h k 0, h m,..., p 1
0
i 0,..., p 1

(6-3)

with respect to the sequence of input increments {u(k|k),,u(m-1+k|k)} and to the slack variable
, and by setting u(k)=u(k-1)+u(k|k)*, where u(k|k)* is the first element of the optimal sequence.

When the reference r is not known in advance, the current reference r(k) is used over the whole
prediction horizon, namely r(k+i+1)=r(k) in Equation (6-3).

i, j

, w u i, j , w yi, j are nonnegative weights for the corresponding variable. The smaller w, the less

important is the behavior of the corresponding variable to the overall performance index.

u j, min , u j, max , u j, min , u j, max , y j, min , y j, max are lower/upper bounds on the corresponding
variables. In Equation (6-3), the constraints on u, u, and y are relaxed by introducing the slack

0 . The weight

variable

on the slack variable

penalizes the violation of the constraints.

with respect to input and output weights, the more the constraint violation is

The larger

penalized. The Equal Concern for the Relaxation (ECR) vectors

V u min , V u max , V

min

,V

max

, V y min , V y max have nonnegative entries which represent the

concern for relaxing the corresponding constraint; the larger V, the softer the constraint.
V=0 means that the constraint is a hard one that cannot be violated. By default, all input constraints
are hard V

V y min

min

V y max

V u max V u min V u max 0 and all output constraints are soft


1 . As hard output constraints may cause infeasibility of the optimization

problem (for instance, because of unpredicted disturbances, model mismatch, or just because of
numerical round off).

43

6.6. Cost Function of Model Predictive Control


Cost Function (6-2) is shown as follows.

u ( 0)

ut arg et (0)

u ( p 1)

ut arg et ( p 1)

J ( z, )

u ( 0)
L

u ( 0)

ut arg et (0)

u ( p 1)

ut arg et ( p 1)

u ( 0)
W

(6-4)

u ( p 1)

u ( p 1)

y (1)

r (1)

y ( p)

r ( p)

y (1)

r (1)

y( p)

r ( p)

Constraint (6-3) is shown as follows.

V y min (1)

y min (1)

y (1)
L

L
y min ( p)
u min (1)

min

( p)

y( p)

L
y max ( p ) V y max ( p)

min

(1)

u ( 0)

u max (1)

u min (1)

min
u

min

u max ( p 1)

u ( 0)

(1)

u max (1)

L
u

min

max
u

( p 1)

max

(1)

max

( p 1)

u ( p 1)

( p 1)

(6-5)

u ( p 1)

( p 1)

L
u min ( p 1)

V u max (1)

L
u min ( p 1)

V y max (1)

y max (1)

u max ( p 1)

Cost Function (6-4) is shown as follows.

J ( z, ) U T W 2 uU

U TW 2

Y T W 2 yY

(6-6)

Constraint (6-6) is shown as follows.

Ymin

Ymax

U min

U max

U min

(6-7)

U max

u that minimizes J is calculated sequentially-iterated by the quadratic programming with


constraints. Symbols that used in equation (6-6) and (6-7) are shown as follows.

44

u ( 0)

u t arg et (0)

u ( p 1)

u t arg et ( p 1)

u ( 0)
(6-8)

u ( p 1)
Y

y (1)

r (1)

y ( p)

r ( p)

V y min (1)

y min (1)

Ymin

V y min ( p )

y min ( p )

V u min (1)

u min (1)

U min

V u min ( p 1)

u min ( p 1)

u min (1)

min

(1)

min

( p 1)

U min
u min ( p 1)
y max (1)

V y max (1)
L

Ymax
y max ( p )

V y max ( p)
V u max (1)

u max (1)

U max
u max ( p 1)

u max (1)

V u max ( p 1)
V

max

(1)

max

( p 1)

(6-9)

U min
u max ( p 1)

45

7. Evaluation of Control System


7.1. Introduction
This chapter evaluates control performance of cascade PID control and Model Predictive Control of
the outer control system designed in chapter 5.

7.2. Simulation Model of Cascade PID Control


Figure 33 shows simulation model of cascade PID control.
After 0 to 25000 seconds, it is controlled in combination of cascade PID control and the inner
control system.
Cascade
PID
Controller

Computing
Unit

Data display part

Cascade
PID
Controller
Data storing part
Cascade
PID
Controller

Permeation part
PID controller1

Permeation part
PID controller2

Permeation part
PID controller3

Material Part
PID controller1
Material Part
PID controller2

Signal Builder
Block

Gas Separator1

Gas Separator2

Material Part
PID controller3

Gas Separator3

Figure 33. Simulation Model (gas_dynamics3_cascade_tuned.mdl)

7.3. Simulation Model of Model Predictive Control


Model that simulates Model Predictive Control is shown in figure 34. Model Predictive Control is
performed from time 2000 seconds. So, Model Predictive Controller (MPC Controller Block) is
located within Enabled Subsystem. It is controlled in the inner control system only up to 2000
seconds, and in combination of Model Predictive Control and the inner control system after 2000 to
25000 seconds.

46

Data display part


Computing
Unit
Model Predictive
Controller

Permeation part
PID controller1

Permeation part
PID controller2

Permeation part
PID controller3

Material Part
PID controller1
Material Part
PID controller2

Signal Builder
Block

Gas Separator1

Gas Separator2

Material Part
PID controller3

Gas Separator3

Figure 34. Simulation Model ()

7.4. Comparison of Cascade PID Control and Model Predictive Control


Perform simulations for cascade PID control and Model Predictive Control. The results obtained are
shown in figure 35 to 38. (Figure 35: Set points and controlled variables, Figure 36: superimpose of
Figure 35, Figure 37: manipulated variables, Figure 38: disturbance)
In (1) in figure 35 (left side of figure 36), set point tracking control apparently stops and windup that
requires time for a while to restart set point tracking is confirmed in cascade PID control. Windup
occurs because: integrator is affected if output signal (MV) is reached to upper or lower limit in PID
calculation when error that is difference between set point and controlled variable occurs. An
appropriate integrated value is stored in integrator and normal calculation is performed if MV does
not go over the limits. If MV goes over the limits, excessive integrated values are stored in integrator.
It requires substantial time for integrated value to become 0 when this state is controlled to be
normal range. Until reaching this time, MV output does not return to normal range, and the state of
going over the limits continues. The functionality to initialize integrated value in a short time is
called anti-reset windup. This PID controller does not have anti-reset windup.
(1) of figure 35 (left side of figure 36) indicate the state which can not track set point. Each gas
separator constructs own closed cascade PID control system, and in the gas separator 3, it confirms

47

that manipulated variable of cascade PID controller is at the upper limit in (1) of figure 37. The
cascade PID control shows that the ability to make oxygen of more than 95% concentration set here
can not be obtained.
Manipulated variable of cascade PID control always stick to the upper limit within of the upper and
lower limits of manipulated variable, 0~1.5[atm].Manipulated variable of the upper and lower limits
of Model Predictive Control is 0~1[atm], and manipulated variable of Model Predictive Control
fluctuate within the range, stress put on the plant is lower in Model Predictive Control.
In Model Predictive Control, set point tracking control is achieved within the upper and lower limits
of the manipulated variables.
Weight factor of set point tracking of the gas separator 3 is weighted and set point tracking of the gas
separators 2 and 3 are lowered for Model Predictive Control in the design of cost function. Figure 35
shows that set point tracking is the best in the gas separator 3, followed by the gas separator 2 and 1,
respectively, which confirms behavior in accordance with the design concept. It also shows that the
ability to make oxygen with more than 95% concentration can be achieved in the current Model
Predictive Control performance. Weight factors for the manipulated variables 1, 2 and 3 are
minimized for large behavior range in the cost function. Each manipulated variables indicates larger
behavior range for control value set point tracking. As impact of disturbance (figure 38) is not so
significant for both cascade PID control and Model Predictive Control, it can be considered as good
for disturbance absorbability.
In conclusion, Model Predictive Control is considered to have the better control performance in this
example. However, this cascade PID control is simple and there are some possibilities for improved
control performance using feedforward and decoupling and so on.

48

Cascade PID control

Model Predictive Control

Windup

(2)

(3)

Figure 35. Setpoints and manipulated variables

Windup

Figure 36. Superimpose of figure 35

49

Manipulated Variables

Cascade PID Control

(1)

Figure 37. Manipulated variables

50

Model Predictive Control

Disturbance

Figure 38. Disturbance

8. Conclusion
This example shows simulation for gas separator process control using permeable membrane in
Simulink.
The control object (plant) is gas separator. Plant model is created on a formula basis using Simulink,
and as control system for the plant, cascade PID control and Model Predictive Control are compared.
Control system for the gas separator process control consists of combination of the outer and inner
control systems (cascade control). Outputs of the outer control system is manipulated variables that
is set points to track controlled variables of inner control system.
The procedures for simulation are as follows:
(1) Plant modeling
Governing rules of the plant are assumed and modeled on a formula basis. The governing rules are
derived from mass balance equation and ideal gas equation.
(2) System identification
Identify parametric model from plant input and output response in time domain.
(3) Control system design (PID control, Model Predictive Control)
Design of PID control for the inner control system, and cascade PID control and Model Predictive

51

Control for the outer control system. The control object is the above parametric model.
(4) Evaluation of Control System
Performance of designed control system is evaluated in some diagram. Validity of Model Predictive
Control is confirmed in this example for multi-inputs multi-outputs system.
Plant model and control system in this example can be created in MATLAB&Simulink and
simulated. Logics of MATLAB&Simulink can be changed and extended as a more detailed model,
and improved gradually, a larger system can be constructed. It is also possible to embed
experimental equation or table format if processes are difficult to equate theoretically. Efficient and
intuitive modeling is possible in Simulinks graphical environment.

9. References
[1] Kenji Hashimoto and Fumimaru Ogino, Todays Chemical Engineering, Sangyo-Tosho (2001)
[2] Iori Hashimoto, Shinji Hasebe and Manabu Kano, Process Control Engineering, Asakura
Publishing Co., Ltd. (2002)
[3] Model Predictive Control Toolbox Users Guide Version 2 The Mathworks, 2004
[4] Shuichi Adachi, Control Engineering using MATLAB, Tokyo Denki University Press (1999)

10. Exemption from Responsibility


Under no circumstances will The MathWorks Inc. be liable in any way for in this content, or for
any loss or damage of any kind incurred as a result of the use of this content.

11. Author
Hiroumi Mita
hiroumi.mita@mathworks.co.jp
Principal Application Engineer
AEG
The MathWorks Inc.

52

Created in February 2005


Modified in June 2010
This model is created using MATLAB Version 7.9 ,Model Model Predictive Control Toolbox Version 3.1.1 and Simulink Version 7.4.

MATLAB&Simulink Sample Model Description


Simulation of Cascade PID Control and Model Predictive Control for a gas separation plant by
membrane separation

MATLAB and Simulink are registered trademarks of the MathWorks, Inc. All other names such as products are trademarks or registered trademarks of
respective owners. Reprint, copy or reproduction of the whole or any part of this material is prohibited. The contents of this material may be altered
without prior notice.

53

You might also like