http://home.hit.no/~hansha/?
page=labview
Control Systems in LabVIEW
with Self-paced Step-by-Step Exercises Hans-Petter Halvorsen, M.Sc.
LabVIEW Installation
Note! You get the Serial Number from your Teacher,
but the software can be used for 30 days before you
Download the software here: need to enter a valid Serial Number.
http://home.hit.no/~hansha/?page=labview
These are the main modules we use in the different
courses at Telemark University College:
LabVIEW (LabVIEW Professional Development System 32-Bit: English)
NI-DAQmx (Hardware Driver for NI USB-6008, NI TC-01, etc.)
LabVIEW Control Design and Simulation Module
LabVIEW MathScript RT Module
Note! These packages are separate downloads!
All LabVIEW Software can be downloaded here: www.ni.com/download
LabVIEW Training
Here you will find lots of Videos, Tutorials and Exercises
LabVIEW Training for Students (National Instruments):
http://ni.com/students/learnlabview
LabVIEW Course:
http://home.hit.no/~hansha/?training=labview
Learning by Doing!
It is recommended that you watch some of the videos before you read furter
National Instruments is National Instruments creates
the vendor of LabVIEW both Hardware and Software
LabVIEW = Fun!
Graphical Programming:
Very different from traditional programming like VB, C#,
Maple, MATLAB, MathScript, etc.
It is more like a drawing program than a Programming
Language
This makes it easy to use for those who are not programmers
(or dont like programming J)
Excellent tool when using Hardware, when you need to take
Measurements (DAQ), etc.
It is fun and makes you very creative!
LabVIEW Example
LabVIEW has the same things as other programming languages, but in a graphical way!
Sequence Structure Comment While Loop Sub VI Local Variable
(Function/Method)
Case Structure Stop Button
Property Nodes Constants (if-else) Condition
Arrays Note! To do something with an object Right-click on it (When shall the loop end?)
Hardware Air Heater
Wi-Fi DAQ
Water Tank
USB-6008
Pt-100
TC-01
ZigBee Arduino
Vision System
cRIO
NOx Sensor
LabVIEW
This is the core LabVIEW installation that installs
the LabVIEW Programming Environment.
LabVIEW MathScript RT Module
This module is a text-based tool that is very similar to MATLAB. The syntax
is similar to MATLAB, you can create and run so-called m files, etc. The
module is available from the Tools menu inside LabVIEW.
LabVIEW Control Design and Simulation Module
This module is used for creating Control and Simulation applications with
LabVIEW. Here you will find PID controllers, etc. The module is available
as a palette on your block diagram.
NI-DAQmx
DAQmx is the Hardware Driver needed in order to use hardware devices like NI
USB-6008, NI TC-01, etc. inside LabVIEW. The module is available as a palette on
your block diagram.
http://www.ni.com/pdf/manuals/376039a.pdf
Students: Try some of these Shortcuts and Tools
Control Systems
Hans-Petter Halvorsen, M.Sc.
Your App created
DAQ Data Acquisition with LabVIEW
Sensors, etc.
A DAQ System consists of 4 parts:
NI TC-01 Thermocouple Device, NI DAQmx Driver
1. Physical input/output signals, sensors
NI USB 6008 DAQ Device, etc.
2. DAQ device/hardware
3. Driver software
4. Your software application (Application software)
Implementing a Control System
While the real process is continuous, normally the Controller and the Filter is implemented
in a computer.
Types of Industrial Control Systems
DCS
PLC
SCADA
Industrial Control Systems (ICS)
Industrial Control Systems are computer controlled systems that monitor and control industrial
processes that exist in the physical world
cRIO
LabVIEW
Programmable Automation
Controller (PAC) Industrial PID
PC based Control System/SCADA
Controller
System (Supervisory Control And
Data Acquisition) I/O Module
Distributed Control Systems (DCS)
PLC (Programmable Logic Controller)
Controller I/O Modules
DeltaV
Siemens PLC
PC-based Control System
PID Control using LabVIEW and I/O Module
Industrial PID Controller
PC-based Control System
Process Examples
0-5V/1-5V 0-5V
Analog In Analog Out
Controller (PID) and Lowpass Filter
Measurement(s) Control Signal
- + - + Implementation
I/O Module AD Converter
DA Converter USB
USB-6008
PC-based Control System
PC-based Control System
LabVIEW Example (Simulation)
Mathematical Model
of the Process
Feedback Loop
Feedback Node
PC-based Control System LabVIEW Example (Real process)
SubVI that handles
the I/O between
LabVIEW and the Real
Process included Filter
and Scaling
PC-based Control System LabVIEW Example (HMI/GUI)
PID Control in LabVIEW
Hans-Petter Halvorsen, M.Sc.
PID Control using LabVIEW
Built-in PID
Controllers:
Discrete PI created from Scratch
Control System
v
Controller
Kp Ti Td
r e u y
PID Process
-
Sensor
Control System implementation with Pen & Paper v
Kp Ti Td
r e u y
PID Process
-
Sensor
Control System implementation in LabVIEW
A Simulation Loop is used in this Example
Control System implementation with Pen & Paper
v
Controller
Kp Ti Td
r e u y
PID Process
-
Sensor
Control System implementation in LabVIEW
A While Loop is used in this Example
Alternative 1:
PID Control in LabVIEW
Alternative 2:
PID Palette in LabVIEW (PID Toolkit)
This alternative
uses seconds!
Note! The functions PID.vi and PID Advanced.vi requires that Ti and Td is in
minutes, while its normal to use seconds as the unit for these parameters. You can
use the following piece of code in order to transform them:
This means we enter values for Ti and Td in secons on the Front Panel and the values
are converted to minutes in the code.
Help -> Find Examples...
PID Control Demo
Students: Try the General PID Simulator
example that is included with LabVIEW
PID Controller Alternative 1a
PID Advanced VI + While Loop
PID Controller Alternative 1b
Right-click and select
SubVI Node Setup
PID Advanced VI + Simulation Loop
PID Controller Alternative 2a
PID block + While Loop
PID Controller Alternative 2b
PID block + Simulation Loop
Discretization
Hans-Petter Halvorsen, M.Sc.
AD & DA Converters
Measurement Signal
AD Converter
Control Signal DA Converter
USB
AD Analog to Digital
DA Digital to Analog
Continuous Signal
Discrete Signal A computer can only deal
with discrete signals
Note!
Different
books use Ts = Sampling Time
different
notations When Ts -> 0, we have a continuous signal,
but in a computer that is not possible.
k = 0, 1, 2, 3, 4, ....
Discretization Methods
Euler forward method:
Euler backward method:
Other methods are Zero Order Hold (ZOH), Tustins method, etc.
Discretization Example
Given the following continuous system:
We will use the Euler forward method :
Discrete Syntax
Note The following:
Discretization in LabVIEW using the Formula Node
Implementing discrete equations in
LabVIEW using C syntax
Example:
Discrete Lowpass Filter
Hans-Petter Halvorsen, M.Sc.
Discrete Lowpass Filter
Lowpass Filter Transfer function:
We define:
Inverse Laplace the differential Equation:
This gives:
We use the Euler Backward method:
Filter output Noisy input signal
This gives: This algorithm can be easily implemented in a
Programming language
Discrete Lowpass Filter - LabVIEW
Testing the Discrete Lowpass Filter
We see the Filter removes the noise
Discrete PI Controller
Hans-Petter Halvorsen, M.Sc.
Discrete PI Controller
Continuous PI Controller:
We may set:
This gives the following discrete PI algorithm:
We use the Euler Backward method:
This algorithm can be easily implemented in a Programming language
Discrete PI Controller
LabVIEW
Test of Discrete PI Controller in LabVIEW
PID Controller created Mathematical Model
from scratch in LabVIEW of the Process
Feedback Loop
Feedback Node
PC-based Control System LabVIEW Example (HMI/GUI)
Do you need more Practice? - Select a Challenge
Hans-Petter Halvorsen, M.Sc.
Create a PC based Control System as illustrated below:
Hans-Petter Halvorsen, M.Sc.
University College of Southeast Norway
www.usn.no
E-mail: [email protected]
Blog: http://home.hit.no/~hansha/