SlideShare a Scribd company logo
Hans-Petter Halvorsen
https://www.halvorsen.blog
Discrete Control
Systems in LabVIEW
• Introduction
• Mathematical Model
– Discretization – We will make a Discrete version of
the Model/Differential Equation
• PID Controller
– Discrete PI Controller – We will make a Discrete
version of the standard continuous PI Controller
• Control System
– We make a basic Control System where the Discrete
Model and Discrete PI Controller are used
Contents
Hans-Petter Halvorsen
https://www.halvorsen.blog
Introduction
Table of Contents
Introduction
• We will simulate a 1. Order
Process/Differential Equation
–We will Implement a Discrete version of
the Model and perform Simulations
• We will create a basic Control System
–We will make and Implement a Discrete
PI Controller and perform Simulations
Control System
Controller Process
𝑟 𝑢
𝑒
−
Reference
Value
Control
Signal
𝑦
𝑦
PID Controller
The purpose with a Control System is to Control a Dynamic System, e.g., an industrial
process, an airplane, a self-driven car, etc. (a Control System is “everywhere” today)
Feedback Loop
Hans-Petter Halvorsen
https://www.halvorsen.blog
Mathematical Model
Table of Contents
1. Order System
1. Order
Process
𝑢 𝑦
̇
𝑥 = −𝑎𝑥 + 𝑏𝑢
𝑦 = 𝑥
In order to simulate this model in LabVIEW you can make a discrete version of the
model, or you can implement it as a “Block Diagram” using the features in
LabVIEW Control Design and Simulation Module
Differential Equation of a 1. order System:
̇
𝑦 =
1
𝑇
(−𝑦 + 𝐾𝑢)
Where 𝐾 is the Gain and 𝑇 is the Time constant
̇
𝑦 = −𝑎𝑦 + 𝑏𝑢 Dynamic
System
𝑢(𝑡) 𝑦(𝑡)
Assume the following general Differential Equation:
or:
Where 𝑎 =
!
"
and 𝑏 =
#
"
This differential equation represents a 1. order dynamic system
Assume 𝑢(𝑡) is a step (𝑈), then we can find that the solution to the differential equation is:
𝑦 𝑡 = 𝐾𝑈(1 − 𝑒$
%
")
Input Signal Output Signal
(by using Laplace)
1. Order System
100%
63%
𝐾𝑈
𝑡
𝑇
𝑦 𝑡 = 𝐾𝑈(1 − 𝑒/
0
1)
𝐻 𝑠 =
𝑦(𝑠)
𝑢(𝑠)
=
𝐾
𝑇𝑠 + 1
𝑦(𝑡)
1. Order Step Response
Time constant
𝐾 is the Gain
Discretization
We have the continuous differential equation: ̇
𝑥 = −𝑎𝑥 + 𝑏𝑢
We apply Euler: ̇
𝑥 ≈
& '(! $& '
"!
Then we get:
𝑥 𝑘 + 1 − 𝑥 𝑘
𝑇)
= −𝑎𝑥(𝑘) + 𝑏𝑢(𝑘)
This gives the following discrete differential equation (difference equation):
𝑥 𝑘 + 1 = (1 − 𝑇!𝑎)𝑥(𝑘) + 𝑇!𝑏𝑢(𝑘)
This equation can easily be implemented in any text-based
programming language or the Formula Node in LabVIEW
Where 𝑎 =
!
"
and 𝑏 =
#
"
Discrete Model in LabVIEW
𝑥 𝑘 + 1 = (1 − 𝑇!𝑎)𝑥(𝑘) + 𝑇!𝑏𝑢(𝑘)
Simulation in LabVIEW
Code
Hans-Petter Halvorsen
https://www.halvorsen.blog
PID Controller
Table of Contents
Control System
Controller Process
𝑟 𝑢
𝑒
−
Reference
Value
Control
Signal
𝑦
𝑦
PID Controller
The purpose with a Control System is to Control a Dynamic System, e.g., an industrial
process, an airplane, a self-driven car, etc. (a Control System is “everywhere” today)
Feedback Loop
PID Controller
𝑢 𝑡 = 𝐾*𝑒 +
𝐾*
𝑇+
(
,
-
𝑒𝑑𝜏 + 𝐾*𝑇. ̇
𝑒
P I D
Proportional Gain Integral Time Derivative Time
𝐾. 𝑇/ 𝑇0
Tuning Parameters:
𝑢! = 𝑢!"# + 𝐾$ 𝑒! − 𝑒!"# +
𝐾$
𝑇%
𝑇&𝑒!
𝑒/ = 𝑟/ − 𝑦/
Discrete PI Controller that we can implement in different programming languages:
𝑢 𝑡 = 𝐾!𝑒 +
𝐾!
𝑇"
4
#
$
𝑒𝑑𝜏
PI Controller
Very often we just need a PI Controller:
𝑢 𝑡 = 𝐾"𝑒 +
𝐾"
𝑇#
4
$
%
𝑒𝑑𝜏
We start with the continuous PI Controller:
̇
𝑥 ≈
𝑥 𝑘 − 𝑥 𝑘 − 1
𝑇!
We can use the Euler Backward Discretization method:
Where 𝑇) is the Sampling Time
Then we get:
𝑢& − 𝑢&'(
𝑇!
= 𝐾"
𝑒& − 𝑒&'(
𝑇!
+
𝐾"
𝑇#
𝑒&
We derive both sides in order to remove
the Integral:
̇
𝑢 = 𝐾* ̇
𝑒 +
𝐾*
𝑇+
𝑒
Finally, we get:
𝑢7 = 𝑢7/8 + 𝐾9 𝑒7 − 𝑒7/8 +
𝐾9
𝑇:
𝑇;𝑒7
Where 𝑒' = 𝑟' − 𝑦'
Discrete PI Controller
Hans-Petter Halvorsen
https://www.halvorsen.blog
Control System
Table of Contents
Control System
Controller Process
𝑟 𝑢
𝑒
−
Reference
Value
Control
Signal
𝑦
𝑦
PID Controller
The purpose with a Control System is to Control a Dynamic System, e.g., an industrial
process, an airplane, a self-driven car, etc. (a Control System is “everywhere” today)
Feedback Loop
Control System in LabVIEW
Built-in PID Controller
Discrete PI Controller
𝑒! = 𝑟! − 𝑦!
𝑢! = 𝑢!"# + 𝐾$ 𝑒! − 𝑒!"# +
𝐾$
𝑇%
𝑇&𝑒!
Discrete PI Algorithm:
Discrete PI Controller (Alternative Solution)
Control System in LabVIEW
Control System Code
Summary
• A Basic Control System has been made using LabVIEW
• Lots of Improvements can be made, e.g.,:
– Improve GUI
• More Features/Functionality, More Intuitive and more user-friendly
– Improve Code Structure, e.g., use a State Machine principle
– Make a more robust PI(D) Controller
– Use and Test with a more complicated Process/Model
– Find better PI(D) Parameters using different Tuning methods,
e.g., Ziegler-Nichols, Skogestad, etc.
– Connect and Control a Real Process using a DAQ Device
– Etc.
Hans-Petter Halvorsen
University of South-Eastern Norway
www.usn.no
E-mail: hans.p.halvorsen@usn.no
Web: https://www.halvorsen.blog

