Introduction to Actor Framework
03 May 2024 by James Nichols
Introduction
This article serves as an overview of using the Actor Framework that ships with LabVIEW. We have started a series (first part here) aimed at people who may just be starting to use the Actor Framework, or are interested in learning more about working with it. To that end, we are sharing some of the learning we have had whilst getting to grips with it ourselves.
Overview
We are going to assume that if you are reading this article, that you are familiar with LVOOP and are already aware of the outcomes from using the LabVIEW Actor Framework, or are generally aware of the actor model as a programming concept.
As a brief summary, the Actor Framework is used to develop a LabVIEW program which runs as a number of dynamically dispatched classes (actors) which communicate by sending each other messages. The Actor Framework seeks to achieve:
- Highly asynchronous system behaviour
- Extensible software architecture
- Streamlined module design and debug due to high levels of encapsulation
The LabVIEW Actor Framework ships with LabVIEW and is comprised of a series of classes and scripts that can be used to create actors within a LabVIEW project.
A template project also ships with LabVIEW, along with an informative example titled “Actor Framework Fundamentals”.
There are also several good existing resources on the Actor Framework that try to explain it to various depths. Two such resources are listed below:
- Actor Framework is not as hard as you think and here is why… - A LabVIEW Wiki article by Quentin"Q" Alldredge
- LabVIEW Actor Framework - A YouTube series by Tom Quillian
Actor Framework – the Important Bits!
When you create an actor, you can see that it is a class that inherits from a base class called Actor.
This Actor class contains a significant number of VIs and utilizes some additional classes in order to transform your class from just an ordinary class into a fully-fledged actor.
Fortunately, in order to use the Actor Framework effectively, we only really need to consider two of these classes and just a handful of methods.
These two class diagrams show us how your actor inherits from the Actor Framework base actor.
The public methods shown in Actor are the eight override methods that will be available in your actors. Your actors can be made without overriding these methods, however it is sometimes necessary to do so as a way of getting the exact actor behaviour you require.
The Actor Core method is the heart of each actor and is essentially a while loop with a dequeuer; it sits idle until a message arrives. Messages come in the form of class objects which all inherit from the Actor Framework Message class.
Back to Blog listings