Tips for Code Re-Use. Rejwan Ali, Marketing Engineer NI Africa and Oceania

Similar documents
Programming for the LabVIEW Real-Time Module Using LabWindows/CVI

LabVIEW 2009 Real-Time & FPGA 最新技術剖析. National Instruments 美商國家儀器 行銷部技術經理吳維翰

Integrating Data Acquisition and Instrument Control with Your Scilab Scripts

Introduction to LabVIEW and NI Hardware Platform

EECS Berkeley EE249 LabVIEW Framework. Hugo A. Andrade Principal Architect LabVIEW Platform & Real Time Group

Introduction to Automating Standalone Instruments

LabVIEW Real-Time Module Release Notes

LabVIEW Real-Time Module for Mac OS X User Manual Addendum

Graphical System Design Platform. NI LabVIEW. Test and Measurement Industrial Measurements and Control Embedded Design. ni.

Using COTS Hardware with EPICS Through LabVIEW A Status Report. EPICS Collaboration Meeting Fall 2011

ni.com Integrating EPICS and LabVIEW

Embedded Control Redefined: New C/C++ Options on NI Linux Real-Time

Developing Microsoft.NET Applications for Windows (Visual Basic.NET)

LabVIEW programming I

ECU Measurement and Calibration in a Real-Time Test Environment. Roland Magolei National Instruments Engineering GmbH Embedded Networks

LabVIEW Release Notes

Integrated Simulation and Hardware-test Environment for Microcontroller Development

Running OPAL-RT s ehs on National Instruments crio: Sub-microsecond power-electronic simulation

Academic Software Solutions

FPGA design with National Instuments

Software-Defined Test Fundamentals. Understanding the Architecture of Modular, High-Performance Test Systems

Paul Goossens Product Director

Developing Code for Distribution with LabVIEW: Top Five Things You Should Know

CHAPTER 3 LabVIEW REAL TIME APPLICATION DEVELOPMENT REFERENCES: [1] NI, Real Time LabVIEW. [2] R. Bishop, LabVIEW 2009.

Plugin Architectures. Customizable application with plugin architecture

ni.com What s New in 2013

What s New in LabVIEW 2018 and LabVIEW NXG

VB.NET. Exercise 1: Creating Your First Application in Visual Basic.NET

NI Smart Cameras PRODUCT FLYER CONTENTS. Have a question? Contact Us.

Faster Time to Measurement Advances in LabVIEW Instrument Control

Designing Real-Time Control Applications Using LabVIEW and CompactRIO. Developer Days 2009

Introduction to MATLAB application deployment

Getting Started with the LabVIEW Robotics Module Version 2011

Moving MATLAB Algorithms into Complete Designs with Fixed-Point Simulation and Code Generation

LabVIEW FPGA Module Version 2013