More Related Content

PDF
Frequency Response with MATLAB Examples.pdf
PPT
Chapter 1 Automatic Controloverview
PDF
Clase 01-introduccion-a-la-ing-control (1)
PPT
week1a-cohhgghgggggggggggggggggntrol.ppt
PPTX
Closed-loop control system modelling_pid.pptx
PPTX
Control System Design
PPTX
Introduction to Automatic Control Systems
PPT
1.intro lcs (ch1)
Frequency Response with MATLAB Examples.pdf
Chapter 1 Automatic Controloverview
Clase 01-introduccion-a-la-ing-control (1)
week1a-cohhgghgggggggggggggggggntrol.ppt
Closed-loop control system modelling_pid.pptx
Control System Design
Introduction to Automatic Control Systems
1.intro lcs (ch1)

Similar to Discrete Control Sysfstem in LabVIEW.pdf (20)

PPTX
Robust Presentation on h ifiinity based full state feedback controller design...
PPTX
Control system basics, block diagram and signal flow graph
PPTX
Robust and Tuneable Family of Gossiping Algorithms
PPT
14446351.ppt
PPTX
Oop object oriented programing topics
PPTX
TN 12 computer Science - ppt CHAPTER-6.pptx
PPTX
Control System Modeling case study with complete explanation
PPTX
Week 14 pid may 24 2016 pe 3032
PPT
Lect 3-4 Zaheer Abbas
PDF
Introduction to control system
PPTX
Control systems engineering
PDF
Introduction to material Engineering 2KIU.pdf
PDF
STPA and Software Verification
PPTX
CONTROL SYSTEMS_AUTOMOBILE_UNIT_i_MATHEMATICAL_MODELING
PDF
Modern Control - Lec 01 - Introduction to Control System
PDF
Arduino - Module 1.pdf
PDF
detail of flowchart and algorithm that are used in programmingpdf
PDF
Algorithm manual
PDF
Algorithm Flowchart Manual ALGORITHM FLOWCHART MANUAL For STUDENTS
PPTX
Design of imc based controller for industrial purpose
Robust Presentation on h ifiinity based full state feedback controller design...
Control system basics, block diagram and signal flow graph
Robust and Tuneable Family of Gossiping Algorithms
14446351.ppt
Oop object oriented programing topics
TN 12 computer Science - ppt CHAPTER-6.pptx
Control System Modeling case study with complete explanation
Week 14 pid may 24 2016 pe 3032
Lect 3-4 Zaheer Abbas
Introduction to control system
Control systems engineering
Introduction to material Engineering 2KIU.pdf
STPA and Software Verification
CONTROL SYSTEMS_AUTOMOBILE_UNIT_i_MATHEMATICAL_MODELING
Modern Control - Lec 01 - Introduction to Control System
Arduino - Module 1.pdf
detail of flowchart and algorithm that are used in programmingpdf
Algorithm manual
Algorithm Flowchart Manual ALGORITHM FLOWCHART MANUAL For STUDENTS
Design of imc based controller for industrial purpose
Ad

