control and simula/on in labview
TRANSCRIPT
Control and Simula.on in LabVIEW
Hans-‐Pe:er Halvorsen, M.Sc.
Hardware
cRIO
ZigBee
Vision System
Arduino
USB-‐6008
Wi-‐Fi DAQ
TC-‐01
NOx Sensor
Pt-‐100
Air Heater
Water Tank
LabVIEW Installa.on Download the soUware here: h:ps://lumen.ni.com/nicif/us/acadevallvdl/content.xhtml These are the main modules we use in the different courses at Telemark University College: • LabVIEW (LabVIEW Professional Development System 32-‐Bit: English) • LabVIEW MathScript RT Module • LabVIEW Control Design and Simula>on Module • LabVIEW PID and Fuzzy Logic Toolkit • LabVIEW System Iden>fica>on Toolkit • NI-‐DAQmx Note! These packages are separate downloads! Make sure to download and install all of them! Select the SoUware in the “August 2013” column (LabVIEW 2013).
Note! The Serial Number is in Fronter!
LabVIEW Training
• LabVIEW Training for Students (Na.onal Instruments):
h:p://www.ni.com/academic/students/learn-‐labview/
• LabVIEW Course: h:p://home.hit.no/~hansha/?training=labview
Control and Simula.on in LabVIEW Control Design & Simula.on Pale:e in LabVIEW
Simula.on Pale:e in LabVIEW PID Pale:e in LabVIEW
Control Design Pale:e in LabVIEW
Students: Check that you have all these pale:es
LabVIEW Control and Simula.on Example
We are going to learn to create such a system!
Simula.on in LabVIEW Simula.on Pale:e in LabVIEW
Simula>on Loop: Similar to a While Loop, but cusomized for used together with the Simula.on Blocks available in LabVIEW
Different Simula.on Blocks by Category • Con.nuous Systems • Discrete Systems • Nonlinar Systems • etc.
h:p://home.hit.no/%7Efinnh/videos/sim_module/sim_pale:e_overview/sim_pale:e_overview.html
Simula>on PaleJe Video (15 minutes)
Simula.on Example
Students: Implement and Simulate this system in LabVIEW
Simula.on Example -‐ Configura.on In the example the following simula.on parameters could be used (right-‐click on the Simula.on Loop border and select “Configure Simula.on parameters…”):
Simula.on Example -‐ Solu.ons
Step Response We see the Step Response is as expected!
PID Control in LabVIEW PID Pale:e in LabVIEW (PID Toolkit)
Note! The func.ons “PID.vi” and “PID Advanced.vi” requires that Ti and Td is in minutes, while it’s 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 entervalues for Ti and Td in secons on the Front Panel and the values are converted to minutes in the code.
Alterna>ve 1: Alterna>ve 2:
This alterna.ve uses seconds!
PID Example
Students: Replace u in the previous example with the built-‐in PID Controller (use Alterna.ve 2)
PID Example -‐ Solu.ons
Front Panel:
PID Example -‐ Solu.ons
Block Diagram:
PID Example – Con.nuous Simula.on
Students: Run your Simula.on with these changes
Add a Stop Bu:on and a “Halt Simula.on” block
Right-‐click on the Simula.on Loop border and select “Configure Simula.on Parameters…”
PID Example – Con.nuous Simula.on -‐ Solu.on
Create a Subsystem of this part
Simula.on Subsystem A Way to structure your code, similar to SubVIs
Students: Change your code above where you create a Simula.on Sub System for your Process
File -‐> New… This is the recommended way to do it! – You can easly reuse your Subsystems in different VIs and your code becomes more structured!
Simula.on Subsystem -‐ Solu.ons
Simula.on Subsystem – Solu.ons2
Simula.on Sub Systems
Now your code has become really simple to understand!
Simula.ons using a While Loop The Simula.on Loop has some drawbacks/is more complicated to use than an ordinary While Loop. If we use simulata.on Subsystems, we can use them inside a While Loop instead!
So for real applica.ons that involves more than just simula.ons, I recommend to use a While Loop instead of a Simula.on Loop.
Simula.on Subsystems
Hans-‐PeJer Halvorsen, M.Sc. Telemark University College Faculty of Technology Department of Electrical Engineering, Informa>on Technology and Cyberne>cs
E-‐mail: [email protected] Blog: hJp://home.hit.no/~hansha/
22