You are on page 1of 55

Flexible tools for Interactive Model-Based

Control Design and Simulation


Roma 29-03-2007

Massimiliano Banfi
National Instruments - System Engineer
Graphical System Design

Design Prototype Deploy


Interactive Algorithm Design Tight I/O Integration Deployable Targets
Control design I/O modules and drivers Rugged deployment platforms
Dynamic system simulation COTS FPGA hardware
Distributed networking
Digital filter design VHDL and C code integration
Human-machine interfaces
Advanced mathematics Design validation tools
Custom designs
Control Design Process

Modeling System
and Design Testing

Hardware-in-
Rapid
the-Loop
Prototyping
Testing

Targeting
Modeling and Design
Control
Setpoint Error
Kc Output
Kp Feedback

Controller Plant

Modeling and design produce controller and plant


models
Rapid Control Prototyping (RCP)
Control
Setpoint Error
Kc Output
Kp Feedback

Controller Plant

Creating a functional prototype of the controller


Targeting Production Controller
Control
Setpoint Error
Kc Output
Kp Feedback

Controller Plant

Download control algorithm to production embedded target


Hardware-in-the-Loop (HIL) Simulation

Control
Error
Kc Output
Kp Feedback
Setpoint
Controller Plant

Testing production controller with simulated plant


System Testing
Control
Error
Kc Output
Kp Feedback
Setpoint
Controller Plant
Todays Challenges
Modeling and design
Iterative process
Models and design space are complex
Prototypes not readily available at start of process
Model tuning required based on empirical data
Rapid control prototyping and HIL
Hardware platforms are typically high cost and inflexible
Significant development required to move from offline
simulation to real-time implementation
NI Platform for Control
LabVIEW Development Environment

Control Design Toolkit System ID Toolkit Simulation Module

Simulation Interface PID & Fuzzy Logic Toolkit


State Diagram Toolkit
Toolkit NI Motion Control

LabVIEW Real-Time LabVIEW FPGA LabVIEW Embedded


Targets

PXI cRIO, cFP RIO/DAQ Devices 32-Bit p


PXI Platform for Real-Time
I/O connectivity 3rd party module support with NI-VISA
Data acquisition Reflective memory, Mil Std 1553 Bus
Signal conditioning Interface, IRIG B/Telemetry Board,
Dynamic signal acquisition Syncro/Resolvers, Serial Sync Board
Motion control 3rd party local displays with serial drivers
Image acquisition NI Touch Panel Computer, QSI, Viewpoint
FPGA Reconfigurable I/O
Switching
Modular instruments
Communication protocols
Ethernet
Serial
GPIB
CAN
Chassis expansion through MXI
NI CompactRIO Reconfigurable
Embedded System
Reconfigurable Chassis
Real-Time Controller

Signal
I/O Modules
Connectivity
Conditioning ADC
DC power with redundant supply inputs
50 G shock
-40 to 70 C temperature
Field Programmable Gate Array
(FPGA)
What it is
A silicon chip with unconnected logic blocks
User can define and redefine functionality
How it works
Define behavior in software
Compile and download to the hardware
When it is used
Low volume applications that cannot afford ASIC fabrication
Designs that require frequent changes or upgrades
Field Programmable Gate Array
(FPGA)

PROGRAMMABLE I/O BLOCK


INTERCONNECT

Source: Xilinx

CONFIGURABLE LOGIC BLOCK (CLB)

Field Programmable Gate Array (FPGA) devices feature a reconfigurable digital circuit
architecture with a matrix of Configurable Logic Blocks (CLBs) surrounded by a
periphery of I/O Blocks. Signals can be routed within the FPGA matrix in any arbitrary
manner by Programmable Interconnect switches and wire routes.
CompactRIO MicroMo Motor Demo NI 9505
Motor Drive Module

Systems

Direct connection to NI 9505


motor drive module
Built-in Quadrature encoder
(512 CPR)

MicroMo 3242
Brushed DC Motor
Step 1. Plant Modeling and Analysis
Speed Motor Actual
Setpoint Error Kc Voltage Kp Speed

Controller Plant

Option A. Existing Model


Option B. Mathematical Modeling
Option C. System Identification
DC Motor Model Note: Assume L (inductance) and b
(rotational friction) are very small

d (t ) d 2 (t )
1 Ri (t ) V (t ) K
dt
T (t ) J dt 2 3
1 K d (t )
2 i (t ) V (t ) (t ) J Ki (t ) 4
R R dt
d (t ) K K2
5 J V (t ) (t )
dt R R

6 Laplace transform: JRs ( s ) KV ( s ) K 2 ( s )


DC Motor Model Cont.

Laplace transform: JRs ( s ) KV ( s ) K ( s )


2
6

Reorganizing Terms JRs ( s ) K 2 ( s ) KV ( s ) 7

Resultant Transfer Angular Speed ( s) K


Function
8
Input Voltage V ( s ) JRs K 2
Analyzing the Plant Model
Time Response (Step Response)
Frequency Response (Bode Plot)
Pole-Zero Map
Property Symbol Units Datasheet Measured Value
Value

(s) K
Resistance R Ohms 7.38 7.96


