You are on page 1of 67

Progettazione grafica con LabVIEW

per il controllo avanzato:

Introduzione alla tecnologia CompactRIO
Davide Palandella
National Instruments Italy

•Introduction to Real-Time
•Real-Time Development Tools
•CompactRIO: FPGA-based architecture
•Programming with LabVIEW Real-Time
•Control and analysis
•Communicating to Real-Time targets
•Programming with LabVIEW FPGA
National Instruments Everywhere
More than 25,000 companies, including
90% of Fortune 500 manufacturing companies use virtual instrumentation
LabVIEW Graphical Programming

LEGO Mindstorms NXT CERN Large Hadron Collider

“the smartest, coolest toy “the most powerful instrument
of the year” on earth”
LabVIEW Graphical System Design Platform
Dataflow C Code Textual Math Simulation Statechart

LabVIEW Real-Time FPGA Microprocessors


PC PXI Systems CompactRIO SB RIO Custom Design WSN
NI CompactRIO FPGA-based Hardware
What is Real-Time?
• Real-time does not always mean real fast
• Real-time means absolute reliability
• Real-time systems have timing constraints that must be
met to avoid failure
• Determinism is the ability to complete a task within a fixed
amount of time
Spectrum of Real-Time Applications

Test and validation Industrial control Embedded design
Operating System Characteristics
General Purpose OS Loop Rate Software Jitter
• High-priority tasks can be
preempted by lower-priority tasks
• Extraneous background programs
- Screen savers, disk utilities, virus
software, and so on 10–100 Hz Unbounded
• Peripheral Interrupts
- Mouse, keyboard, and so on
Real-Time OS
• Scheduler ensures high-priority
tasks execute first
• Direct control over all tasks Up to 50kHz Bounded
• Stand-alone (no mouse, keyboard,
and so on)
Real-Time Development Tools
Development LabVIEW Real-Time

System Analysis Tools

Execution Trace Tool
Microprocessor LabVIEW Real-Time
I/O Connectivity
Application Software

Created by the
embedded Driver API

designer for
each project
Device Drivers

Traditional Board Support

Package (BSP)
• RTOS with prebuilt BSP
• Built-in boot loader, flash and download utilities/drivers (optional)

• USB, Ethernet and other low-level software stacks

vendors supply
• Processor-based SBC
Single-Board • No FPGA
Traditional COTS HW
• Graphical or Text programming
• Program HMI, real-time processor and FPGA with one tool flow
Application Software • Signal processing, control, communications libraries in LabVIEW
• Complete C and VHDL support

Complete Easy to Use I/O API Libraries:

• Built-in APIs for analog, digital, motion, etc

Driver API • APIs for DMA transfer
• APIs for Serial, CAN, TCP and file I/O

Tested, and Validated Low-level Drivers:

Proven Device Drivers
• Device drivers for all analog and digital I/O
• Device drivers for RS232, TCP/IP, UDP, etc
• Drivers for System Services such as Interrupt Control , Power Management ,
Embedded External Bus Interface Unit Control , Deferred Callback , DMA Management

Drivers Board Support
Package (BSP)
Ready to Run Out of the Box:
• VxWorks RTOS with prebuilt BSP
• Built-in boot loader, flash and download utilities/drivers
• USB, Ethernet and other low-level software stacks

• Freescale Processor
CompactRIO or NI
Single-Board • Xilinx FPGA
ComputersRIO • NI custom high performance bus interface ASIC
• Connectivity for custom design or C Series I/O
LabVIEW Real-Time Module

• Rapidly develop robust and reliable systems with graphical programming

• Implement and visualize precise deterministic performance
• Eliminate time spent integrating diverse I/O
LabVIEW Real-Time Hardware Targets

LabVIEW Real-Time

CompactRIO NI Single-Board PXI Desktop or Smart Compact Compact

RIO Industrial PC Camera Vision FieldPoint
NI CompactRIO FPGA-based Hardware

Extreme Ruggedness
• -40 to 70 C temperature range
• 50g shock, 5g vibration
Low Power Consumption
Real-Time FPGA • 9 to 35 VDC power, 7-10 W typical

