0% found this document useful (0 votes)
57 views

Implementing A Level Control System in Labview

This document describes implementing a level control system in LabVIEW. It discusses modeling a level tank system using integrators and time-constant models. It implements these models in LabVIEW using simulation blocks. It then simulates control systems for the models using a built-in PID controller and discrete PI controller. It also discusses applying the control systems to a real process. The document provides an overview of modeling, simulation, and control of a level control system in LabVIEW.

Uploaded by

rami rami
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)
57 views

Implementing A Level Control System in Labview

This document describes implementing a level control system in LabVIEW. It discusses modeling a level tank system using integrators and time-constant models. It implements these models in LabVIEW using simulation blocks. It then simulates control systems for the models using a built-in PID controller and discrete PI controller. It also discusses applying the control systems to a real process. The document provides an overview of modeling, simulation, and control of a level control system in LabVIEW.

Uploaded by

rami rami
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/ 13

 

Telemark  University  College  


Department  of  Electrical  Engineering,  Information  Technology  and  Cybernetics  

Lab Project
 

Implementing  a  Level  Control  


System  in  LabVIEW  
HANS-­‐PETTER   H ALVORSEN,   2 014.10.16  

Faculty of Technology, Postboks 203, Kjølnes ring 56, N-3901 Porsgrunn, Norway. Tel: +47 35 57 50 00 Fax: +47 35 57 54 01

 
Table  of  Contents  
Table  of  Contents  .......................................................................................................................  ii  

1   Modeling  and  Simulation  ....................................................................................................  3  

1.1   Level  Tank  Model  .........................................................................................................  3  

1.2   Model  Implementation  ................................................................................................  4  

2   Control  System  Simulation  .................................................................................................  6  

2.1   Using  built-­‐in  PID  Controller  ........................................................................................  6  

2.2   Discrete  PI  Controller  ...................................................................................................  7  

2.3   Feedforward  Control  ...................................................................................................  8  

3   Apply  on  the  Real  Process  ................................................................................................  10  

3.1   Real  Process  ...............................................................................................................  10  

ii  
     

1 Modeling  and  Simulation  


1.1 Level   T ank   M odel  
Recommended  Chapters  in  the  Text  book:  

  Ch.  6  “Matematisk  Prosessmodellering”  

  Ch.  6.3  “Massebalanse”  

We  will  assume  a  Level  System  as  shown  below:  

 
A  very  simple  (linear)  model  of  the  water  tank  may  be  as  follows:  

1
ℎ= 𝐾 𝑢−𝐹!"#  
𝐴 !
Where:  

• ℎ   [𝑐𝑚]   is  the  level  in  the  water  tank.   0𝑐𝑚 ≤ ℎ ≤ 20𝑐𝑚  


• 𝑢   [𝑉]   is  the  pump  control  signal  to  the  pump.   0𝑉 ≤ 𝑢 ≤ 5𝑉  
• 𝐴   [𝑐𝑚2]   is  the  cross-­‐sectional  area  in  the  tank  
• 𝐾!   [(𝑐𝑚3/𝑠)/𝑉]   is  the  pump  gain.  The  flow  into  the  tank  is   𝐹!" = 𝐾! 𝑢,  i.e  we  
control  the  flow  into  the  tank  using  a  pump.  
• 𝐹!"#   [𝑐𝑚3/𝑠]   is  the  outflow  through  the  valve.  The  outflow  may  be  manually  
adjusted  with  a  handle.  

The  model  above  is  a  socalled  Integrator.  

3  
4     Modeling  and  Simulation    

A  more  accurate  model  may,  e.g.,  be:  

1
ℎ= 𝐾 𝑢 − 𝐾! ℎ  
𝐴 !
where   𝐾!   is  the  valve  gain  on  the  outflow.  

It  is  more  normal  to  put  it  like  this:  

𝐾! 𝐾!
ℎ=− ℎ+ 𝑢  
𝐴 𝐴
(The  general  term  is   𝑥 = 𝑎𝑥 + 𝑏𝑢)  

The  model  above  is  a  socalled  Time-­‐constant  system  (1.order  system).  

The  following  model  is  even  more  accurate:  

1 𝜌𝑔ℎ
ℎ= 𝐾! 𝑢 − 𝐾!  
𝐴 𝐺

This  is  a  socalled  1.order  nonlinear  model.  

Recommended  Chapters  in  the  Text  book:  

  Ch.  8  “Prosessdynamikk”  

1.2 Model   I mplementation  


Recommended  Chapters  in  the  Text  book:  

  Ch.  12  “Simulering  av  reguleringssystemer”  

