LabVIEW AF_10 Top 5 Actor Overrides & Chat Room

First rule of coding - Just write the code.

Tom McQuillan Youtue Channel

LabVIEW Sample Code

Top 5 Actor Overrides & Chat Room Project

Notes:

The source video did not provide every details of the Chat Room Implementation since there will too much trivial. The writer will cover original video content and try to finish the application. The “LabVIEW Sample Code” will contain Tom’s code and writer’s attempt. Since this is writer’s first actor application code, there will are a lot room to improve.

Top 5 Actor Overrides

Tops 5 Actor overrides lists are following:

  1. Pre Launch Init.vi
  2. Actor Core.vi
  3. Stop Core.vi
  4. Handle Last Ack Core.vi
  5. Handle Error.vi

Pre Launch Init.vi

Inside Actor.vi, we can find the Pre Launch Init.vi, the very top level implementation doesn’t do anything. It is a placeholder, an empty diagram.

One of the implementation is to create different user event to update User Interface in Pre Launch Init.vi. If any error happens, we need follow the best practices to call the “Destroy Events”

Inside “Destroy Events”, send the stop event and clean the event reference.

One thing we MUST NOT do is

DO NOT try to launch nested actors in the pre Launch Init.vi, which will hang system.

Actor Core.vi

Actor Core will not launch if any happened in Pre Launch Init.vi, and will clean up the reference that open in Pre Launch Init.vi.

Again,

  • The Actor Class Private contains the QMS “Cluster” Data
  • The Message Class, Contains the QMS “Case Structure” and parameters pass to the QMS “Case Structure”

One of the implementation is to use Actor Core as UI. The event handling loop is used in Actor Core to handle

  • Value Changes to send message
  • User Event to update UI

If we create reference want to pass the core, we need to do it before the parent Implementation of Actor Core.

The Chat Window Model Actor Core is not used as UI

Before We launch nested actor, a few abstract messages are added nested Actor private data, “Chat Room Name” and nested actor Enqueuer. UI Class is bundle into Calling Actor “Chat Window Model” private data, do it before parent implementation

Handle Error.vi

Error Handle is inside actor core

By default, it is empty code but to stop the actor. Sometimes an override is needed prevent certain error to shut down whole actor. We c

We could add simple error handler dialog and case structure to handle the errors. Apart from error 43 which is Open/Create/Replace File Vi when File Dialog is Cancelled

DETT = Desktop Execution Trace Toolkit (Used for debugging)

Stop Core.vi

The Stop Core is also found inside Actor Core

This VI is going to send out STOP MESSAGE to all of the Nested Actors. If a Calling Actor stops, all of its nested actors will stop by default.

We may also need to stop any help loops or clean up references caused by your Actors Core.

Handle Last Ack Core.vi

Handle Last Ack Core.vi overrides is essentially message overrides, if we tunneled into Actor Core. We send Last Ack.vi at the end of a nested Actor.vi

Receive Message.vi Event-> Do.vi -> Last Ack:Do.vi -> Handle last Ack ->

Three things will be sent with “Send Last Ack.vi”

  1. Last data appeared in that nested actor
  2. Nested Actor Enqueuer
  3. The error status of the nested Actor

The Calling Actor is going to purge its registry, check who is my nested Actors, if the Enqueuer match any of the registry. The Enqueuer will be removed.

The next is Handle Last Ack Core.vi

Handle Last Ack Core.vi is the action by Calling actor, it receive stopped nested actor last data and perform

Chat Room Project

Comments