You are on page 1of 67

Progettazione grafica con LabVIEW

per il controllo avanzato:


Introduzione alla tecnologia CompactRIO
Davide Palandella
National Instruments Italy

ni.com/it
Agenda

•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

ni.com/it
National Instruments Everywhere
More than 25,000 companies, including
90% of Fortune 500 manufacturing companies use virtual instrumentation

ni.com/it
LabVIEW Graphical Programming

LEGO Mindstorms NXT CERN Large Hadron Collider


“the smartest, coolest toy “the most powerful instrument
of the year” on earth”

ni.com/it
LabVIEW Graphical System Design Platform
Dataflow C Code Textual Math Simulation Statechart

LabVIEW Real-Time FPGA Microprocessors


Desktop

PC PXI Systems CompactRIO SB RIO Custom Design WSN

ni.com/it
NI CompactRIO FPGA-based Hardware

ni.com/it
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

ni.com/it
Spectrum of Real-Time Applications

Test and validation Industrial control Embedded design

ni.com/it
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)

ni.com/it
Real-Time Development Tools
Compiler
Linker
Development LabVIEW Real-Time
Software
Debugger

System Analysis Tools


Execution Trace Tool
RTOS
Real-Time
Microprocessor LabVIEW Real-Time
Hardware
Target
I/O Connectivity

ni.com/it
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)

COTS HW
• USB, Ethernet and other low-level software stacks

vendors supply
SBC and BSP
• Processor-based SBC
Single-Board • No FPGA
Traditional COTS HW
Computers

ni.com/it
• 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

Validated,
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

Middleware
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
Single-Board
ComputersRIO • NI custom high performance bus interface ASIC
• Connectivity for custom design or C Series I/O

ni.com/it
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

ni.com/it
LabVIEW Real-Time Hardware Targets

LabVIEW Real-Time

CompactRIO NI Single-Board PXI Desktop or Smart Compact Compact


RIO Industrial PC Camera Vision FieldPoint
System

ni.com/it
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
Processor

• 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.com/it
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

ni.com/it
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

ni.com/it
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

ni.com/it
Exercise Station – CompactRIO Demo Box

ni.com/it
LabVIEW 8.6: A New Era for CompactRIO

• Program CompactRIO in minutes with new


CompactRIO Scan Mode
• Work with new monitoring and maintenance tools

ni.com/it
New LabVIEW 8.6 Programming Model for
CompactRIO
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
Table

FPGA Host Interface LabVIEW FPGA


VI

ni.com/it
Exercise 1
Temperature Threshold Measurement

I/O
I/O
I/O Scan
I/O
LabVIEW
Real-Time
I/O

ni.com/it
CompactRIO Specialty Digital
Functionality

• 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
encoder

ni.com/it
Exercise 2- Specialty Digital Function

ni.com/it
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

ni.com/it
Implementing Control in LabVIEW
(CompactRIO)

Minimal change in code for different types of I/O

ni.com/it
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

ni.com/it
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

ni.com/it 28
Exercise3- Alias and new Function
Blocks
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

ni.com/it
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
apps

ni.com/it
Remote Panels
• Uses LabVIEW built-in Web server
• Monitor and control application with a Web browser

ni.com/it
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

ni.com/it
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

ni.com/it
Scheduling Example: Two Real-Time
Tasks
• Task A runs every 10 ms and needs 3 ms of CPU time
A A
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


B B B B B B B B B B B B B B
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:
B A B A B A B A B A B A B B B B B A B A B A B
0 1 2 3 4 5 6 7 8 9 10 11 12 13

ni.com/it
Implement Multirate Scheduling

ni.com/it
FPGA Technology

Programmable
Interconnects

Logic
Blocks

I/O Blocks

ni.com/it
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
personalities

ni.com/it
How Does LabVIEW FPGA Work?

1. Same graphical programming

2. Generate VHDL

3. Compile VHDL through Xilinx

4. Generate downloadable bit file

ni.com/it
When to Use LabVIEW FPGA

• Waveform acquisition > 1kHz


• Custom triggering
• Hardware based analysis
• Highest performance
• Unsupported modules
• Unsupported targets

ni.com/it
FPGA Co-Processing
• Hardware-in-the-loop LVDT Simulation

• Sensor simulation
 Cam and crank
 LVDTs
• 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

ni.com/it
Programming CompactRIO with
LabVIEW FPGA
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
table

FPGA Host Interface LabVIEW FPGA


VI

ni.com/it
Combining Scan Mode with FPGA Mode

• Add FPGA to project


• Drag modules to FPGA
• Requires compile
• Scan mode modules
• FPGA mode modules

ni.com/it
Exercise 4. Using LV FPGA
Programming with LabVIEW FPGA

I/O
I/O

I/O
LabVIEW LabVIEW
Real-Time FPGA
I/O

ni.com/it
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 

ni.com/it
CompactRIO Embedded System
•Extreme Durability
•Reconfigurable FPGA Circuitry
•Isolated Industrial I/O
•Real-Time OS
•Small Size, Low Power Consumption

ni.com/it
NI Single-Board RIO Embedded Device

• Single-Board Computer based on


CompactRIO
 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.com/it
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

ni.com/embeddedeval

ni.com/it
RT Series PXI Embedded Controllers
• High speed I/O
• Instrument grade accuracy
• Synchronization backplane
• Headless operation
• Hard drive or CompactFlash
• Watchdog timers

ni.com/it
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

ni.com/it
Additional Information
• Visit
ni.com/labview/i
ni.com/pac/i
ni.com/realtime
ni.com/fpga
ni.com /compactrio or ni.com/sbrio - and find:
» Product information
» User applications
» Training opportunities
» In-depth tutorials
• Technical Support
 www.ni.com/ask
 www.ni.com/zone
ni.com/it
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


Systems
• 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
RTOS FPGA
NI Scan Engine

Scan Mode I\O modules


LabVIEW Real-Time

FPGA Mode I\O modules


I/O Variables
RIO Scan
I/O
memory Interface
table

User FPGA Timing


FPGA Host
Interface data
LabVIEW
FPGA VI
http://www.ni.com/labview/whatsnew/i/
ni.com/labview/whatsnew/i/upgrade.htm
LabVIEW Tour, Dove?
Industria
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
Agenda
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
Formazione

Manutenzione Supporto
Hardware Tecnico

Manutenzione
Software

ni.com/it
 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
Base
Formazione
 Corsi Tematici sulle misure
 Corsi orientati ai moduli software: Real-Time, FPGA
CORSI TEMATICI:
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
Supporto
Tecnico

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

ni.com/it 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
Manutenzione

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


Software

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


Manutenzione
Hardware

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

CONTRATTI HARDWARE PER RAPIDA MANUTENZIONE – Gestione fermi macchina

SAP (SYSTEM ASSURANCE PLAN) - STANDARD – cFP, cRIO e PXI


hw assemblato e testato, sw e sw driver preinstallati, 3 anni di garanzia e del servizio di calibrazione inclusi
ni.com/it 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

Installazione
Progettazione Sviluppo
Impiego

Ciclo vita del sistema-apparecchiatura-progetto


ni.com/it
LabVIEW World
• La prima rivista italiana per la
comunità LabVIEW
• Per abbonarti, visita il sito di
Fiera Milano Editore
www.ilb2b.it/labview_world
• Se sei un utente Developer Suite
o Standard Service Program di
National Instruments, un anno di
abbonamento è incluso

ni.com/it
Grazie per l’attenzione

Xxxx xxxxx
National Instruments Italy
x.x@ni.com

ni.com/it