Vous êtes sur la page 1sur 76

LabVIEW for Real-Time Control in

Measurement and Automation


National Instruments LabVIEW RT
and the RT Series Hardware
Agenda
Definitions
PID Control
Fuzzy Logic Control
Control Issues
Real-Time Control
Control Overview

Analyze Output
Determine needs Data to process

Open-Loop Control
System determines output needs
No Feeback
Control Overview

Acquire Analyze Output


Data from process Determine needs Data to process

Closed-Loop Control
Data acquired to determine current state
Control system determines output needs
Feedback provided
Control Overview

Acquire Analyze Output


Temperature Heater / AC
Thermometer
Controller turned on, off

Temperature Example
Data acquired from thermometer
Controller determines temperature status (too high? Low?)
Heater or AC turned on / off
Control Terminology
Terms: Examples:
Process variable Temperature
Setpoint Desired temperature
Controller output Heater voltage
Plant Furnace
Acquire
Acquire
Data from process
Single-point acquisition
Allows fast control loops
Analysis
Analyze
Determine needs
Analyze acquired points
Use full range of LabVIEW functions
Mean, RMS, FFT,
Single-point versions of multiple-point functions
Analysis Functionality
Array-Based Analysis Point-by-Point Analysis
1. Acquire all points 1. Acquire one point
of data stream of data stream
2. Filter and analyze 2. Filter and analyze
3. Make decision 3. Make decision
4. Generate report 4. Generate report
Demo: Single-point analysis

1- PointByPoint.vi
Software only
Analysis
Analyze
Determine needs
Analyze acquired points
Determine proper output signal
Simple Control
PID
Fuzzy Logic
How do you implement Control?
Analyze
Determine needs
Evaluate Error
Proportionally
Evaluate History
Integrate error over time
Evaluate dynamics
Rate of change of error- derivative
PID Control Analyze
Determine needs
PID Parameters Analyze
Determine needs

Proportional gain Kc

Integral gain Kc/Ti


Ti is the integral time constant or reset time

Derivative gain Kc*Td


Td is the derivative time constant or rate time
PID Gains P
Proportional gain K c
The Sledgehammer
Immediate controller
response to setpoint change
PV may not settle exactly on
SP
1 MOhm 1 MOhm
+ +

Excitation 1 MOhm
Analog In
.153uF .153uF
- -

Demo: P only

2- Simple PID.vi
DAQ, Simple Circuit
PID Gains PI
Integral gain Kc / Ti
Fine tuning
Integrates error over time
Overcomes offset from
Proportional
May cause overshoot,
oscillation, and instability
problems
+ +

Excitation Analog In

- -

Demo: PI

2- Simple PID.vi
DAQ, Simple Circuit
PID Gains PID
Derivative gain Kc* Td
Whoa
Puts the reigns on PI control
Prevents overshoot and
oscillation
Adds stability
+ +

Excitation Analog In

- -

Demo: PID

2- Simple PID.vi
DAQ, Simple Circuit
PID Considerations Analyze
Determine needs

Tuning
Integrator Windup
Varying Behaviors
Manual / Auto switch
Hold Value
Loop Speed
PID Toolkit
Analyze
Determine needs
Tuning Autotuning
Integrator Windup Integrator Anti-windup
Varying Behaviors Gain scheduling
Manual / Auto switch Switch
Hold Value Hold mode
Loop Speed
+ +

Excitation Analog In

- -

Demo: PID Toolkit

3- Toolkit PID
DAQ, Simple Circuit
Fuzzy Logic Dataflow
Fuzzy Logic Control for LabVIEW Analyze
Determine needs
Why is fuzzy logic important?
Easy to implement an intuitive control strategy
Better control of non-linear systems
PID control is linear
Fuzzy control is non-linear
Fuzzy Logic: Rule-Based Control Analyze
Determine needs

Example
If temperature is high, then heater voltage output should be
low.
Membership sets
What is meant by high?
Fuzzy Sets Analyze
Determine needs
Boolean (or two-valued) sets:
Members belong to a set non-members do not
Traditional Boolean values (on/off, 1/0)
Fuzzy Sets:
Partial membership to set allowed
Values along continuum of 0 to 1
Boolean Set Analyze
High Body Temperature Determine needs

