# Design Of Controllers Using Matlab Software Biology Essay

Published:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

The project is a Process Control study which deals with controlling the output of a specific process in accordance with the inputs provided. This is done by using controllers. Controllers are tuned according to the desired output.

MATLAB software has been used to simulate the various processes. The software is an indispensable tool which helps in providing an insight to the actual process. It helps evaluate the necessary tuning parameters for a controller and generates the graphical representation of the output.

## CHAPTER 1

## INTRODUCTION

## PROCESS CONTROL

Process control is a field of study that deals with mechanisms and building of steps to control the output of a specific process. The main objective of process control is to maintain a process at the desired operating conditions, safely and efficiently, while taking into consideration both environmental and product quality requirements.

Bringing a process under control requires manipulation and controlling of the variables involved in the process. The process variables are therefore classified as: [1]

Controlled Variables : These are the variables which can be controlled. The set point is the desired value of the controlled variable.

Manipulated Variables : The process variables that can be manipulated in order to achieve the required set point.

Disturbance Variables : These variables affect the controlled variables but cannot be manipulated. Generally, disturbance variables cannot be measured.

## PROJECT OBJECTIVE

The importance of process control in the process industries has become greater than before as a result of rapidly changing economic conditions and stricter environmental and safety regulations.[2]

The project aims at studying and understanding the different process control strategies involved. The development of a controller for a process is of prime importance and hence will be studied in the course of this project.

## ORGANISATION OF THE PROJECT

The study involves the formulation of a control problem and calculation of parameters using mathematical formulae for various controllers.

MATLAB and Simulink have been extensively used to arrive at the results. MATLAB is a vast software tool which makes it easier for the user to simulate a given problem.

## CHAPTER 2

## CASCADE CONTROL OVERVIEW

## 2.1 TYPES OF PROCESS CONTROL STRATEGIES

Closed-loop systems are broadly classified into three categories: [1]

Feedback Control Systems : These type of systems involve the measurement of the controlled variable which is in turn used to adjust the manipulated variable. The disturbance variable is not measured.

Feedforward Control Systems : Here the disturbance variable is measured but not the controlled variable.

Cascade Control Systems : The disturbance variable is not necessarily measured. It has a primary and a secondary controller associated with it.

## 2.2 INTRODUCTION TO CASCADE CONTROL

Cascade control systems are control systems with multiple loops. In cascade control configurations, there is only one manipulated variable and more than one measurement.

Cascade control can be usefully applied to any process where a measurable secondary variable directly influences the primary controlled variable through some dynamics.

Fig. 1.1 Basic Cascade Control Structure

As shown in Figure 1.1, the cascade control structure has two nested loops whose functioning are dependent on each other. In the figure:

C1:Primary Controller

C2:Secondary Controller

d1,d2: Disturbances

P2: Secondary Plant Process

P1: Primary Plant Process

The controller in the outer loop is also known as the master controller while the controller in the inner loop is referred to as the slave controller. As the names suggest, the role of the master controller is to serve as the set point for the slave controller. For a cascade control system to function accurately, the response of the inner loop must be much faster than the outer loop. [1]

## 2.3 ADVANTAGES AND DISADVANTAGES

2.3.1 Advantages

Disturbances arising within the secondary loop are corrected by the secondary controller before they can affect the value of the primary controlled output.[3]

The cascade control structure effectively accounts for external disturbances.

Significant reduction of dead time in variable response. [3]

Improved closed-loop response due to the presence of measured variable close to the potential disturbance which allows the feedback loop to react quickly.

2.3.2 Disadvantages

Tuning cascade controllers is more difficult as the set point changes as well as the number of parameters involved in the process increases.

The use of additional controllers and sensors can be costly.

## CHAPTER 3

## SIMULATION STUDIES ON CASCADE CONTROL SYSTEM

The power of MATLAB and its Control System toolbox enables the simulation of the various structures and systems. The modelling of the processes involved is done on Simulink which is a very handy tool provided by MATLAB.

The cascade structure problem requires the breakdown of the multiple-loop system into two single-loop controllers-Primary controller and Secondary Controller.

## 3.1 SINGLE-LOOP CONTROLLERS

The two single-loop controllers are first modelled as open loop systems with no feedback. This is done in order to determine the various parameters involved in the tuning of the controllers.

