0% found this document useful (0 votes)
306 views102 pages

Technical Report For SIWES PDF

Uploaded by

Tanuj Handa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
306 views102 pages

Technical Report For SIWES PDF

Uploaded by

Tanuj Handa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 102

A

TECHNICAL REPORT OF THE

STUDENT WORK EXPERIENCE SCHEME (SIWES I)

HELD AT

THE DEPARTMENT OF CHEMICAL ENGINEERING,

PROCESS SYSTEMS ENGINEERING LABORATORY,

OBAFEMI AWOLOWO UNIVERSITY ILE-IFE, OSUN STATE.

BY:

OSINUGA, ABRAHAM BOLUWATIFE

MATRIC NO: CHE/2014/065

A STUDENT OF CHEMICAL ENGINEERING DEPARTMENT,

FACULTY OF TECHNOLOGY,

OBAFEMI AWOLOWLO UNIVERSITY ILE IFE, OSUN STATE.

TITLE PAGE

IN PARTIAL FUFILMENT OF THE REQUIREMENTS FOR

THE AWARD OF A BACHELOR’S DEGREE IN CHEMICAL ENGINEERING

MAY 2018.
Department of Chemical Engineering,
Obafemi Awolowo University,
Ile-Ife, Osun state.

May 18, 2018.

The Coordinator,
Students industrial work Experience Scheme (SIWES),
Department of Chemical Engineering,
Obafemi Awolowo University,
Ile-Ife, Osun state.

Dear Sir,

LETTER OF TRANSMITTAL

In partial fulfillment of the requirements for the award of B.Sc. (Hons) in Chemical Engineering,

I hereby submit for grading, the report for the Students’ Industrial Work Experience Scheme

(SIWES)-CHE 300. This was undertaken at the Process Systems Engineering Research area of

the Department of Chemical Engineering, Obafemi Awolowo University, Ile-Ife, Osun state

from 19th February to May 12th, 2018 under the supervision of Dr A. Bamimore.

Yours faithfully,
OSINUGA Abraham B.,

CHE/2014/065.

ii
ACKNOWLEDGEMENT

I express sincere gratitude to God on the successful completion of my Students’ Industrial Work

Experience Scheme (SIWES) I.

My sincere appreciation goes to Dr. A. Bamimore, my supervisor, who did not only supervise

me, also tutored me in the course of my Internship.

Many thanks to the process control team (consisting of Olaposi, Latifah.K, Latifah.O, Abdulahi

and Kemi), other friends of the PROCESS MAFIAS graduating set and to all part four Chemical

Engineering students.

All my teachers, lecturers (Dr O. Sanda stands out here), parents, siblings, colleagues and friends

are also acknowledged. Thank you so much for your contribution to the “Engineer” I am

becoming.

I celebrate you all for your support and tutelage in every way.

iii
ABSTRACT

This report gives details of my experience during the SIWES programme at the Process Systems

Engineering Research Laboratory, Department of Chemical Engineering, Obafemi Awolowo

University Ile-Ife, Osun state.

In my course of work with process control team which performed laboratory research and

simulation on dynamic model equations, using computer assisted methods and models to design,

control, and optimize process systems using MATLAB with SIMULINK, selected systems

(which includes: Continuous fermentor, Heater mixer, pH reactor, Nonlinear two tank system,

etc.) were modelled and controlled in order to obtain desired outputs. Open-loop and close-loop

responses were obtained for both the simulations and real-time control of these systems.

In a bid to obtain close-loop responses for the systems, the use of some controllers were employed

and I was involved in instrumenting chemical process rig for a Direct Digital control (DDC)

which includes calibration of control elements (pumps, valves and sensors). This was achieved by

interfacing a micro-controller board Arduino Mega and Due with the chemical process plant.

iv
TABLE OF CONTENTS

TITLE PAGE _________________________________________________________________ i

LETTER OF TRANSMITTAL __________________________________________________ ii

ACKNOWLEDGEMENT ______________________________________________________ iii

ABSTRACT _________________________________________________________________ iv

TABLE OF CONTENTS _______________________________________________________ v

LIST OF TABLES ____________________________________________________________ x

LIST OF FIGURES ___________________________________________________________ xi

CHAPTER ONE ______________________________________________________________ 1

INTRODUCTION ___________________________________________________________ 1

1.1 Introduction to SIWES Programme ______________________________________ 1

1.2 Bodies Involved in the Management of SIWES _____________________________ 3

1.3 Aims and objectives of SIWES _________________________________________ 3

1.4 About Organization __________________________________________________ 4

1.5 Organization of the Report _____________________________________________ 5

CHAPTER TWO _____________________________________________________________ 6

TERMINOLOGIES & LITERATURE REVIEW __________________________________ 6

2.1 Process Systems Engineering. __________________________________________ 6

2.1.1 What is Systems Engineering? ______________________________________ 6

v
2.1.2 What is Process Systems Engineering? ________________________________ 6

2.1.3 What then is Process Control? ______________________________________ 7

2.2 Process Model_______________________________________________________ 7

2.2.1 What is a Process Model? __________________________________________ 7

2.2.1a Ordinary Differential Equation, ODE. ______________________________ 8

2.2.1b Partial Differential Equation, PDE. _________________________________ 8

2.2.1c Differential Algebraic Equation, DAE. ______________________________ 9

2.2.2 Numerical Differentiation _________________________________________ 10

2.2.2a Euler Method _________________________________________________ 11

2.2.2b Runge-Kutta’s Method _________________________________________ 12

2.3 Software Packages __________________________________________________ 12

2.3.1 Matlab and Simulink _____________________________________________ 12

2.3.1.1 MATLAB ___________________________________________________ 12

2..3.1.2 Simulink_____________________________________________________ 13

2.3.2 Microsoft Excel _________________________________________________ 13

2.4 Control Terminologies _______________________________________________ 13

2.4.1 Process ________________________________________________________ 13

2.4.2 Disturbance ____________________________________________________ 13

2.4.3 Controlled variable ______________________________________________ 14

2.4.4 Set point_______________________________________________________ 14

vi
2.4.5 Manipulated variables ____________________________________________ 14

2.4.6 Final control element _____________________________________________ 14

2.4.7 Measured variable _______________________________________________ 14

2.4.8 Sensor ________________________________________________________ 14

2.4.9 Controller _____________________________________________________ 15

2.4.10 Transducer _____________________________________________________ 15

2.4.11 Simulation _____________________________________________________ 15

2.4.12 Dynamic Model _________________________________________________ 15

2.4.13 Problems: Servo- and Regulatory problems ___________________________ 16

2.4.13.1 Servo-problem ________________________________________________ 16

2.4.13.2 Regulatory problem ____________________________________________ 16

2.4.14 Implementation _________________________________________________ 16

CHAPTER THREE __________________________________________________________ 17

METHODOLOGY _________________________________________________________ 17

3.1 NUMERICAL DIFFERENTIATION ___________________________________ 17

3.1.1 Euler Method ___________________________________________________ 17

3.1.2 Runge-Kutta Method _____________________________________________ 17

3.2 SIMULATIONS ____________________________________________________ 18

3.2.1 OPEN LOOP SIMULATION ______________________________________ 18

3.2.2 CLOSE LOOP SIMULATION _____________________________________ 19

vii
3.2.2.1 CONTROL STRUCTURE/STRATEGY ___________________________ 19

3.2.2.1.1 Proportional Integral Derivative (PID) Controller _________________ 19

Control Algorithm: __________________________________________________ 20

3.3 REAL-TIME IMPLEMENTATION AND CONTROL _____________________ 20

3.4 CALIBRATION OF EQUIPMENT _____________________________________ 22

3.4.1 CALIBRATION OF PUMPS ______________________________________ 23

3.4.2 CALIBRATION OF HEIGHT SENSORS ____________________________ 24

3.4.3 CALIBRATION OF pH PROBE ___________________________________ 24

CHAPTER FOUR ____________________________________________________________ 25

RESULTS AND DISCUSSIONS ______________________________________________ 25

4.1 Continuous Fermentor _______________________________________________ 25

4.1.1 Open-loop simulation ____________________________________________ 27

4.1.2 Close-loop simulation ____________________________________________ 33

4.2 Heater Mixer system _________________________________________________ 34

4.2.1 Open-loop simulation ____________________________________________ 37

4.2.2 Close-loop simulation ____________________________________________ 52

4.3 Nonlinear Two Tanks system __________________________________________ 52

4.3.1 Open-loop simulation ____________________________________________ 56

4.3.2 Close-loop simulation ____________________________________________ 59

4.3.3 Calibration of Equipment _________________________________________ 63

viii
4.3.3.1 Sensor Calibration for tank 1 _____________________________________ 64

4.3.3.2 Sensor Calibration for tank 2 _____________________________________ 66

4.3.3.3 Pump Calibration ______________________________________________ 68

4.3.3.3 Valve Calibration _______________________________________________ 69

4.3.4 Real-time Implementation and Control _______________________________ 71

4.4 Neutralization Reactor pH system ______________________________________ 74

4.4.1 Open-loop simulation ____________________________________________ 76

4.4.2 Close-loop simulation ____________________________________________ 81

4.4.3 Calibration of Equipment _________________________________________ 83

CHAPTER FIVE ____________________________________________________________ 87

CONCLUSIONS ___________________________________________________________ 87

5.1 CONCLUSION ____________________________________________________ 87

REFERENCES ______________________________________________________________ 88

ix
LIST OF TABLES

Table 3-1: PID Controller modes and benefits _____________________________________ 20

Table 4-1, Nominal values of paramaters and operating conditions for the continuous fermentor

system ____________________________________________________________ 26

Table 4-2, Nominal values of paramaters and operating conditions for the HEATER MIXER

system ____________________________________________________________ 36

Table 4-3, Nominal values of parameters and operating conditions for the nonlinear _ two-tanks

system______________________________________________________ ______ 55

Table 4-4, Experimental Raw Data for height sensor for Tank 1 _______________________ 64

Table 4-4, Experimental Raw Data for height sensor for Tank 2 _______________________ 66

Table 4-5, Experimental Raw Data for Pump Calibration for Two-tank System ___________ 68

Table 4-6, Experimental Raw Data for Pump Calibration for Two-tank System ___________ 69

Table 4-7, Nominal values of parameters and operating conditions for the pH neutralization

system ____________________________________________________________ 75

Table 4-8, Experimental data for Calibration of Base pump for the PH system ____________ 84

Table 4-9, Experimental data for Calibration of Buffer pump for the PH system ___________ 85

Table 4-10, Experimental data for Calibration of Acid pump for the PH system ___________ 86

