+ All Categories
Home > Documents > Software Engineering With LabVIEW

Software Engineering With LabVIEW

Date post: 14-Apr-2018
Category:
Upload: engr-nayyer-nayyab-malik
View: 222 times
Download: 0 times
Share this document with a friend

of 56

Transcript
  • 7/30/2019 Software Engineering With LabVIEW

    1/56

    Elijah Kerry, Certified LabVIEW Architect (CLA)

    Senior Product Manager for LabVIEW, National Instruments

    Software Engineering Best Practices

  • 7/30/2019 Software Engineering With LabVIEW

    2/56

    2

  • 7/30/2019 Software Engineering With LabVIEW

    3/56

    3

  • 7/30/2019 Software Engineering With LabVIEW

    4/56

    5

    Examples of Software Engineering Debt(just some of the most common LabVIEW development mistakes)

    No source code control (or Project) Flat file hierarchy

    Stop isnt tested regularly

    Wait until the end of a project to build an application

    Few specifications / documentation / requirements

    No buddying or code reviews

    Poor planning (Lack of consideration for SMoRES)

    No test plans

    Poor error handling

    No consistent style

    Tight coupling, poor cohesion

  • 7/30/2019 Software Engineering With LabVIEW

    5/56

    6

    The Cost of a Software Defect

    Development Phase Cost Ratio

    Requirements 1

    Design 3-6x

    Implementation 10x

    Development Testing 15-40x

    Acceptance Testing 30-70xPost Release 40-1000x

    Based on an analysis of 63 software development projects at companies including IBM, GTE and TRW

  • 7/30/2019 Software Engineering With LabVIEW

    6/56

    Avionics ApplicationsRobotics and Mechatronics Large Physics Applications

    High-Volume Production Test Structural Health Monitoring Medical Devices

    Large System Development Powered by LabVIEW

  • 7/30/2019 Software Engineering With LabVIEW

    7/568

    Topics

    Configuration Management Requirements Tracking

    Architecture and Design

    Coding Styles and Standards

    Testing and Debugging

    Documentation

    ni.com/largeapps

  • 7/30/2019 Software Engineering With LabVIEW

    8/569

    RequirementsGathering

    Application

    Architecture

    Deployment

    Unit Testing

    SystemTesting

    Integration

    Testing

    ModuleArchitecture

    Review and Test

    Software Engineering V-Model

    Prototyping Service

  • 7/30/2019 Software Engineering With LabVIEW

    9/5614

    Size of LabVIEW Applications

    0

    2

    4

    6

    8

    10

    12

    14

    16

    0 to 100 VIs 100 to 250 VIs 250 to 1000 VIs 1000 to 3000 VIs3000 to 5000 VIs Greater than5000

    Source: 2010 ni.com/largeapps survey

  • 7/30/2019 Software Engineering With LabVIEW

    10/5615

    Average Number of Developers Per Project

    0

    5

    10

    15

    20

    25

    > 10 5 to 10 3 to 5 2 1

    Source: NIWeek 2008 Software Engineering Survey

  • 7/30/2019 Software Engineering With LabVIEW

    11/5616

    Source Code Control

    Developer 1

    Developer 2

    Merger

    Code Revision

    Code

    Repository

    Locked for edit

    Requirements

    Gathering

    Application

    ArchitectureDevelopment

    Debugging &

    TestingDeployment

    Software Configuration Management

    Checked Out Checked In

    Checked Out Checked In

    Checked InChecked Out

    Get Latest Version

  • 7/30/2019 Software Engineering With LabVIEW

    12/5617

    SCC Options for Integration within LabVIEW

    Native LabVIEW Integration Perforce

    Integration Through Standard API Microsoft Visual SourceSafe

    Microsoft Team System

    Rational ClearCase PCVS (Serena) Version Manager

    MKS Source Integrity

    Seapine Surround SCM

    Borland StarTeam

    Telelogic Synergy

    ionForge EvolutionSupport through additional add-ons Subversion

    Mecurial

  • 7/30/2019 Software Engineering With LabVIEW

    13/56

    18

    Development TrunkFeature-Team

    Repository

    Feature-Team

    RepositoryFeature-Team

    Repository

    Individuals Local

    Repositories

    NI Configuration Management

    Different trunk for each

    LabVIEW version

    Teams of 3 to 7

    developers work in

    smaller repositories

    Individuals may have

    their own repositories

    New features and

    changes are regularlymerged in

  • 7/30/2019 Software Engineering With LabVIEW

    14/56

    Popularity of SCC Options Amongst LabVIEW Programmers

    10

    48

    1 1 14 3

    0

    10

    20

    30

    40

    50

    60

    Perforce Subversion ClearCase Git VSS Mecurial none

    Source: 2010 ni.com/largeapps survey

  • 7/30/2019 Software Engineering With LabVIEW

    15/56

    20

    DEMO

    Configuration Management

  • 7/30/2019 Software Engineering With LabVIEW

    16/56

    21

    Graphical Differencing

    Provides a checklist of changesUseful for peer reviews

    Available via command-line

  • 7/30/2019 Software Engineering With LabVIEW

    17/56

    22

    Separate Compiled Code From Source FileImproved Source Code Control Integration

    Eliminate the need to re-save and re-submit files to source code control unless

    the graphical source code has been changed by the developer

    *this feature is not on by default and needs to be enabled from the VI Properties dialog

    2009.vi file format

    2010.vi file format*

    Front PanelBlock

    Diagram

    Connector

    PaneIcon

    Compiled

    Code

    Inplaceness

    Info

    Compiled

    Code

    Inplaceness

    Info

    Front PanelBlock

    Diagram

    Connector

    PaneIcon

    A separate object file is created to

    store and retain this information

  • 7/30/2019 Software Engineering With LabVIEW

    18/56

    TopLevel.vi

    SubVI2.vi

    SubVI1.vi

    Source Code Control Scenario: Today

    In SCC

    TopLevel.vi

    SubVI2.vi

    Local Machine

    Edit

    Save

    Check-in

    SubVI1.viSubVI1.vi SubVI1.vi

  • 7/30/2019 Software Engineering With LabVIEW

    19/56

    Source Code Control Scenario: 2010

    In SCC

    TopLevel.vi

    SubVI2.vi

    Local Machine

    Edit

    Run/SaveSubVI1.vi

    Check-in

    local .viobj

    cache

    TopLevel

    .viobj

    SubVI1

    .viobj

    SubVI2

    .viobj

    TopLevel

    .viobj

    SubVI1

    .viobj

    SubVI1.vi

    TopLevel.vi

    SubVI2.vi

    SubVI1.viSub VI1.vi SubVI1.vi

  • 7/30/2019 Software Engineering With LabVIEW

    20/56

    25

    VI Package Manager

    Build and manage packages of LabVIEW code

  • 7/30/2019 Software Engineering With LabVIEW

    21/56

    26

    Structured Error Handler

    GXML Library

    Install and Manage VI Packages

  • 7/30/2019 Software Engineering With LabVIEW

    22/56

    27

    Easily Upgrade and Downgrade Versions

  • 7/30/2019 Software Engineering With LabVIEW

    23/56

    28

    Structured Error Handler

    GXML Library

    Create VI Configuration Files

    AMC Library G Library

    A single file that contains multiple packages.

    Easily share and distribute code that depends upon multiple libraries.

    Structured Error

    Handler Config

  • 7/30/2019 Software Engineering With LabVIEW

    24/56

    33

    Track Changes

    Manage Reuse Libraries

    Integrate with SCC

    Merge Graphical Code Manage Files and Links

    System Level View

    Software Configuration Management for LabVIEW

  • 7/30/2019 Software Engineering With LabVIEW

    25/56

    34

    The Software Engineering Process

    Now Included

    with DevSuite

    NI Requirements

    Gateway

    Requirements

    Gathering

    Application

    ArchitectureDevelopment

    Testing and

    ValidationDeployment

    LabVIEW

    VI Analyzer

    LabVIEW Desktop

    Execution Trace

    LabVIEW Unit

    Test Framework

    Application

    Builder

    LabVIEW

    Statechart

    Improve quality. Reduce risk. Save time.

    Prove it works.

    Object

    OrientationReal Time

    FPGA

    EmbeddedNI TestStand

    Dataflow

    MathScript

    Statechart

    Simulation

  • 7/30/2019 Software Engineering With LabVIEW

    26/56

    35

    The Software Engineering Process

    NI Requirements

    Gateway

    Requirements

    Gathering

    Application

    ArchitectureDevelopment

    Testing and

    ValidationDeployment

    LabVIEW

    VI Analyzer

    LabVIEW Desktop

    Execution Trace

    LabVIEW Unit

    Test Framework

    Application

    Builder

    LabVIEW

    Statechart

    Improve quality. Reduce risk. Save time.

    Prove it works.

    Object

    OrientationReal Time

    FPGA

    EmbeddedNI TestStand

    Dataflow

    MathScript

    Statechart

    Simulation

  • 7/30/2019 Software Engineering With LabVIEW

    27/56

    37

    Requirements Traceability Solution from NI

  • 7/30/2019 Software Engineering With LabVIEW

    28/56

    38

    Requirements

    Gathering

    Application

    ArchitectureDevelopment

    Debugging &

    TestingDeployment

    Requirements Coverage and

    Project Tracking Traceability and Documentation

    Generation

  • 7/30/2019 Software Engineering With LabVIEW

    29/56

    39

    DEMO

    Requirements Tracking

  • 7/30/2019 Software Engineering With LabVIEW

    30/56

    40

    Documentation

    Labeled objects

    In-line comments

    Distinct Icon

    Description and Tip

    HTML Print-Out

    Requirements Coverage

  • 7/30/2019 Software Engineering With LabVIEW

    31/56

    41

    Tools for Debugging and Testing

    High RiskLow Risk

    Debugging &

    Testing

    Dynamic Code AnalysisReal Time

    Execution Trace

    Static Code Analysis

    Functional Validation

    of CodeUnit Test

    Framework

    Advanced

    SimpleA

    pplicationCom

    plexity

    Application Criticality

    Desktop

    Execution Trace

    VI Analyzer

    Toolkit

  • 7/30/2019 Software Engineering With LabVIEW

    32/56

    42

    Performing a LabVIEW Code Review

    Walk someone through your code

    Questions to consider:

    Is the code easy to maintain, and has it been documented?

    What happens if the code returns an error?( or if it receives an error?)

    Is too much functionality located in a single VI?

    Are there any race conditions?

    Is the memory usage within acceptable limits?

    Perform code reviews frequently

  • 7/30/2019 Software Engineering With LabVIEW

    33/56

    43

    Establish or Adopt Development Guidelines

    Front Panel Style Fonts and Text Characteristics

    Colors

    Graphics and Custom Controls

    Layout

    Sizing and Positioning

    Labels

    Paths versus Strings

    Enumerated Type Controls versus Ring Controls Default Values and Ranges

    Property Nodes

    Key Navigation

    Dialog Boxes

    Style Checklist VI Checklist

    Front Panel Checklist

    Block Diagram Checklist

    Block Diagram Style Wiring Techniques

    Memory and Speed Optimization

    Sizing and Positioning

    Left-to-Right Layouts

    Block Diagram Comments

    Call Library Function Nodes and Code Interface

    Nodes

    Type Definitions Sequence Structures

    Icon and Connector Pane Style Icons

    Example of Intuitive Icons

    Connector Panes

    NI Style Guideline: ni.com/largeapps

  • 7/30/2019 Software Engineering With LabVIEW

    34/56

    44

    Preparing for a Code Review with VI Analyzer

    Automate code analysiswith 80+ configurable tests

    Performance

    Style Complexity

    Interactively inspect failures

    Generate custom reports

    Code complexity metrics

    Write your own tests with VI

    Scripting LabVIEW 2010

  • 7/30/2019 Software Engineering With LabVIEW

    35/56

    45

    VI Analyzer Code Complexity MetricsTests for Industry Standard Metric Calculations

    True

    False

    Case 1

    Case 2

    Case 3

    Edges = 5 Nodes = 3 Paths = 1

    Cyclomatic complexity: 5 3 + 2 (1) = 4

  • 7/30/2019 Software Engineering With LabVIEW

    36/56

    48

    DEMO

    VI Analyzer for Peer Reviews

  • 7/30/2019 Software Engineering With LabVIEW

    37/56

    49

    Tools for Debugging and Testing

    High RiskLow Risk

    Debugging &

    Testing

    Dynamic Code AnalysisReal Time

    Execution Trace

    Static Code Analysis

    Functional Validation

    of CodeUnit Test

    Framework

    Advanced

    Si

    mpleA

    pplicationCom

    plexity

    Application Criticality

    Desktop

    Execution Trace

    VI Analyzer

    Toolkit

  • 7/30/2019 Software Engineering With LabVIEW

    38/56

    51

    Trace Production Systems Remotely

    Run-Time Execution Information

    Run-Time Execution Information

    Network

    Network

    Deployed Real-Time Applications

    VIs and Debuggable Executables

    LabVIEW Desktop Execution Trace Toolkit

    LabVIEW Real-Time Execution Trace Toolkit

  • 7/30/2019 Software Engineering With LabVIEW

    39/56

    52

    Desktop Execution Trace Toolkit

    Trace During Run-Time: Event Structures

    Memory Allocation

    Queues / Notifiers

    Reference Leaks

    Thread ID

    Unhandled Errors

    Dynamic / Static SubVIs

    Custom User Strings

  • 7/30/2019 Software Engineering With LabVIEW

    40/56

    53

    Desktop Execution Trace Toolkit

    Trace During Run-Time: Event Structures

    Memory Allocation

    Queues / Notifiers

    Reference Leaks

    Thread ID

    Unhandled Errors

    Dynamic / Static SubVIs

    Custom User Strings

  • 7/30/2019 Software Engineering With LabVIEW

    41/56

    54

    DEMO

    Dynamic Code Analysis with Desktop Execution Trace Toolkit

  • 7/30/2019 Software Engineering With LabVIEW

    42/56

    55

    Remote Debugging of Executables

    Include block diagrams with an executable

    Remotely troubleshoot using LabVIEW debug tools

  • 7/30/2019 Software Engineering With LabVIEW

    43/56

    56

    Tools for Debugging and Testing

    High RiskLow Risk

    Debugging &

    Testing

    Dynamic Code AnalysisReal Time

    Execution Trace

    Static Code Analysis

    Functional Validation

    of CodeUnit Test

    Framework

    Advanced

    SimpleA

    pplicationCom

    plexity

    Application Criticality

    Desktop

    Execution Trace

    VI Analyzer

    Toolkit

  • 7/30/2019 Software Engineering With LabVIEW

    44/56

    57

    Data Science Automation

    Developed Long-term testing solution for artificial hearts"The Unit Test Frameworks

    flexibility and ease of use

    certainly enabled much faster

    and reliable completion of thisportion of the project

    potentially saving hundreds

    of hours and thousands of

    dollars over the life of theproject."

  • 7/30/2019 Software Engineering With LabVIEW

    45/56

    58

    LabVIEW Unit Test Framework

    VI Under Test

    Input Values Output

    Expected OutputUnit Test

    FrameworkAutomated

    Report Generation

    Test vector = Input value(s) + Expected output(s)

  • 7/30/2019 Software Engineering With LabVIEW

    46/56

    59

    Windows Desktop

    LabVIEW Unit Test Framework

    VI Under Test

    Input Values Output

    Expected OutputUnit Test

    FrameworkAutomated

    Report Generation

    Test vector = Input value(s) + Expected output(s)

  • 7/30/2019 Software Engineering With LabVIEW

    47/56

    60

    Real Time

    LabVIEW Unit Test Framework

    VI Under Test

    Input Values Output

    Expected OutputUnit Test

    FrameworkAutomated

    Report Generation

    Test vector = Input value(s) + Expected output(s)

  • 7/30/2019 Software Engineering With LabVIEW

    48/56

    61

    DEMO

    Unit Testing

  • 7/30/2019 Software Engineering With LabVIEW

    49/56

    63

    Code Coverage Example

    6 Diagrams. 3 Diagrams Executed. 50% Code Coverage

  • 7/30/2019 Software Engineering With LabVIEW

    50/56

    64

    Code Coverage Example

    2nd Test Vector (aggregates covered code from 1st pass)

    Block diagram, 5 Case diagrams executed. ( 4 + 1 ) / 6 = 83.33% Code Coverage

    1ST Test Vector:

    Block diagram, 2 Case diagrams executed. ( 2 + 1 ) / 6 = 50% Code Coverage

  • 7/30/2019 Software Engineering With LabVIEW

    51/56

    65

    Programmatic Unit Testing

    Programmatically

    invoke testing and

    report generation

  • 7/30/2019 Software Engineering With LabVIEW

    52/56

    66

    Unit Tests

    Implementation

    Software Requirements

    Test Results

    Integration with Requirements Gateway

    A li ti B ild API N i L bVIEW 2011

  • 7/30/2019 Software Engineering With LabVIEW

    53/56

    69

    Application Builder API New in LabVIEW 2011Automate build and deployment processes

  • 7/30/2019 Software Engineering With LabVIEW

    54/56

    70

    App Builder Log-File GenerationDocument version, date and time of Vis included in build

    Available in LabVIEW 2009

    NI b ifi i li i h i i

  • 7/30/2019 Software Engineering With LabVIEW

    55/56

    LabVIEW

    Core 1

    LabVIEW

    Core 2LabVIEW Core 3

    Certified

    LabVIEW

    Developer

    Advanced

    Architectures

    in LabVIEWCertified

    LabVIEW

    Architect

    Certified

    LabVIEW

    Associate

    Developer

    NI LabVIEW Certifications Align with Training

    Managing

    Software

    Engineering in

    LabVIEWLabVIEW

    Connectivity

    LabVIEW

    Performance

    Object-Oriented

    Design &

    Programming in

    LabVIEW

    Recommended course

    Optional course

    Optional certification

    Developer Senior Developer Software Architect

    / Project Manager

    "Certification is an absolute must for anyone serious about calling himself a

    LabVIEW expert... At our organization, we require that every LabVIEW developer

    be on a professional path to become a Certified LabVIEW Architect."

    - President, JKI Software, Inc.

    More Information on Architectures and Process

  • 7/30/2019 Software Engineering With LabVIEW

    56/56

    More Information on Architectures and ProcessDedicated to LabVIEW Development and Software Engineering Practices

    Technical White Paper Seriesni.com/largeapps

    Online Community Dedicated to Development Best Practices

    ni.com/community/largeapps

    Follow My Blog on Software Engineering with LabVIEW

    ekerry.wordpress.com

    Follow me on Twitter

    elijah286


Recommended