The  model  should  be  implemented  using  the  blocks  (Integrator,  Summation,  Multiplication,  
etc.)  from  the  Simulation  palette  in  LabVIEW:  

Implementing a Level Control System in LabVIEW


5     Modeling  and  Simulation    

  Implement  the  model  using  the  Control  and  Simulation  Loop.  Test  the  model  using  a  
step  response.  

Begin  with  the  simple  model:  

1
ℎ= 𝐾 𝑢−𝐹!"#  
𝐴 !
The  following  values  can  be  used  in  the  simulations:  

𝐾! = 15(𝑐𝑚! /𝑠)/𝑉  

A = 80𝑐𝑚!  

Use,  e.g.,  the  following  Simulation  Time:  

𝑇! = 0.1𝑠  

You  may  also  want  to  try  the  following  model  (voluntary):  

1
ℎ= 𝐾 𝑢 − 𝐾! ℎ  
𝐴 !
Discuss  the  results  for  the  different  models.  

  When  the  system  works  as  expected,  implement  the  model  as  a  Simulation  Subsystem  
and  use  it  within  a  While  Loop.  

Implementing a Level Control System in LabVIEW


 

2 Control  System  Simulation  


Recommended  Chapters  in  the  Text  book:  

  Ch.  9  “PID  regulatoren”  

  Ch.  10  “Innstilling  av  PID-­‐regulatorer”  

A  typical  control  system  in  LabVIEW  can  be  developed  as  follows:  

 
Where  we  use  feedback  control  (PID)  in  order  to  control  the  system  to  make  sure  the  output  
of  the  system  stays  on  the  reference  value.  

2.1 Using   b uilt-­‐in   P ID   C ontroller  


  Use  one  of  the  built-­‐in  PID  controllers  in  LabVIEW  in  order  to  control  the  level  system.  

   

6  
7     Control  System  Simulation    

  Find  proper  PID  parameters.  Make  sure  the  control  system  can  handle  changes  in  the  
reference  as  well  as  changes  in  the  outflow.  

Recommended  Chapters  in  the  Text  book:  

  Ch.  10.5.2  “Innstilling  av  PI-­‐regulator  for  integrator  med  tidsforsinkele”  

  Ch.10.5.4  “Instilling  av  PI-­‐regulator  for  ren  integrator”,  

  Make  sure  to  create  a  user-­‐friedly  Front  Panel  (HMI).  The  HMI  should  consist  a  
simulation  of  the  water  tank,  it  should  be  possible  to  change  PID  parameters,  etc.  

The  HMI  should  include  a  Chart  with  both  the  Level  (ℎ)  and  the  Reference  signal  and  another  
Chart  showing  the  Control  Signal  (𝑢)  

