PUSHING THE LIMITS OF LABVIEW




                                   Beyond State Machines:
                                   Building Modular Applications in LabVIEW Using
                                   Public & Private Events
                                   Justin Goeres
                                   Senior Engineer & Product Marketing Manager
                                   JKI




Monday, August 8, 11
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 LABVIEW

Monday, August 8, 11
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 LABVIEW

Monday, August 8, 11
A Public & Private Events Framework




                                                PUSHING THE
           4 | JKI CONFIDENTIAL
                                                LIMITS OF LABVIEW

Monday, August 8, 11
Agenda

         What is it?




                                  PUSHING THE
           5 | JKI CONFIDENTIAL
                                  LIMITS OF LABVIEW

Monday, August 8, 11
Agenda

         What is it?
         How does it work?




                                  PUSHING THE
           5 | JKI CONFIDENTIAL
                                  LIMITS OF LABVIEW

Monday, August 8, 11
Agenda

         What is it?
         How does it work?
         What’s it good for?




                                  PUSHING THE
           5 | JKI CONFIDENTIAL
                                  LIMITS OF LABVIEW

Monday, August 8, 11
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 LABVIEW

Monday, August 8, 11
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 LABVIEW

Monday, August 8, 11
What is it?

         A “module” has:
                      Statefulness / private data
                      Asynchronous process(es)
                      Public API
                      Public Events




                                                     PUSHING THE
           6 | JKI CONFIDENTIAL
                                                     LIMITS OF LABVIEW

Monday, August 8, 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 LABVIEW

Monday, August 8, 11
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 LABVIEW

Monday, August 8, 11
How Does it Work?




                                  PUSHING THE
           9 | JKI CONFIDENTIAL
                                  LIMITS OF LABVIEW

Monday, August 8, 11
Process VI & Public Events




                                       PUSHING THE
         10 | JKI CONFIDENTIAL
                                       LIMITS OF LABVIEW

Monday, August 8, 11
Process VI & Public Events




    Shift register for private module data
                    (“State”)




                                             PUSHING THE
         10 | JKI CONFIDENTIAL
                                             LIMITS OF LABVIEW

Monday, August 8, 11
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 LABVIEW

Monday, August 8, 11
Public Events: Sending Information OUT

     Process VI generates a Public Event...




                                                   PUSHING THE
          11 | JKI CONFIDENTIAL
                                                   LIMITS OF LABVIEW

Monday, August 8, 11
Public Events: Sending Information OUT

     Process VI generates a Public Event...




                                                   PUSHING THE
          11 | JKI CONFIDENTIAL
                                                   LIMITS OF LABVIEW

Monday, August 8, 11
Public Events: Sending Information OUT

     Process VI generates a Public Event...




                                                   PUSHING THE
          11 | JKI CONFIDENTIAL
                                                   LIMITS OF LABVIEW

Monday, August 8, 11
Public Events: Sending Information OUT

     Process VI generates a Public Event...




                                                   PUSHING THE
          11 | JKI CONFIDENTIAL
                                                   LIMITS OF LABVIEW

Monday, August 8, 11
Public Events: Sending Information OUT

     Process VI generates a Public Event...




                                                   PUSHING THE
          11 | JKI CONFIDENTIAL
                                                   LIMITS OF LABVIEW

Monday, August 8, 11
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 LABVIEW

Monday, August 8, 11
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 LABVIEW

Monday, August 8, 11
The Public API

                       Public API VIs...


                                     ...generate Private Events...




                                                                     PUSHING THE
         14 | JKI CONFIDENTIAL
                                                                     LIMITS OF LABVIEW

Monday, August 8, 11
The Public API

                       Public API VIs...


                                     ...generate Private Events...




                                                          ...that are handled by the
                                                          asynchronous Process VI




                                                                              PUSHING THE
         14 | JKI CONFIDENTIAL
                                                                              LIMITS OF LABVIEW

Monday, August 8, 11
Public API / Private Events




                                        PUSHING THE
         15 | JKI CONFIDENTIAL
                                        LIMITS OF LABVIEW

Monday, August 8, 11
Public API / Private Events




                                        PUSHING THE
         15 | JKI CONFIDENTIAL
                                        LIMITS OF LABVIEW

Monday, August 8, 11
Public API / Private Events




                                        PUSHING THE
         15 | JKI CONFIDENTIAL
                                        LIMITS OF LABVIEW

Monday, August 8, 11
Public API / Private Events




                                        PUSHING THE
         15 | JKI CONFIDENTIAL
                                        LIMITS OF LABVIEW

Monday, August 8, 11
Public API / Private Events




                                        Only our Process VI
                                         can receive this
                                          PRIVATE event




                                                 PUSHING THE
         15 | JKI CONFIDENTIAL
                                                 LIMITS OF LABVIEW

Monday, August 8, 11
Public API / Private Events




                                     Process VI registers for
                                 “Private Events” at initialization




                                                                      PUSHING THE
         16 | JKI CONFIDENTIAL
                                                                      LIMITS OF LABVIEW

Monday, August 8, 11
Public API / Private Events




                                 When the Process VI receives a
                                   Private Event, it responds
                                         appropriately.




                                                                  PUSHING THE
         17 | JKI CONFIDENTIAL
                                                                  LIMITS OF LABVIEW

Monday, August 8, 11
Putting it All Together



           Client code
       registers for Public
             Events



                                    Client code invokes
                                         Public API




                                             PUSHING THE
         19 | JKI CONFIDENTIAL
                                             LIMITS OF LABVIEW