x
LIST OF FIGURES

Figure 3-0-1: Schematic Diagram for the nonlinear two tanks system (Adebayo, 2015) ---------- 21

Figure 3-0-2: Description of Real-time Control --------------------------------------------------------- 22

Figure 4-1-1: Simulink Block model for the Continuous fermentor system ------------------------- 28

Figure 4-1-2: Subsystem ------------------------------------------------------------------------------------ 28

Figure 4-1-3: subsystem 1 ----------------------------------------------------------------------------------- 29

Figure 4-1-4: subsystem 2 ----------------------------------------------------------------------------------- 29

Figure 4-1-5: subsystem 3 ----------------------------------------------------------------------------------- 30

Figure 4-1-6: S-Function Model for Continuous fermentor -------------------------------------------- 30

Figure 4-1-7: Open loop response for the Continuous fermentor system ---------------------------- 31

Figure 4-1-8: result, using ode45 solver to solve the dynamic model for the continuous fermentor

-------------------------------------------------------------------------------------------------- 32

Figure 4-1-9: SIMULINK model diagram for PID controller with Continuous Fermentor system -

------------------------------------------------------------------------------------------------------------------ 33

Figure 4-1-10: Response for PID controller with Continuous Fermentor system ------------------ 33

Figure 4-2-1: schematic diagram of heater mixer setup (V.A. Bavdekar et al,2011). -------------- 35

Figure 4-2-2: S-Function Model for the Heater mixer system ----------------------------------------- 43

Figure 4-2-3: Simulink Model diagram for the Heater Mixer system -------------------------------- 43

Figure 4-2-4: Subsystem Model diagram for the Heater Mixer system ------------------------------ 44

Figure 4-2-5: Subsystem for Q1(U1) ---------------------------------------------------------------------- 45

Figure 4-2-6: Subsystem for Q2(U2) ---------------------------------------------------------------------- 45

Figure 4-2-7: Subsystem for F2(U3) ---------------------------------------------------------------------- 46

Figure 4-2-8: Subsystem for F1(D) ------------------------------------------------------------------------ 46

Figure 4-2-9: Subsystem showing Equation 1, T1dot --------------------------------------------------- 47


xi
Figure 4-2-10: Subsystem describing Equation 2, T2dot ----------------------------------------------- 48

Figure 4-2-11: subsystem describing Equation 3, h2dot ------------------------------------------------ 49

Figure 4-2-12: Open loop response for the Simulation ------------------------------------------------- 49

Figure 4-2-13: response using ode45 solver in m.file --------------------------------------------------- 51

Figure 4-3-1: Schematic Diagram for the nonlinear two tanks system (Adebayo, 2015) ---------- 53

Figure 4-3-2: Detailed dimensions for the nonlinear two tanks system(Adebayo, 2015)---------- 54

Figure 4-3-3: S-Function Model diagram for Nonlinear Two Tank System. ------------------------ 57

Figure 4-3-4: Simulink model diagram for Nonlinear Two tank system ----------------------------- 57

Figure 4-3-6: Open-loop response for the Two Tank system ------------------------------------------ 58

Figure 4-3-7: Simulink Model diagram for PI_Controller close-loop simulation ------------------ 59

Figure 4-3-8: Close loop response using a Proportional Integral (PI) controller for the Nonlinear

Two Tank System -------------------------------------------------------------------------- 60

Figure 4-3-9: Simulink model Diagram for PID _Control on the two tank system----------------- 61

Figure 4-3-10: Close-loop response for the PID_control of the two tank system (servo) --------- 62

Figure 4-3-11: Simulink model diagram for calibration for the To tank system. ------------------- 63

Figure 4-3-12: Graphical Representation for Tank 1 height sensor ----------------------------------- 65

Figure 4-3-13: Graphical Representation for Tank 2 height sensor ----------------------------------- 67

Figure 4-3-14: Graphical Representation for Pump for two tank system ---------------------------- 68

Figure 4-3-15: Graphical Representation for Valve for two tank system ---------------------------- 70

Figure 4-3-16: Res ----------------------------------------------------------------------------------------------

ponse for Real-time Control using PID Controller for the Two-tank System ----------------------- 71

Figure 4-3-17: SIMULINK model diagram for Real-time Control using PID Controller for the

Two-tank System --------------------------------------------------------------------------- 72

xii
Figure 4-3-18: Image showing the Real-time Control Setup for the Two-tank System in the

Laboratory ----------------------------------------------------------------------------------- 73

Figure 4-4-1: S-Function model diagram for the pH system ------------------------------------------- 77

Figure 4-4-2: SIMULINK model diagram for the pH system.----------------------------------------- 78

Figure 4-4-3: Subsystem for SIMULINK model for PH_openloop simulation --------------------- 78

Figure 4-4-4: ODE1 for PH_system ----------------------------------------------------------------------- 79

Figure 4-4-5: ODE2 for PH_SIMULINK MODEL ----------------------------------------------------- 79

Figure 4-4-6: Algebraic Equation model for PH_SIMULINK MODEL ----------------------------- 80

Figure 4-4-7: SIMULINK model for PI controller for the PH system-------------------------------- 81

Figure 4-4-8: pH response for PI controller for the PH system. --------------------------------------- 82

Figure 4-4-9: SIMULINK model diagram for PID_ close loop simulation of PH system -------- 82

Figure 4-4-10: Response for PID_ close loop simulation of PH system ----------------------------- 83

Figure 4-4-11: Plot of Count against Base pump flow rate for the PH_system --------------------- 84

Figure 4-4-12: Plot of Count against Buffer Pump's flow rate for the PH_system ----------------- 85

Figure 4-4-13: Plot of Count against Acid pump's flow rate for the PH_System. ------------------ 86

xiii
CHAPTER ONE
INTRODUCTION

1.1 Introduction to SIWES Programme

The main thrust of ITF programme and services is to stimulate human performance, improve

productivity, and induce value-added production in industry and commerce. Through its Students

Industrial Work Experience Scheme (SIWES), and Vocational and Apprentice Training

Programs, the Fund also builds capacity for graduates and youth self-employment, in the context

of Small Scale Industrialization, in the economy.

As a part of the implementation process of the Second National Development Plan (1970-1974),

SIWES, a programme instituted to provide managerial and industrial skill development for all

facets of the economy, was established by ITF in 1973 to tackle the problem of lack of adequate

practical skills preparatory for employment in industries, by Nigerian graduates of tertiary

institutions. The Scheme was to expose students to industry-based skills necessary for a smooth

transition from the classroom to the industry.

The ITF established by Decree 47 of 1971 is charged with the responsibility of supervising and

providing fund for the program. This is done in conjunction with the school’s designated

officers. Section 2 of Decree 47 stipulates that the fund may be utilized to provide and encourage

acquisition of skills and industry or commerce with a view to generating a pool of indigenous

trained manpower, sufficient to meet the need of the economy.

Participation in SIWES has become a necessary pre-condition for the award of Diploma and

Degree certificates in specific disciplines in most institutions of higher learning in the country, in

accordance with the education policy of government. In order to encounter employers in


engaging IT students due to perceived increase in expenditure, which might arise for payment of

allowances to the students, the ITF is charged with the welfare of the students during training.

This is done by giving students specified monthly allowance. This however, should not deter the

employers from offering engaged students some emoluments, as students in their little way

contribute to the advancement of the organization. More so this would boost the morale of the

students’ result in increased participation on their part. During the course of the training, officers

of the ITF are expected to visit the students to ensure proper attendance and training. This may

be done with the assistance of the schools designated officers.

Thus, in accordance with the Federal Government and National Universities Commission

directives, all students, especially of science and engineering related disciplines, are obliged to

go on practical work experience, in a related industry. The SIWES is a mandatory session that

must be observed towards acquiring a Bachelor of Science degree and it is also an avenue to

broaden students’ theoretical knowledge on practical processes.

Students of tertiary institutions are opportune as they get familiarized and exposed to the needed

experience in handling machinery and equipment which are usually not available in the

educational institutions.

Hence, the following structure has been put in place to ensure the smooth running of the

program:

• OPERATORS: the ITF, the co-coordinating agencies (NUC, NBTE, NCCE), employers

of labour and the universities.

• FUNDING: The Federal Government of Nigeria.

2
• BENEFICIARIES: Undergraduate students of the following: Agriculture, Engineering,

Technology, Environmental Science, Education, Medical Science and Pure and Applied

Sciences (Fund, 2004).

1.2 Bodies Involved in the Management of SIWES

The bodies involved are: Federal Government, Industrial Training Fund (ITF), Other Supervising

Agencies are: National University Commission (NUC), National Board for Technical Education

(NBTE) & National Council for Colleges of Education (NCCE) (Fund, 2004).

The functions of these agencies above include among others to:

 Ensure adequate funding of the scheme.

 Establish SIWES and accredit SIWES unit in the approved institutions

 Formulate policies ad guideline for participating bodies and institutions as well as

appointing SIWES coordinators and supporting staff.

 Supervise students at their places of attachment and sign their log-book and ITF Forms.

 Vet and process student’s log-books and forward same to ITF Area office.

 Ensure payment of Allowances for the students and supervisors.

1.3 Aims and objectives of SIWES

The aims and objectives of the SIWES programme are as follows:


 Provide an avenue for students in institutions of higher learning to acquire

industrial skills and experience in their approved course of study.

3
 Prepare students for the industrial works situation which they are likely to meet after

graduation.

 Expose students to work methods and techniques in handling equipment and

machinery not available in their institutions.

 Provide students with an opportunity to apply their knowledge in real world situation

thereby bridging the gap between theories and practices.

 Enlist and strengthen employers’ involvement in the entire educational process and

prepare students for employment in Industry and Commerce.

1.4 About Organization

Process Systems Engineering Laboratory of the Department of Chemical Engineering, Obafemi

Awolowo University, Ile-Ife, Osun state, is a research laboratory in which research work are

carried out.

The research work of the PSE group is focused in three (3) major areas: Optimization,

Operations, and Control. Research in Optimization includes theoretical and methodological

advances in large-scale nonlinear programming, mixed-integer and disjunctive programming,

global optimization, the optimization of differential-algebraic systems and the optimization of

data-driven models and analytics. Aspects in Operations include enterprise-wide optimization,

supply chain management and optimization under uncertainty, planning and scheduling of batch

and continuous process systems, real-time optimization. Finally, aspects in Control include

adaptive control and on-line parameter estimation, self-learning control, control of distributed

systems, thermodynamics-based control, passivity theory, the design and verification of process

operating systems, and real-time data analysis.


4
The organization uses the MATLAB and SIMULINK software packages for majority of its