• Reconfigurable FPGA for high-speed and custom I/O timing, triggering, and control
• I/O modules with built-in signal conditioning for connection to sensors/actuators
• Real-time processor for reliable measurement, analysis, connectivity, and control
NI Single-Board RIO Embedded Control & Acquisition
Real-Time Processor
Networking/Peripherals 400 MHz processor for floating-point control,
10/100 Ethernet port analysis, and logging
RS232 Serial port
Reconfigurable FPGA
Customized timing and processing of I/O

Small Size, Low Power

21 x 9 cm. (8.2 x 3.7 in.)
19-30 VDC power, (7-10 W typ.)
-20 to 55 °C operating temp
-20 to 85 °C storage temp

Expansion I/O
Connect up to three C Series modules for
additional I/O (strain, TC, comm., motion, etc…)

Onboard Analog and Digital I/O

110 DIO, Up to 32-ch AI, up to 4-ch AO,
Up to 32-ch of 24 V DIO
C Series I/O Modules
• Analog Input
 Up to 250 kS/s
 simultaneous sampling
 4, 8, 16, and 32-ch options • Digital I/O
 Built-in signal condition for sensors – Up to 30 MHz timing
• Strain gages, accelerometers, – 8 and 32-channel options
thermocouples, RTDs – 5V/TTL, 12/24/48 V logic levels
 Up to 300V, ± 60 V, ±20 mA – Available ch-to-ch isolation
 12, 16 and 24-bit resolution
 Available ch-to-ch isolation
• Other
– 2-port CAN modules (high and low
• Analog Output speed)
 Up to100 kS/s simultaneous – Brushed DC servo motor drive
updating module
 4-ch per module • Connector options
 10 V, ±20 mA – Screw terminal, spring terminal, BNC,
 Isolation D-Sub
CompactRIO/Single-Board RIO Applications
Machine Control Machine Monitoring In-Vehicle Data Acquisition
• Packaging/Processing • Machine Condition Monitoring • In-Vehicle Data Acquisition
 High-speed motion – Bearing order analysis, – Automobiles, motorcycles,
control, batch control, lubrication monitoring, cooling, recreational vehicles, research
discrete control combustion… aircraft, trains
• Heavy Machinery Control • Mobile/portable DSA, NVH • Engine and ECU test cells
 Real-time signal – Noise, vibration, harshness, – HIL testing of engines and
processing and control dynamic signal analysis, engine controllers, sensor
of power electronics, acoustics simulation using FPGA
hydraulic systems
• Distributed Acquisition • Rapid Control Prototyping
• Semiconductor/Biomed
 Custom motion and – Central controller with – Automotive/aerospace control
vision inspection, distributed I/O nodes over prototyping
material handling Ethernet/wireless
Exercise Station – CompactRIO Demo Box
LabVIEW 8.6: A New Era for CompactRIO

• Program CompactRIO in minutes with new

CompactRIO Scan Mode
• Work with new monitoring and maintenance tools
New LabVIEW 8.6 Programming Model for
NI CompactRIO
LabVIEW Real-Time FPGA

LabVIEW Real-Time NI Scan Engine

I/O Variables
RIO Scan
I/O Memory Interface

I/O Modules

I/O Modules

FPGA Host Interface LabVIEW FPGA

Exercise 1
Temperature Threshold Measurement

I/O Scan
CompactRIO Specialty Digital

• Add specialty digital functionality to any C Series digital

I/O module (8 channels or less)
• No programming required
• Supports high-speed counter, PWM, and quadrature
Exercise 2- Specialty Digital Function
The LabVIEW Timed Loop
• Each timed loop is a real-time task
• Variety of sources for loop timing
• Assign unique priorities to a maximum
of 128 tasks
• Obtain timing feedback from loop
• Dynamically change loop timing
• Assign to particular CPU core on
multicore systems
Implementing Control in LabVIEW

Minimal change in code for different types of I/O
LabVIEW Real-Time Control & Analysis
• Built-in Tools for Control
 PID, Fuzzy Logic, Advanced
 Import C algorithms, Simulink Models

• Complete Analysis Libraries

 FFT, Linear Algebra, Filtering
 Point by Point Analysis and Signal Generation

• Easily Integrate Diverse I/O

 Data Acquisition
 Modular Instruments
 Serial, GPIB, CAN, IEEE 1394, DeviceNet
• IEC61131-3 Function Blocks
 18 new functions common in industrial control
 Seamless LabVIEW Project integration
LabVIEW Function Blocks

• Familiar industrial functions based on

