control systems in labview - overview

50
Control Systems in LabVIEW Hans-Petter Halvorsen, M.Sc. http://home.hit.no/~hansha/?page=labview with Self-paced Step-by-Step Exercises

Upload: vudien

Post on 02-Jan-2017

242 views

Category:

Documents


2 download

TRANSCRIPT

ControlSystemsinLabVIEW

Hans-PetterHalvorsen,M.Sc.

http://home.hit.no/~hansha/?page=labview

withSelf-pacedStep-by-StepExercises

LabVIEWInstallation

Downloadthesoftwarehere:

http://home.hit.no/~hansha/?page=labviewThesearethemainmodulesweuseinthedifferentcoursesatTelemark UniversityCollege:

• LabVIEW (LabVIEW ProfessionalDevelopmentSystem32-Bit:English)

• NI-DAQmx (HardwareDriverforNIUSB-6008,NITC-01,etc.)• LabVIEW ControlDesignandSimulationModule• LabVIEWMathScript RTModuleNote!Thesepackagesareseparate downloads!

Note!YougettheSerialNumber fromyourTeacher,butthesoftwarecanbeused for30daysbeforeyouneed toenteravalidSerialNumber.

AllLabVIEWSoftwarecanbedownloadedhere:www.ni.com/download

LabVIEWTraining

• LabVIEWTrainingforStudents(NationalInstruments):

http://ni.com/students/learnlabview

• LabVIEWCourse:http://home.hit.no/~hansha/?training=labview

Hereyouwillfind lotsofVideos,TutorialsandExercises

Itisrecommendedthatyouwatchsomeofthevideosbeforeyoureadfurter

LearningbyDoing!

NationalInstrumentsisthevendorofLabVIEW

NationalInstrumentscreatesbothHardware andSoftware

LabVIEW=Fun!GraphicalProgramming:• VerydifferentfromtraditionalprogramminglikeVB,C#,

Maple,MATLAB,MathScript,etc.• Itismorelikea“drawingprogram”thanaProgramming

Language• Thismakesiteasytouseforthosewhoarenotprogrammers

(ordont likeprogrammingJ)• ExcellenttoolwhenusingHardware,whenyouneedtotake

Measurements(DAQ),etc.• Itisfunandmakesyouverycreative!

LabVIEWExample

PropertyNodes

SequenceStructure WhileLoop SubVI(Function/Method)

CaseStructure(if-else)Constants

Arrays

StopButtonCondition

(Whenshalltheloopend?)

LocalVariableComment

Note!Todosomethingwithanobject– Right-clickonit

LabVIEWhasthesamethingsasotherprogramminglanguages,butinagraphical way!

Hardware

cRIO

ZigBee

VisionSystem

Arduino

USB-6008

Wi-FiDAQ

TC-01

NOxSensor

Pt-100

AirHeater

WaterTank

DAQmxistheHardwareDriverneeded inorder tousehardwaredevices likeNIUSB-6008,NITC-01,etc.insideLabVIEW.Themoduleisavailableasapaletteonyourblockdiagram.

LabVIEWThisisthecoreLabVIEWinstallationthatinstallstheLabVIEWProgrammingEnvironment.

Thismoduleisatext-based toolthatisverysimilartoMATLAB.Thesyntaxissimilarto MATLAB,youcancreateandrunso-calledmfiles,etc.ThemoduleisavailablefromtheToolsmenuinsideLabVIEW.

LabVIEWMathScriptRTModule

LabVIEWControlDesignandSimulationModuleThismoduleisusedforcreatingControlandSimulationapplicationswithLabVIEW.HereyouwillfindPIDcontrollers,etc.Themoduleisavailableasapaletteonyourblockdiagram.

NI-DAQmx

http://www.ni.com/pdf/manuals/376039a.pdf

Students:TrysomeoftheseShortcutsandTools

ControlSystems

Hans-PetterHalvorsen,M.Sc.

DAQ– DataAcquisition

ADAQSystemconsistsof4parts:1. Physicalinput/outputsignals,sensors2. DAQdevice/hardware3. Driversoftware4. Yoursoftwareapplication(Applicationsoftware)

NIDAQmx Driver

YourAppcreatedwithLabVIEW

NITC-01ThermocoupleDevice,NIUSB6008DAQDevice,etc.

Sensors,etc.

ImplementingaControlSystemWhiletherealprocessiscontinuous,normallytheControllerandtheFilterisimplementedinacomputer.

PLC DCS

SCADA

TypesofIndustrialControlSystems

IndustrialControlSystems(ICS)

DistributedControlSystems(DCS)

DeltaV

PLC (ProgrammableLogicController)

SiemensPLC

PCbasedControlSystem/SCADASystem(Supervisory ControlAndDataAcquisition)

cRIO

IndustrialControlSystemsarecomputercontrolledsystemsthatmonitorandcontrolindustrialprocessesthatexistinthephysicalworld

Controller I/OModules

IndustrialPIDController

I/OModule

ProgrammableAutomationController (PAC)