Introduction to Programming Microsoft.NET Applications with Visual Studio 2008 (C#)

개발과정에서의 MATLAB 과 C 의연동 ( 영상처리분야 )

NI-Industrial Communications for EtherCAT

LabVIEW FPGA Module Release Notes

Bergmans Mechatronics LLC. User Guide. LabSocket-E v1.0. Jan Copyright 2017 Bergmans Mechatronics LLC. Alliance Partner

LabVIEW Real-Time Module Release and Upgrade Notes

M Introduction to Visual Basic.NET Programming with Microsoft.NET 5 Day Course

Mounzer saleh Applications engineer Tel:

Hardware-in-the-Loop and Real-Time Testing Techniques

NI Linux Real-Time. Fanie Coetzer. Field Sales Engineer SA North. ni.com

A NET Refresher

The Internet of Things and Factory of Future

Sharing and Deploying MATLAB Programs Sundar Umamaheshwaran Amit Doshi Application Engineer-Technical Computing

PROGRAMMING WITH THE MICROSOFT.NET FRAMEWORK USING MICROSOFT VISUAL STUDIO 2005 Course No. MS4995A 5 Day PREREQUISITES COURSE OUTLINE

LabWindows /CVI Release Notes Version 8.0.1

Introduction to Programming Microsoft.NET Framework Applications with Microsoft Visual Studio 2005 Course #MS4994A 5 Days COURSE OUTLINE

How Real-Time Testing Improves the Design of a PMSM Controller

Graphical System Design

LabVIEW Programming for a Multicore Environment. Stefan Kreuzer Applications Engineer National Instruments

Control Technology. motion controller and power amplifier

EE249 Lab September 30 h, 2008 Hugo A. Andrade

Getting Results with CompactRIO and LabVIEW

Scientific Instrumentation using NI Technology

LabVIEW programming II

Scaling MATLAB. for Your Organisation and Beyond. Rory Adams The MathWorks, Inc. 1

FMI to NI VeriStand & LabVIEW Add-on. User Guide

Improving Prototype Validation with NI Multisim and LabVIEW. Bhavesh Mistry, Product Manager National Instruments

Modeling a 4G LTE System in MATLAB

MOIS Overview. 1. Developer Walkthrough

Linear Algebra in LabVIEW

From Design to Deployment:

Benefits of Programming Graphically in NI LabVIEW

DATA SHEET. VEE Pro 9.33

Benefits of Programming Graphically in NI LabVIEW

Precision Characterization of Ethernet Devices with LabVIEW Real-Time and FPGA

Communication Systems Design in Practice

Control System Design and Rapid Prototyping Using Simulink Chirag Patel Sr. Application Engineer Modeling and Simulink MathWorks India

2015 The MathWorks, Inc. 1

Chapter 12 Microsoft Assemblies. Software Architecture Microsoft Assemblies 1

Link native libraries from a.net application

How to validate your FPGA design using realworld

Quick Installation Guide: QUARC TM on NI ELVIS III

Analytical Instrumentation

ni.com Decisions Behind the Design: LabVIEW for CompactRIO Sample Projects

2559 : Introduction to Visual Basic.NET Programming with Microsoft.NET

MathWorks Products and Prices Euro Academic September 2016

Tools for Developing LXI Systems

LabVIEW programming II

LabVIEW Application Builder User Guide

What You ll Do Today. Learn LabVIEW fundamentals Acquire temperature signal Output warning light based on alarm level Write data to file

.NET CLR Framework. Unmanaged Hosts - Assembly Access

Getting Started with the LabWindows /CVI Real-Time Module

Single-Axis Motion Controller/Driver for DC or Stepper Motor. LabVIEW Driver Manual in NSTRUCT Environment. Version 1.0.x. For Motion, Think Newport

LabVIEW FPGA Module Release and Upgrade Notes

Module 4. Computer-Aided Design (CAD) systems

2015 The MathWorks, Inc. 1

ECE 463 Lab 1: Introduction to LabVIEW

Essential Technologies for Industrial Machine Design and Prototyping

Developing Microsoft.NET Applications for Windows (Visual Basic.NET)

MathWorks Products and Prices North America January 2018

The MathWorks Products and Prices Euro Academic March 2010

TestStand. Contents RELEASE NOTES. Version 2017

Qt for Device Creation

LabVIEW FPGA in Hardware-in-the-Loop Simulation Applications

Integrated Test Executive and Programming Development Environment

Transcription:

ni.com 1

ni.com

Tips for Code Re-Use Rejwan Ali, Marketing Engineer NI Africa and Oceania

Graphical System Design A platform-based approach for measurement and control 4

Calling Compiled Code From LabVIEW

C DLL vs..net Assembly C DLL.NET Assembly 6

The Secret to Calling External Code from LabVIEW You must have some knowledge about the external code you are calling! What language was used to develop the code? Is there a run-time present on the system for which you are calling the compiled code? What functionality is available in the external code? What data types are being handled in the external code? 7

Ways to Call C DLLs from LabVIEW 1. Call Library Function Node 2. Import Shared Library Wizard 8

Call Library Function Node (CLFN) What is it? Function for directly calling a DLL or shared library function Demonstration How do you use it? 1. Point to the library file on disk (.dll) 2. Specify the name of the function 3. Specify the arguments types the function requires 4. Specify the calling convention 9

Import Shared Library Wizard What is it? Utility to wrap DLL calls into LabVIEW VIs How do you use it? (Tools»Import»Shared Library) 1. Point to the library file and header file on disk (.dll,.h) 2. Select functions to convert 3. Configure the VIs and Controls 10

Import Shared Library Wizard What s so great? It s automatic! Parse the header file List the functions in the shared library Convert shared library data types into LabVIEW data types Generates a wrapper VI for each function Saves the VIs in a LabVIEW project library Demonstration 11

WARNING! Caveats of Calling DLLs in LabVIEW Requires knowledge of C prototypes and DLL contents Familiarity yields better optimization of LabVIEW code Difficult to debug application if DLL throws an error Must have a header file or documentation Some complex parameter types not supported Examples: array of structures, structs as return values Shared Libraries execute synchronously Shared Libraries are platform specific 12

Ways to Call.NET Assemblies from LabVIEW 1..NET Connectivity Nodes (Programmatic) 2..NET Container (UI) 13

A Little Bit About.NET What is the.net Framework? Common Language Runtime (CLR) - Execution Engine Base Class Library - Standard functionality Different versions - 3.0, 3.5, 4.0 What is a.net Assembly? Unit of deployment built using the.net compiler Includes a manifest that contains information about the assembly Name, version, publisher security Files that make up the assembly, dependent assemblies Resources, exported data types 14

Characteristics of.net Code Object Oriented Inheritance (from any number of other objects) Data Protection (various levels of access to data) Public accessed anywhere (inside or outside the class) Private cannot be accessed outside the class Protected - can be used within the class as well as classes that inherits from this class 15

.NET Connectivity Nodes Constructor Node Creates an instance of a.net object 16

.NET Connectivity Nodes Constructor Node Creates an instance of a.net object Property Node Gets (reads) and/or sets (writes) properties of a reference 17

.NET Connectivity Nodes Constructor Node Creates an instance of a.net object Property Node Gets (reads) and/or sets (writes) properties of a reference Demonstration Invoke Node Invokes a method or action on a reference 18

WARNING! Caveats of Calling.NET Assemblies in LabVIEW Must be compatible with the Common Language Runtime (CLR) Must have compatible Class Libraries Demonstration LabVIEW does not automatically detect changes to Assemblies already loaded into memory 19

Using the.net Container What is it? LabVIEW control for hosting.net UI components How do you use it? Load UI components in.net Assembly Use.NET connectivity nodes to control Demonstration What are the Benefits? Add functionality that does not exist natively in LabVIEW Develop UIs that more closely resemble Windows OS Create UIs dynamically at run-time 20

Using Textual Nodes in LabVIEW

Add-on Modules With LabVIEW Real-Time Capability MathScript RT Module Re-use.m scripts that you developed in MathWorks Inc. MATLAB or GNU Octave Control Design & Simulation Module Move beyond PID for advanced control and dynamic system simulation Now run your algorithms and models on NI Linux Real-Time targets Native LabVIEW solution No code generation or 3 rd party software required ni.com MATLAB is a registered trademark of The MathWorks, Inc.. 23

Octave vs MathScript 24

LabVIEW MathScript RT Module Text-based controls, signal processing, analysis, and math 900 built-in functions / userdefined functions Reuse many of your.m file scripts created with The MathWorks, Inc. MATLAB software and others Based on original math from NI MATRIXx software A native LabVIEW solution Interactive and programmatic interfaces Does not require 3 rd -party software Enables hybrid programming MATLAB is a registered trademark of The MathWorks, Inc.. 25

LabVIEW MathScript RT Background Textual node & interactive window Added plug-ins: LabVIEW Control Design & Simulation Module LabVIEW Digital Filter Design Toolkit Compatible with The MathWorks, Inc.: MATLAB Signal Processing Toolbox Control System Toolbox DSP System Toolbox Useful for desktop or real-time applications with hardware MATLAB and Simulink are registered trademarks of The MathWorks, Inc.. 26

Don t Get Confused About the Nodes Native LabVIEW code Works with: LabVIEW on Windows, Mac or Linux LabVIEW Real-Time Requires MATLAB Only works with LabVIEW on Windows Does not work with LabVIEW Real-Time 27

Demo: MathScript Interactive Environment 28

LabVIEW MathScript DEMO Graphical and textual programming Interactive user-interface 29

Heat Equation DEMO C:\Program Files (x86)\national Instruments\LabVIEW 2013\examples\MathScript\MathScript - Heat Equation 30

Importing your.m file and adding interactivity DEMO http://www.utdallas.edu/~dlm/3350%20comm%20sys/fftandmatlabwanjun%20huang.pdf 31

Recommended options for analyzing data with MathScript DAQ Assistant plus MathScript node Instrument Drivers plus MathScript node I/O Asst plus MathScript node 32

Working with LabVIEW MathScript Develop scripts interactively with the MathScript Window Move to the MathScript Node to Instrument your Algorithms Move back and forth as necessary to complete your work MathScript Node MathScript Window 33

Data Types in MathScript Real and complex numerics & matrices Booleans and strings Structs (can connect to LabVIEW clusters) Cell arrays Plot objects 34

Debugging A MathScript Node Execution highlighting and single-stepping Probe tool for: Variables in each node Output defined within node Syntax error indication for each line Error indicator for node 35

Additional MathScript Capabilities User-defined functions Global variables shared between interactive window and node Special MathScript probe for debugging node Warning glyphs and guidance to improve run-time performance Nodes can run in parallel and on multi-core computers 36

Dynamic System Simulation DEMO Quadcopter shipping example available w/ evaluation software Full state feedback control implementation and simulation w/ LabVIEW Control Design and Simulation Module Equations of motion in LabVIEW MathScript node 6 DOF 37

Real-Time Algorithm Examples Open algorithms for microprocessor targets: Optimization w/ constraints Curve fitting Model predictive control System identification Solutions for MIMO & nonlinear systems Online design & adaptation Constraint plane path to min(f(x,y)) x86 mp PPC mp PPC mp PXI RIO CompactRIO f(x,y) min(f(x,y)) Single-Board RIO 38

ISC Ltd. w/ Houlder Ltd. Dr. Andy Clegg, Lead Engineer & ISC Managing Director: We used the LabVIEW MathScript RT Module to run a textual node containing our m-file code, developed with MATLAB on a desktop, for kinematics on the real-time CompactRIO controller. MathScript has significant benefits for real-time deployment on the CompactRIO controller including determinism, easy debugging, and no extra compilation steps. 39

MathScript Industrial Case Study Quotes BPP-TECH (UK) Riser Management: LabVIEW MathScript and formula nodes enabled our pre-existing IP developed in text-based languages to be included within the software, allowing for more effective code reuse. ALSTOM (UK) Condition Monitoring: The original Novus tool developed using MATLAB software has been successfully implemented within the LabVIEW platform. We chose LabVIEW over other programming languages because it helped us decrease development time, develop familiar Windows-style GUIs, use LabVIEW MathScript functions to embed our.m file scripts in the solution, and adapt system functionality for future releases. 40

Deploy to Hardware Through LabVIEW The MathWorks Inc. software development environment MathScript RT Module Your.m code MATLAB Control Design & Simulation Module Your.mdl code Simulink Simulink Coder LabVIEW Real-Time NI VeriStand CompactRIO, Single-Board RIO, PXI, or desktop MATLAB and Simulink are registered trademarks of The MathWorks, Inc.

Simulation Model Converter DEMO http://www.library.cmu.edu/ctms/ctms/simulink/basic/imatlab.htm ni.com 42

LabVIEW Control Design and Simulation Module Both signal flow and.m file development Single environment for: Simulation of dynamic systems Real-time implementation for rapid control prototyping or hardware-in-the-loop simulation ni.com 43

F14 DEMO ni.com 44

Standard Notation Reduces Learning Curve LabVIEW Control Design & Simulation Module The Simulink software environment Simulink is a registered trademark of The MathWorks, Inc. ni.com 45

Multi-Modal Rover for Search and Rescue Coordinated Robotics Lab With both an FPGA and a PowerPC processor, the Single-Board RIO platform has the flexibility to handle a variety of programming tasks and algorithms in an efficient manner. Onboard Ethernet, combined with a Wi-Fi adapter, enables realtime wireless communication, debugging, and deployment of software Nick Morozovsky, Mechanical Engineering PhD student, Switchblade project leader ni.com 46

Video UCSD Switchblade Robot http://www.youtube.com/watch?v=dw0wxplywli ni.com 47

LabVIEW MathScript RT and Control Design and Simulation Review Quickly take code to hw targets Multicore ease-of-use Instrumenting your algorithm Graphical/textual combination LabVIEW includes full programming capability Integration of 3 rd party IP including.m and.mdl LabVIEW is a complete graphical system design environment w/ all of the MoC s that you need 48

Summary LabVIEW is an open software platform No reason to rewrite code Save development time and money by integrating external code Basic understanding of external code required Language and OS used to compile, run-time present Functionality and data types implemented Multiple ways to integrate external code Call Library Function Node (C DLL) Import Shared Library Wizard (C DLL).NET Connectivity Nodes and Container (.NET Assembly).MathScript interactive window and nodes Simulation Model Converter 49

50

51