IEC 61131-3 standard
• Designed for real-time control
• Network-published shared variable
parameter values
• Install with LabVIEW Real-Time Module
• Also runs on Windows OS
• LabVIEW Project integration 28
Exercise3- Alias and new Function
Accumulate and Collect Timing Edge Detection
Accumulate Count Down

Collect Boolean Array Count Up One Shot Rising

Collect Numeric Array Count Up Down

Totalize Pulse Timer

Bistable/Flip-Flop Elapsed Timer

RS Bistable Retentive Timer On

SR Bistable Timer On Delay

Timer Off Delay
External Communication Methods

• Default Communication
 Best for developing and debugging
• Remote Panels
 Best for remote control through Web browser
• Shared Variables
 Best for fast and distributed communication
 Simple, intuitive API for fast development
 Scalable for high-channel, rapid development
Remote Panels
• Uses LabVIEW built-in Web server
• Monitor and control application with a Web browser
LabVIEW 8.6 Real-Time
Web Services Support
• Windows and Real-Time
• Custom Web clients
• No run-time engine needed
Web Server
• Standard HTTP protocol
• Firewall friendly

Thin Client Thin Client
LabVIEW Execution Trace Toolkit
• Add-on for the LabVIEW Real-Time Module
• Provides exact execution tracing of VIs and threads
running on real-time target for advanced debugging

Step 1: Use the Trace Step 2: Use the Execution Trace Tool to view
VI’s to analyze behavior thread execution and debug application
Scheduling Example: Two Real-Time
• Task A runs every 10 ms and needs 3 ms of CPU time
0 1 2 3 4 5 6 7 8 9 10 11 12 13

• Task B runs every 1 ms and needs 0.5 ms of CPU time

0 1 2 3 4 5 6 7 8 9 10 11 12 13
Idle Time

• Timed Loop A (priority 100) and Timed Loop B (priority 101) together:
0 1 2 3 4 5 6 7 8 9 10 11 12 13
Implement Multirate Scheduling
FPGA Technology



I/O Blocks
Importance of FPGA in Systems

• High Reliability – Designs become a custom circuit

• High Determinism – Runs algorithms at deterministic rates
down to 25 ns (faster in many cases)
• True Parallelism – Enables parallel tasks and pipelining
• Reconfigurable – Create new and alter existing task-specific
How Does LabVIEW FPGA Work?

1. Same graphical programming

2. Generate VHDL

3. Compile VHDL through Xilinx

4. Generate downloadable bit file
When to Use LabVIEW FPGA

• Waveform acquisition > 1kHz

• Custom triggering
• Hardware based analysis
• Highest performance
• Unsupported modules
• Unsupported targets
FPGA Co-Processing
• Hardware-in-the-loop LVDT Simulation

• Sensor simulation
 Cam and crank
• Encoding/decoding sensors
 Tachometers
Quadrature Encoder
 Custom digital protocols
• Signal Processing and Analysis
 Spectral analysis (FFT and windowing)
 Filtering, Averaging, etc.
 Integrate 3rd party IP
Programming CompactRIO with
NI CompactRIO
LabVIEW Real-Time FPGA

LabVIEW Real-Time NI Scan Engine

I/O Variables
RIO Scan
I/O memory Interface

I/O Modules

I/O Modules

FPGA Host Interface LabVIEW FPGA

Combining Scan Mode with FPGA Mode

• Add FPGA to project

• Drag modules to FPGA
• Requires compile
• Scan mode modules
• FPGA mode modules
Exercise 4. Using LV FPGA
Programming with LabVIEW FPGA


Real-Time FPGA
LabVIEW Real-Time Targets

NI Single- Desktop Compact Compact

CompactRIO Board RIO PXI PC Vision System FieldPoint

I/O Variety      
Scalability      
Performance      
Ruggedness      

Good  Better  Best 
CompactRIO Embedded System
•Extreme Durability
•Reconfigurable FPGA Circuitry
•Isolated Industrial I/O
•Real-Time OS
•Small Size, Low Power Consumption
NI Single-Board RIO Embedded Device

• Single-Board Computer based on

 Real-Time OS, Reconfigurable FPGA, uses C
Series I/O Modules
• Several I/O modules included onboard (DIO,
AI, AO, 24V DI & DO)
• Ideal for high-volume and
OEM applications
NI Embedded Evaluation Kit
• Contents • Price
– 879 € for 90-day eval kit
 NI Single-Board RIO with DIO, AI, AO –1049 € for 180-day eval kit
 Signal accessory daughter card
 LabVIEW evaluation software
