Top Banner
1 The LabVIEW Style Templates Peter Blume Bloomy Controls, Inc.
46

The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

Nov 12, 2018

Download

Documents

tranxuyen
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

1

The LabVIEW Style Templates

Peter Blume

Bloomy Controls, Inc.

Page 2: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

2

OverVIEW

• The LabVIEW Style Book

• ***Free*** Downloads

� Specification template

� Project directory template

� Design pattern templates

� Utility VIs

� Style rules checklist

• Questions & feedback

Page 3: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

3

The LabVIEW Style Book

• Prentice Hall © 2007

• Best practices for developing quality LabVIEW applications

• Over 200 style rules� Ease of use

� Efficiency

� Readability

� Simplicity

� Performance

� Maintainability

� Reliability

• Drop off your card to win a copy!

Page 4: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

4

Companion

Web Site

• www.bloomy.com/lvstyle/

• Reviews

• Data sheet

• Downloads

• Email the author

• Purchase the book

Page 5: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

5

Downloads Page

Page 6: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

6

Specifications

• Theorem 2.1Written specifications positively

influence LabVIEW style

• Rule 2.2Write a requirements specification

document before you begin coding

Page 7: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

7

Page 8: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

8

Project File Organization

• Rule 2.8 Maintain an organized repository on disk

• Rule 2.9 Create a LabVIEW source folder hierarchy that reflects your application’s architecture

• Rule 2.10 Create the folder hierarchy before you begin coding

Page 9: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

9

Page 10: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

10

Page 11: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

11

Page 12: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

12

Page 13: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

13

Page 14: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

14

Page 15: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

15

Design Pattern Templates

• Immediate SubVI

• Continuous Loop

• Event Handling Loop

• Classic State Machine

• Queued State Machine

• Event-Driven State Machine

• Producer-Consumer

Page 16: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

16

SubVI Error Handling

Rule 5.25 Assign error clusters to bottom left and

right terminals

Rule 7.13 Skip most subVI diagrams on error using

an Error Case Structure

Rule 7.15 Use the SubVI with Error Handling

template

Page 17: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

17

Immediate SubVI

Page 18: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

18

NI Single Loop Application

Page 19: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

19

Continuous Loop Rules

• Rule 4.35 Use shift registers over local and global variables

• Rule 4.36 Group most shift registers near the top of the loop

• Rule 4.37 Label wires exiting the left shift register terminal

• Rule 8.1 Use multiple criteria for the loop condition

• Rule 8.3 Include a delay within continuous While Loops

Page 20: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

20

Continuous Loop

Page 21: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

21

Limitations of Continuous Loop

• Rule 8.4 Avoid polling GUI objects

• Use an Event structure

Page 22: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

22

NI User Interface Event Handler

Page 23: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

23

Event Structure Rules

• Rule 8.5 Use the Value Change event for most GUI controls

• Rule 8.6 Place control terminals within their Value Change event case

• Rule 8.7 Resize the Event Data Node to hide unused terminals

• Rule 8.8 Avoid continuous timeout events

Page 24: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

24

Event-Handling Loop

Page 25: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

25

Event-Handling Loop - Shutdown

Page 26: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

26

Limitations of Event-Handling Loop

• Only one subdiagram per GUI event

• Rule 8.9 Use a state machine design pattern in

most VIs of medium or greater complexity

Page 27: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

27

NI Standard State Machine

Page 28: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

28

State Machine - Rules

• Rule 8.12 Use an enumerated type definition for

the case selector

• Rule 8.13 Minimize code external to the Case

structure

• Rule 8.14 Include states for Initialize, Idle,

Shutdown, and Blank

Page 29: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

29

Classic State Machine

Page 30: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

30

Limitations of Classic State Machine

• Can only store one state in shift register

• Not event driven

• Consider the Queued State Machine or Event

Driven State Machine

Page 31: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

31

NI Queued Message Handler

Page 32: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

32

Queued State Machine - Rules

• Use a queue of enum or cluster of enum and

variant

• Rule 8.15 Avoid timeout with Enqueue and

Dequeue Element

Page 33: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

33

Queued State Machine

Page 34: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

34

Event-Driven State Machine

• Queued State Machine with Event structure in

Idle state

� Event structure captures GUI events

� Event-driven performance

Page 35: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

35

Page 36: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

36

Limitations of Queued State Machines

• Can only process one state at a time

• Processing states freezes the GUI

• Consider separate loops for GUI event handling

and state machine

Page 37: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

37

NI Producer-Consumer (Events)

Page 38: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

38

Producer-Consumer

Page 39: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

39

Multiple-Loop

Application

Framework

Page 40: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

40

Utility VIs

• Two Button Dialog VI

• Wait n mSec VI

• Merge Multiple Errors VI

• Clear Error All or Specified VI

Page 41: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

41

Style Rules Checklist

• Rule 10.1 Enforce your organization’s style

convention using code reviews

• Rule 10.7 Use a manual checklist to perform a

comprehensive style review

Page 42: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

42

Page 43: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

43

VI Package

• Requires� Download from jkisoft.com

• Installs on LabVIEW 8.2, 8.5, and 8.6 independently

• Can install on Mac, Windows, and Linux

• Refreshes the LabVIEW palettes immediately after installation / uninstallation / upgrade

• Provides configuration management capabilities� Version control

• Easy to use

Page 44: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

44

Conclusion

• Accessible via palettes

• Promote good style� Ease of use

� Efficiency

� Readability

� Simplicity

� Performance

� Maintainability

� Reliability

• Save time & money

Page 45: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

45

Feedback & Discussion

• E-mail the author and/or send feedback to

[email protected]

• Download the templates from

www.bloomy.com/lvstyle/

• Drop off your card to win a fee copy!

Page 46: The LabVIEW Style Templatesieee.li/pdf/viewgraphs/labview_style_templates.pdf · 3 The LabVIEW Style Book • Prentice Hall ©2007 • Best practices for developing quality LabVIEW

46

Contact Bloomy Controls

Headquarters:

839 Marshall Phelps Rd.

Windsor, CT 06095

(860) 298-9925

MA Office:

257 Simarano Dr.

Marlborough, MA

(508) 281-8288

NJ Office:

2125 Center Ave.

Fort Lee, NJ

(201) 944-9890

� Email [email protected]

� Write or visit