Five Techniques for Better LabVIEW Code

1889 days ago, 619 views
PowerPoint PPT Presentation

Presentation Transcript

Slide 1

Five Techniques for Better LabVIEW Code Peter Blume President

Slide 2

Overview Introduction Five strategies with cases Specifications Data stream State machines Error taking care of Documentation Conclusion

Slide 3

Introduction Most LabVIEW applications start with a modern estimation as well as control test LabVIEW encourages quick advancement cycles Easy to interface and control instrumentation Fast answers for mechanical difficulties Instant satisfaction for engineers LabVIEW designers embrace quick propensities Sloppy wiring No documentation Computer science essentials are disregarded Fast propensities = negative behavior patterns

Slide 4

Justifying Bad Habits LabVIEW is a graphical dialect Computer science basics don't make a difference Block outline is self-archiving We don't have sufficient energy to compose great code Intense time weights LabVIEW is an auxiliary obligation Requirements constantly change Equipment accessibility imperatives I'm the main designer/end-client Nobody else necessities to utilize or comprehend my projects

Slide 5

Issues Resulting from Bad Habits Application prerequisites grow LabVIEW code gets to be chaotic Inefficient Buggy Difficult to investigate, extend, and keep up Not reusable Overall improvement time is expanded

Slide 6

Bad Code Example

Slide 7

Good Code Example

Slide 8

Let's Write Better LabVIEW Code! Take after these five systems More in advance time and exertion Attention to detail Discipline Dramatically spare time over the long haul

Slide 9

1. Compose a Functional Specification Understand the application's prerequisites Interview administrators, designers, engineers, directors, accountants Document the necessities Statement of abnormal state destinations Specific prerequisites for I/O, examination, GUI Timetable and spending Design model screen shot Assign needs to every prerequisite Test technique

Slide 10

Functional Specification (Continued) Avoid planning the framework Don't drag out particular stage by including a lot of detail, for example, how to execute the framework Make the determination promptly open Have all benefactors audit and support Revise when necessities change Keep it some place that you and others can rapidly reference it

Slide 11

Simple Specification Example

Slide 12

Bad Code Example

Slide 13

Good Code Example

Slide 14

2. Utilize Proper Data Flow Data stream definition: "A square chart hub executes when every one of its sources of info are accessible. At the point when a hub finishes execution, it supplies information to its yield terminals and passes the information to the following hub in the dataflow way." Parallel ways are allowed and attractive Efficiency is upgraded when LabVIEW decides the execution arrange Readability is improved when source terminals, wires, and goal terminals are obvious

Slide 15

Data Flow Impediments Sequence structures Excessive settling Local and worldwide factors Coercions Sloppy wiring Excessive twists Overlapping wires with different items Multidirectional information stream

Slide 16

Impeded Unnecessary grouping Coercion Local factors Simple Data Flow Example Better information stream

Slide 17

Bad Code Example

Slide 18

Bad Code – Zoom In on Wiring

Slide 19

Data Flow Enhancements Artificial information reliance Use mistake bunch and additionally undertaking ID Shift registers Reduce nearby and worldwide factors Clusters Reduce the general number of wires Neat wiring Left-to-right information stream Straight wires Consistent information sorts Comments with ">" demonstrating information stream course

Slide 20

Good Code Example

Slide 21

3. Utilize a State Machine Top-Level Architecture Define application as a progression of states Go to any state from whatever other state Easy to change, keep up, and troubleshoot Self-archiving Scalable

Slide 22

Classic State Machine

Slide 23

State Machine Enhancements Use specified or string for case selector Poll UI occasions in "No Event, Default" outline or in discrete occasion structure in parallel circle Use instinctive state names Include "Introduce" and "Shutdown" states

Slide 24

Enumerated State Machine

Slide 25

Event-Driven State Machine

Slide 26

4. Join Proper Error Handling Trap and report any I/O related mistakes in all VIs I/O capacities incorporate DAQ, record I/O, instrument I/O, correspondence Trapping is encouraged by engendering of blunder group Reporting strategies incorporate exchange incite or log to document

Slide 27

Error Trapping

Slide 28

What's Wrong With This Picture?

Slide 29

Better Error Handling

Slide 30

5. Report Your Source Code Assume each VI will be utilized and kept up by different engineers Best time to record your source code is while you create it

Slide 31

LabVIEW Documentation Techniques Control names Use concise, natural marks Indicate units in enclosures or utilize free names Enter portrayals or online help where facilitate content is required Icons Intuitive content or realistic 10-point little text styles Color-coding for symbols of related subVIs

Slide 32

Documentation Techniques (cont'd) Diagram Leave the foundation shading white Set all control names unmistakable Liberally archive with free names Enter depictions for each subVI

Slide 33

Bad Code Example

Slide 34

Good Code Example

Slide 35

Summary Write a determination for all activities before you start coding Use legitimate information stream Use a state machine best level design Incorporate appropriate mistake taking care of Document your source code while you code

Slide 36

Conclusion Techniques enhance: Readability Robustness Efficiency Maintainability Reusability Techniques can be actualized rapidly on the off chance that you make them propensities Apply to each venture, beginning now Apply reliably all through every venture Dramatic diminishment in general time and exertion

Slide 37

About Bloomy Controls Test, estimation, mechanization, and control masters since 1991 Systems mix, programming improvement, and preparing supplier NI Select Integrator and Certified Training Center 3 Certified LabVIEW Architects 8 Certified LabVIEW Developers 1 Certified TestStand Architect 2 Certified TestStand Developers 8 Certified Professional Instructors Offices in Windsor, CT; Milford, MA; and Mahwah, NJ

Slide 38

Contact Bloomy Controls Email Write or visit