https://www.halvorsen.
blog
Air Heater System
Hans-Petter Halvorsen
Heater Control
Unit
!"#$
Fan
% & (!"#$ )
Air Heater System
Aim:
*$ Control the Temperature on
!'() *+
the outlet (!"#$ )
%&
Heater
Control
Unit
!"#$ Temperature
Sensor on the 20 − 50℃
Fan outlet
Air In , - (!"#$ ) Air Out
Control Signal
to the Heater
1 − 53
0 − 53
Air Heater System
The system can be modelled as a 1. order system with time-delay
1
"̇#$% = −"#$% + +, - . − (/ + "012
(%
Model Values
You can assume the following values in your simulations:
The range for !"#$ could, e.g.,
be 20℃ ≤ !"#$ ≤ 50℃
https://www.halvorsen.blog
Air Heater in
LabVIEW
Hans-Petter Halvorsen
Air Heater in LabVIEW
You can implement the Air Heater in LabVIEW in
different ways:
• The model can be implemented using the blocks
(Integrator, Summation, Multiplication, etc.) from the
Simulation palette in LabVIEW (LabVIEW Control
Design and Simulation Module)
• Create a Discrete version of the differential equation
(use e.g., Euler Forward). Then use the Formula Node,
MathScript Node or MATLAB Node inside LabVIEW
You should test both these alternatives
Air Heater Model in LabVIEW
LabVIEW Control Design and Simulation Module
Note! This model is implemented in a so-called “Simulation Subsystem” (which is recommended!!!)
Simulation Subsystem
A Way to structure your code, similar to SubVIs
This is the recommended way to do it! – You can easily reuse your
Subsystems in different VIs and your code becomes more structured!
Select File -> New ..., Then choose “Simulation
Subsystem”.
Create your Model within the Simulation Subsystem
Ex
Model Simulation Example (Note! No PID Control in this Example) am
pl
e
Note! This is just an Example! – You should create your own personal Application
Clear the Charts, etc. Step Response
using “Property Nodes”
Manual
Control
Simulation SubSystem
Initialization
https://www.halvorsen.blog
Discretization
Hans-Petter Halvorsen
Continuous vs. Discrete Systems
" A computer can only deal with discrete signals
Continuous Signal
Discrete Signal
"
! "(# + 1)
"(#)
)* - Sampling Interval "(# − 1)
"(# − 1) - Previous Value )*
"(#) - Current Value
#
#+1
#−1
"(# − 1) - Next Value
# #)*
Continuous vs. Discrete Systems - Example
In this Example we have used Sampling Interval %& = 0.1+
"(!) Discrete Values
Continuous Signal
%& = 0.1+ %& = 0.1+ %& = 0.1+ %& = 0.1+ %& = 0.1+ ...
!
!=0 !=1 !=2 !=3 !=4 !=5 !%&
0=0 0 = 0.1+ 0 = 0.2+ 0 = 0.3+ 0 = 0.4+ 0 = 0.5+ 0 = !%&
Discretization of Air Heater
Continuous Model:
1
"̇#$% = −"#$% + +, - . − (/ + "012
(%
We can use e.g., the Euler Approximation in order to find the discrete Model:
3 5+1 −3 5 "6 - Sampling Time 3 5 - Present value
3̇ ≈
"6 3 5 + 1 - Next (future) value
The discrete Model will then be on the form:
3 5+1 =3 5 + …
We can then implement the discrete model in any programming language
Discretization of Air Heater
1
"̇#$% = −"#$% + +, - . − (/ + "012
We make a discrete version: (%
"#$% 3 + 1 − "#$% (3) 1
= −"#$% (3) + +, - 3 − (/ + "012
"6 (%
This gives the following discrete system:
"6
"#$% 3 + 1 = "#$% 3 + −"#$% (3) + +, - 3 − (/ + "012
(%
The Time delay (/ makes it a little complicated. We can simply by setting (/ = 0
"6
"#$% 3 + 1 = "#$% 3 + −"#$% (3) + +, - 3 + "012
(%
Discretization of Air Heater
Discrete version with Time delay !" = 0
%,
%&'( ) + 1 = %&'( ) + −%&'( ()) + 01 2 ) + %345
!(
We can use the following values in the simulation:
!( = 22
01 = 3.5
%345 = 21.5
We can set the Sampling Time %, = 0.1:
Discretization of Air Heater with Time Delay
We have the following discrete system:
!)
!"#$ % + 1 = !"#$ % + −!"#$ (%) + ./ 0 % − *1 + !234
*$
The Time delay *1 makes it more complicated to implement
*1 is in seconds and we need to convert it to discrete intervals in forms of %
56
The discrete version of *1 is: 78
Then we get:
!) *1
!"#$ % + 1 = !"#$ % + −!"#$ (%) + ./ 0 % − + !234
*$ !)
Assuming *1 = 2: and !) = 0.1: we get 0 % − 20 This mean that we have to remember
the 20 previous samples of 0(%)
https://www.halvorsen.blog
Control System
in LabVIEW
Hans-Petter Halvorsen
The PID Algorithm
!" 2
& ( = !" ' + 0 '34 + !" #% '̇
#$ 1
Where & is the controller output and ' is the Tuning Parameters:
control error:
' ( = * ( − ,(() !" Proportional Gain
* is the Reference Signal or Set-point
#$ Integral Time [sec. ]
, is the Process value, i.e., the Measured value #% Derivative Time [sec. ]
Built-in PID in LabVIEW
Example of Control System in LabVIEW
Ex
PID Control of Model in LabVIEW
am
pl
e
The Simulation Loop has some drawbacks/is more complicated to use than an ordinary While Loop. If we
use Simulatation Subsystems, we can use them inside a While Loop instead! - which becomes very handy!
For real applications that
involves more than just
simulations (such as DAQ,
File Logging, PID control
of the real process, etc.), I
recommend to use a
While Loop instead of a
Feedback Node Simulation Loop.
Ex
am
PID in LabVIEW pl
e
Front Panel
Normally we use seconds as unit for Ti and Td (which is
recommended!)
But the built-in PID algorithm in LabVIEW uses minutes
as unit!
Cluster
Block Diagram:
Trick:
Divide by 60
You could also put this code
into a new SubVI
Hans-Petter Halvorsen
University of South-Eastern Norway
www.usn.no
E-mail: [email protected]
Web: https://www.halvorsen.blog