The AF Msg Forwarding Utility: Getting Started

Getting started with the Zyah AF Msg Forwarding Utility is simple, but it does require some initial architecture decisions and setup.

Once you’ve installed the VI package, all the pieces you need to begin integrating the utility with your application are immediately available.

This guide will take you through our recommendations on how to integrate the Msg forwarding utility into a new, blank Actor Framework project. (If you have an existing AF project, the steps to integrate the Zyah AF Msg Forwarding Utility are very similar and just as easy.)

When finished, you will have an actor project that generates messages from a Fridge Actor for consumption by a Chart Temperature Display Actor.


Note: The images referenced here are from LabVIEW 2020 SP1 and the code uses v1.1.0.2 of the Zyah AF Msg Forwarding Utility.


Add Zyah AF Msg Forwarding Utility to Project

Start by creating a new empty project. Save the project before continuing. In this example, we can save it as “Getting Started AF Msg Forwarding”

Once the new project is created, open a new blank VI. On the block diagram, navigate to the Zyah Solutions > Zyah AF Msg Forwarding palette and place AF Msg Forwarding Actor.vi onto the block diagram. This is done as a quick way to load the forwarding utility into the project dependencies.

Move the AF Msg Forwarding Actor library directly into the project (out of “Dependencies”).

Base Actor

Now that we have the forwarding utility and the forwarding base actor in the project, we can create our project-specific base actor. The purpose of the base actor is to provide a single point of inheritance so that all actors in the tree have access to the forwarding utility. This base actor will also need to inherit from the AF Msg Forwarding Actor.

Create a new Actor in your project. This can be done by right-clicking on My Computer and selecting New > Actor.

Base Actor

Name of Actor = Base Actor

Inherit from = Actor (leave it as Actor for now, we’ll change this in the next step)

Save files to = ..\Getting Started AF Msg Forwarding

Select OK to add it to the project.

Change Base Actor Inheritance

Open the properties of the Base Actor class. Select Inheritance and change it to AF Msg Forwarding Actor. Select Inherit from Selected to confirm change. Base Actor inheritance should look like the hierarchy shown to the left. Select OK from properties window when done.

Override Get Interfaces to Forward

Within the Base Actor, there is one VI that you will need to override, Get Interfaces to Forward.

The Get Interfaces to Forward VI provides a place to set which interfaces need to be forwarded by the utility. Later on we will place the interface class objects here.

For now override this VI, remove the call parent method and save it. When finished, it should look like the screenshot to the left.

Data Interface Class

Before we create our data generator actor, we need an interface with messages to send our generated data.

Fridge Announcements Interface

Create a new interface called Fridge Announcements. Don’t forget to also create a library called Fridge Announcements and add the new announcements interface to it.

Handle Fridge Temperature Message

Create a new VI from Dynamic Dispatch Template and call it Handle Fridge Temperature. Add a double precision numeric control as the input called Fridge Temperature. Save the VI and create a new actor message for it.

Now is a good time to save the Fridge Announcements library.

Update Base Actor List of Interfaces to Forward

Update Get Interfaces to Forward

Add the Fridge Announcements interface object to the block diagram.

In this example, we only have one interface we want to forward. However, the base method expects a list of several interfaces (as would be the case in a real-world project). We use Build Array to match the output terminal.

Data Generator Actor

We need a data generator that will continuously send out announcements at N frequency. We’ll use a fridge as an example. The fridge will send out its fridge temperature at a rate of 1Hz. The fridge actor will also need to inherit from our Base Actor so it has access to the utility.

Create a new actor and name it Fridge Actor.

Fridge Actor

Name of Actor = Fridge Actor

Inherit from = Base Actor (browse to Base Actor if not in drop down list)

Save files to = ..\Getting Started AF Msg Forwarding

Fridge Actor added to project

Generate Refrigerator Data

Now we can create a method within Fridge Actor to generate random temperature readings. Create a new VI from Dynamic Dispatch and name it Generate Refrigerator Data. Add the random number (range) VI with a range of your choosing. We’ll use 0-30 for this example. Add the Send Handle Fridge Temperature VI. Use the Read Caller Enqueuer VI for the Message Enqueuer input.

Create an actor message for Generate Refrigerator Data.

Override Actor Core

Override Actor Core and add a time-delayed Generate Refrigerator Data Msg to occur at 1Hz (every 1000ms). Save the Fridge Actor library.

Data Consumer Actor

Now that we have an actor generating data, we need an actor to consume and display this data. Create a new actor called Chart Temperature Display Actor.

Create Chart Temperature Display Actor

Name of Actor = Chart Temperature Display Actor

Inherit from = Base Actor (browse to Base Actor if not in drop down list)

Save files to = ..\Getting Started AF Msg Forwarding

Chart Temperature Display Actor added to project.

Override Actor Core

Override Actor Core VI and add a waveform chart to the front panel. Hide the other front panel controls and indicators. For a cleaner UI, set the waveform chart to Fit Control to Pane.

Update Chart Temperature Display Actor Private Data

Open the private data of the Chart Temperature Display Actor and add a waveform chart reference to it. Save and close it.

Actor Core - Bundle Waveform Reference

In Actor Core, create a reference to the Waveform Chart indicator and bundle it into the actor private data.

Actor Core - Capture Panel Close Event

The panel close event will allow us to stop the demo program from this UI. Add an event structure with a Panel Close? event and send a normal stop to the caller enqueuer.

Optionally, discard the panel close for ease of testing during development.

Inherit from Fridge Announcements Interface

We need the chart display actor to inherit from the fridge announcements interface. This allows fridge data to be displayed on the UI.

Go to the Chart Temperature Display Actor’s Class Properties and select the Inheritance category. Select Change Parent Interface and select Fridge Announcements as the parent interface. Select OK to confirm changes.

Override Handle Fridge Temperature

Now that we inherited from Fridge Announcements, we can override its Handle Fridge Announcements VI. Override Handle Fridge Announcements VI and update the waveform chart using the value property node. The updated value will be the input Fridge Temperature.

Root Actor

The Root Actor will provide us with a starting point for this demo. Root Actor will launch both the Fridge Actor and Chart Temperature Display Actor. It is also responsible for forwarding messages in the application using the Zyah AF Msg Forwarding Utility.

Create Root Actor

Name of Actor = Root Actor

Inherit from = Base Actor

Save files to = ..\Getting Started AF Msg Forwarding

Root Actor added to project

Override Actor Core VI and launch both the Fridge Actor and Chart Temperature Display Actor using the Launch Nested App Actor VI from the Zyah AF Msg Forwarding palette. Note that this is not the standard Launch Nested Actor method that ships with Actor Framework. Launch Nested App Actor is needed for automatic announcement forwarding to take place.

Make sure you set Open Actor Core front panel? to True for the chart actor.

Launch Root Actor

The last step is to launch the Root Actor. Create a VI called Launch AF Forwarding Demo and launch the Root Actor.

Run the Launch AF Forwarding Demo. You should see the Chart Temperature Display Actor front panel updating at 1Hz with random data.

Remember, temperature data is automatically being forwarded through our base actor. Root Actor does not need to inherit from the announcements interface or provide its own interface override. The forwarding utility handles forwarding data from the fridge actor to the chart display.

Have fun with this and let us know what cool projects you’re able to build using the Zyah AF Msg Forwarding Utility.

Previous
Previous

The AF Msg Constructor Utility

Next
Next

Introducing the AF Msg Forwarding Utility