3.1.1 Primary Process (Second-Order Process)

The primary process involved in the problem undertaken is a second-order process with the transfer function: [2]

Gp(s) = 1 (3.1)

0.5s2+1.5s+1

The tuning of the primary controller requires the evaluation of parameters. The steps involved are:

a) Modeling the open loop primary control process to find out the steady state value.

b) Determining the values of open loop gain constant K, process time constant τ and dead time td using the TWO POINT METHOD.

c) The tuning parameters (Proportional, integral and derivative) are then evaluated for a PID controller using the COHEN-COON METHOD.

The steps involved are:

(i) Open-Loop Primary Process

The use of MATLAB enables the modelling of the open-loop primary control process as shown in figure 3.1.

Fig. 3.1 Open-loop primary process

The simulation of the open-loop process provides us with the value at which the process finally steadies itself at-STEADY STATE VALUE.

Amplitude

Fig. 3.2: Open-loop response of primary process to step-input

Figure 3.2 shows that the steady-state value of the process is 1.This value will be used in the next step.

(ii) Two-Point Method

The Two-Point Method is the second step involved in determining the parameters of the PID controller. This method finds the times, t2 and t1, at which the process amplitude reaches 28.3 % and 63.2 % of the final steady-state value respectively.

For finding the exact values of t1 and t2, a small MATLAB program code is developed as follows:

num=[0 1];

den=[0.5 1.5 1];

t=0:0.01:5;

step(num,den,t)

title('Step Response with Proportional Control')

xlabel('Time(sec)')

ylabel('Amplitude')

Fig. 3.3 Open loop response of second order process

Now, steady-state value = 1

From the graph it is observed that:

t2 = time taken to reach 28.3 % of the steady-state value = 0.759 sec

t1 = time taken to reach 63.2% of the steady-state value = 1.58 sec

τ = Process time constant = 1.5(t1-t2) =1.23 sec

td = Dead-time = t1-τ = 0.35 sec

K = Static Gain = O/P at steady state = 1

I/P at steady state

This concludes the Two-Point Method.

(iii) Cohen-Coon Method Of Tuning

Cohen and Coon observed that the response of most processing units to an input change, had a sigmoid shape, which was approximated by the response of a first-order system with dead-time: [2]

GPRC(s) ≈ K e-td (3.2)

τs+1

Therefore, for the process under consideration this reduces to:

GPRC(s) ≈ e-0.35 (3.3)

1.23s + 1

To achieve a one-quarter decay ratio and minimum integral square error, they derived expressions for the tuning parameters of a PID controller.Evaluating the expressions[2] for the values of K, τ and td found in step 2 yields the following parameters of the PID controller to be used:

KC = Proportional Gain = 4.93

τI = Integral time = 0.772

τD = Derivative time = 0.121

3.1.2 Primary Closed-Loop Response For The Parameters Evaluated

The closed-loop response of the primary process is now modelled with the primary controller whose parameters have been found in step (iii) above.

Fig. 3.4 Block diagram for closed-loop structure of primary process

The transport delay is present due to the exponential term in GPRC(s).The time delay is equal to the dead-time = 0.35.

No. of Samples

Fig. 3.5 Closed loop response with controller (set point change=1)

Figure 3.5 shows the step response of the closed loop primary process with the parameters designed. It can be seen that the oscillatory response settles down to a steady state value of 1.

The MATLAB simulated code of the closed loop process is given below:

Kp=1

Ki=0.81

num=[0 1];

den=[0.5 1.5 1];

numa=Kp*num;

dena=den;

[numac,denac]=cloop(numa,dena);

t=0:0.01:5;

step(numac,denac,t)

title('Step Response with Proportional Control')

xlabel('Time(sec)')

ylabel('Amplitude')

The output of the above code shows that the process settles down at 0.5 (Figure 3.6).

Fig. 3.6 Closed-loop response for second order process with controller

3.1.3 Secondary Process (First-Order Process)

The secondary controller is now tuned separately after the primary process. The first step involved in both the processes is however the same. The secondary process forms the inner loop of the overall cascade control process.

The secondary process involved in the problem is a first-order process with the transfer function: [2]

Gs(s) = 1 (3.4)

0.1s + 1

The steps involved are as follows:

(i) Open-Loop Secondary Process

The modelling of the open-loop process for the secondary system is done below:

Fig. 3.7 Open loop model of secondary process

The graphical response of the open loop secondary process simulates to give the following:

No. of samples

Fig. 3.8 Open-loop response of Secondary process

The graph confirms the steady-state value of the process being equal to 1.The open-loop simulation is not necessary for the calculation of the parameters as in the primary process.

(ii) Synthesis Method Of Tuning

The Synthesis Method of tuning is a theoretical method and does not involve simulation. It involves mathematical steps which directly generate the values of the parameters required to tune the controller.

The formulae for the two parameters (Kc and Ti) to be found are:

Kc = τ (3.5)

Kτc

Ti = τ (3.6)

Where the symbols denote:

Kc = Controller gain

τ = Process Time- Constant

τc = Closed-loop time constant

Ti = Integral time

The process under consideration is Gs(s) = 1 , which

## 0.1s + 1

directly gives the value of τ = coefficient of s=0.1 and K=numerator=1.

The value of τc is the coefficient of s in the transfer function given by

τc = Gs(s) (3.7)

1 + Gs(s)H(s)

After mathematical calculations, the value of τc is found out to be 0.05.

The Parameters are hence calculated using these values as:

## Kc=2 and Ti=τ=0.1

3.1.4 Secondary Closed-Loop Response For The Parameters Evaluated

The parameters calculated are now used to find the closed loop response of

the secondary process. The process is first modelled as:

Fig. 3.9 Closed loop model of Secondary Process

The graphical response of the closed loop secondary process simulates to give the following.

Number of Samples

Fig. 3.10 Closed-loop response of Secondary process

## 3.2 CASCADE CONTROLLER

Till now, the primary and the secondary processes were considered separately. Combining them into a single process is referred to as the cascade controlled process.

Fig. 3.11 Cascaded Process

As shown in figure 3.11, the secondary process forms the inner loop (slave) of the cascaded structure while the primary process forms the outer loop (master).

The parameters required for the simulation have been calculated in the primary and secondary processes.The simulation result is shown in figure 3.12.

Number of Samples

Fig. 3.12 Output response of the Cascaded Structure

## CHAPTER 4

## SIMULATION STUDIES

## EFFECT OF DISTURBANCES

Noise in a process can substantially change the output of the process. It is therefore very important to consider the effects of noise on the processes considered so far.

Primary Process

Noise is added to the primary process considered in section 3.1.2 in the form of another step input. The step input is added after a step time of 100 seconds to see whether the noise settles down or not.

The process diagram is as shown in the figure below:

Fig. 4.1 Primary process with noise

The step input labelled 'Step 1' acts as noise in the process. The simulation result for the above process is :

No. of Samples

Fig. 4.2 Primary Process with disturbance applied at t=100 seconds

The noise applied at 100 seconds settles down to value 1 as shown in figure 4.2.

Secondary Process

The secondary process is now applied a noise input in the same way as done to the primary process. The secondary process is now modelled as :

Fig 4.3 Secondary process with noise

The step input is added after a step time of 150 seconds and it it settles down to value 1 as shown in figure 4.4 :

No. of Samples

Fig. 4.4 Secondary process with disturbance applied at t=150 seconds

Cascade Process

After having studied the effects of disturbances on the primary and secondary processes, noise will be added to the cascaded structure of the two processes as shown in the figure below :

Fig. 4.5 Cascade process with noise

The step input labelled 'Step 1' is the noise for the secondary process while 'Step 2' is the noise for the primary process. The simulation result is as shown:

No. of Samples

Fig. 4.6 Cascade process with disturbances

The disturbances here are settling down in lesser time as compared to both processes separately.

## TIME-DOMAIN SPECIFICATIONS

Time-domain specifications include the analysis of characteristics of second order systems. The characteristics found out in this section are peak time, settling time and percentage overshoot.

Peak time is defined as the time taken for the response to reach the peak value for the very first time.

Settling time is defined as the time taken by the response to reach and stay within a specified tolerance band. It is usually 2% or 5% of the final value.

Overshoot simply refers to the output exceeding the ultimate steady-state output. Percentage overshoot is given by the following formula :

% overshoot = A-B * 100 (4.1)