works. Both packages are simply referred to as MATLAB.

The organization supports totally the SIWES program and as such gives the student the

knowledge and direction the need to standout better and confident. The IT student are being

shown the methods in which the software makes it analysis and are shown also how to use

support tools and programs to guide them in in getting the knowledge best suited for them.

1.5 Organization of the Report

This report has five chapters of which Chapter one gives a brief introduction of how and what

SIWES. Chapter two describes the Terminologies as regarding this report and what was being

done during the course of the SIWES. Chapter three tells the description of work done while

chapter four tells of the results for each of the method applied to selected system during the

course of the SIWES and discussed, briefly, these results. Chapter Five crowns it up with a

conclusion.

5
CHAPTER TWO

TERMINOLOGIES & LITERATURE REVIEW

2.1 Process Systems Engineering.

2.1.1 What is Systems Engineering?

Systems engineering is an interdisciplinary field of engineering and engineering management

that focuses on how to design and manage complex systems over their life cycles. At its core,

systems engineering utilizes systems thinking principles to organize this body of knowledge.

Issues such as requirements engineering, reliability, logistics, coordination of different teams,

testing and evaluation, maintainability and many other disciplines necessary for successful

system development, design, implementation, and ultimate decommission become more difficult

when dealing with large or complex projects. Systems engineering deals with work-processes,

optimization methods, and risk management tools in such projects. It overlaps technical and

human-centered disciplines such as industrial engineering, mechanical engineering,

manufacturing engineering, control engineering, software engineering, electrical engineering,

cybernetics, organizational studies and project management. Systems engineering ensures that all

likely aspects of a project or system are considered, and integrated into a whole (Wikipedia,

Wikipedia-Systems Engineering, n.d.).

2.1.2 What is Process Systems Engineering?

Process systems engineering, commonly referred to as PSE, comes under the banner of systems

engineering, and uses computer assisted methods and models to design, control, and optimize

6
processes.

PSE is concerned with the systematic analysis and optimization of decision making processes for

the discovery, design, manufacture and distribution of chemical products.

“PSE research also deals with fundamental theoretical issues. PSE research strives to create

representations and models to generate desirable alternatives, and then select from among

them solutions that meets constraints and optimize multiple objectives.”, Quote from Prof.

Ignacio Grossmann, Carnegie Mellon on Process Systems Engineering (PSE).

2.1.3 What then is Process Control?

Process control is an application area of chemical engineering - an identifiable specialty for the

Chemical Engineering. It combines chemical process knowledge (how physics, chemistry, and

biology work in operating equipment) and an understanding of dynamic systems, a topic

important to many fields of engineering. Thus study of process control allows chemical

engineers to span their own field, as well as form a useful acquaintance with allied fields.

Practitioners of process control find their skills useful in design, operation, and troubleshooting -

major categories of chemical engineering practice.

2.2 Process Model

2.2.1 What is a Process Model?

A model of a system/process is:

 A representation of the essential aspects of the system for a process

7
 in a suitable (mathematical) form: - often DAE (Differential Algebraic Equations) or

ODE (Ordinary Differential Equations).

 that can be experimentally verified

 in order to clarify questions about the system

The form and content of dynamic process models are on the one hand determined by the

application of the model, and on the other by the available knowledge. The application of the

model determines the external structure of the model, whereas the available knowledge

determines the internal structure. Dynamic process models can be used for simulation studies to

get information about the process behavior; the models can also be used for control or

optimization studies. Process knowledge may be available as physical relationships or in the

form of process data (Brian Roffel, Ben Betlam, 2006).

2.2.1a Ordinary Differential Equation, ODE.

An ordinary differential equation (ODE) is a differential equation containing one or more

functions of one independent variable and its derivatives. The term ordinary is used in contrast

with the term partial differential equation which may be with respect to more than one

independent variable.

2.2.1b Partial Differential Equation, PDE.

A partial differential equation (PDE) is a differential equation that contains unknown

multivariable functions and their partial derivatives. PDEs are used to formulate problems

involving functions of several variables, and are either solved by hand, or used to create a

relevant model. A special case is ordinary differential equations (ODEs), which deal with

functions of a single variable and their derivatives.

A relatively simple PDE is:

8
𝜕𝑢
( 𝑥 , 𝑦 ) = 0.
𝜕𝑥

This relation implies that the function 𝑢(𝑥, 𝑦) is independent of 𝑥. However, the equation gives

no information on the function's dependence on the variable y. Hence the general solution of this

equation is

𝑢 ( 𝑥 ,𝑦 ) = 𝑓 ( 𝑦 ) ,

where 𝑓 is an arbitrary function of 𝑦.

The analogous ordinary differential equation is

𝑑𝑢
(𝑥) = 0;
𝑑𝑥

which has the solution

𝑢(𝑥) = 𝑐,

where 𝑐 is any constant value. These examples illustrate that general solutions of ordinary

differential equations (ODEs) involve arbitrary constants, but solutions of PDEs involve arbitrary

functions. A solution of a PDE is generally not unique; additional conditions must generally be

specified on the boundary of the region where the solution is defined. For instance, in the simple

example above, the function 𝑓(𝑦) can be determined if u is specified on the line 𝑥 = 0

(Wikipedia, 2018).

2.2.1c Differential Algebraic Equation, DAE.

A differential-algebraic equation (DAE) is an equation involving an unknown function and its

derivatives. A (first order) DAE in its most general form is given by:

𝐹(𝑡, 𝑥, 𝑥 ′ ) = 0, 𝑡0 ≤ 𝑡 ≤ 𝑡𝑓 … … … … … … … … . . (1)

9
Where 𝑥 = 𝑥(𝑡), the unknown function, and 𝐹 = 𝐹 (𝑡, 𝑢, 𝑣) have 𝑁 components, denoted by

𝑥𝑖 and 𝐹𝑖 , 𝑖 = 1, 2, . . . , 𝑁 respectively. Every DAE can be written as a first order DAE. The

term DAE is usually reserved for the case when the highest derivative 𝑥 ′ cannot be solved for in

terms of the other terms 𝑡, 𝑥, when (1) is viewed as an algebraic relationship between three

variables 𝑡, 𝑥, 𝑥 ′ . The Jacobian 𝜕𝐹/𝜕𝑣 along a particular solution of the DAE may be singular.

Systems of equations like (1) are also called implicit systems, generalized systems, or descriptor

systems. The DAE may be an initial value problem where 𝑥 is specified at the initial time,

𝑥(𝑡0 ) = 𝑥0 , or a boundary value problem, where the solution is subject to 𝑁 two-point

boundary conditions 𝑔(𝑥(𝑡0 ), 𝑥(𝑡𝑓 )) = 0 .

The method of solution of a DAE will depend on its structure. A special but important class of

DAEs of the form (1) is the semi-explicit DAE or ordinary differential equation (ODE) with

constraints

𝑦 ′ = 𝑓 (𝑡, 𝑦, 𝑧)

0 = 𝑔 (𝑡, 𝑦, 𝑧)

which appear frequently in applications. Here 𝑥 = (𝑦, 𝑧) and 𝑔 (𝑡, 𝑦, 𝑧) = 0 are the explicit

constraints.

Simply put, differential algebraic equations comprise algebraic equations and differential

equations.

2.2.2 Numerical Differentiation


Numerical differentiation is the use of iterative equation in order to get an approximation of the

derivatives of a function.

10
In this report, the use of Euler method and Runge-kutta method are considered.

2.2.2a Euler Method

Euler method (also called forward Euler method) is a first-order numerical procedure for solving

ordinary differential equations (ODEs) with a given initial value. It is the most basic explicit

method for numerical integration of ordinary differential equations and is the simplest Runge–

Kutta method. The Euler method is named after Leonhard Euler, who treated it in his book

Institutionum calculi integralis (published 1768–70).

The Euler method is a first-order method, which means that the local error (error per step) is

proportional to the square of the step size, and the global error (error at a given time) is

proportional to the step size. The Euler method often serves as the basis to construct more

complex methods, e.g., predictor–corrector method.

𝑦 ′ (𝑡) = 𝑓(𝑡, 𝑦(𝑡)), 𝑦(𝑡 0 ) = 𝑦0 . }

Choose a value ℎ, for the size of every step and set 𝑡𝑛 = 𝑡0 + 𝑛ℎ.

Now, one step of the Euler method from 𝑡 𝑛 + 𝑡 𝑛+1 = 𝑡 𝑛 + ℎ is:

𝑦 𝑛+1 = 𝑦𝑛 + ℎ . 𝑓 ( 𝑡 𝑛 , 𝑦𝑛 ) .

The value of 𝑦𝑛 is an approximation of the solution to the ODE at time 𝑡𝑛 : 𝑦𝑛 ≈ 𝑦(𝑡𝑛 ). The

Euler method is explicit, i.e. the solution 𝑦𝑛+1 is an explicit function of 𝑦 for 𝑖 ≤ 𝑛

While the Euler method integrates a first-order ODE, any ODE of order 𝑁 can be represented as

a first-order ODE: to treat the equation (Wikipedia, wikipedia, 2018).

11
2.2.2b Runge-Kutta’s Method

The fourth-order Runge–Kutta (RK4) method having a truncation error of 𝜗(ℎ4) is one of the

most widely used methods for solving differential equations and used throughout my work. Its

algorithm is described below.


𝑦𝑘+1 = 𝑦𝑘 + (𝑓 + 2𝑓𝑘2 + 2𝑓𝑘3 + 𝑓𝑘4 )
6 𝑘1

where

𝑓𝑘1 = 𝑓(𝑡𝑘 , 𝑦𝑘 )

𝑓𝑘2 = 𝑓(𝑡𝑘 + ℎ⁄2 . 𝑦𝑘 + 𝑓𝑘1 . ℎ/2)

𝑓𝑘3 = 𝑓(𝑡𝑘 + ℎ⁄2 . 𝑦𝑘 + 𝑓𝑘2 . ℎ/2)

