st. louis labview user group

23
St. Louis LabVIEW User Group How to Choose an Architecture June 21 st 2011

Upload: goro

Post on 11-Jan-2016

80 views

Category:

Documents


6 download

DESCRIPTION

St. Louis LabVIEW User Group. How to Choose an Architecture June 21 st 2011. Terminology. C. So what is a design pattern in LabVIEW?. Basic design patterns that ship with LabVIEW Advanced design patterns Object oriented design patterns New design patterns that emerge over time - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: St. Louis LabVIEW User Group

St. Louis LabVIEW User Group

How to Choose an ArchitectureJune 21st 2011

Page 2: St. Louis LabVIEW User Group

TerminologyDesign Patterns – “You know you don’t want to reinvent the wheel (or worse, a flat tire), so you look to Design Patterns – the lessons learned by those who’ve faced the same problems.” – Head First Design Patterns by Freeman, Robson, Sierra & Bates

Design – A process of problem-solving and planning for a software solution

Software Architecture – “structure or structures of the system, which comprise software components, the externally visible properties of those components, and the relationships among them”– Software Architecture in Practice – 1st ed.

Page 3: St. Louis LabVIEW User Group

C. So what is a design pattern in LabVIEW?

– Basic design patterns that ship with LabVIEW– Advanced design patterns– Object oriented design patterns– New design patterns that emerge over time

• So why do we need advanced design patterns?

Page 4: St. Louis LabVIEW User Group

A. Use Cases – Laboratory

– Can range from very simple to very complex– Are sequential in nature or process oriented– Are more likely to leverage express VIs– Can require a basic framework that is easily

modified for a variety of similar tests

Page 5: St. Louis LabVIEW User Group

B. Use Cases – Test

– Are often sequential in nature– Typically have a very simple and intuitive user interface– Need high level executive code (perhaps Test Stand) to

coordinate test execution– Necessitate flexibility for exchanging instrumentation– Use a methodology to set and modify limits and other

configuration information– Could require several vehicles for logging data (file,

database, Web)– Can require extra design effort when the use case

demands parallel testing

Page 6: St. Louis LabVIEW User Group

C. Use Cases – Process/Distributed

– Include many asynchronous processes– Require a clearly defined messaging system– Involve processes or services which provide data

to multitudes of clients– Are potentially distributed across a network

Page 7: St. Louis LabVIEW User Group

What is the big picture?

UI.vi DAQ.vi

Report.vi Error.vi

QDSMQDSM

QDSMQDSM

Page 8: St. Louis LabVIEW User Group

A. Introduction

Let’s see, should I use functional global variables or single element queues? I used functional globals before, so I’ll use them again.

Get the right tool for the right job!

Page 9: St. Louis LabVIEW User Group

What happens to data?

• Fundamentally, five things happen to data in LabVIEW.

Modify

Move

StoreDisplay

Protect

Page 10: St. Louis LabVIEW User Group

How might the application change?

You cannot account for every potential change

Page 11: St. Louis LabVIEW User Group

Other Important Considerations

Performance

Locking

Buffering

Page 12: St. Louis LabVIEW User Group

State Machine• Actions may be invoked by a person, a remote

system across TCP/IP, a database, another VI, or some other mechanism. We are architecting for multiple processes.

InitializeGet TCP MsgHandle Error

Action 2

TCP InitSend TCP MsgHandle Error

Page 13: St. Louis LabVIEW User Group

Enum or String?• Enums

– Seamlessly connect to the case structure such that there are no typos.– Facilitate adding cases.– The architect can distribute the type def enum and QDSM to the developer.

• String – The QDSM template can have a case in the structure that handles potential

typos.– Strings facilitate integration with other functions that use strings such as Run

Time Menu Tags and TCP/IP VIs.– Strings are a universal data type that is recognizable outside the LabVIEW

environment.– Strings can be used on the connector pane of subVIs that form part of the

reuse library associated with the QDSM.– Can be used to append data with a state change.

Page 14: St. Louis LabVIEW User Group

One Cluster Shift Register or Many?

If you use many:• Easy to view all of the

data without having to unbundle or show context help• Important to group

them in one location, at the top or the bottom• Now possible to

automatically wire the unwired cases

Consider doing both!!

Page 15: St. Louis LabVIEW User Group

Architecture

• JKI State Machine• Design your own• FGV / DVR• Obj Oriented

Page 16: St. Louis LabVIEW User Group

Queue Driven Message Handler – Reusable Components

Page 17: St. Louis LabVIEW User Group

Functional Global Variables – Benefits

– Provide global access to data while minimizing potential race conditions introduced by global variables

– Encapsulate data so that debugging and maintenance is easier

– Facilitate the creation of reusable modules which simplifies writing and maintenance of code

– Can pass any kind of data and can enhance a variety of advanced design patterns (such as user events)

Page 18: St. Louis LabVIEW User Group

Sidebar: Creating and Registering User Events (Review)

Note: The label for the User Event Data Type input becomes the name for the user event in the event structure

Page 19: St. Louis LabVIEW User Group

Sidebar: Improve Flexibility of User Events

Pro• Are custom events• Can pass data with the

event• Can move data across the

block diagram• Are buffered• Are ideal for shutdown and

other high priority or global actions

Con• Can be confusing to a

novice user• Cannot be renamed like

queues• Must have a mechanism to

pass the reference to multiple locations

Being able to pass the reference through a FGV adds flexibility!

Page 20: St. Louis LabVIEW User Group

Advantages of XControls

– Encapsulates UI code into an abstract component• Reduces complexity and increases readability of main

block diagram • Removes UI-based restraints from the architecture of

the main VI• Abstracts complex code away from standard developers

– Creates reusable and distributable UI components• Easily distributable• Updates control instances to new versions while

maintaining integrity

Page 21: St. Louis LabVIEW User Group

Consistencyof SubVIs

Organizationof Libraires

Usabilityof APIs

• Connector Panes• Front Panels• Data Types• Planning for Change

• Layered API Design• Palette Menu Structure

• Documentation• Naming• Icons

B. Design Techniques

Page 22: St. Louis LabVIEW User Group

Where Can You Go for More Code and Ideas?

– Asynchronous Message Communication (AMC)– Specific Error Handler (SEH)– Current Value Table (CVT)– Buffered Variable Table (BVT)– Generic Configuration Editor (xCE)– Multi-Process Engine (MPE)

Page 23: St. Louis LabVIEW User Group

Where Can You Go for More Code and Ideas?

www.lavag.orgMore Than A Message

BoardA Community of Avid

LabVIEW ProgrammersA Place to Learn About

New TechnologiesA Place to Shape the Future of LabVIEW