B

Where A = Amplitude at peak time

B = Ultimate (final) value of the response

Integral square error (ISE) and Integral absolute error (IAE) are measures of a system performance. These are measured for the primary process using MATLAB functions. The model is shown below :

Fig. 4.7 Calculating ISE AND IAE (Step input 0 to 1)

The reading given by 'Display' is for the Integral Square Error (ISE) while 'Display 1' gives the Integral Absolute Error (IAE). From figure 4.7, it is seen that :

ISE = 0.7726, IAE = 1.278

The peak time and settling time are calculated from the primary process response:

No. of Samples

Fig. 4.8 Primary process closed loop response (Step input 0 to 1)

From figure 4.8 it is seen that Peak time = 3 seconds and Settling time = 11 seconds. It is also seen that A = 1.2 and B = 1.Using equation 4.1, the percentage overshoot is calculated to be 20%.

The above calculations have been done for step input varying from 0 (initial) to 1 (final). On a similar basis, the calculations are done for step input varying from 0 to 2.

The block model of the primary process is shown in figure 4.9.

Fig. 4.9 Calculating ISE AND IAE (Step input 0 to 2)

Figure 4.9 gives the following readings for step input from 0 to 2 :

ISE = 3.101, IAE = 2.615

The following response gives the Settling time and Peak time for step input 0 to 2.

No. Of Samples

Fig. 4.10 Primary process closed loop response (Step input 0 to 2)

From figure 4.10, it is seen that Peak time = 2.8 seconds and Settling time = 9 seconds. Percentage Overshoot can also be calculated with A = 2.5 and B = 2. Using equation 4.1, percentage overshoot is calculated to be 25%.

The above calculated results are tabulated in the table below:

Set Point Change

Peak time

Settling time

% Overshoot

ISE

IAE

1

3

11

20

0.7726

1.278

2

2.8

9

25

3.101

2.615

## CHAPTER 5

## CONTINUOUS STIRRED TANK

## REACTOR (CSTR)

## 5.1 WHAT IS A CSTR

Chemical reactors used in chemical plants are vessels or containers inside which the chemical reactions of the plant occur. A Continuous Stirred Tank Reactor (CSTR) is an example of such chemical reactors.

The continuous stirred tank reactor (CSTR) is one in which the reactants and products continuously flow in and out of the reactor. There is an inlet stream that brings all of the reactants in at a particular rate and dumps them into a large container. A shaft with a blade attached (stirrer) is present in the reactor that rotates to mix the reactants. Finally there is an outlet stream, from where the solution exits the reactor.

## 5.2 TEMPERATURE CONTROL OF A JACKETED CSTR

Fig. 5.1 A Continuous Stirred Tank Reactor (CSTR)

Figure 5.1[4] applies a cascade control strategy for the CSTR. Here the temperature of the reactor is measured and compared with the desired reactor temperature. The output of this reactor temperature controller is a set-point to the jacket temperature controller. The jacket temperature controller manipulates the jacket flow rate.

In the cascade control configuration of the shown CSTR (figure 5.1), the reactor temperature controller is the primary (or master) controller, while the jacket temperature controller is the secondary (or slave) controller.

The jacket temperature dynamics are generally faster than the reactor temperature dynamics. This is significant as the inner loop process is required to have faster response than the outer loop process. The inner loop controller then adjusts the manipulated variable before it has an effect on the primary (outer) output.

Fig. 5.2 Block Diagram Representation of CSTR cascade process

Figure 5.2[4]shows the block diagram of the CSTR process. The output of the primary controller which is the reactor temperature is the set-point to the inner-loop controller. The manipulated variable for the secondary loop is the jacket flow rate.

## CHAPTER 6

## CSTR PROCESS ANALYSIS

This chapter deals with the analysis and simulation of the primary and the secondary processes of CSTR described in chapter 5. The transfer functions used for the simulation of the two processes are given below.

For primary process:[4]

Gp(s) = 0.02 (6.1)

s + 0.02

For secondary process: [4]

Gs(s) = 1 (6.2)

5s + 1

The analysis and simulation for the above two processes will be done in the subsequent sections.

## 6.1 PRIMARY PROCESS

The primary process is a first-order process as given in equation 6.1. Therefore, Synthesis method of tuning will be applied to obtain the controller parameters.