Membership

Temperature
Fuzzy Set Analyze
High Body Temperature Determine needs

Membership

Temperature
Fuzzy Logic Control
+ +

Excitation Analog In

- -

Demo: Fuzzy Logic

4- Fuzzy.vi
Simple Circuit
Fuzzy Logic and PID Combined
Set Point Values Fuzzy Controller Process
Command Variable
Rule base
IF AND THEN

IF AND THEN
P
I
IF AND THEN
D PID


Fuzzificatio n Fuzzy Inference Defuzzification

Measured Values
Fuzzy Logic Design Software Analyze
Determine needs
+ +

Excitation Analog In

- -

Demo: Fuzzy Logic Design

5- Fuzzy.vi
Simple Circuit
Control Concerns

Tuning Autotuning
Integrator Windup Integrator Anti-windup
Varying Behaviors Gain scheduling
Manual / Auto switch Switch
Hold Value Hold mode
Loop Speed Real-Time
Real-Time Definitions Output
Real-time means same time Data to process

Real-time does NOT mean real fast


Hard real-time - deadlines can not be missed
Flight control
Engine testing
Soft real-time - missed deadline acceptable
Temperature logging
Banking
More soft real-time applications than hard
Real-Time Applications
Type Example Real-Time OS
Event Response Control temperature and
provide safe shutdown in
an emergency

Control Monitor temperature,


compare to desired
temperature, initiate
appropriate heating
or cooling

Data Acquisition Monitor temperature


General-Purpose OS
Operating Systems
General-purpose OS
High-priority tasks can be preempted by lower-priority tasks
Many extraneous programs run in the background
Screen savers, disk utilities, virus software, etc.
Must service interrupts from peripheral devices
Mouse, keyboard, etc.
No determinism guaranteed
Real-Time OS
Scheduling system ensures that high-priority tasks execute first
Difficult software integration
Can be very expensive
Typical Real-Time Applications
Windows LabVIEW-RT LabVIEW-FPGA
General OS Real-Time OS Hardware

Internet Motion Control

Mechanical Test Telecom Test

Business/POS Engine Test

Medical Network Control H/W Loop

Industrial Automation Dynamic Signal Analysis

Hydraulic Control Simulation

1000 100 10 1 100 50 10 1


Milliseconds Microseconds
LabVIEW Development System

Rapid development with graphical programming


Built-in functionality for measurement and control applications
Tight software and hardware integration
LabVIEW Real-Time System

Target

Processor I/O modules

Develop on Execute on
Host Computer RT Target
Download
PXI - Compact PCI for Control
Compact and modular form
Ethernet connectivity
Excellent networking protocols
DataSocket
VI Server
TCP/IP
RT Series PXI Embedded Controllers
PXI Backplane
Processor
Up to 40 kHz PID loop rate
I/O integration
Headless operation
Hard drive or CompactFlash
Watchdog timer
Memory
DAQ Boards
SCXI Modules
Demo: PXI-RT

6- Audio.vi
PXI Sound Demo
LabVIEW RT
Low cost RT controller
Easy to configure
Easy to program
Reliable
Full access to hard drive, cards, and some peripherals
High loop speeds
~50 microseconds
PXI Timing and Triggering
Star Trigger

10 MHz
CLK
Real-Time OS

Star Trigger

Peripheral

Peripheral

Peripheral
Controller
Controller
System

Local Bus

132 Mb/s, 33 MHz, 32-bit Computer Bus

PXI Trigger Bus


RT PXI Modular Components
I/O connectivity
Data acquisition
Signal conditioning
Dynamic signal acquisition
Motion control
Image acquisition
Third party connectivity with NI-VISA
Communication protocols
Ethernet
Serial
GPIB
CAN
Chassis expansion through MXI-3
LabVIEW Real-Time Module

Delivers reliable, deterministic performance


Creates embedded, stand-alone applications
Features built-in tools for control
RT Series DAQ Board
Local PCI Bus Memory
DAQ Daughter Board

Processor
Processor Board

I/O options Features