𝑓𝑘4 = 𝑓(𝑡𝑘 + (ℎ. 𝑦𝑘 + 𝑓𝑘3 . ℎ)

2.3 Software Packages

2.3.1 Matlab and Simulink

2.3.1.1 MATLAB

MATLAB, which stands for MATrix LABoratory, is a technical computing environment for

high performance numeric computation and visualization.

12
MATLAB is a high-level software package with many built-in functions that make the learning

of numerical methods much easier and more interesting (Won Y. Yang, Wenwu Cao, Tae-Sang

Chung and John Morris., 2005). In this report, MATLAB is used for operations and building

programs for problem solving.

2..3.1.2 Simulink

SIMULINK is a part of MATLAB that can be used to simulate dynamic systems. To facilitate

model definition, SIMULINK adds a new class of windows called block diagram windows. In

these windows, models are created and edited primarily by mouse-driven commands. Part of

mastering SIMULINK is to become familiar with manipulating model components within these

windows.

2.3.2 Microsoft Excel

Excel is a spreadsheet software package contained in Microsoft Office Suite and used for curve

fitting in this report.

2.4 Control Terminologies

2.4.1 Process

The equipment within some boundary, along with the streams of matter and energy that cross

that boundary -- what we usually mean when we think of 'chemical process'.

2.4.2 Disturbance

A change imposed on the process. For example, the input stream of a system varying with time.

13
2.4.3 Controlled variable

These are some feature of the process that we would like to control. It may be a stream crossing

the boundary or some quantity within. We want to control it because the disturbance makes it

change with time, in a way that we don't like. For example, the controlled variable is the liquid

level in the two tank system in CHAPTER THREE.

2.4.4 Set point

The desired value of the controlled variable. For example, but we do want to confine the

controlled variable between high and low limits.

2.4.5 Manipulated variables

These are some feature of the process that we adjust so that we can exert influence on the

controlled variable. In most chemical processes, the manipulated variable will be the flowrate of

a stream.

2.4.6 Final control element

It is a device that adjusts the manipulated variable. If the manipulated variable is usually a

stream, the final control element is usually a valve, referred to as a control valve.

2.4.7 Measured variable

Most often, synonymous with the controlled variable – we measure it so that we can tell how

well our control scheme is working. Of course, we may also measure the manipulated variable

and other variables, as well.

2.4.8 Sensor

This is a measuring instrument. For chemical processes, the most common measurements are of

flow (F), temperature (T), pressure (P), level or height (L), and composition (A, for analyzer).

The sensor will detect the value of the measured variable as a function of time.
14
2.4.9 Controller

Controller is the device that detects the output of the sensor, decides how seriously the controlled

variable deviates from the set point, and directs the final control element in response. The

controller performs calculations based on its control algorithm.

2.4.10 Transducer

The controller must be able to communicate with sensor and final element. Transducers convert

and transmit signals to make this possible.

2.4.11 Simulation

Simulation is the imitation of the operation of a real-world process or system. The act of

simulating something first requires that a model be developed; this model represents the key

characteristics, behaviors and functions of the selected physical or abstract system or process.

The model represents the system itself, whereas the simulation represents the operation of the

system over time (Wikipedia, 2018).

Process simulation is a model-based representation of chemical, physical, biological, and other

technical processes and unit operations in software.

2.4.12 Dynamic Model

A dynamic model represents the behaviour of a system over time. It is used where the system's

behaviour is best described as a set of states that occur in a defined sequence. The components of

the dynamic model are: States. There are many kinds of dynamic models: linear or nonlinear.

States represent the condition of the system at some moment in time. Some state variables which

define the system are heat, density, velocity, rate of reaction, acidity, etc.

15
2.4.13 Problems: Servo- and Regulatory problems

I was introduced to the following problem types associated with control objectives which are the

Servo- and regulatory problems

2.4.13.1 Servo-problem

Servo-problem is a problem that constitutes of a goal to make an output of a process system track

or meet a set-point changes based on a fixed input feed (i.e. no disturbance on the system).

2.4.13.2 Regulatory problem

Regulatory on the other hand, deals with ability of the controller to reject disturbances which can

be inform mismatch in the input values expected for some input variables, and yet track or meet

the desired set-point for the system’s output. This is also referred to as disturbance rejection

problem. A perturbation is a form of disturbance to a system, say for instance, you desire to

produce a paste of say pH 7 and have designed a model such that it accepts a particular state of

feed input. A sudden change in the feed input states can cause a change in the desired output

(set-point). The regulatory problem handles this situation by recognizing the change as

disturbance and rejects it to meet the desired set-point of pH 7.

2.4.14 Implementation

To implement is to make happen, simply put. This is making the control strategy a reality for a

particular system. This occurs both in Real-time and Simulation-time.

16
CHAPTER THREE

METHODOLOGY

There are several software packages for Process Simulation and Implementation of control

strategy, the one at the scope of this work is the use of MATLAB and SIMULINK.

3.1 NUMERICAL DIFFERENTIATION

3.1.1 Euler Method

The MATLAB code that describes the algorithm used Euler method is as follows:

function [xk1]=Euler(xo, uo, Ts, Nsteps);


delta=Ts/Nsteps ;
xk1=xo ;
for k=1:Nsteps
xk1=xk1 + delta*odefun(xk1,u);
end

3.1.2 Runge-Kutta Method

The MATLAB code that describes the algorithm used for Runge-Kutta method is as follows:

k1=h*odefun(xo,uo);
k2=h*odefun(xo+k1/2,uo);
k3=h*odefun(xo+k2/2,uo);
k4=h*odefun(xo+k3,uo);
x(:,1)=xo+1/6*(k1+2*k2+2*k3+k4);
for k=1:Nu
k1=h*odefun(x(:,k),u(:,k));
k2=h*odefun(x(:,k)+k1/2,u(:,k));
k3=h*odefun(x(:,k)+k2/2,u(:,k));
k4=h*odefun(x(:,k)+k3,u(:,k));

x(:,k+1)=x(:,k)+1/6*(k1+2*k2+2*k3+k4) ;
end

17
3.2 SIMULATIONS

3.2.1 OPEN LOOP SIMULATION

Open-loop control is a process taking place in a system where by one or more variables in the

form of input variables exert influence on other variables in the form of output variables by

reason of the laws which characterize the system. The distinguishing feature of open-loop control

is the open nature of its action, that is, the output variable does not have any influence on the

input variable.

The open-loop also known as feedforward or negative feedback control were carried out for

some selected systems given their dynamic model equations, from various sources as cited,

either as DAEs or ODEs.

These were done using basically two main methods, namely:

 Modelling using Simulink block diagrams

 MATLAB coding, S-Function code (m.file) embedded in a Simulink block.

The Simulink block diagrams modelling were used to create steady state process simulation for

the selected system using both subsystems and not. Figures for each of the systems where this

method was used are shown in CHAPTER FOUR of this report under each system details.

On the other hand, the S-Function method involved writing MATLAB codes in a script file saves

in the m.file format and then called upon in Simulink environment using the S-Function block.

The Level-1 codes were used for this all through. See scripts for S-Function (in 4.2.1 Open-

loop simulation) for a general format of the code. Other details are included in CHAPTER

FOUR under the respective systems.

18
Results for each Process system are discussed in CHAPTER FOUR of this report.

3.2.2 CLOSE LOOP SIMULATION

Closed-loop control as a process where the controlled variable is continuously monitored and

compared with the reference variable. Depending on the result of this comparison, the input

variable for the system is influenced to adjust the output variable to the desired value despite any

disturbing influences. This feedback results in a closed-loop action. Close loop simulations are

also called feedback control simulations.

The Controller does the adjustment of the output variable indirectly by directly modifying the

manipulated variable using of the deviation (also referred to as Controller error, gotten from the

comparison made). The Controllers used for these control activity are the Proportional (P),

Proportional Integral (PI) and Proportional Integral Derivative (PID) controllers. They are varied

based on the system considered as discussed in chapter four.

Closed-loop simulations were made for respective systems, using majorly the PID controller and

auto-tuning method) as discussed in chapter four of this report.

3.2.2.1 CONTROL STRUCTURE/STRATEGY

3.2.2.1.1 Proportional Integral Derivative (PID) Controller

Feedback control means measuring the controlled variable (an output), comparing that

measurement to the set point (desired value), and acting in response the error (difference

between set point and controlled variable) by adjusting the manipulated variable (an input). The

control algorithm is the set of calculations and decisions that lies between the error and the

directions given to the final control element.

19
Control Algorithm:

𝑑𝑒(𝑡)
𝐺𝑃𝐼 = 𝑃 ∙ 𝑒(𝑡) + 𝐼 ∙ ∫ 𝑒(𝑡) ∙ 𝑑𝑡 + 𝐷 ∙
𝑑𝑡

Where 𝑒(𝑡) = 𝑆𝑒𝑡𝑝𝑜𝑖𝑛𝑡 − 𝑐𝑜𝑛𝑡𝑟𝑜𝑙𝑙𝑒𝑑 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒. 𝑒(𝑡) is the controller error.

The PID algorithm of is a mathematical representation of the error-handling actions we desired

the controller to take.

Table 3-1: PID Controller modes and benefits

Modes Benefits

Proportional, P  rapid adjustment of manipulated variable

 speeds dynamic response

Integral, I  produces zero offset

Derivative, D  provides rapid response to control variable changes

3.3 REAL-TIME IMPLEMENTATION AND CONTROL

The Real-time implementation is an extension of simulation just that the dynamic model is not

used as a plant-wide signals are collected and controlled. The physical plant, available in the

laboratory as designed for only the two tank system now replaced its dynamic model in the

Closed-loop Simulink model. The Arduino micro-controller element was used to exchange

signals from the controller and the plant via USB cable using a Computer. This is also known as

interfacing the plant with the controller.

20
Figure 3-0-1: Schematic Diagram for the nonlinear two tanks system (Adebayo, 2015)

21
The control structure for the implementation and control for the Nonlinear Two tank System

shown above (see Figure 3-0-1) is described by generic description in the figure below (see

Figure 3-0-2 )

Figure 3-0-2: Description of Real-time Control

In a bid to successful transmit/measure physical quantities needed for implementation and

control of the control elements, the need for calibration comes in. This need to be accurate as

wrong calibration equation will tend to have large effect on the whole process.

3.4 CALIBRATION OF EQUIPMENT

In this context, Calibration is simply finding the relationship between signals and counts sent

into the Arduino controller to and from the SIMULINK environment to the physical quantity.

The physical quantities in consideration here are: flow rate, height, percentage opening and pH.

Calibration is important to ensure the accuracy of the control.

22
The SIMULINK environment is interfaced with the Arduino controller. The USB port from the

personal computer is connected via a connecting USB cable to the Arduino box. The pumps,

height sensors, electrically actuated valve and the pH probe are connected to the Arduino box.

The Arduino box simply converts signals from the computer to signals understandable by the

pumps, Valve and pH sensor.

The team calibrated pumps, an actuated valve, height sensors and the pH sensor. The calibration

of these equipment ensures that we obtain the correct measured values (physical quantities).

3.4.1 CALIBRATION OF PUMPS

The process of calibrating the pumps is kicked off by obtaining the counts to the Arduino