From the transfer function (equation 6.1), it is seen that the values of K = 0.02 and τ = 1.

Using the above values of K and τ, and using equations (3.5) and (3.6), the values for the PID controller are calculated as follows:

Kc = Controller gain = 2

Ti = Integral time = 1

The primary process is modelled as shown in figure 6.1.

Fig. 6.1 Closed loop model of Primary CSTR Process

The closed loop response of the primary process for the parameters evaluated is shown in figure 6.2.

No. of Samples

Fig. 6.2 Closed-loop response of Primary CSTR process

## 6.2 SECONDARY PROCESS

The secondary process is also a first-order process as given in equation 6.2. Hence, application of Synthesis method formulae will help to evaluate the controller parameters for the process.

From the transfer function (equation 6.2), it is seen that the values of K = 1 and τ = 5.

Using the above values of K and τ, and using equations (3.5) and (3.6), the values for the PID controller are calculated as follows:

Kc = Controller gain = 2

Ti = Integral time = 5

The secondary process is modelled as shown in figure 6.3.

Fig. 6.3 Closed loop model of Secondary CSTR Process

The closed loop response of the secondary process for the parameters evaluated is shown in figure 6.4.

No. of Samples

Fig. 6.4 Closed-loop response of Secondary CSTR process

## 6.3 CASCADE PROCESS

The primary and the secondary processes are now cascaded for the CSTR process. The cascade process is modelled as shown in figure 6.5.

Fig. 6.5 Cascade Process for CSTR

The parameters for the above process are same as calculated in sections 6.1 and 6.2 for the processes involved.

The closed loop response of the cascade process is shown in figure 6.6.

No. of Samples

Fig. 6.6 Cascade control response for CSTR

## 6.4 EFFECT OF DISTURBANCES

The addition of disturbances in the CSTR process will be analysed in the following sections.

6.4.1 Primary Process

Noise is added to the primary process considered in section 6.1 in the form of another step input. The step input labelled 'Step 1' acts as a disturbance to the process.

Fig. 6.7 Primary CSTR process model with noise

The disturbance is added at a step time of 200 seconds. The simulated response for the primary process with noise is as shown in figure 6.8.

No. of Samples

Fig. 6.8 Primary CSTR process response with noise

The noise applied at 200 seconds settles down to value 1 as shown in figure 6.8.

6.4.2 Secondary Process

Noise is added to the secondary process considered in section 6.2 in the form of another step input. The secondary process block diagram with noise looks like as shown in figure 6.9.

Fig. 6.9 Secondary CSTR process model with noise

The noise 'Step 1' is added after 100 seconds giving the simulation as shown in figure 6.10.

No. of Samples

Fig. 6.10 Secondary CSTR process response with noise

6.4.3 Cascade Process

Noise is added to the cascade process considered in section 6.3 in the form of another step input. The cascade process block diagram with noise is as shown in figure 6.11.

Fig. 6.11 Cascade CSTR process model with noise

'Step 1' is the noise disturbance for the inner (secondary) loop while 'Step 2' is for the outer (primary) loop.

'Step 1' is applied to the process after 250 seconds while 'Step 2' is applied after 350 seconds. The simulation result is shown in figure 6.12.

No. of Samples

Fig. 6.12 Secondary CSTR process response with noise

The little bump at 250 seconds settles down at value 1 (noise for secondary process).The noise at 350 seconds also settles down to value 1 (noise for primary process).

## CHAPTER 7

## SUMMARY AND CONCLUSION

The project covers the basic aspects of a process control scheme. Cascade control strategies for various processes have been drawn which help understand the advantages of cascade control.

MATLAB software has been extensively used to help simulate the responses of the processes modelled. It helps analyse the process by giving the values of the time-domain specifications which in turn helps in comparing a process with another.

For the cascade processes, the primary and the secondary processes have been first considered as separate processes and then cascaded into a single structure.

Different tuning methods have been used for the study and calculation of parameters for the controller. These include the Two-point method, Cohen-Coon method and the Synthesis method.

The Continuous Stirred Tank Reactor (CSTR) was taken up as an example of the cascade control problem where the temperature of the CSTR was controlled using the cascade control scheme. This was followed by the analysis of the CSTR using MATLAB software.