Sunteți pe pagina 1din 23

Welcome to ALARM

Wireless access
 Username: guest-alatec
 Password: pypuzp54

1
Introduction to the Actor Framework
Stephen R. Mercer
Senior Software Engineer
LabVIEW R&D
Allen C. Smith
Senior Systems Engineer
Systems Engineering

2
Agenda

• What is the Actor Framework?


• What Actor Framework Replaces
• How AF Minimizes Code Replication
• How AF Standardizes Module Communication
• Getting started with Actor Framework
• Where to Learn More

3
What is the Actor Framework?

The Actor Framework:


• Is a set of classes that you can use to build
modular, scalable, parallel-processing systems
• Mitigates the risk of deadlock or race
conditions
• Builds on the queue-driven state machine
• Maximizes reuse
• Is easy to use

4
Queue-Driven State Machine

5
Scalable
Larger Systems MOdular
REusable
Simple

6
Three Sources of Code Replication

1. Override the handling of a message


2. Extend the set of handled messages
3. Append additional behavior to the state machine
Extend
Override

Append

7
Source 1: Override Speed

Toggle/
Notify
Direction
Speed

Toggle
On
Direction

8
Cluster and Node...

9
… become Class and Method

10
… become Class and Method

11
Source 2: Extend
Speed

E-Stop Toggle
On
Direction
Speed

Toggle
On
Direction

12
Message and Case Structure…

Message may be malformed

13
… become Class and Dynamic Dispatch

• Message is strongly-typed
• Don’t need to translate variants
or flatten strings
• No change to state machine
Add new method to target
class and message class to
access it

14
Source 3: Append

16
New Class: Actor.lvclass

17
Using the Parent

18
Fan UI.lvclass:Actor Core.vi
Using the Child
• Child actors may add UI to functional
parent actors
• Can have multiple UIs to same
functionality
• Can test UI and functions independently

Behavior can be changed at run time

19
Standardizing Communication:
Launch Actor.vi

The only public method of the Actor class

Typical use pattern for the Actor:


• Create class and methods
• Pass class reference and a queue
to receive messages to Launch
Actor.vi

20
Demonstration

22
For Best Results

• Announcement messages, not request messages


• No message should get or set the entire actor
• Embrace peer-to-peer messaging
• Actors may register as listeners for other Actors
• Synchronous messages can be created at your risk

Real-world applications demonstrate scalability

25
Recap
• Extensible along three axes without replication:
 Override
 Extend
 Append behavior

• Messages have strict type and direction


• Standard for highly scalable communications
• Reduced the risk associated with by-reference
architectures in a dataflow environment
33
Download the Actor Framework

https://decibel.ni.com/content/docs/DOC-17193
Getting started with the Actor Framework

34

S-ar putea să vă placă și