controller corresponding to the maximum and minimum volumetric flow rates of the pumps. The

fluid used for the calibration is water. A volumetric flask and a timer is also used in the

calibration process.

Subsequently, for a particular amount of time (e.g. 30s, 60s), different values of counts with

interval of 10units between the maximum and minimum count values are inputted to the Arduino

controller and the volume of water pumped into the measuring cylinder is recorded for each

count. The count, time, volume and volumetric flow rate are recorded on an excel sheet. A plot

of the volumetric flow rate, q(cm3/s) against the count is obtained using basic fitting tool of

Matlab and Excel.

An equation was obtained from the plot and used as the calibration equation.

4.3.3 Calibration of Equipment and 4.4.3 Calibration of Equipment show Simulink block

diagram for calibration of the pump for a two tank system and pumps for the pH system.

23
3.4.2 CALIBRATION OF HEIGHT SENSORS

The height sensors are calibrated one after the other by adding water in to the tanks to a

particular level (say from 10cm, 20cm, etc. in the interval of 10cm), taking a reading of both the

count read by the sensor through the Arduino and the direct reading of the measured water level

by physical observation of water level as measured from the readings on the tank (as inscribed on

tank). The table of values for both the height and count are shown in 4.3.3 Calibration of

Equipment.

A plot of height against count is then gotten with the aid of Basic fitting tools of MATLAB, this

then generates the calibration equation needed to effectively, relate the count as an input to the

Height of water from sensors as an output of the algebraic equation.

3.4.3 CALIBRATION OF pH PROBE

The real response of the pH sensor as related to the count of recognized by the Arduino is needed

as calibration equation. However, the difference between the theoretical and actual behavior of a

pH electrode which must be compensated for, requires that the pH meter is calibrated to match

the current characteristics of the used pH sensor.

During calibration, it is required that pH 7 calibration be done first. Calibration can be done at a

maximum of 3 points as the indicators available are only three and for (pH= 4.0, 7.0 and 10.0).

These three points are known as the low calibration point, the middle calibration point and the

high calibration point. Where pH 7 must be the first calibration point. This is known as the

middle calibration point. The calibration is done using the designed Simulink model to interact

with the pH probe via Arduino.

A table of values for a plot of pH against count is generated and with the help of MATLAB

fitting tool and EXCEL, the calibration equation is gotten.

24
CHAPTER FOUR

RESULTS AND DISCUSSIONS

The results are discussed under the cases in chapter three as carried out, they are categorized

based on the selected systems. Each Process system will show as subsection of it various results

obtained from the methodology applied to it. Figures and table of values are duly attached.

4.1 Continuous Fermentor

A continuous fermentor essentially consists of a stirred tank, a feed, and an outlet stream. The

process can be represented by the following nonlinear ordinary differential equations (M.A.

Henson, D.E. Seborg, 1992).

𝑋̇ = −𝐷𝑋 + µ𝑋 (4.1)

1
𝑆̇ = 𝐷(𝑆𝑓 − 𝑆) − µ𝑋 (4.2)
𝑌𝑥
𝑠

𝑃̇ = −𝐷𝑃 + (𝛼µ + 𝛽)𝑋 (4.3)

Where

µ𝑚 [1 − 𝑃⁄𝑃 ] 𝑆
𝑚
µ= 2 (4.4)
𝑆
𝐾𝑚 + 𝑆 + ( ⁄𝐾 )
𝑖

In this process, cell concentration 𝑋 is the controlled variable and one of the output variable,

dilution rate 𝐷 is the manipulated variable also an input variable. The nominal values of the

parameters in the above equations are given in Table 4-1.

25
Table 4-1, Nominal values of paramaters and operating conditions for the continuous

fermentor system

Variable Description Nominal value

D dilution rate 0.202h-1

Ki substrate inhibition constant 22 g/l-1

Km substrate saturation constant 1.2 g/l-1

P process or product concentration 24.87

Pm product saturation constant 50 g/l-1

S substrate concentration in the outlet stream 2.404 g/l-1

Sf substrate concentration in the feed 20.0 g/l-1

X cell concentration 7.038g/l-1

Yx/s cell-mass yield 0.4g/g

𝛼 kinetic parameter 2.2g/g

𝛽 kinetic parameter 0.2 h-1

µm the maximum growth rate 0.48h-1

26
4.1.1 Open-loop simulation

The S-Function script code:

function [sys,x0,str, ts] = model_fsfun(t,x,u,flag,x0)


switch flag,
case 0,
% initializing
sizes = simsizes;
sizes.NumContStates = 3; % X, S and P are continuous variable, because they vary with time
sizes.NumDiscStates = 0;
sizes.NumOutputs = 3; % the Output variables are X, S and P since these are
the variables we desired to know their steady state values
sizes.NumInputs = 2; % having D and Sf as input variables(manipulated
variables
sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);
x0=[6;5.0;19.14];
str=[];
ts=[0 0];
case 1
% parameters
Yxs=0.4 ;
alpha=2.2 ;
beta=0.2 ;
mumax=0.48 ;
Pm=50 ;
Km=1.2 ;
Ki=22 ;
% state variables:
X=x(1);
S=x(2);
P=x(3);
% input parameters:
D=u(1);
Sf=u(2);
%dynamic model equations:
mu= (mumax*S*(1-P/Pm))/(Km+S+(S^2/Ki));
x1_dot=-D*X + mu*X;
x2_dot=D*(Sf-S)-(mu*X)/Yxs;
x3_dot= -D*P + (alpha*mu + beta)* X;
sys = [x1_dot;x2_dot;x3_dot];
case 3 % output
sys = [x(1); x(2) ; x(3)];
case {2 4 9} % 2:discrete
% 4:calcTimeHit
% 9:termination
sys =[];
otherwise
error(['unhandled flag =',num2str(flag)]) ;
end

The Simulink block model and S-Function model for the open-loop simulation are shown below:

(Figure 4-1-1 to Figure 4-1-6)

27
Figure 4-1-1: Simulink Block model for the Continuous fermentor system

Figure 4-1-2: Subsystem

28
Figure 4-1-3: subsystem 1

Figure 4-1-4: subsystem 2

29
Figure 4-1-5: subsystem 3

Figure 4-1-6: S-Function Model for Continuous fermentor

30
The results from simulations for the continuous fermentor system are shown below: (see Figure 4-1-7).

Figure 4-1-7: Open loop response for the Continuous fermentor system

The result above is exactly the same when using ODE solver (ode45) in m.file as shown below:

The ODE described as a function file.

function f = ODEfun(t, x)
X=x(1);
S=x(2);
P=x(3);
% Explicit equations
mumax=0.48;
Ki=22;
alpha=2.2;
beta=0.2;
Km=1.2;
Pm=50;
Yxs=0.4;
D=0.15;
Sf=20;
mu= (mumax*S*(1-P/Pm))/(Km+S+(S^2/Ki));
31
% Differential Equations
dXdt=-D*X + mu*X;
dSdt=D*(Sf-S)-(mu*X)/Yxs;
dPdt= -D*P + (alpha*mu + beta)* X;

f=[dXdt; dSdt; dPdt];


end

The m.file code is as follows:


tspan=[0,100];
x0=[6.0; 5.0; 19.14];

[t,x]= ode45(@ODEfun, tspan, x0);

plot(t,x(:,1), t,x(:,2), t, x(:,3));


legend('X','S', 'P')
xlabel('Time(hr)');
ylabel('state variables');

Figure 4-1-8: result, using ode45 solver to solve the dynamic model for the continuous

fermentor

32
4.1.2 Close-loop simulation

Used PID Controller to model in SIMULINK, model and response are:

Figure 4-1-9: SIMULINK model diagram for PID controller with Continuous Fermentor

system

Figure 4-1-10: Response for PID controller with Continuous Fermentor system

33
4.2 Heater Mixer system

The heater-mixer setup consists of two tanks in series as shown in Figure 4-2-1. The contents in

the tank are well agitated using variable speed agitators. A cold water stream is introduced in the

first tank. The water in Tank-1 is heated using 4 kW heating coil. The hot water that overflows

the first tank is mixed with cold water stream entering into Tank-2. The water in the second tank

is heated using another 3 kW heating coil. The heat inputs Q1 and Q2 to both the tanks can be

manipulated by changing current inputs to the thyristor power control units, which can be varied

between 4 and 20 mA. The cold water inlet flow F1 and F2 to both the tanks can be manipulated

using pneumatic control valves. The temperatures in the two tanks (T1 and T2) and level in

second tank (h2) are measured variables while the heat inputs to Tank-1 (Q1) and Tank-2 (Q2)

and cold water inlet flowrates to Tank-1 (F1) and Tank-2 (F2) are treated as manipulated inputs.

The system is interfaced with a computer using a data acquisition module (Advantech 5000

series hardware) and combination of LabVIEW and MATLAB. A grey box model was

developed for the system, which is described by the following differential equations (Vinay A.

Bavdekara, Anjali P. Deshpandeb, Sachin C. Patwardhana,∗, 2011).

𝑑𝑇1 𝛼1 𝑄1
= (𝐹1 (𝑇𝑐 − 𝑇1 ) + ) ÷ 𝑉1
𝑑𝑡 𝜌𝐶𝑝

𝑑𝑇2 𝛼2 𝑄2 − 2𝜋𝑟2 ℎ2 𝑈(𝑇2 − 𝑇𝑎 )


= (𝐹1 (𝑇1 − 𝑇2 ) + 𝐹2 (𝑇𝑐 − 𝑇2 ) + ) ÷ (𝐴2 ℎ2 )
𝑑𝑡 𝜌𝐶𝑝

𝑑ℎ2
= (𝐹1 + 𝐹2 − 10−3 × 𝑘√ℎ2 ) ÷ 𝐴2
𝑑𝑡

The flows (𝐹1 and 𝐹2 ) are modelled as a function of the % of the input current range (𝐷 and 𝑈3 )

to the respective control valves. The heat terms (𝑄1 and 𝑄2 ) are modelled as % of the input

34
current range (𝑈1 and 𝑈2 ) to the respective thyristor power control modules. The algebraic

equations that relate the model inputs to the mA signals are given below:

𝐹1 = (1.2676𝐷 3 − 108.02𝐷2 + 8166𝐷) ∗ 10−10 𝑚3 /𝑠

𝐹2 = (−0.1115𝑈3 4 + 17.2404𝑈3 3 − 817.6𝑈3 2 + 18858𝑈3 ) ∗ 10−10 𝑚3 /𝑠

𝑄1 = −0.0026𝑈1 3 + 0.0584𝑈1 2 + 53.579𝑈1 𝑊𝑎𝑡𝑡𝑠