• LabVIEW, LabVIEW Real-Time, and
LabVIEW FPGA (expiring license)
 Getting started guide with
exercises and tutorials
 Power supply
 Ethernet cable
RT Series PXI Embedded Controllers
• High speed I/O
• Instrument grade accuracy
• Synchronization backplane
• Headless operation
• Hard drive or CompactFlash
• Watchdog timers
Desktop PC as Real-Time Target
• Convert desktop, industrial PCs, and Single-Board
Computers (SBC) into Real-Time targets
• Integrate large variety of PCI I/O hardware
• Leverage high performance of latest PCs
Additional Information
• Visit /compactrio or - and find:
» Product information
» User applications
» Training opportunities
» In-depth tutorials
• Technical Support
Le Caratteristiche di LabVIEW 2009
• Development Environment Enhancements
• Language and Performance Improvements
• LabVIEW MathScript RT Module
• Data Management and Visualization
• Software Engineering Tools
• LabVIEW Community
What’s New in LabVIEW Real-Time
Architect Advanced Systems with Real-Time Technologies
• Real-Time Hypervisor
• MathScript RT Module
• Object-Oriented Programming

Distribute, Synchronize, and Communicate Between Real-Time

• Absolutely Timed Structures
• Network Improvements
• System Replication
• Secure Web Services (SSL)

Increase CompactRIO Scan Mode Flexibility and FPGA Integration

• Programmatically configure and access I/O
• Insert preprocessed FPGA Data into the Scan Engine
• Synchronize LabVIEW FPGA code with the NI Scan Engine
Wall Clock Timing on
LabVIEW Real-Time Targets
• Fire events at a specific
time on a specific day
• Synchronize multiple
distributed targets
Synchronize Events across
Distributed Real-Time Targets
Add FPGA Data to the Scan Engine
New in 2009
NI CompactRIO
NI Scan Engine

Scan Mode I\O modules

LabVIEW Real-Time

FPGA Mode I\O modules

I/O Variables
RIO Scan
memory Interface

User FPGA Timing

Interface data
LabVIEW Tour, Dove?
Milano * 27 ottobre Novotel Cà Granda
Torino* 29 ottobre Novotel Torino
Genova 4 novembre Novotel Genova Ovest
Firenze 5 novembre Una Way Firenze Nord – Campi Bisenzio
Brescia 10 novembre AC Hotel
Padova * 11 novembre Crowne Plaza
Chieti 18 novembre Hotel Sporting Villa Maria – Francavilla a Mare
Rimini 19 novembre Hotel Diplomat Palace
Roma* 24 novembre Hotel dei Congressi
Bari 26 novembre Sheraton Nicolaus
Ore 9:00 Registrazione
Ore 9:30 Benvenuto
Ore 9:45 – 11:00 Introduzione: le novità di LabVIEW 2009
Le nuove funzionalità dell’ambiente di sviluppo per semplificare la
programmazione, i miglioramenti nel linguaggio e nelle prestazioni per
aumentare la produttività, gli strumenti di software engineering.
Ore 11:00 – 11:20 Pausa caffè
Ore 11:20 – 13:00 Il mondo di LabVIEW 2009: i moduli e le novità hardware
Programmazione real-time (possibilità di scaricare file LabVIEW
Mathscript su target real-time, migliore comunicazione e
sincronizzazione fra sistemi distribuiti e maggior integrazione fra Scan
Engine e FPGA) ed FPGA (migliore integrazione con il compilatore,
nuove IP - intellectual property - per calcolo e signal processing);
generazione di report html da una rappresentazione a diagramma di
stato; nuovi toolkit RF di LabVIEW per GPS, WLAN, WiMAX e MIMO;
nuovi nodi Wireless Sensor Network programmabili da LabVIEW;
prototipazione digitale grazie all’integrazione con SolidWorks ed alle
librerie NI SoftMotion.
Il bus ideale per le applicazioni di acquisizione dati, datalogging
e monitoraggio
In occasione di quattro date speciali, LabVIEW 2009 Tour proseguirà
nel pomeriggio con un seminario formativo sul tema: “PCI Express,
USB, ZigBee, Wi-Fi, Ethernet, PXI: qual è il bus per le tue applicazioni
di acquisizione dati, datalogging e monitoraggio?”. Obiettivo del
seminario è presentare linee guida ed esempi concreti su come
scegliere il bus più adatto tra i molteplici disponibili in funzione delle
esigenze della tua applicazione; si analizzeranno le piattaforme
hardware di acquisizione dati NI per ogni bus, tra cui plug-&-play USB,
wireless Wi-Fi ed Ethernet, i nuovi Wireless Sensor Network su
ZigBee, la terza generazione di schede della Serie X per PCI
Express/PXI Express, fino all’acquisizione dati intelligente con FPGA
su PCI/PXI. Verranno poi discussi gli strumenti software per acquisire,
analizzare e presentare i risultati ottenuti, sfruttando la piattaforma di
programmazione grafica di NI LabVIEW.
Nota bene: è necessario registrarsi separatamente alla sessione
pomeridiana della data prescelta.