Inductance L H 4.64e-3 6.11e-3

Rotor Inertia J kg-m2 1.9e-6 16e-6

Friction Torque Constant

Back-EMF Constant
B

Ke
N-m-s

V/rad/s
1.8e-6

3.11e-2 3.12e-2 V ( s ) JRs K 2


Torque Constant Kt N-m/A 3.11e-2 3.11e-2

Diode Threshold Voltage Vth V 0.7 0.8


Demonstration: Mathematical Modeling

Modeling in Simulink
Modeling in NI Express Workbench
Transfer Function (State Space, Zero-Pole-Gain)
Modeling in LabVIEW
Transfer Function (State Space, Zero-Pole-Gain)
Time Domain Differential Equation

Demo
Demo
Step 1. Plant Modeling and Analysis
Speed Motor Actual
Setpoint Error Kc Voltage Kp Speed

Controller Plant

Option A. Existing Model


Option B. Mathematical Modeling
Option C. System Identification
LabVIEW System Identification Toolkit
Identify and validate linear models of
systems from empirical data
Seamless integration with NI I/O
Parametric model estimation (both SISO
and MIMO)
Nonparametric model estimation
Recursive model estimation
Data preprocessing
Model conversion, validation, and
presentation
Closed-loop system identification with
feedback detection
Partially known grey box system
identification
Demonstration: System Identification
System Identification Toolkit
Stimulate and measure response
Identify plant model coefficients
LabVIEW System ID Toolkit
LabVIEW System Signals System ID DC Motor
ID Toolkit Algorithms Model
Stimulus
AO0 Mot Cmd

QE Tach
Response
Demo
Demo
Step 2. Control Design
Speed Motor Actual
Setpoint Error Kc Voltage K Speed

Controller JRs K 2
Plant

Many Control Design Options


Focus on Root Locus Method
PID Synthesis
LabVIEW Control Design Toolkit
Easily create interactive control
design and analysis VIs
Model construction, conversion, and
reduction
Time and frequency response
Dynamic characteristics
Classical control design -
root locus, PID, lead/lag ...
State-space control and estimation -
LQR, LQG, pole placement, Kalman
filter ...
Demonstration: LabVIEW Control Design

LabVIEW Dev Sys LabVIEW Control Design Toolkit


LabVIEW System
ID Toolkit
LabVIEW Control DC Motor Controller
Design Toolkit Model Model
Analyze
Analyze Design
Closed-Loop System
Plant Controller

Demo
Demo
Step 3. Simulation
Speed Motor Actual
Setpoint Error s 1 Ti Voltage K Speed
Kc
s JRs K 2

Controller Plant

Simulate response to arbitrary inputs (vs. step response,


etc.)
Simulate controller with non-linear and/or higher-order
plant models
LabVIEW Simulation Module
Simulate dynamic systems including controllers and plants
Real-time implementation for rapid control prototyping or hardware-in-the-loop
simulation
LabVIEW Simulation Module Features
Linear systems continuous and
discrete time
Nonlinear system blocks and lookup
tables
Fixed-step, variable step, and stiff
solvers
Trimming and linearization
Model hierarchy
Integration with Formula node and
MathScript node (through subVI)
Integration with 3D picture control for
system visualization
3D Picture Control w/ LabVIEW Simulation
Intern project, 2006
Charles Beaman, UT ME
undergrad
Transition into courses taught by
Prof. Beaman at UT
Current effort to put on
Connexions (Erik Luther)
Can be applied to courses in:
Physics
Intro to Engineering
Dynamic Systems
Controls,
Demontration: LabVIEW Simulation
Module Demo

LabVIEW Dev Sys LabVIEW Simulation Module


LabVIEW System
ID Toolkit
Actual
LabVIEW Control
Speed
Design Toolkit Controller DC Motor
LabVIEW Model Model
Speed
Simulation Module Setpoint

Demo
Demo
Step 4. Control Prototyping
Speed Motor Actual
Setpoint Error s 1 Ti Voltage Electric Speed
Kc
s Motor
RT PXI System/cRIO
Controller Plant

Prototype controller with real-time hardware


Download control algorithm to RT PXI
Connect to actual plant system (electric motor)
Demontration: Real-Time Prototyping

Simulation Module and LabVIEW Real-Time


Implement controller on real-time hardware
Speed LabVIEW Simulation Module Actual
LabVIEW Dev Sys Setpoint Speed
Controller DC Motor AO
LabVIEW Model Update
Model
Simulation Module
AI Scan
LabVIEW RT

Demo
Demo
Step 5. Targeting Production Controller

PRODUCTION Motor
Error s 1 Ti Voltage
Kc
EMBEDDED
s
CONTROLLER

Production controller with real-world I/O


Download control algorithm to production embedded target
Not connected to real-world plant

Demo
Demo
NI LabVIEW Embedded Development Module
Deploy on any 32-bit processor LabVIEW Embedded
Development Module
Use the same LabVIEW graphical
programming to deploy to custom
devices
More than 400 built-in numerical
analysis and signal processing libraries
Third party toolchain
Interactive front panel and block Third party OS
diagram debugging
C code generator for breadth of
toolchain and target support
Step 6. Hardware-in-the-Loop
Speed Motor Actual
Setpoint Error Productio Voltage K Speed
n
JRs K 2
Controller
Controller
RT PXI System
Plant Model