More from ManhHoangVan (20)

PDF
MQTfsdaffffffffffffffffffffffffffffffffffffffffT.pdf
PPTX
Modbusprofibus01profibus01profibus01.pptx
PPTX
HARprofibus01profibus01profibus01profibus01T.pptx
PDF
OPprofibus01profibus01profibus01profibus01C.pdf
PPTX
Profinetprofibus01profibus01profibus01profibus01.pptx
PPTX
profibus01profiprofibus01profibus01bus01.pptx
PDF
04. SQL Servesdafr with CSharp WinForms.pdf
PDF
05. Datalogging SQL Server with CSharp WinForms.pdf
PDF
09. OPC DA with Measurement Studio 2019.pdf
PDF
Create and Use Multipfsfsdfafasle Forms.pdf
PDF
Azure DevOfsdfsdfsfasfsdfasfsdfsdfsdps.pdf
PDF
Using USB-6008fdsfsfsdfaafds in CSharp.pdf
PDF
TC01 - Visvvsvafaffsdfsfsdfaual Studio.pdf
PPTX
OPC_Basics_Webcasfsfsfdsfsdafsdfsdfsdfasfdasft_SWTB.pptx
PPTX
OPdfsafsdfasdfaaaaaaafdsfasdfdasfdasfdasfC.pptx
PPT
4597231dsafsfsafsafsfsafsfaffsdfdsfsfds.ppt
PDF
1 circuit variables1 circuit variables.pdf
PDF
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
PDF
Lllsjjsjsjjshshjshjsjjsjjsjjzjsjjzjjzjjzj
PDF
discrete_state_spaceeeeeerrrrrrrrrrrrrrrr
MQTfsdaffffffffffffffffffffffffffffffffffffffffT.pdf
Modbusprofibus01profibus01profibus01.pptx
HARprofibus01profibus01profibus01profibus01T.pptx
OPprofibus01profibus01profibus01profibus01C.pdf
Profinetprofibus01profibus01profibus01profibus01.pptx
profibus01profiprofibus01profibus01bus01.pptx
04. SQL Servesdafr with CSharp WinForms.pdf
05. Datalogging SQL Server with CSharp WinForms.pdf
09. OPC DA with Measurement Studio 2019.pdf
Create and Use Multipfsfsdfafasle Forms.pdf
Azure DevOfsdfsdfsfasfsdfasfsdfsdfsdps.pdf
Using USB-6008fdsfsfsdfaafds in CSharp.pdf
TC01 - Visvvsvafaffsdfsfsdfaual Studio.pdf
OPC_Basics_Webcasfsfsfdsfsdafsdfsdfsdfasfdasft_SWTB.pptx
OPdfsafsdfasdfaaaaaaafdsfasdfdasfdasfdasfC.pptx
4597231dsafsfsafsafsfsafsfaffsdfdsfsfds.ppt
1 circuit variables1 circuit variables.pdf
Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06Lect-06
Lllsjjsjsjjshshjshjsjjsjjsjjzjsjjzjjzjjzj
discrete_state_spaceeeeeerrrrrrrrrrrrrrrr
Ad