Dove e quando: Milano, 27 ottobre Torino, 29 ottobre

Padova, 11 novembre Roma, 24 novembre

Dalle 14:30 alle 17:30

I Servizi di NI Italy

Manutenzione Supporto
Hardware Tecnico

 Corsi organizzati presso le sedi NI, presso il cliente e ON-LINE via web
 Prodotti disponili per la formazione: Manuali, CD Kit
 LabVIEW, LabWindows/CVI, TestStand, DIAdem
 Corsi Tematici sulle misure
 Corsi orientati ai moduli software: Real-Time, FPGA
Intermedia  Corsi
La orientati
misura con all’uso di hardware:
il supporto del PC Acquisizione Dati, Bus
CAN, Strumenti
Misure Modulari
Elettriche con il -PC
PXI, Vision & Motion, CompactRIO
Misure Termotecniche
Corsi avanzati con ilprogrammi
sui prodotti, PC “ad hoc” per il cliente
Corso Base: Acustica & Vibrazione
Avanzata Certificazione – Associate,
Corso Avanzato: Acustica & Developer,
Vibrazione Architect per
LabVIEW, LabWindows/CVI, TestStand

Supporto tecnico mediante WEB FORUM

Supporto tecnico telefonico/e-mail mediante gli Application Engineer di NI

Italy (è richiesto l’acquisto di un Servizio Software – di seguito)

Giornate di START-UP presso la sede del cliente

Supporto tecnico presso la sede del cliente Supporto sistemistico – Definizione architettura sistema / Review finale

Standard Service Program, SSP – fino a 5 licenze:
 Durata annuale - Aggiornamento automatico della/e licenze software
 Supporto tecnico diretto mediante Application Engineer
 Sconto sui programmi di formazione

 Ricezione rivista tecnica LabVIEW World (per gli utenti di LabVIEW)


Contratto Software - fino a un max di 5 licenze:

 Durata annuale con rinnovo automatico, costo inferiore al precedente
 Servizi inclusi: come per SSP

Volume License Agreement, VLA - manutenzione annuale per multilicenze:

 Vantaggi e risparmio nell’acquisto delle licenze e costo della manutenzione
 Tutti i servizi previsti per SSP

RIPARAZIONI: mediamente 10/15 gg lavorativi


ESTENSIONE DI GARANZIA: fino a 5 anni / Gestione longevità e ciclo vita sistema



hw assemblato e testato, sw e sw driver preinstallati, 3 anni di garanzia e del servizio di calibrazione inclusi SAP – PREMIUM – Programmi di manutenzione per rispondere a esigenze specifiche del cliente
I servizi di NI durante il progetto
Servizi specialistici Supporto di Startup
Supporto sistemistico Upgrade Assistance
Corsi Avanzati / Supporto tecnico

Servizi Standard Piano-contratto di manutenzione

Calibrazione, Estensione di garanzia, Riparazioni
Corsi e certificazioni
Programma di aggiornamento piattaforma Software

Progettazione Sviluppo

Ciclo vita del sistema-apparecchiatura-progetto
LabVIEW World
• La prima rivista italiana per la
comunità LabVIEW
• Per abbonarti, visita il sito di
Fiera Milano Editore
• Se sei un utente Developer Suite
o Standard Service Program di
National Instruments, un anno di
abbonamento è incluso
Grazie per l’attenzione

Xxxx xxxxx
National Instruments Italy