Prototype plant with real-time hardware


Download plant model to RT PXI
Connect to production controller
7. Final Test and Verification
Speed Motor Actual
Setpoint Error Voltage Speed

NI Core!!!
LabVIEW for Design, Prototype, and Deploy
LabVIEW conditional compiling
technology provides for:
Model reuse
Test reuse
RCPTarget

EmbeddedTarget

HILTarget
Benefits of LabVIEW Graphical System Design
Simulation Configurable
Graphical Dataflow

State Diagram Math Script


New LabVIEW MathScript
Powerful textual programming for signal
processing, analysis, and math
More than 650 built-in functions
Reuse many of your m-file scripts created with
The MathWorks, Inc. MATLAB software and
others
Partially based on original math from
NI MATRIXx
A native LabVIEW solution
Interactive and programmatic interfaces
Does not require third-party software

MATLAB is a registered trademark of The MathWorks, Inc. All other


trademarks are the property of their respective owners.
Little or No Learning Curve for Customers Familiar
with The MathWorks Inc. MATLAB Language Syntax
LabVIEW MathScript Syntax MATLAB syntax
Little or No Learning Curve for The MathWorks,
Inc. Simulink Software Users

LabVIEW Simulation Module

The Simulink Software Environment

Simulink is a registered trademark of The MathWorks, Inc. All other


trademarks are the property of their respective owners.
LabVIEW is the original
Little or No Learning Curve for The MathWorks, Inc. Simulink
Software Users
LabVIEW The Simulink Software
Simulation Module Environment
Simulation Model Conversion
Convert your plant and controller models developed in The MathWorks,
Inc. Simulink environment into LabVIEW Simulation Module code
NI LabVIEW Simulation Interface Toolkit (SIT)

Use the LabVIEW Simulation Interface Toolkit to:


Build powerful user interfaces for models developed in the Simulink
environment
Interact with, view, and control models from LabVIEW
Deploy models to real-time hardware with LabVIEW Real-Time*
*Requires The MathWorks, Inc. Real-Time Workshop

Real-Time Workshop is a registered trademark of The MathWorks, Inc. All


other trademarks are the property of their respective owners.
LabVIEW Simulation Interface Toolkit (SIT)
LabVIEW Front Panel Simulation Model

SIT Connection Manager

LabVIEW Controls and Model Parameters and


Indicators Signals
Control Design Development Paths
Design and Code Prototyping and
Analysis Simulation Generation HIL Testing

MATRIXx System
Xmath AutoCode
Build
Math Inter. TK Simulation Interface
Toolkit (Future) Simulation Interface TK (Future)
LV Script Node

LabVIEW RT,
LabVIEW LabVIEW LabVIEW
Windows

Math Inter. TK Simulation Interface


Simulation Interface Toolkit
Toolkit
LV Script Node

The
MathWorks MATLAB Simulink RTW
References: MicroNova Simulator

Eth
e rne
t

Windows PC
(e.g. user interface) En
gin
e sig
na
ls

PXI RT HIL
Simulator

Engine Control Unit (ECU)


MicroNova System
Display elements and connection panel for ECU

Signal conditioning

Realtime
computer

CAN-card

Analog Output

MicroNova Motor-HIL-card Power supply


based on NI FPGA card
MicroNova CAN
(FPGA to cRIO Expansion Chassis)
Lockheed Martin Simulator
(PXI, LabVIEW Real-Time, SIT, VISA)

Application
Prototype integrated avionics unit in XSS-11
Create hardware-in-the-loop/HIL simulator to
test LIDAR (light detection and ranging
system) controller
Key points
LabVIEW and NI hardware provide future
flexibility
NI helped create an interface to a third-party
synchronous serial interface using NI-VISA
Siemens Power
HIL (Hardware-in-the-Loop) Simulation
Host and Server
Monitor

PXI RT System
I/O Signals

Steam Turbine Actual


Simulator Turbine Controller
White Goods

LabVIEW Real-Time, DAQ, and Simulink models


through the Simulation Interface Toolkit (SIT) are
used in the design and test of appliances.
NI Benefits
Software
One graphical programming approach for
Windows, Real-Time, FPGA, Prototypes, Embedded, Distributed & Control Design

I/O
Breadth: plug-in and distributed
Price and Value

Openness
Software (e.g. DLL, SIT, ActiveX/COM, .NET, IVI, OPC, LabVIEW Tools Network)
Hardware (e.g. CompactRIO Modules, PXI based on CompactPCI, PCIExpress)
Virtual Instrumentation means to be able to do full systems in some cases and
integrate with others in other cases (e.g. when other products are already in use)
Visit the web site: www.ni.com\design
Discuss products and configure your application
Obtain estimated costs or a quote to take with you
Request a free consultation an NI engineer will
come to your office to:
Discuss your application and specialized topics
Demonstrate customized applications, examples,
and products
Schedule an onsite seminar at your location

You might also like