LabVIEW

PC-basedControlSystem

IndustrialPIDControllerPIDControlusingLabVIEWandI/OModule

USB

PC-basedControlSystem

Analog InMeasurement(s)

AnalogOutControlSignal

ProcessExamples

Controller (PID)andLowpassFilterImplementation

ADConverter

DAConverter

I/OModule

USB-6008

+ +--

0-5V0-5V/1-5V

PC-basedControlSystem

PC-basedControlSystem–LabVIEWExample(Simulation)

MathematicalModeloftheProcess

FeedbackNode

FeedbackLoop

PC-basedControlSystem– LabVIEWExample(Realprocess)

SubVI thathandlestheI/ObetweenLabVIEWandtheRealProcessincludedFilterandScaling

PC-basedControlSystem– LabVIEWExample(HMI/GUI)

PIDControlinLabVIEW

Hans-PetterHalvorsen,M.Sc.

PIDControlusingLabVIEW

Built-inPIDControllers:

DiscretePIcreatedfromScratch

ControlSystem

PID Process

Sensor

r e u y

-

Controller

Kp Ti Td

v

ControlSystemimplementationinLabVIEW

PID Process

Sensor

r e u y-

Kp Ti Td

vControlSystemimplementationwith“Pen&Paper”

ASimulationLoopisusedinthisExample

PID Process

Sensor

r e u y-

Controller

Kp Ti Td

v

ControlSystemimplementationinLabVIEW

ControlSystemimplementationwith“Pen&Paper”

AWhileLoop isusedinthisExample

PIDControlinLabVIEWPIDPaletteinLabVIEW(PIDToolkit)

Note!Thefunctions“PID.vi”and“PIDAdvanced.vi”requires thatTi andTdisinminutes,whileit’snormaltousesecondsastheunitfortheseparameters.Youcanusethefollowing pieceofcodeinordertotransformthem:ThismeansweentervaluesforTi andTdinsecons ontheFrontPanelandthevaluesareconvertedtominutes inthecode.

Alternative1:Alternative2:

Thisalternativeusesseconds!

PIDControlDemoHelp->FindExamples...

Students:Trythe“GeneralPIDSimulator”examplethatisincludedwithLabVIEW

PIDController– Alternative1aPIDAdvancedVI+WhileLoop

PIDController– Alternative1b

Right-clickandselect“SubVI NodeSetup”

PIDAdvancedVI+SimulationLoop

PIDController– Alternative2aPIDblock+WhileLoop

PIDController– Alternative2bPIDblock+SimulationLoop

Discretization

Hans-PetterHalvorsen,M.Sc.

ADConverter

DAConverter

MeasurementSignal

ControlSignal

USB

AD&DAConverters

AD – AnalogtoDigitalDA – DigitaltoAnalog

ContinuousSignal

DiscreteSignal Acomputercanonlydealwithdiscretesignals

Note!Differentbooksusedifferentnotations

k=0,1,2,3,4,....

Ts=SamplingTime

WhenTs->0,wehaveacontinuoussignal,butinacomputerthatisnotpossible.

DiscretizationMethodsEulerforwardmethod:

Eulerbackwardmethod:

OthermethodsareZeroOrderHold(ZOH),Tustin’smethod,etc.

DiscretizationExampleGiventhefollowingcontinuous system:

WewillusetheEulerforwardmethod :

DiscreteSyntax

NoteThefollowing:

DiscretizationinLabVIEWusingtheFormulaNode

Example:

ImplementingdiscreteequationsinLabVIEWusingCsyntax

DiscreteLowpassFilter

Hans-PetterHalvorsen,M.Sc.

DiscreteLowpassFilter

WeusetheEulerBackwardmethod:

InverseLaplacethedifferentialEquation:

Thisgives:

Lowpass FilterTransferfunction:Wedefine:

Thisgives:

Thisalgorithmcanbeeasilyimplemented inaProgramming language

Filteroutput Noisyinput signal

DiscreteLowpassFilter- LabVIEW

TestingtheDiscreteLowpassFilter

WeseetheFilterremovesthenoise

DiscretePIController

Hans-PetterHalvorsen,M.Sc.

DiscretePIControllerContinuous PIController:

WeusetheEulerBackwardmethod:

Wemayset:

ThisgivesthefollowingdiscretePIalgorithm:

Thisalgorithmcanbeeasilyimplemented inaProgramming language

DiscretePIControllerLabVIEW

MathematicalModeloftheProcess

FeedbackNode

TestofDiscretePIControllerinLabVIEW

FeedbackLoop

PIDControllercreatedfromscratchinLabVIEW

PC-basedControlSystem– LabVIEWExample(HMI/GUI)

Hans-PetterHalvorsen,M.Sc.

DoyouneedmorePractice?- SelectaChallenge

CreateaPCbasedControlSystemasillustratedbelow:

Hans-PetterHalvorsen,M.Sc.

UniversityCollegeofSoutheastNorwaywww.usn.no

E-mail:[email protected]:http://home.hit.no/~hansha/