Successfully reported this slideshow.
PUSHING THE LIMITS OF LABVIEW                                   Beyond State Machines:                                   B...
Rules         1. Vote with your feet.         2. Please turn on your smartphones.                                  @Justin...
Let’s Get This Straight         User Events are a very easy-to-use feature with a lot         of cool functionality.      ...
A Public & Private Events Framework                                                PUSHING THE           4 | JKI CONFIDENT...
Agenda         What is it?                                  PUSHING THE           5 | JKI CONFIDENTIAL                    ...
Agenda         What is it?         How does it work?                                  PUSHING THE           5 | JKI CONFID...
Agenda         What is it?         How does it work?         What’s it good for?                                  PUSHING ...
Agenda         What is it?         How does it work?         What’s it good for?         What’s it bad at?                ...
Agenda         What is it?         How does it work?         What’s it good for?         What’s it bad at?         How can...
What is it?         A “module” has:                      Statefulness / private data                      Asynchronous p...
Key Benefits         Module knows nothing about who’s consuming the         data it produces         Lightweight & easy to ...
Client Code is Simple             Start Process &                                  Invoke Public API   Exit Module        ...
How Does it Work?                                  PUSHING THE           9 | JKI CONFIDENTIAL                             ...
Process VI & Public Events                                       PUSHING THE         10 | JKI CONFIDENTIAL                ...
Process VI & Public Events    Shift register for private module data                    (“State”)                         ...
Process VI & Public Events    Shift register for private module data                    (“State”)                         ...
Public Events: Sending Information OUT     Process VI generates a Public Event...                                         ...
Public Events: Sending Information OUT     Process VI generates a Public Event...                                         ...
Public Events: Sending Information OUT     Process VI generates a Public Event...                                         ...
Public Events: Sending Information OUT     Process VI generates a Public Event...                                         ...
Public Events: Sending Information OUT     Process VI generates a Public Event...                                         ...
Public Events: Sending Information OUT     Process VI generates a Public Event...                                        ....
Public Events: One to Many     Process VI generates a Public Event...                                 ...that can be recei...
The Public API                       Public API VIs...                                     ...generate Private Events...  ...
The Public API                       Public API VIs...                                     ...generate Private Events...  ...
Public API / Private Events                                        PUSHING THE         15 | JKI CONFIDENTIAL              ...
Public API / Private Events                                        PUSHING THE         15 | JKI CONFIDENTIAL              ...
Public API / Private Events                                        PUSHING THE         15 | JKI CONFIDENTIAL              ...
Public API / Private Events                                        PUSHING THE         15 | JKI CONFIDENTIAL              ...
Public API / Private Events                                        Only our Process VI                                    ...
Public API / Private Events                                     Process VI registers for                                 “...
Public API / Private Events                                 When the Process VI receives a                                ...
Putting it All Together           Client code       registers for Public             Events                               ...
Putting it All Together           Start Process &                                 Invoke Public API   Exit Module         ...
Everything is a Module                                               Main                                               Ap...
Everything is a Module                                               Main                                               Ap...
Everything is a Module                    Main                   App UI                      Main                         ...
Extensions & Tweaks         Use with by-value & by-ref objects         Community & Protected Events         Dynamically un...
Things That Suck         Most annoying bug ever. Fixed in LV2011!         No Event queue management or introspection      ...
Take Home Point         User Events are a very easy-to-use feature         with a lot of cool functionality.         They ...
The End!                                 Discussion!                                               PUSHING THE         25 ...
Upcoming SlideShare
Loading in …5
×

NIWeek 2011: Beyond State Machines / Building Modular Applications in LabVIEW (JKI)

6,269 views

Published on

Slides for presentation given by Justin Goeres at NIWeek 2011. Learn about a template for inter-process communication that’s easy enough for Intermediate developers, but powerful and flexible enough for CLAs. Nearly every significant LabVIEW-based application uses multiple loops and multiple pieces of hardware. Without a clear design pattern, coordinating all these moving pieces is a recipe for spaghetti code. In this presentation, we introduce an elegant, powerful, and easy-to-use template for inter-process communication based on the concept of “Public” and “Private” events.

Published in: Technology, Business
  • Be the first to comment