It  should  also  be  possible  to  change  the  flow  out  of  the  tank  (𝐹!"# )  from  the  HMI  in  order  to  
see  if  the  controller  can  handle  changes  in  the  outflow.  

Use  a  While  Loop  in  order  to  implement  your  Control  System.  

2.2 Discrete   P I   C ontroller  


Now  you  are  going  to  create  your  own  PI  controller  from  scratch.  

A  continuous  time  PI  controller  may  be  written:  


!
𝐾!
𝑢 𝑡 = 𝑢! + 𝐾! 𝑒 𝑡 + 𝑒𝑑𝜏  
𝑇! !

Where  u  is  the  controller  output  and  e  is  the  control  error:  

𝑒 𝑡 = 𝑟 𝑡 − 𝑦(𝑡)  

  Create  a  discrete  PI  controller  in  LabVIEW  using  the  Formula  Node.  Create  a  SubVI  of  
the  code.  

-­‐  Typical  Inputs  to  the  controller:   𝐾! , 𝑇! , 𝑦, 𝑟  

-­‐  Typical  Outputs  from  the  controller:   𝑢  

Make  sure  the  PI  controller  works  as  expected.  

Recommended  Chapters  in  the  Text  book:  

  Ch.  9.3  “Tidsdiskret  PID-­‐regulator”  

Implementing a Level Control System in LabVIEW


8     Control  System  Simulation    

  Ch.  9.5  “Integratorbegrensing  (Anti-­‐windup)”  

Below  we  see  an  example  of  the  Formula  Node  in  LabVIEW:  

  Compare  the  results  from  one  of  the  built-­‐in  PID  controllers  with  the  results  from  the  PI  
controller  created  from  scratch.  

2.3 Feedforward   C ontrol  


Recommended  Chapters  in  the  Text  book:  

  Ch.  7  “Regulering  med  foroverkobling”  

Here  you  will  control  the  system  using  a  standard  PID  controller  together  with  a  
Feedforward  controller  in  order  improve  the  control  of  the  system.  

 
The  total  control  signal  then  becomes:  

𝑢 = 𝑢!"# + 𝑢!!  

Implementing a Level Control System in LabVIEW


9     Control  System  Simulation    

  Start  by  creating  a  standard  block  diagram  (pen  &  paper)  of  your  system  with  PID  
controller,  Feedforward  controller,  process.,  etc.  (This  block  diagram  should  be  part  of  the  
HMI)  

Design  of  Modelbased  Feedforward  Controller:  

Recommended  Chapters  in  the  Text  book:  

  Ch.  7.3  “Modellbasert  foroverkobling”  

We  create  our  feedforward  controller  based  on  the  process  model:  

1
ℎ= 𝐾 𝑢−𝐹!"#  
𝐴 !
In  this  model  is   𝐹!"#   a  noise  signal/disturbance  that  we  want  to  remove  by  using  
Feedforward.  

We  want  to  design  the  Feedforward  controller  so  that   𝐹!"#   is  eliminated.  

Tip!    

-­‐  We  solve  for  the  control  variable   𝑢   (replace   𝑢   with   𝑢! ),  and  substituting  the  process  
output  variable   ℎ   by  its  setpoint   ℎ!" .    

-­‐  We  also  assume  that  the  setpoint  is  constant,  i.e.   ℎ!" = 0.    

Implementation:  

  Implement  and  test  the  control  system  (feedback  +  feedforward  control)  

Does  the  feedforward  control  improve  the  level  control  (compare  with  not  using  
feedforward  control,  i.e.,  only  using  feedback  control)?  

You  should  make  it  possible  to  turn  the  feedforward  controller  on/off  from  the  Front  Panel  
so  we  can  easly  switch  between  using  only  pid  or  pid  +  feedforward.  

Implementing a Level Control System in LabVIEW


 

3 Apply  on  the  Real  Process  


Do  you  have  time  left?  Try  this  extra  challenge  (voluntary!!).  

3.1 Real   P rocess  


  Control  the  real  Level  System  (LM-­‐900)  that  we  have  on  the  Lab  using  your  PI  controller  
and  an  USB-­‐6008  DAQ  device.  

Below  we  see  LM-­‐900  Level  Control  System  

 
You  find  more  information  about  the  LM-­‐900  Level  Tank  here:  

http://home.hit.no/~hansha/?equipment=leveltank  

Below  we  see  the  control  loop:  

 
10  
11     Apply  on  the  Real  Process    

LabVIEW  USB-­‐6008  example:  

   

  The  real  process  is  noisy,  so  it  is  recommended  that  you  implement  and  use  a  Lowpass  
Filter/Measurement  Filter.  

Recommended  Chapters  in  the  Text  book:  

  Ch.  4.3.3  “Målefilter”  

Lowpass  Filter  differential  equation:  

𝑇! 𝑦!" (𝑡) = 𝑦! 𝑡 − 𝑦!" (𝑡)  

Since  we  shall  implement  the  Measurement  Filter  in  a  computer,  we  need  to  make  a  dicrete  
version  of  the  filter.  We  use  the  Euler  Backward  discretization  method:  

𝑥(𝑡! ) − 𝑥(𝑡!!! )
𝑥≈  
𝑇!

This  gives:  

𝑇! 𝑇!
𝑦!" (𝑡! ) = 𝑦!" (𝑡!!! ) + 𝑦 (𝑡 )  
𝑇! + 𝑇! 𝑇! + 𝑇! ! !

Where  we  define  the  following:  

𝑇!
≡ 𝑎  
𝑇! + 𝑇!

Finally,  we  get:  

𝑦!" (𝑡! ) = (1 − 𝑎)𝑦!" (𝑡!!! ) + 𝑎𝑦! (𝑡! )  

𝑇!
𝑎=  
𝑇! + 𝑇!

Implementing a Level Control System in LabVIEW


12     Apply  on  the  Real  Process    

This  discrete  Measurement  Filter  can  be  easily  implemented  in  a  computer  using  e.g.,  
LabVIEW,  C#,  etc.    

Golden  rule:  

𝑇!
𝑇! ≤  
5
 

Implementing a Level Control System in LabVIEW


 

  Telemark  University  College  

Faculty  of  Technology  

Kjølnes  Ring  56  

N-­‐3918  Porsgrunn,  Norway  

www.hit.no  

    Hans-­‐Petter  Halvorsen,  M.Sc.  

Telemark  University  College  

Department  of  Electrical  Engineering,  Information  Technology  and  Cybernetics  

E-­‐mail:  [email protected]  

Blog:  http://home.hit.no/~hansha/  

 
 

You might also like