𝑄2 = −0.0035𝑈2 3 + 0.782𝑈2 2 + 78.82𝑈2 𝑊𝑎𝑡𝑡𝑠

The nominal values for operating the simulation are as shown on, Table 4-12.

Figure 4-2-1: schematic diagram of heater mixer setup (V.A. Bavdekar et al,2011).

35
Table 4-2, Nominal values of paramaters and operating conditions for the HEATER MIXER

system

Variable Nominal value

T1 58.6 ℃

T2 50.8 ℃

h2 1.2 g/l-1

Ta 301 K

k 0.1

V1 1.75 * 10−3 𝑚3

A2 7.854 * 10−3 𝑚2

r2 0.05 m

U 175 W/m.K

𝛼1 1

𝛼2 1

Tc 33.8 ℃

U1 10 mA

U2 10 mA

U3 11 mA

D 9 mA

36
4.2.1 Open-loop simulation

The S-Function script code:


function [sys,x0,str,ts,simStateCompliance] = heat_mix(t,x,u,flag)
%SFUNTMPL General MATLAB S-Function Template
% With MATLAB S-functions, you can define you own ordinary differential
% equations (ODEs), discrete system equations, and/or just about
% any type of algorithm to be used within a Simulink block diagram.
%
% The general form of an MATLAB S-function syntax is:
% [SYS,X0,STR,TS,SIMSTATECOMPLIANCE] = SFUNC(T,X,U,FLAG,P1,...,Pn)
%
% What is returned by SFUNC at a given point in time, T, depends on the
% value of the FLAG, the current state vector, X, and the current
% input vector, U.
%
% FLAG RESULT DESCRIPTION
% ----- ------ --------------------------------------------
% 0 [SIZES,X0,STR,TS] Initialization, return system sizes in SYS,
% initial state in X0, state ordering strings
% in STR, and sample times in TS.
% 1 DX Return continuous state derivatives in SYS.
% 2 DS Update discrete states SYS = X(n+1)
% 3 Y Return outputs in SYS.
% 4 TNEXT Return next time hit for variable step sample
% time in SYS.
% 5 Reserved for future (root finding).
% 9 [] Termination, perform any cleanup SYS=[].
%
%
% The state vectors, X and X0 consists of continuous states followed
% by discrete states.
%
% Optional parameters, P1,...,Pn can be provided to the S-function and
% used during any FLAG operation.
%
% When SFUNC is called with FLAG = 0, the following information
% should be returned:
%
% SYS(1) = Number of continuous states.
% SYS(2) = Number of discrete states.
% SYS(3) = Number of outputs.
% SYS(4) = Number of inputs.
% Any of the first four elements in SYS can be specified
% as -1 indicating that they are dynamically sized. The
% actual length for all other flags will be equal to the
% length of the input, U.
% SYS(5) = Reserved for root finding. Must be zero.
% SYS(6) = Direct feedthrough flag (1=yes, 0=no). The s-function
% has direct feedthrough if U is used during the FLAG=3
% call. Setting this to 0 is akin to making a promise that
% U will not be used during FLAG=3. If you break the promise
% then unpredictable results will occur.
% SYS(7) = Number of sample times. This is the number of rows in TS.
37
%
%
% X0 = Initial state conditions or [] if no states.
%
% STR = State ordering strings which is generally specified as [].
%
% TS = An m-by-2 matrix containing the sample time
% (period, offset) information. Where m = number of sample
% times. The ordering of the sample times must be:
%
% TS = [0 0, : Continuous sample time.
% 0 1, : Continuous, but fixed in minor step
% sample time.
% PERIOD OFFSET, : Discrete sample time where
% PERIOD > 0 & OFFSET < PERIOD.
% -2 0]; : Variable step discrete sample time
% where FLAG=4 is used to get time of
% next hit.
%
% There can be more than one sample time providing
% they are ordered such that they are monotonically
% increasing. Only the needed sample times should be
% specified in TS. When specifying more than one
% sample time, you must check for sample hits explicitly by
% seeing if
% abs(round((T-OFFSET)/PERIOD) - (T-OFFSET)/PERIOD)
% is within a specified tolerance, generally 1e-8. This
% tolerance is dependent upon your model's sampling times
% and simulation time.
%
% You can also specify that the sample time of the S-function
% is inherited from the driving block. For functions which
% change during minor steps, this is done by
% specifying SYS(7) = 1 and TS = [-1 0]. For functions which
% are held during minor steps, this is done by specifying
% SYS(7) = 1 and TS = [-1 1].
%
% SIMSTATECOMPLIANCE = Specifices how to handle this block when saving and
% restoring the complete simulation state of the
% model. The allowed values are: 'DefaultSimState',
% 'HasNoSimState' or 'DisallowSimState'. If this value
% is not speficified, then the block's compliance with
% simState feature is set to 'UknownSimState'.

% Copyright 1990-2010 The MathWorks, Inc.

%
% The following outlines the general structure of an S-function.
%
switch flag,

%%%%%%%%%%%%%%%%%%
% Initialization %
%%%%%%%%%%%%%%%%%%
case 0,

38
[sys,x0,str,ts,simStateCompliance]=mdlInitializeSizes;

%%%%%%%%%%%%%%%
% Derivatives %
%%%%%%%%%%%%%%%
case 1,
sys=mdlDerivatives(t,x,u);

%%%%%%%%%%
% Update %
%%%%%%%%%%
case 2,
sys=mdlUpdate(t,x,u);

%%%%%%%%%%%
% Outputs %
%%%%%%%%%%%
case 3,
sys=mdlOutputs(t,x,u);

%%%%%%%%%%%%%%%%%%%%%%%
% GetTimeOfNextVarHit %
%%%%%%%%%%%%%%%%%%%%%%%
case 4,
sys=mdlGetTimeOfNextVarHit(t,x,u);

%%%%%%%%%%%%%
% Terminate %
%%%%%%%%%%%%%
case 9,
sys=mdlTerminate(t,x,u);

%%%%%%%%%%%%%%%%%%%%
% Unexpected flags %
%%%%%%%%%%%%%%%%%%%%
otherwise
DAStudio.error('Simulink:blocks:unhandledFlag', num2str(flag));

end

% end sfuntmpl

%
%===========================================================================
==
% mdlInitializeSizes
% Return the sizes, initial conditions, and sample times for the S-function.
%===========================================================================
==
%
function [sys,x0,str,ts,simStateCompliance]=mdlInitializeSizes

%
% call simsizes for a sizes structure, fill it in and convert it to a
% sizes array.
39
%
% Note that in this example, the values are hard coded. This is not a
% recommended practice as the characteristics of the block are typically
% defined by the S-function parameters.
%
sizes = simsizes;

sizes.NumContStates = 3;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 3;
sizes.NumInputs = 4;
sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 1; % at least one sample time is needed

sys = simsizes(sizes);

%
% initialize the initial conditions
%
x0 = [58.6;50.8;0.38];

%
% str is always an empty matrix
%
str = [];

%
% initialize the array of sample times
%
ts = [0 0];

% Specify the block simStateCompliance. The allowed values are:


% 'UnknownSimState', < The default setting; warn and assume DefaultSimState
% 'DefaultSimState', < Same sim state as a built-in block
% 'HasNoSimState', < No sim state
% 'DisallowSimState' < Error out when saving or restoring the model sim state
simStateCompliance = 'UnknownSimState';

% end mdlInitializeSizes

%
%===========================================================================
==
% mdlDerivatives
% Return the derivatives for the continuous states.
%===========================================================================
==
%
function sys=mdlDerivatives(t,x,u)
% parameters
alp1=1;
alp2=1;
k=0.1;
V1=1.75*10^-3;
A2=7.854*10^-3;

40
r2=0.05;
U=175;
Ta= 301;
Tc=33.8;
rho=1000;
Cp=4200;

% state variables:
T1=x(1);
T2=x(2);
h2=x(3);
% input parameters:

U1=u(1);
U2=u(2);
U3=u(3);
D=u(4);

%dynamic model equations:

F1=((1.2676*D^3)-(108.02*D^2)+(8166*D))*10^-10;%m^3/s %flow to tank 1


F2=((-.1115*U3^4)+(17.2404*U3^3)-(817.6*U3^2)+(18858*U3))*10^-10; %m^3/s % flow to tank
2
Q1=(-.0026*U1^3)+(0.0584*U1^2)+(53.579*U1); % Watt %heat to tank 1
Q2=(-.0035*U2^3)-(0.782*U2^2)+(78.82*U2); %Watt % heat to tank 2

dT1dt=(F1*(Tc-T1)+((alp1*Q1)/(rho*Cp)))/V1;
dT2dt=(F1*(T1-T2)+F2*(Tc-T2)+((alp2*Q2)-(2*pi*r2*h2*U*(T2-Ta)))/(rho*Cp))/(A2*h2);
dh2dt= (F1+F2-((10^-3)*k*sqrt(h2)))/A2;

sys = [dT1dt; dT2dt; dh2dt];

% end mdlDerivatives

%
%===========================================================================
==
% mdlUpdate
% Handle discrete state updates, sample time hits, and major time step
% requirements.
%===========================================================================
==
%
function sys=mdlUpdate(t,x,u)

sys = [];

% end mdlUpdate

%
%===========================================================================
==
% mdlOutputs
% Return the block outputs.
41
%===========================================================================
==
%
function sys=mdlOutputs(t,x,u)

sys = [x(1); x(2) ; x(3)];

% end mdlOutputs

%
%===========================================================================
==
% mdlGetTimeOfNextVarHit
% Return the time of the next hit for this block. Note that the result is
% absolute time. Note that this function is only used when you specify a
% variable discrete-time sample time [-2 0] in the sample time array in
% mdlInitializeSizes.
%===========================================================================
==
%
function sys=mdlGetTimeOfNextVarHit(t,x,u)

sampleTime = 1; % Example, set the next hit to be one second later.


sys = t + sampleTime;

% end mdlGetTimeOfNextVarHit

%
%===========================================================================
==
% mdlTerminate
% Perform any end of simulation tasks.
%===========================================================================
==
%
function sys=mdlTerminate(t,x,u)

sys = [];

% end mdlTerminate

42
Figure 4-2-2: S-Function Model for the Heater mixer system

Figure 4-2-3: Simulink Model diagram for the Heater Mixer system

43
Figure 4-2-4: Subsystem Model diagram for the Heater Mixer system

44
Figure 4-2-5: Subsystem for Q1(U1)

Figure 4-2-6: Subsystem for Q2(U2)

45
Figure 4-2-7: Subsystem for F2(U3)