Monday, August 8, 11
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 LABVIEW

Monday, August 8, 11
Everything is a Module


                                               Main
                                               App




             EKG                            Leak
            Analysis                      Detection




                                 Analog                Motor
                                  Input               Controller

                                                                   PUSHING THE
         21 | JKI CONFIDENTIAL
                                                                   LIMITS OF LABVIEW

Monday, August 8, 11
Everything is a Module


                                               Main
                                               App




             EKG                            Leak
            Analysis                      Detection




                                 Analog                Motor
                                  Input               Controller

                                                                   PUSHING THE
         21 | JKI CONFIDENTIAL
                                                                   LIMITS OF LABVIEW

Monday, August 8, 11
Everything is a Module

                    Main
                   App UI                      Main
                                               App




             EKG                            Leak
            Analysis                      Detection




                                 Analog                Motor
                                  Input               Controller

                                                                   PUSHING THE
         21 | JKI CONFIDENTIAL
                                                                   LIMITS OF LABVIEW

Monday, August 8, 11
Extensions & Tweaks

         Use with by-value & by-ref objects
         Community & Protected Events
         Dynamically unregister / reregister
         Synchronous communication




                                               PUSHING THE
         22 | JKI CONFIDENTIAL
                                               LIMITS OF LABVIEW

Monday, August 8, 11
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 LABVIEW

Monday, August 8, 11
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 LABVIEW

Monday, August 8, 11
The End!




                                 Discussion!




                                               PUSHING THE
         25 | JKI CONFIDENTIAL
                                               LIMITS OF LABVIEW

Monday, August 8, 11

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

  • 1.
    PUSHING THE LIMITSOF LABVIEW Beyond State Machines: Building Modular Applications in LabVIEW Using Public & Private Events Justin Goeres Senior Engineer & Product Marketing Manager JKI Monday, August 8, 11
  • 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 LABVIEW Monday, August 8, 11
  • 3.
    Let’s Get ThisStraight 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 LABVIEW Monday, August 8, 11
  • 4.
    A Public &Private Events Framework PUSHING THE 4 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 5.
    Agenda What is it? PUSHING THE 5 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 6.
    Agenda What is it? How does it work? PUSHING THE 5 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 7.
    Agenda What is it? How does it work? What’s it good for? PUSHING THE 5 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 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 LABVIEW Monday, August 8, 11
  • 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 LABVIEW Monday, August 8, 11
  • 10.
    What is it? A “module” has:  Statefulness / private data  Asynchronous process(es)  Public API  Public Events PUSHING THE 6 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 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 LABVIEW Monday, August 8, 11
  • 12.
    Client Code isSimple Start Process & Invoke Public API Exit Module register for Public as needed when done Events PUSHING THE 8 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 13.
    How Does itWork? PUSHING THE 9 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 14.
    Process VI &Public Events PUSHING THE 10 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 15.
    Process VI &Public Events Shift register for private module data (“State”) PUSHING THE 10 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 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 LABVIEW Monday, August 8, 11
  • 17.
    Public Events: SendingInformation OUT Process VI generates a Public Event... PUSHING THE 11 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 18.
    Public Events: SendingInformation OUT Process VI generates a Public Event... PUSHING THE 11 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 19.
    Public Events: SendingInformation OUT Process VI generates a Public Event... PUSHING THE 11 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 20.
    Public Events: SendingInformation OUT Process VI generates a Public Event... PUSHING THE 11 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 21.
    Public Events: SendingInformation OUT Process VI generates a Public Event... PUSHING THE 11 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 22.
    Public Events: SendingInformation 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 LABVIEW Monday, August 8, 11
  • 23.
    Public Events: Oneto Many Process VI generates a Public Event... ...that can be received by any number of consumers! PUSHING THE 12 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 24.
    The Public API Public API VIs... ...generate Private Events... PUSHING THE 14 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 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 LABVIEW Monday, August 8, 11
  • 26.
    Public API /Private Events PUSHING THE 15 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 27.
    Public API /Private Events PUSHING THE 15 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 28.
    Public API /Private Events PUSHING THE 15 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 29.
    Public API /Private Events PUSHING THE 15 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 30.
    Public API /Private Events Only our Process VI can receive this PRIVATE event PUSHING THE 15 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 31.
    Public API /Private Events Process VI registers for “Private Events” at initialization PUSHING THE 16 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 32.
    Public API /Private Events When the Process VI receives a Private Event, it responds appropriately. PUSHING THE 17 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 33.
    Putting it AllTogether Client code registers for Public Events Client code invokes Public API PUSHING THE 19 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 34.
    Putting it AllTogether Start Process & Invoke Public API Exit Module register for Public as needed when done Events PUSHING THE 20 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 35.
    Everything is aModule Main App EKG Leak Analysis Detection Analog Motor Input Controller PUSHING THE 21 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 36.
    Everything is aModule Main App EKG Leak Analysis Detection Analog Motor Input Controller PUSHING THE 21 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 37.
    Everything is aModule Main App UI Main App EKG Leak Analysis Detection Analog Motor Input Controller PUSHING THE 21 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11
  • 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 LABVIEW Monday, August 8, 11
  • 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 LABVIEW Monday, August 8, 11
  • 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 LABVIEW Monday, August 8, 11
  • 41.
    The End! Discussion! PUSHING THE 25 | JKI CONFIDENTIAL LIMITS OF LABVIEW Monday, August 8, 11