1 of 16

Modern Development Workflows in LabVIEW

Greg Richardson

Distinguished Engineer and� LabVIEW Product Architect�NI Product R&D

2 of 16

Margaret HamiltonFirst programmer hired�for Apollo module�flight software

"I began to use the term 'software engineering' to distinguish it from hardware and other kinds of engineering, yet treat each type of engineering as part of the overall systems engineering process."

#ourgiantsarefemale

3 of 16

>32 years in LabVIEW R&D

App�Builder

Run Time Engine

DLL�Builder

lvlib

SuperSecretPrivateSpecialStuff=true

WindowsLongPaths=true (LV2021SP1)

DDE

4 of 16

Elements of modern development workflows

Post-commit validation

per change/

batched/scheduled

Local dev�per worktree

Dev machine setup

Agent setup

Get source

Modify

Build

Get dependencies

Validate

Test

Get dependencies

Export creation

Build

Get source

Convention validation

Pre-commit validation

per change

Get dependencies

Code review

Build

Get source

Convention validation

Test

5 of 16

Machine Setup

  • How much should be in base image vs dynamic?
    • Frequency of version changes
    • Number of versions in active support
    • Install time

  • Which OS?
    • LabVIEW cannot cross-build between�desktop OSs or bitness

  • Tooling approaches
    • Manual/custom scripts
    • JKI Dragon – NIPM (including LV) and VIPM
    • Virtual machines – alleviates install time
    • Containers – lighter weight than VMs
  • LabVIEW activation
    • Can be automated
    • CI/CD license

Dev machine setup

Agent setup

6 of 16

Source Control

  • Frequent, small commits
  • All source should use “Separate compiled code”
  • Set a “Save version” in all projects
  • Avoid merging VIs
    • Modularity: isolate concepts
    • Small VIs
    • Communication
  • Don’t put built output into SCC

Get source

Code review

Backup

History

Release mgt

Code review

7 of 16

Source Control

Mainline branching model

Get source

main

release2

patch

release1

8 of 16

Code Review

  • Interactive diff with author
  • Interactive diff without author
  • Generated diff report
    • Linked from review tooling
    • Directly in review tooling

Multiple approaches

  • Manually generate
  • Automated
    • SCCSup Compare Two VIs.vi
      • [App]User Interaction>>Compare VIs XML
    • Picture generation (Get Image or Print)
    • Post to review tooling

Tooling for diff reports

Code review

9 of 16

Dependency Management

  • Dependency list is source
    • Dependency content is not source
  • Artifact repository
    • NIPM/VIPM
      • JKI Dragon
    • JFrog Artifactory

Files not authored by your team & files built from your team’s source

Get dependencies

Export creation

10 of 16

Dependency Locations

  • LVAddons.CustomLocation (2022Q3)
    • Overrides c:\Program Files\NI\LVAddons

  • LVAddons.AdditionalLocations (2024Q1)
    • ‘;’ delimited list of paths
    • Overlays the addon root

Avoid cross contamination of dependencies between builds

  • Put dependencies in an easily cleaned location

Don’t assume all machines have the same absolute paths

  • Load dependencies from symbolic paths

  • “TargetClass”.LibraryPaths (2021SP1)
    • Overlays the LabVIEW directory
    • Name varies by target type
      • LocalHost.LibraryPaths
      • NI.RT.LINUX.PXI.LibraryPaths
      • NI.RT.CDAQ.Linux.LibraryPaths

Get dependencies

Build

11 of 16

Build Output Locations

  • Additional LVAddon location
    • LVAddons.CustomLocation=c:\Addons
    • LVAddons.AdditionalLocations=c:\Addons
  • Create c:\Addons\PPLs\1\lvaddoninfo.json
  • Build to c:\Addons\PPLs\1\user.lib

Instead of DNatt’s c:\PPLs, build and install to custom <userlib>

  • Extend with platform/bitness
    • c:\Addons\PPLs\1\Targets\NI\RT\user.lib

(Starting in LV 2023 Q3)

    • c:\Addons\PPLs\1\Targets\win32\user.lib
    • c:\Addons\PPLs\1\Targets\win64\user.lib
    • c:\Addons\PPLs\1\Targets\linux\user.lib

Get dependencies

Build

12 of 16

Build Output Locations (alt)

  • Different paths
    • LocalHost.LibraryPaths=c:\PPLs\win64
    • NI.RT.LINUX.PXI.LibraryPaths=c:\PPLs\RT
    • NI.RT.CDAQ.Linux.LibraryPaths=c:\PPLs\RT

“TargetClass”.LibraryPaths

  • Single path with target directories
    • c:\PPLs\Targets\NI\RT\user.lib

(Starting in LV 2023 Q3)

    • c:\PPLs\Targets\win32\user.lib
    • c:\PPLs\Targets\win64\user.lib
    • c:\PPLs\Targets\linux\user.lib

Get dependencies

Build

13 of 16

Static Analysis

  • Editor version
  • Source only
  • Broken VIs
  • Connector patterns
  • VI complexity

What to enforce?

  • VI Analyzer
    • Runs VI-based rules
    • Broad abilities

  • pylabview
    • Parses LV file formats
    • Limited but fast

Tooling

Convention validation

14 of 16

Testing

  • Caraya
  • NI Unit Test Framework
  • VI Tester
  • InstaCoverage
  • AST Unit Tester

Avoid building your own framework

Test

15 of 16

Automation mechanism

  • Named operations stored in predefined location
    • Class based with per operation help
  • Writes stdout at end

LabVIEW CLI

  • VI path provided as argument
    • Loose VI based
  • Writes stdout incrementally

G CLI

Use a CLI

    • Provide access to stderr/stdout
    • Can separate operation lifetime from LabVIEW lifetime
    • Designed for headless operation

Build

Convention validation

Test

16 of 16

Questions or Comments?