Figure 4-2-8: Subsystem for F1(D)

46
Figure 4-2-9: Subsystem showing Equation 1, T1dot

47
Figure 4-2-10: Subsystem describing Equation 2, T2dot

48
Figure 4-2-11: subsystem describing Equation 3, h2dot

The open loop responses are shown below:

Figure 4-2-12: Open loop response for the Simulation

49
The result above is exactly the same when using ODE solver (ode45) in m.file as shown below:

The script file for ODEs


function f = ODEfun(t, x)
T1=x(1);
T2=x(2);
h2=x(3);
% Explicit equations
alp1=1;
alp2=1;
k=0.1;
V1=1.75*10^-3;
A2=7.854*10^-3;
r2=0.05;
U=175;
Ta= 301;
Tc=33.8;
rho=1000;
Cp=4200;
D=0.3125;
U1=0.375;
U2=0.375;
U3=0.4375;
F1=((1.2676*D^3)-(108.02*D^2)+(8166*D))*10^-10;%m^3/s %flow to tank 1
F2=((-.1115*U3^4)+(17.2404*U3^3)-(817.6*U3^2)+(18858*U3))*10^-10; %m^3/s % flow to tank
2
Q1=(-.0026*U1^3)+(0.0584*U1^2)+(53.579*U1); % Watt %heat to tank 1
Q2=(-.0035*U2^3)-(0.782*U2^2)+(78.82*U2); %Watt % heat to tank 2

% Differential Equations
dT1dt=(F1*(Tc-T1)+((alp1*Q1)/(rho*Cp)))/V1;
dT2dt=(F1*(T1-T2)+F2*(Tc-T2)+((alp2*Q2)-(2*pi*r2*h2*U*(T2-Ta)))/(rho*Cp))/(A2*h2);
dh2dt= (F1+F2-((10^-3)*k*sqrt(h2)))/A2;

f=[dT1dt; dT2dt; dh2dt];


end

The m.file for solving using Ode45 solver


tspan=[0,1000];
x0=[58.6; 50.8; 0.38];
[t,x]= ode45(@ODEfun, tspan, x0)

subplot(2,1,1);
plot(t,x(:,1), t,x(:,2));
legend('T1','T2')
xlabel('Time(s)');
ylabel('T (K)');
grid off;
title('Temperature of Tank 1 & 2');

subplot(2,1,2);
plot( t,x(:,3));
legend('h2');
xlabel('Time(s)');
50
ylabel('h2 (m)');
grid off;
title('height of tank 2');

Figure 4-2-13: response using ode45 solver in m.file

51
4.2.2 Close-loop simulation

Did not run any close loop simulation for this system.

4.3 Nonlinear Two Tanks system

This system consists of two tanks (cuboidal and trapezoidal tanks) modelled with the following

differential equations (Adebayo, 2015);

1
ℎ1̇ = (𝑈 − 𝑈2 𝑆𝑝 √2𝑔ℎ1 − 𝐶2 𝑆𝑝 √2𝑔ℎ1 )
𝑎𝑤 1

𝐻
ℎ2̇ = (𝑈 𝑆 √2𝑔ℎ1 + 𝐶2 𝑆𝑝 √2𝑔ℎ1 − 𝐶3 𝑆𝑝 √2𝑔ℎ2 )
𝑏𝑤ℎ2 + 𝑐𝑤𝐻 2 𝑝

The schematic of the nonlinear multi-tank system is given in Figure 4-3-1. Detailed dimensions

of tanks are shown in Figure 4-3-2.

The control objective is to maintain the liquid level in both tanks ℎ1 and ℎ2 at desired heights

using pump flow rate, 𝑈1 and valve/flow coefficient 𝑈2 .

52
Figure 4-3-1: Schematic Diagram for the nonlinear two tanks system (Adebayo, 2015)

53
Figure 4-3-2: Detailed dimensions for the nonlinear two tanks system(Adebayo, 2015)

54
Table 4-3, Nominal values of parameters and operating conditions for the nonlinear

two-tanks system

Variable Description Nominal value

H Maximum height of Tanks 35cm

C2 Orifice outflow coefficient of top 0.1668

manual valve

C3 Orifice outflow coefficient of bottom 0.6327

manual valve

Sp Output area of the Orifice 1.267 cm2

d Valve diameter 0.5 inch

g Acceleration due to gravity 981 cm2 s-1

a Base-length of upper Tank 25 cm

b Top-length of lower Tank 34.5 cm

c Base-length of lower Tank 10 cm

w Width of Tank 3.5 cm

u1 Pump flow rate 130 cm3 s-1

u2 Orifice outflow of actuated valve 0.4

h1 Level of fluid in Tank 1 16.7 cm

h2 Level of fluid in Tank 2 13.4 cm

55
4.3.1 Open-loop simulation

The model used for the two tank system as in Simulink and S-Function are shown below:

The S-Function code is described below:


function [sys,x0,str,ts] =two_tank_sfun1(t,x,u,flag,x0);
switch flag

case 0 % initialization;

sizes = simsizes;
sizes.NumContStates = 2;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 2;
sizes.NumInputs = 2;
sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);

x0=[0;0]; %Initial values of states

str=[];
ts= [0 0] ;

case 1 % derivatives;
%values of parameters
H=35;
C2=0.1668;
C3=0.6327;
Sp=1.267;
g=981;
a=25;
b=34.5;
c=10;
w=3.5;

U1=u(1); U2=u(2);
%C2=u(3); %C3=u(4); %c3=u(4);

h1=x(1);
h2=x(2);

x1dot=(1/(a*w))*(U1-U2*Sp*sqrt(2*g*h1)-C2*Sp*sqrt(2*g*h1)) ;
x2dot=(H/(b*w*h2+c*w*H))*(U2*Sp*sqrt(2*g*h1)+C2*Sp*sqrt(2*g*h1)-C3*Sp*sqrt(2*g*h2)) ;

sys = [x1dot;x2dot];

case 3 % outputs;
sys = [x(1); x(2)] ;

case {2, 4, 9}
sys = [];
end

56
Figure 4-3-3: S-Function Model diagram for Nonlinear Two Tank System.

Figure 4-3-4: Simulink model diagram for Nonlinear Two tank system

57
Figure 4-3-5: Subsystem

The Open loop responses are shown below:

Figure 4-3-6: Open-loop response for the Two Tank system

58
4.3.2 Close-loop simulation

The close-loop simulation was designed using open-loop SIMULINK model already described

above, it was designed for two cases: namely, (i) Using the PI controller and (ii) Using the PID

controller

The control objective is to maintain the liquid level in both tanks ℎ1 and ℎ2 at desired heights

using pump flow rate, 𝑈1 and valve/flow coefficient 𝑈2 . The system pairing was figured out by

calculating the Relative Gain Array, RGA, which is beyond my scope for now. The pairing was

off-diagonal pairing.

The respective models, and responses are shown below:

Step change on the set points were introduced for both heights. Having a set point of 10 for both

heights until 500sec then h1 is set to 16.7cm while h2 is set to 13.4 cm (i.e. Servo-problem).

(I) PI controller:

Figure 4-3-7: Simulink Model diagram for PI_Controller close-loop simulation

59
Figure 4-3-8: Close loop response using a Proportional Integral (PI) controller for the

Nonlinear Two Tank System

60
(II) PID Controller:

Figure 4-3-9: Simulink model Diagram for PID _Control on the two tank system

61
Figure 4-3-10: Close-loop response for the PID_control of the two tank system (servo)

62
4.3.3 Calibration of Equipment

Calibration was done for real-time implementation and control of the system.

The Simulink model used in calibrating the pump, valve and Height sensors is as shown on Figure 4-3-

11.

Figure 4-3-11: Simulink model diagram for calibration for the To tank system.

The Calibration data and equation are shown below:

63
4.3.3.1 Sensor Calibration for tank 1

Table 4-4, Experimental Raw Data for height sensor for Tank 1

Runs h1(cm) h1(count)

1 5 777

2 8 786

3 10 792

4 14 804

5 15 808

6 18 817

7 20 824

8 23 832

9 25 838

10 28 848

11 30 854

12 35 869

13 37 875

64
y = 0.3252x - 247.65
Sensor 1
40

35 Sensor 1

30

25

20

15

10

0
760 780 800 820 840 860 880

Figure 4-3-12: Graphical Representation for Tank 1 height sensor

 Calibration equation

y = 0.325x - 247.6

65
4.3.3.2 Sensor Calibration for tank 2

Table 4-4, Experimental Raw Data for height sensor for Tank 2

Runs h2(count) h2(cm)

1 766 4.5

2 775 7

3 784 10

4 793 13

5 799 15

6 805 17

7 814 20

8 830 25

9 836 27

10 845 30

11 861 35

12 867 37.2

66
Sensor 2
40
35
30 y = 0.325x - 244.64
25
20 h2(cm)

15 Linear (h2(cm))

10
5
0
760 780 800 820 840 860 880

Figure 4-3-13: Graphical Representation for Tank 2 height sensor

 Calibration equation

y = 0.325x - 244.6

67
4.3.3.3 Pump Calibration

Table 4-5, Experimental Raw Data for Pump Calibration for Two-tank System

Runs time(s) height(cm) height(count) Area(cm2) Area*height(cm3) q(cm3/s)

1 35.47 20 180 87.5 1750 49.33747

2 20.51 20 190 87.5 1750 85.32423

3 19.43 25 200 87.5 2187.5 112.5836

4 15.21 25 210 87.5 2187.5 143.8199

5 12.97 25 220 87.5 2187.5 168.6584

6 13.61 30 230 87.5 2625 192.8729

7 11.88 30 240 87.5 2625 220.9596

8 10.79 30 250 87.5 2625 243.2808

PUMP
y= 1E-08x4 - 9E-06x3 + 0.0025x2 + 0.0586x + 172.03
300

250

200
calibration
150
Poly. (calibration)
100

50

0
0 50 100 150 200 250 300

Figure 4-3-14: Graphical Representation for Pump for two tank system

68
 Calibration equation

y = 1E-08x4 - 9E-06x3 + 0.002x2 + 0.058x + 172.0

4.3.3.3 Valve Calibration

Table 4-6, Experimental Raw Data for Pump Calibration for Two-tank System

Fully opened(FO)- Fully closed(FC) Fully closed(FC)- Fully opened(FO)

q2(counts) q2(%) q2 q2(counts) q2(%) q2

255 100 1 55 0 0

220 90 0.9 85 10 0.1

180 85 0.85 95 20 0.2

150 60 0.6 100 30 0.3

100 35 0.35 150 55 0.55

