Mass Compilers

cancel
Showing results for 
Search instead for 
Did you mean: 

Mass Compilers - Actor Framework Bootcamp.pptx

See attached slides and sample code for today's Actor Framework user group meeting. I hope to see you there!

Following up...

Thanks to all who attended last night! For those who could not make it, I want to add some additional context to the post.

Challenge 1 shows a typical event-driven producer/consumer. The challenge is to rewrite (or adapt) this code into a single actor. No need to worry about nested actors, maintaining other actors' queue references, how to design and actor-oriented application, etc. Just make one. The legacy producer/consumer works almost exactly like an actor does, including equivalent subVIs for commonly overridden actor methods (Pre Launch Init, Actor Core, Handle Error) and also includes similarly equivalent message Send subVIs. I added plenty of comments to guide you through the transition to actor.

Key points:

  • Create an actor (easiest in LV 2015+)
  • Override Actor Core to create an actor with a user interface. Make sure to set this Actor Core override (in VI properties) to "Show front panel when called".
  • The legacy consumer loop will be replaced by "Call Parent Method" (we are extending the parent Actor Core to add event handling in parallel)
  • All of your actor's core functionality happens in methods (VIs belonging to your actor class). In this case you will need only two methods:
    • Generate Random Numbers
    • Inject Error
  • Both of these methods get called by mesage (which LabVIEW scripts for you)
  • You invoke methods by calling Send methods (like Send Generate Random Numbers.vi)
  • The first (root) actor must be launched by a Launcher VI (you can't just run Actor Core). The example code is LV 2013 which launches the old way. 2014+ added a VI called Launch Root Actor and you should use that instead when available.


Good luck and post questions if you have them!

Regards,

Ethan

Message 1 of 4
(6,718 Views)

How do you go about creating and .exe from the AF application's source code?

0 Kudos
Message 2 of 4
(5,993 Views)

In a basic application, the startup VI is simply your launcher (the VI that launches root actor). If you want to be explicit about inclusion, you can add each actor and all of its messages to a library (.lvlib) and specify in the buildspec to always include all relevant libraries.

This is a good starting point for building your application. In reality, actors coupled by messages will include each other's libraries automatically. This will all change if you start using AF to build plugin architectures--but I wouldn't worry about that out of the gate.

0 Kudos
Message 3 of 4
(5,995 Views)

Also, Robert Smith (of Bloomy, NJ) wrote a couple of nice blog posts on this topic: http://www.bloomy.com/support/blog/getting-started-actor-framework

0 Kudos
Message 4 of 4
(5,995 Views)