NIWeek 2011: Beyond State Machines / Building Modular Applications in LabVIEW (JKI)

  1. 1. PUSHING THE LIMITS OF LABVIEW Beyond State Machines: Building Modular Applications in LabVIEW Using Public & Private Events Justin Goeres Senior Engineer & Product Marketing Manager JKIMonday, August 8, 11
  2. 2. Rules 1. Vote with your feet. 2. Please turn on your smartphones. @JustinGoeres is going Beyond State Machines at #niweek! PUSHING THE 2 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  3. 3. Let’s Get This Straight User Events are a very easy-to-use feature with a lot of cool functionality. They form the basis of JKI’s primary application frameworks & templates. If we could get a couple things fixed/added to LabVIEW, we could do even better. PUSHING THE 3 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  4. 4. A Public & Private Events Framework PUSHING THE 4 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  5. 5. Agenda What is it? PUSHING THE 5 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  6. 6. Agenda What is it? How does it work? PUSHING THE 5 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  7. 7. Agenda What is it? How does it work? What’s it good for? PUSHING THE 5 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  8. 8. Agenda What is it? How does it work? What’s it good for? What’s it bad at? PUSHING THE 5 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  9. 9. Agenda What is it? How does it work? What’s it good for? What’s it bad at? How can you use it in your projects? PUSHING THE 5 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  10. 10. What is it? A “module” has:  Statefulness / private data  Asynchronous process(es)  Public API  Public Events PUSHING THE 6 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  11. 11. Key Benefits Module knows nothing about who’s consuming the data it produces Lightweight & easy to use Compatible with by-ref and by-val architectures PUSHING THE 7 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  12. 12. Client Code is Simple Start Process & Invoke Public API Exit Module register for Public as needed when done Events PUSHING THE 8 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  13. 13. How Does it Work? PUSHING THE 9 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  14. 14. Process VI & Public Events PUSHING THE 10 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  15. 15. Process VI & Public Events Shift register for private module data (“State”) PUSHING THE 10 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  16. 16. Process VI & Public Events Shift register for private module data (“State”) Generate a “Public Event” when “something happens” PUSHING THE 10 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  17. 17. Public Events: Sending Information OUT Process VI generates a Public Event... PUSHING THE 11 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  18. 18. Public Events: Sending Information OUT Process VI generates a Public Event... PUSHING THE 11 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  19. 19. Public Events: Sending Information OUT Process VI generates a Public Event... PUSHING THE 11 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  20. 20. Public Events: Sending Information OUT Process VI generates a Public Event... PUSHING THE 11 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  21. 21. Public Events: Sending Information OUT Process VI generates a Public Event... PUSHING THE 11 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  22. 22. Public Events: Sending Information OUT Process VI generates a Public Event... ...which is received by any other Event Structure that’s registered for it. PUSHING THE 11 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  23. 23. Public Events: One to Many Process VI generates a Public Event... ...that can be received by any number of consumers! PUSHING THE 12 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  24. 24. The Public API Public API VIs... ...generate Private Events... PUSHING THE 14 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  25. 25. The Public API Public API VIs... ...generate Private Events... ...that are handled by the asynchronous Process VI PUSHING THE 14 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  26. 26. Public API / Private Events PUSHING THE 15 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  27. 27. Public API / Private Events PUSHING THE 15 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  28. 28. Public API / Private Events PUSHING THE 15 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  29. 29. Public API / Private Events PUSHING THE 15 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  30. 30. Public API / Private Events Only our Process VI can receive this PRIVATE event PUSHING THE 15 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  31. 31. Public API / Private Events Process VI registers for “Private Events” at initialization PUSHING THE 16 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  32. 32. Public API / Private Events When the Process VI receives a Private Event, it responds appropriately. PUSHING THE 17 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  33. 33. Putting it All Together Client code registers for Public Events Client code invokes Public API PUSHING THE 19 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  34. 34. Putting it All Together Start Process & Invoke Public API Exit Module register for Public as needed when done Events PUSHING THE 20 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  35. 35. Everything is a Module Main App EKG Leak Analysis Detection Analog Motor Input Controller PUSHING THE 21 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  36. 36. Everything is a Module Main App EKG Leak Analysis Detection Analog Motor Input Controller PUSHING THE 21 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  37. 37. Everything is a Module Main App UI Main App EKG Leak Analysis Detection Analog Motor Input Controller PUSHING THE 21 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  38. 38. Extensions & Tweaks Use with by-value & by-ref objects Community & Protected Events Dynamically unregister / reregister Synchronous communication PUSHING THE 22 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  39. 39. Things That Suck Most annoying bug ever. Fixed in LV2011! No Event queue management or introspection No Notifier-like behavior (“ignore previous”) PUSHING THE 23 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  40. 40. Take Home Point User Events are a very easy-to-use feature with a lot of cool functionality. They form the basis of JKI’s primary application frameworks & templates. If we could get a couple things fixed/added to LabVIEW, we could do even better. PUSHING THE 24 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11
  41. 41. The End! Discussion! PUSHING THE 25 | JKI CONFIDENTIAL LIMITS OF LABVIEWMonday, August 8, 11

×