28
National Instruments Confidential LabVIEW Simulation Module

LabVIEW Simulation Module

Embed Size (px)

Citation preview

Page 1: LabVIEW Simulation Module

National Instruments Confidential

LabVIEW Simulation Module

Page 2: LabVIEW Simulation Module

National Instruments Confidential 2

LabVIEW Simulation Module• Simulate dynamic systems including controllers & plants• Real-time implementation for rapid control prototyping or hardware-in-the-loop

simulation

Page 3: LabVIEW Simulation Module

National Instruments Confidential 3

LabVIEW Simulation Module Benefits• Complete simulation and real-time implementation capability -

stay in one environment from design to test to implementation• LabVIEW user interface to change and observe parameters as

simulation or control system is running• Use any LabVIEW VI or programming structure inside or outside of

simulation loops:– Integrated design and simulation, batch simulation– DAQ, RIO, Vision, or CAN for I/O and feedback

• Easily create parallel and multirate simulation or control loops

Page 4: LabVIEW Simulation Module

National Instruments Confidential 4

LabVIEW Simulation Module Overview

• Linear systems – continuous and discrete time

• Nonlinear systems blocks and lookup tables

• Signal generation and graphing• 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

Page 5: LabVIEW Simulation Module

National Instruments Confidential 5

Hardware Options for LV Sim

• Offline simulation – desktop computers• Real-time simulation and control:

– PXI– Desktop computers– CompactRIO– Compact FieldPoint– Single board computers (SBC)– 32 bit processors w/ LV Embedded (pioneer stage)

Page 6: LabVIEW Simulation Module

National Instruments Confidential 6

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.

Page 7: LabVIEW Simulation Module

National Instruments Confidential 7

LabVIEW is the original …Little or No Learning Curve for The MathWorks, Inc. Simulink® Software Users

The Simulink® software environment

LabVIEW Simulation Module

Page 8: LabVIEW Simulation Module

National Instruments Confidential 8

LabVIEW Loop Structures

• LabVIEW While Loop• LabVIEW Timed Loop

– precise timing• LabVIEW Simulation Loop

– precise timing + ODE solver

Page 9: LabVIEW Simulation Module

National Instruments Confidential 9

Simulation Parameter Configuration

• Interactive configuration• Programmatic

configuration

Page 10: LabVIEW Simulation Module

National Instruments Confidential 10

LabVIEW Simulation Module Demo

Page 11: LabVIEW Simulation Module

National Instruments Confidential 11

Debugging and Errors

• Create indicator for error output of Simulation Loop

• Utilities>>Get Simulation Parameters, create indicator

• Execution highlighting• Breakpoints• Probes• Custom probes• Single-stepping

Page 12: LabVIEW Simulation Module

National Instruments Confidential 12

Software Tip for LV Sim

• The parameters for each block can be set to be set to:– Configuration Dialog Box– Terminal

• Allows for parameters to be set through data flow programming and mixing of toolkits and modules in one VI

Page 13: LabVIEW Simulation Module

National Instruments Confidential 13

Simulation Icon Styles

• Can change icon style of blocks within simulation loop or subsystem– Static– Dynamic– Text Only– Express

• Right-click on block and choose “icon style”

Page 14: LabVIEW Simulation Module

National Instruments Confidential 14

Simulation Timing Capability

• Can slow down time to study fast dynamics in detail (collision between two cars)

• Can speed up time to study slow dynamics efficiently (temperature control of large water tank)

• Can tie simulation time to wall clock (choose auto period)

• Finish time can be infinite to allow user to adjust dynamics or control gains as simulation is running

Page 15: LabVIEW Simulation Module

National Instruments Confidential 15

Simulation Exercise I – sw timing

Page 16: LabVIEW Simulation Module

National Instruments Confidential 16

Simulation Exercise II – hw timing

Page 17: LabVIEW Simulation Module

National Instruments Confidential 17

Simulation Exercise III - hw timing w delay

Page 18: LabVIEW Simulation Module

National Instruments Confidential 18

Ordinary Differential Equation (ODE) Solvers• ODE solvers approximate solution to

continuous time systems described by differential equations

• Considerations in choosing solver:– Accuracy vs computational speed

• High-order ODE solvers more accurate• Low-order ODE solvers are faster

– Fixed time step vs. variable time step• Variable time step are faster• Fixed time step recommended for real-time

implementation– Stiff systems (transients vary more quickly than

problem solution)• dt is step size of ODE solver

00 )(

),(

yty

ytfdt

dy

Page 19: LabVIEW Simulation Module

National Instruments Confidential 19

Solver Types:

• Fixed step size:– Runge-Kutta 1 (Euler)– Runge-Kutta 2– Runge-Kutta 3– Runge-Kutta 4

• Variable step size:– Runge-Kutta 23– Runge-Kutta 45– BDF (moderately stiff systems)– Adams-Moulton– Rosenbrock (some stiff systems)

• Discrete States Only (fixed time steps for discrete-time systems)

Page 20: LabVIEW Simulation Module

National Instruments Confidential 20

Simulation Discontinuities

• ODE solvers assume that signals and derivatives of signals are continuous

• Discontinuities in nonlinear and discrete systems are accounted for by LV Sim

• For other discontinuities, use Detect Zero Crossing function or configure Integrator function to reset when signal crosses zero

Page 21: LabVIEW Simulation Module

National Instruments Confidential 21

Continuous Linear Systems

• Following models supported:– State space– Transfer function– Zero pole gain

• Integrator• Derivative• Transport Delay

Page 22: LabVIEW Simulation Module

National Instruments Confidential 22

Discrete Linear Systems

• Following discrete models supported:– State space– Transfer function– Zero pole gain

• Discrete Integrator• Discrete Derivative• Discrete Zero Order Hold• Discrete First Order Hold• Discrete Filter

Page 23: LabVIEW Simulation Module

National Instruments Confidential 23

Nonlinear Systems and Lookup Tables

• Backlash• Dead Zone• Friction• Quantizer• Rate Limiter• Relay• Saturation• Switch• Detect Zero Crossing

• Lookup Tables (1,2, & 3D)

Page 24: LabVIEW Simulation Module

National Instruments Confidential 24

Signal Arithmetic

• Gain– Reverse direction

• Summation– Change signs– Add or null inputs– Change shape

• Multiplication– Can add inputs– Change shape

Page 25: LabVIEW Simulation Module

National Instruments Confidential 25

Exercise: Formula Node & Prog Structures for Phase Plane Analysis

Page 26: LabVIEW Simulation Module

National Instruments Confidential 26

LabVIEW for Design, Prototype and Deploy

LabVIEW conditional compiling technology provides for:

– Model reuse – Test reuse

RCP Target

HIL Target

Embedded Target

Page 27: LabVIEW Simulation Module

National Instruments Confidential 27

Demonstration: CompactRIO demo with LabVIEW Simulation Module and RIO I/O

FPGA

Real-Time

Page 28: LabVIEW Simulation Module

National Instruments Confidential 28

Implementation Choices

• LabVIEW Control Design Toolkit Implementation VIs running in Timed Loop

• LabVIEW Simulation Module