16-bit multifunction Shared memory
12-bit multifunction User-defined LEDs
High-speed digital
RT DAQ for Safety Shutdown
Windows Computer

RT Series
E Series

Board
DAQ

DAQ
DSA
Signal Conditioning

Signal Monitor
Oil Pressure
Oil Temperature
Safety
Air Pressure Shutdown
Turbo Speed
Vibration
Turbo Charger Unit Under Test
LV-FPGA

More information - 2003


Distributed I/O with FieldPoint
Rugged, reliable I/O
Built-in isolation and signal
conditioning
Communication interfaces for
Ethernet, serial, Foundation
Fieldbus, and wireless networks
Distributed monitoring, control,
and datalogging applications
FieldPoint for Industrial Control
Programmable power-up output
Hot swappable modules

Watchdog timers

Embedded processor

Isolation

Sensor and device diagnostics


Demo: FP-RT

7- PID- Cycle Time.vi


FP - Temperature
RT Targets

RT Series DAQ RT PXI RT FieldPoint


Performance 1 kHz 40 kHz (max) < 1kHz
(PID loop rate)

Small Size Good Better Best


I/O Variety Good Best Better
I/O Count Low High High
Rugged Better Best

Distributed Better Best


Remote System Explorer
Configures system
Installs or upgrades software
Creates utility disks
Lists installed software or hardware
Develop
Host Computer
Download

Host Computer

RT Target
Execute

Front Panel
displays on Host

Host Computer
Default
Communication

Code executes
on RT Engine
RT Target
Demo: Default Communication

7- PID-Cycle Time.vi
FP - Temperature
Default Communication
No additional programming
Quick for debugging
Insufficient for some cases
Uses more network bandwidth than necessary
Unable to save data for further analysis
Need LabVIEW Real-Time development system on host
LabVIEW Web Server
FP-2000 Runs Web Server
Clients view VI Front Panel in Internet Explorer
Clients need run-time installed (free)
Clients can request control of VI
Deploy

Host Computer
Custom
Communication

RT Target
Demo: DataSocket Communication

8-
FP - Temperature
Round Robin Scheduling
Shop Manager
(Scheduler)

Normal

Normal Mechanic
(CPU)

Normal
Preemptive Scheduling
Time Shop Manager
Critical (Scheduler)

Normal

Normal Mechanic
(CPU)

Normal
LabVIEW Real-Time Scheduler
Combination of Round Robin and Preemptive
Normal priority shares the CPU
Time-critical priority releases CPU when finished or sleeping
Assign priority to each VI
Timing for Real-Time Applications
Real-Time Terminology
Determinismhow consistently a system is able to perform
operations within a fixed time
Jitteramount of time the actual loop cycle time varies from the
desired cycle time
Sleepperiod of time when the thread programmatically relinquishes
control of the processor
Objectives
Maximize performance
Maximize determinism
Minimize jitter
Jitter Diagram
Jitter

Desired Loop Time

1
Loop Iteration

2
3
4
5

Loop Time
Timing Strategies
Software
Wait until next millisecond multiple VI
Millisecond loop rates (microsecond jitter)
Hardware
Sample or update clock of I/O board
Microsecond loop rates (nanosecond jitter)

HW Clock

AI Scan
Software Timing Diagram s AI sampled
jitter AO written

AI PID AO SW Sleep
1
2
Loop Iteration

3
4

Time Desired Loop


Time (ms)
AI Hardware Timing Diagram ns AI sampled
jitter AO written

AI PID AO HW Sleep
1
2
Loop Iteration

3
4

Time Desired Loop


Time ( s)
Synchronized I/O Timing Diagramns AI sampled
jitter AO written

AI PID AO HW Sleep
1
2
Loop Iteration

3
4

Time Desired Loop


Time ( s)
Demo: Jitter

9- Jitter Test.vi
NI-Scope
PXI - Scope
Networked Real-Time Application
Development PC-Based Web Viewers
Machine Instrument

Internet

PLC FieldPoint PXI

GPIB Serial
Conclusion
More Information:
2002 National Instruments Catalog
www.ni.com
zone.ni.com
www.daqman.com
Steve.summers@ni.com
Steve.aposhian@ni.com

Vous aimerez peut-être aussi