Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Telemark

University College
Department of Electrical Engineering, Information Technology and Cybernetics

Case Project




Control System in LabVIEW


HANS-PETTER H ALVORSEN, 2 013.08.16

Faculty of Technology,

Postboks 203, Kjlnes 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 ........................................................................................................................................... 3
1.1 Air Heater .................................................................................................................................. 3
1.2 Level Tank .................................................................................................................................. 4
2 Simulation ......................................................................................................................................... 6
2.1 DAQ Device ............................................................................................................................... 6
2.1.1 DAQ Assistant .................................................................................................................... 6
2.2 Model Implementation ............................................................................................................. 8
2.2.1 Model Adjustment ............................................................................................................. 9
3 Control System ............................................................................................................................... 11
3.1 Discrete Low-pass Filter .......................................................................................................... 11
3.2 Discrete PI Controller .............................................................................................................. 12
3.3 Control System ........................................................................................................................ 12
3.4 Controller Tuning .................................................................................................................... 13

ii

1 Modeling
1.1

Air Heater

Below we see the Air Heater.


Heater: The air is heated by an electrical heater. The supplied power is controlled by an external
voltage signal in the range (min power, max power).
Temperature sensors: Two Pt100 temperature elements are available (some of the Air Heaters have
only one). You can use Temperature sensor 1 in this assignment. The range is , and this
voltage range corresponds to the temperature range (with a linear relation).
A simple mathematical model of the system could be:
!"# =

1
!"# + ! ! + !"#
!

Where:

!"# is the air temperature at the tube outlet


[] is the control signal to the heater
! [] is the time-constant
! [ / ] is the heater gain
! [] is the time-delay representing air transportation and sluggishness in the heater

Modeling

!"# is the environmental (room) temperature. It is the temperature in the outlet air of
the air tube when the control signal to the heater has been set to zero for relatively long
time (some minutes)

The following values can be used:


! = 22
! = 0
! = 3.5

!"# = 21.5
Note! All of the devices are slightly different. It is necessary to run som experiments in order to find
the optimal values for your device. The procedure is described later.

1.2

Level Tank

The LM-900 Level Tank equipment will be used in this Lab Work:


Control Signal: A pump fills the tank with water from the reservoir. The pump speed can be
controlled by a voltage signal in the range 0 5. The pump can be controlled by an external
voltage signal at the FROM PC connector.
Measurement Signal: The measurement is a voltage signal in the range 0 5 available at the
TO PC connector. This voltage range corresponds to a level range of 0 20 , approximately
(unless you need a more accurate relation, you can assume this range in your applications).
Control System in LabVIEW

Modeling

Scaling: You need to scale the signal 0 5 to 0 20. The following linear relationship applies:
= +
A very simple (linear) model of the water tank is as follows:
! = ! !"#
or
=

1
!"#
! !

Where:

[] is the level in the water tank


[] is the pump control signal to the pump
! [2] is the cross-sectional area in the tank
! [(3/)/] is the pump gain

!"# [3/] is the outflow through the valve (this outflow can be modeled more
accurately taking into account the valve characteristic expressing the relation between
pressure drop across the valve and the flow through the valve).

The following values can be used:


! = 15( ! /)/
! = 80 !
!"# = 10 ! /
! = 0.1

Note! All of the devices are slightly different. It is necessary to run som experiments in order to find
the optimal values for your device. The procedure is described later.

Control System in LabVIEW

2 Simulation
2.1

DAQ Device

We we will use a USB-6008 DAQ unit in order to read data from the process () to the PC, and write
data () from the PC to the process.

2.1.1 DAQ Assistant


In order to communicate with the USB-6008 DAQ device within LabVIEW, we can use the DAQ
Assistant. Note! The NI-DAQmx software needs to be installed.
The DAQ Assistant is located from the Functions palette: Measurement I/O NI-DAQmx DAQ
Assist.
Analog In Example:

Analog Out Example:

Below we see a typical example in LabVIEW


where we read from the Analog Input port of
the DAQ device:

Below we see a typical example in LabVIEW


where we read from the Analog Output port of
the DAQ device:

Simulation


Loopback Test (Analog Out connected to Analog In):


Front Panel Example:


Control System in LabVIEW

2.2

Simulation

Model Implementation

The model (Level Tank or Air Heater) should be implemented using the blocks (Integrator, Transport
Delay, Summation, Multiplication, etc.) from the Simulation palette in LabVIEW:


Air Heater: The Air Heater model can be implemented as a Simulation Sub System:


Level Tank: The Level Tank model can be implemented as a Simulation Sub System:

Control System in LabVIEW

Simulation

2.2.1 Model Adjustment


The model parameters should be adjusted by some simple experiments where you run the simulator
in parallel with the real process. Use the Trial and Error method in order to find the unknown
parameters.
The LabVIEW program for adjusting the parameters could be like this:


This means that we plot the output of the model and the process and compare them after a change
in the control signal. If they are almost identical, we have found good model parameters, if not, we
need to adjust the modelparameters and try again.
LabVIEW Example:

Control System in LabVIEW

10

Simulation


Front Panel Example:

Control System in LabVIEW

3 Control System
This is a typical block diagram of the system:


Since LabVIEW is a graphical development environment, this can easly be implemented in LabVIEW.

3.1

Discrete Low-pass Filter

Transfer function for a first-order low-pass filter may be written:


=

1

! + 1

Where ! is the time-constant of the filter.


Create a discrete low-pass filter in LabVIEW using the Formula Node in LabVIEW. Create a SubVI of
the code. The user needs to be able to set the time constant of the filter ! from the outside, i.e., it
should be an input to the SubVI. The simulation Time-step ! needs also to be set from the outside.
Use the Euler Backward method:
=

! !!!

!

Perform simulations to make sure the filter works as expected. Explain/Show how you do this. Why
do we use a low-pass filter?
11

12

3.2

Control System

Discrete PI Controller

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:
Use the Euler Backward method:
=

! !!!

!

Make sure the PI controller works as expected.

3.3

Control System

Implement a control system using the discrete PI controller created. Use the mathematical model of
the system in the simulations.
You should also test our control system on the real process (Level Tank or Air Heater).
Note! You need to install the NI-DAQ-mx driver that makes it possible to use the USB-6008 device
together with LabVIEW.
Set up hardware and software according to the sketch below:

Control System in LabVIEW

13

Control System


Make sure to use your low-pass measurement filter created in a previous task.

3.4

Controller Tuning

Use the, e.g., Skogestads method in order to find proper PI parameters for the system.
Skogestads method:
In this task we assume the following process:
=

!"# ()

=
!!"
()
+ 1

The Skogestads method assumes you apply a step on the input () and then observe the response
and the output (), as shown below:

Control System in LabVIEW

14

Control System


If we have a model of the system (which we have in our case), we can use the following Skogestads
formulas for finding the PI(D) parameters directly:


Tip! In this task we can e.g., set ! = 10 and = 1.5 (or try with other values if you get poor PI
parameters).

Control System in LabVIEW







Telemark University College
Faculty of Technology
Kjlnes 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: hans.p.halvorsen@hit.no
Blog: http://home.hit.no/~hansha/

You might also like