95 30 0.3 180 75 0.75

85 20 0.2 220 90 0.9

55 0 0 255 100 1

69
300
FO-FC
250 FC-FO

200

150

100

50

0
0 0.2 0.4 0.6 0.8 1 1.2

Figure 4-3-15: Graphical Representation for Valve for two tank system

 Calibration equations

FO-FC: y = 226.44x3 + 218.55x2 + 190.22x + 53.914

FC-FO: y = 187.47x3 – 202.57x2 + 211x + 58.408

70
4.3.4 Real-time Implementation and Control

I ran a Real-time Control using the PID controller and using the Tuning parameters obtained

from the auto-tuning for PID simulation. The Response was:

Figure 4-3-16: Response for Real-time Control using PID Controller for the Two-tank

System

71
Figure 4-3-17: SIMULINK model diagram for Real-time Control using PID Controller for

the Two-tank System

72
Figure 4-3-18: Image showing the Real-time Control Setup for the Two-tank System in the

Laboratory

73
4.4 Neutralization Reactor pH system

The process consists of a base (NaOH) stream q1, a buffer (NaHCO3) stream q2 and an acid

(HNO3) stream q3 which are mixed in a constant volume tank. The continuous-time fundamental

model of the reactor is comprised of two nonlinear ordinary differential equations (Ławrynczuk,

2013).

1
̇ =
𝑊𝑎4 [(𝑊𝑎1 − 𝑊𝑎4 )𝑞1 + (𝑊𝑎2 − 𝑊𝑎4 )𝑞2 + (𝑊𝑎3 − 𝑊𝑎4 )𝑞3 ]
𝐴ℎ

1
̇ =
𝑊𝑏4 [(𝑊𝑏1 − 𝑊𝑏4 )𝑞1 + (𝑊𝑏2 − 𝑊𝑏4 )𝑞2 + (𝑊𝑏3 − 𝑊𝑏4 )𝑞3 ]
𝐴ℎ

and one algebraic output equation

𝑝𝐻−14
1 + 2 × 10𝑝𝐻−𝐾2
𝑊𝑎 + 10 + 𝑊𝑏 − 10−𝑝𝐻 = 0
1 + 10𝐾1 −𝑝𝐻 + 10𝑝𝐻−𝐾2

State variables 𝑊𝑎 and 𝑊𝑏 are reaction invariants. Nominal values of the variables and operating

points used for this process here are shown in Table 4-7.

74
Table 4-7, Nominal values of parameters and operating conditions for the pH neutralization

system

Variable Description Nominal Value

A area 207 cm2

K1 log of the equilibrium constant 6.35

K2 log of the equilibrium constant 10.25

Wa1 reaction invariant a1 3 ×10-3 M

Wa2 reaction invariant a2 −3 ×10-2 M

Wa3 reaction invariant a3 −3.05 ×10-3 M

Wa4 reaction invariant a4 −4.32 ×10-4 M

Wb1 reaction invariant b1 0

Wb2 reaction invariant b2 3 ×10-2 M

Wb3 reaction invariant b3 5 ×10-5 M

Wb4 reaction invariant b4 5.28 ×10-3 M

q1 acid flowrate 15.55 ml s-1

q2 buffer flowrate 0.55 ml s-1

q3 base flowrate 16.60 ml s-1

h Liquid level 14.0cm

pH4 effluent pH from the neutralization tank 7.0

75
4.4.1 Open-loop simulation
The Simulink model and S-Function model are shown below:
The S-Function script is given below:
function [sys,x0,str,ts] =ph_model(t,x,u,flag,x0)
%
%
switch flag

case 0 % initialization;

sizes = simsizes;
sizes.NumContStates = 2;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 1;
sizes.NumInputs = 1;
sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);

x0=[-4.32e-4;5.28e-4]; %Initial vaues of states

str=[];
ts= [0 0];

case 1 % derivatives;

%values of parameters

wa1=-3.05*(10^-3);
wa2=-3*(10^-2);
wa3=3*(10^-3);
wb1=5*(10^-5);
wb2=3*(10^-2);
wb3=0;
k=8.75;
q1=u(1); %q1=15.55
q2=0.55; %q2=0.55;
q3=16.6; %q3=16.6;

h=14;
wa4=x(1);
wb4=x(2);

a=207;

x2dot=((((wa1-wa4)*q1)+((wa2-wa4)*q2)+((wa3-wa4)*q3))/(a*h)) ;
x3dot=((((wb1-wb4)*q1)+((wb2-wb4)*q2)+((wb3-wb4)*q3))/(a*h)) ;

sys = [x2dot;x3dot] ;

76
case 3 % outputs;

c=10.25;
d=6.35;

wa4=x(1);
wb4=x(2);

f=@(pH)(wa4+(10^(pH-14))+(wb4*((1+(2*10^(pH-c)))/(1+10^(d-pH)+10^(pH-c))))-(10^-pH)) ;

%y=fsolve(@(pH) f(pH),1);
y=fzero(f,9);

sys = [y] ;

case {2, 4, 9}
sys = [];

otherwise
error(['unhandled flag = ',num2str(flag)]);

end

Figure 4-4-1: S-Function model diagram for the pH system

77
Figure 4-4-2: SIMULINK model diagram for the pH system.

Figure 4-4-3: Subsystem for SIMULINK model for PH_openloop simulation

78
Figure 4-4-4: ODE1 for PH_system

Figure 4-4-5: ODE2 for PH_SIMULINK MODEL

79
Figure 4-4-6: Algebraic Equation model for PH_SIMULINK MODEL

The Response gave it steady state value of pH=7 for the nominal operating conditions.

80
4.4.2 Close-loop simulation

The control objective is to maintain the 𝑝𝐻 at the desired set-point using base flow rate, 𝑞1 as

manipulated variable. This make it a SISO system.

The respective models, and responses are shown below:

Step change on the set point was introduced for pH. Having a set point change from 3 to 10 and

finally to 7 (i.e. Servo-problem).

(I) PI controller:

Figure 4-4-7: SIMULINK model for PI controller for the PH system

81
Figure 4-4-8: pH response for PI controller for the PH system.

(II) PID controller:

Figure 4-4-9: SIMULINK model diagram for PID_ close loop simulation of PH system

82
Figure 4-4-10: Response for PID_ close loop simulation of PH system

4.4.3 Calibration of Equipment

The calibration results are as follows:

83
Table 4-8, Experimental data for Calibration of Base pump for the PH system.

Time, t(s) V (cm3) Count Q1(cm3/s)

750.72 100 47 0.133205

161.28 200 67 1.240079

105.85 200 87 1.889466

85.12 210 107 2.467105

72.22 205 127 2.838549

63.8 200 147 3.134796

58.8 210 167 3.571429

64.88 250 187 3.853268

71.9 300 227 4.172462

119.66 555 247 4.638141

Base-Pump
300
y = 0.0455x3 + 8.3349x2 + 4.5894x + 46.873
250

200

150

100

50

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

Figure 4-4-11: Plot of Count against Base pump flow rate for the PH_system

84
Table 4-9, Experimental data for Calibration of Buffer pump for the PH system

Time, t(s) V (cm3) Count Q2(cm3/s)

854.12 100 60 0.11708

671.78 210 80 0.312602

425.7 220 120 0.516796

339.9 240 160 0.70609

239.3 180 180 0.752194

323.2 275 200 0.850866

211.8 180 220 0.849858

310.9 300 245 0.96494

Buffer pump
300
y = -47.939x3 + 243.32x2 + 7.0241x + 55.916
250

200

150

100

50

0
0 0.2 0.4 0.6 0.8 1 1.2

Figure 4-4-12: Plot of Count against Buffer Pump's flow rate for the PH_system

85
Table 4-10, Experimental data for Calibration of Acid pump for the PH system

Time, t(s) V (cm3) Count Q3(cm3/s)

479.7 220 50 0.45862

201.2 270 70 1.341948

126.56 235 90 1.856827

97.97 230 110 2.347657

67.8 190 130 2.80236

87.22 290 150 3.324925

125.03 440 170 3.519155

64.93 230 200 3.542276

45.91 170 220 3.702897

67.26 265 245 3.939935

Acid_pump
300

250 y = 5.1169x4 - 37.791x3 + 100.96x2 - 77.577x + 67.612

200

150

100

50

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5

Figure 4-4-13: Plot of Count against Acid pump's flow rate for the PH_System.
86
CHAPTER FIVE

CONCLUSIONS

5.1 CONCLUSION

During the course of the internship, my use of engineering software packages was sharpened and

I was well grounded in the application of these packages to solve problems.

The SIWES programme did not only promote a team spirit in me, it also gave me the platform to

apply theories to solving real life problems among many other situations. It was really an

experience worth it.

87
REFERENCES

Adebayo, K. (2015). Design, Fabrication and Control of Trapezoidal Tank System. Unpublished

Thesis, Department of Chemical Engineering, Obafemi Awolowo University, Ile-ife.

Brian Roffel, Ben Betlam. (2006). Process Dynamics and Control, Modeling for control and

prediction. John Wiley & Sons.

Euler, L. (1768). Institionum calculi integralis. imp. Acad. imp. Saent., 1769.

Fund, I. T. (2004). Information and Guideline for Students' Industrial Work Experience Scheme.

(pp. ITF (revised 2004),). Jos, Nigeria: ITF.

Ławrynczuk, M. (2013). Practical nonlinear predictive control algorithms for neural Weiner

models. Journal of Process Control 23, 696– 714.

M.A. Henson, D.E. Seborg. (1992). Nonlinear control strategies for continuous fermenters,.

Chem. Eng. Sci. , 821–835.

Vinay A. Bavdekara, Anjali P. Deshpandeb, Sachin C. Patwardhana,∗. (2011). Identification of

process and measurement noise covariance for state and parameter estimation using

extended Kalman filter. Journal of Process Control 21, 585–601.

Wikipedia. (2018). Retrieved from wikipedia:

https://en.wikipedia.org/wiki/Partial_differential_equation

88
Wikipedia. (2018). Retrieved from Wikipedia: https://en.wikipedia.org/wiki/Simulation

Wikipedia. (2018). wikipedia. Retrieved from wikipedia:

https://en.wikipedia.org/wiki/Euler_method

Wikipedia. (n.d.). Wikipedia-Systems Engineering. Retrieved from Wikipedia.org:

https://en.wikipedia.org/wiki/Systems_engineering

Won Y. Yang, Wenwu Cao, Tae-Sang Chung and John Morris. (2005). Applied Numerical

Methods using Matlab. Wiley-interscience; J. Wiley & Sons.

89

You might also like