Recently uploaded (20)

PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPT
Mechanical Engineering MATERIALS Selection
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
Well-logging-methods_new................
PPTX
Construction Project Organization Group 2.pptx
PDF
Digital Logic Computer Design lecture notes
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Automation-in-Manufacturing-Chapter-Introduction.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Internet of Things (IOT) - A guide to understanding
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Operating System & Kernel Study Guide-1 - converted.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Mechanical Engineering MATERIALS Selection
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Well-logging-methods_new................
Construction Project Organization Group 2.pptx
Digital Logic Computer Design lecture notes
Lecture Notes Electrical Wiring System Components
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
CH1 Production IntroductoryConcepts.pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf

Discrete Control Sysfstem in LabVIEW.pdf

  • 2. • Introduction • Mathematical Model – Discretization – We will make a Discrete version of the Model/Differential Equation • PID Controller – Discrete PI Controller – We will make a Discrete version of the standard continuous PI Controller • Control System – We make a basic Control System where the Discrete Model and Discrete PI Controller are used Contents
  • 4. Introduction • We will simulate a 1. Order Process/Differential Equation –We will Implement a Discrete version of the Model and perform Simulations • We will create a basic Control System –We will make and Implement a Discrete PI Controller and perform Simulations
  • 5. Control System Controller Process 𝑟 𝑢 𝑒 − Reference Value Control Signal 𝑦 𝑦 PID Controller The purpose with a Control System is to Control a Dynamic System, e.g., an industrial process, an airplane, a self-driven car, etc. (a Control System is “everywhere” today) Feedback Loop
  • 7. 1. Order System 1. Order Process 𝑢 𝑦 ̇ 𝑥 = −𝑎𝑥 + 𝑏𝑢 𝑦 = 𝑥 In order to simulate this model in LabVIEW you can make a discrete version of the model, or you can implement it as a “Block Diagram” using the features in LabVIEW Control Design and Simulation Module Differential Equation of a 1. order System:
  • 8. ̇ 𝑦 = 1 𝑇 (−𝑦 + 𝐾𝑢) Where 𝐾 is the Gain and 𝑇 is the Time constant ̇ 𝑦 = −𝑎𝑦 + 𝑏𝑢 Dynamic System 𝑢(𝑡) 𝑦(𝑡) Assume the following general Differential Equation: or: Where 𝑎 = ! " and 𝑏 = # " This differential equation represents a 1. order dynamic system Assume 𝑢(𝑡) is a step (𝑈), then we can find that the solution to the differential equation is: 𝑦 𝑡 = 𝐾𝑈(1 − 𝑒$ % ") Input Signal Output Signal (by using Laplace) 1. Order System
  • 9. 100% 63% 𝐾𝑈 𝑡 𝑇 𝑦 𝑡 = 𝐾𝑈(1 − 𝑒/ 0 1) 𝐻 𝑠 = 𝑦(𝑠) 𝑢(𝑠) = 𝐾 𝑇𝑠 + 1 𝑦(𝑡) 1. Order Step Response Time constant 𝐾 is the Gain
  • 10. Discretization We have the continuous differential equation: ̇ 𝑥 = −𝑎𝑥 + 𝑏𝑢 We apply Euler: ̇ 𝑥 ≈ & '(! $& ' "! Then we get: 𝑥 𝑘 + 1 − 𝑥 𝑘 𝑇) = −𝑎𝑥(𝑘) + 𝑏𝑢(𝑘) This gives the following discrete differential equation (difference equation): 𝑥 𝑘 + 1 = (1 − 𝑇!𝑎)𝑥(𝑘) + 𝑇!𝑏𝑢(𝑘) This equation can easily be implemented in any text-based programming language or the Formula Node in LabVIEW Where 𝑎 = ! " and 𝑏 = # "
  • 11. Discrete Model in LabVIEW 𝑥 𝑘 + 1 = (1 − 𝑇!𝑎)𝑥(𝑘) + 𝑇!𝑏𝑢(𝑘)
  • 13. Code
  • 15. Control System Controller Process 𝑟 𝑢 𝑒 − Reference Value Control Signal 𝑦 𝑦 PID Controller The purpose with a Control System is to Control a Dynamic System, e.g., an industrial process, an airplane, a self-driven car, etc. (a Control System is “everywhere” today) Feedback Loop
  • 16. PID Controller 𝑢 𝑡 = 𝐾*𝑒 + 𝐾* 𝑇+ ( , - 𝑒𝑑𝜏 + 𝐾*𝑇. ̇ 𝑒 P I D Proportional Gain Integral Time Derivative Time 𝐾. 𝑇/ 𝑇0 Tuning Parameters:
  • 17. 𝑢! = 𝑢!"# + 𝐾$ 𝑒! − 𝑒!"# + 𝐾$ 𝑇% 𝑇&𝑒! 𝑒/ = 𝑟/ − 𝑦/ Discrete PI Controller that we can implement in different programming languages: 𝑢 𝑡 = 𝐾!𝑒 + 𝐾! 𝑇" 4 # $ 𝑒𝑑𝜏 PI Controller Very often we just need a PI Controller:
  • 18. 𝑢 𝑡 = 𝐾"𝑒 + 𝐾" 𝑇# 4 $ % 𝑒𝑑𝜏 We start with the continuous PI Controller: ̇ 𝑥 ≈ 𝑥 𝑘 − 𝑥 𝑘 − 1 𝑇! We can use the Euler Backward Discretization method: Where 𝑇) is the Sampling Time Then we get: 𝑢& − 𝑢&'( 𝑇! = 𝐾" 𝑒& − 𝑒&'( 𝑇! + 𝐾" 𝑇# 𝑒& We derive both sides in order to remove the Integral: ̇ 𝑢 = 𝐾* ̇ 𝑒 + 𝐾* 𝑇+ 𝑒 Finally, we get: 𝑢7 = 𝑢7/8 + 𝐾9 𝑒7 − 𝑒7/8 + 𝐾9 𝑇: 𝑇;𝑒7 Where 𝑒' = 𝑟' − 𝑦' Discrete PI Controller
  • 20. Control System Controller Process 𝑟 𝑢 𝑒 − Reference Value Control Signal 𝑦 𝑦 PID Controller The purpose with a Control System is to Control a Dynamic System, e.g., an industrial process, an airplane, a self-driven car, etc. (a Control System is “everywhere” today) Feedback Loop
  • 21. Control System in LabVIEW
  • 23. Discrete PI Controller 𝑒! = 𝑟! − 𝑦! 𝑢! = 𝑢!"# + 𝐾$ 𝑒! − 𝑒!"# + 𝐾$ 𝑇% 𝑇&𝑒! Discrete PI Algorithm:
  • 24. Discrete PI Controller (Alternative Solution)
  • 25. Control System in LabVIEW
  • 27. Summary • A Basic Control System has been made using LabVIEW • Lots of Improvements can be made, e.g.,: – Improve GUI • More Features/Functionality, More Intuitive and more user-friendly – Improve Code Structure, e.g., use a State Machine principle – Make a more robust PI(D) Controller – Use and Test with a more complicated Process/Model – Find better PI(D) Parameters using different Tuning methods, e.g., Ziegler-Nichols, Skogestad, etc. – Connect and Control a Real Process using a DAQ Device – Etc.
  • 28. Hans-Petter Halvorsen University of South-Eastern Norway www.usn.no E-mail: hans.p.halvorsen@usn.no Web: https://www.halvorsen.blog