Feb
29

Active VI Toolkit public alpha - Erlang style message passing concurrency toolkit for LabVIEW

by Tomi Maila, Feb 29, 2008 at 4:54 pm
1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 4.4 out of 5)
Loading ... Loading ...

Active VI Toolkit logo ExpressionFlow today announced a public alpha release of Active VI Toolkit, an Erlang style message passing library for development of concurrent LabVIEW applications. The toolkit provides easy-to-use LabVIEW language abstractions for writing concurrent applications based on message passing between parallelly executing VIs. ExpressionFlow Active VI Toolkit greatly simplifies the authoring of highly concurrenct LabVIEW applications.

Download now!

Background

A few months ago I compared the LabVIEW and Erlang concurrency models in my article Two Paths to Concurrency - Comparing Erlang and LabVIEW. Whereas Erlang concurrency model provides means to write highly concurrent highly scalable applications, LabVIEW dataflow model allows very easy ways to write concurrent applications taking advantage of a few processor cores.

Active VI Toolkit is a research project, whose aim is to find the best way to fit Erlang style concurrency model into LabVIEW so that LabVIEW developers can take advantage of both concurrency models depending on their needs. The main design goal in the development of the toolkit so far has been simplicity of use. To reach this design goal, the toolkit tries to utilize existing LabVIEW language aspects as well as possible; the intention is not to reinvent the wheel.

The Active VI Toolkit consists of two modules, the Active VI Toolkit module and a One-Time Store module. Active VI Toolkit module provides language abstractions for message passing whereas One-Time Store module provides language abstractions for returning values as response to received messages.

Active VI Toolkit basics

The Active VI Toolkit is based on a concept of parallely executing VIs (LabVIEW functions) called Active VIs. When a new Active VI instance is created, the connector pane connected controls are initialized in exactly the same way as in a normal subVI (function) call. When an Active VI instance is created, a new thread is spawned that will execute the Active VI. Or to be more precise, a new parallel VI is executed that will call the Active VI.

After the Active VI has been initialized and started, it can usually execute some internal initialization procedures and then start waiting for messages in a loop. The messages can be send to the Active VI with a Send Message to Active VI node. The messages are identified by label and type of some wire connected to type type input of the node. The messages are passed to Active VI as value change events of Active VI front panel controls and can received with a LabVIEW event structure.

When an Active VI needs to be stopped, it’s sent a special Close message with some timeout value using a Close Active VI node. If the Active VI cleanly closes within this timeout, the values of Active VI connector pane indicators are passed to the VI requesting the Active VI to close, otherwise the Active VI will be aborted.

The very basics of creating an Active VI, sending a simple message to an Active VI and Closing an Active VI can be seen in the figure below. The first node on the left creates a new Active VI instance from a strict static VI reference and initializes with string value expressionflow.com. The second node sends a message My Message of type I32 with value 7 to the Active VI. The third. node requests the Active VI to close with infinite timeout and returns the value of the error out indicator on the Active VI connector pane.

Creating, sending message to and closing an Active VI

Writing an Active VI itself is very simple. What is practically needed is some connector pane connected controls and indicators to pass initialization data and return values to and from the Active VI. In addition one needs some controls that define the supported messages and a event structure to handle the receiving of the messages. Usually one also wants to have a while loop to receive more than one message only. Nothing else is needed. A simple Active VI block diagram is illustrated in the figure below.

Basic Active VI block diagram

A basic library that ships with Active VI Toolkit is One-Time Store Toolkit. One-Time Store is a by-reference type that can store a single value of chosen type. It is very similar to a LabVIEW single element queue. However, once the value of the One-Time Store is set, it can never be modified again. In computer science terms One-Time Store is a dataflow variable. However I chose not to use this term as it might confuse LabVIEW users that usually think of dataflow in a little different way.

One-Time Stores can be used as place holders for asynchronous replies to sent messages. The figure below illustrates initializing an empty One-Time Store of string type and sending the One-Time Store reference to an Active VI within a message. After the message is sent, the sender can start waiting for a value of the One-Time Store to be set by the Active VI. In the figure the One-Time Store is immediately destroyed after the value is received. However this doesn’t need to be the case.

Using a One-Time Store as a place holder for a response from an Active VI

From Active VI point of view, replying to this message is simple. To respond to the sender only needs to set the One-Time Store value. Receiving the message in the above image and replying to it is illustrated in the image below.

Active VI responding to a message using a One-Time Store reference

Conclusions

In this post I covered the very basics of Active VI Toolkit. The Active VI toolkit is much more powerful a toolkit that is directly evident from this post. I left some aspects and properties of the toolkit out of this post and will discuss about them in my later posts. Also note that the Active VI toolkit is currently at alpha pre-release version targeted for mainly for concept testing and public discussion.

I’ll soon post follow-up articles on more advanced features of the Active VI toolkit. Meanwhile download the Active VI toolkit from and play around with it and provide us feedback. I especially appreciate feedback on the concept itself and how it could be made better.

Download now!

Print This Post Print This Post

8 Comments

Make A Comment
  • Jim Kring Said:

    Tomi: Great work on the new toolkit. This looks very exciting!

  • Philippe Guerit (PJM_LabVIEW) Said:

    Tomi,

    This look very interesting!
    I will definitively have to try this.
    At first glance, one thing that seem a little “odd” is that you appear to be using different glyphs for representing (what I assume to be) VI references. For instance, in your first screenshot, a strict static VI ref is connected to a “rectangle with bold top edge” glyph then later with a “star” glyph. It seem like this should be the same glyph.
    Now that I am thinking more about it, maybe in the first glyph the node does not know that it is a strict static VI ref but the last node does, thus the “star” for the strictness.

    PJM

  • Tomi Maila Said:

    Philippe, thanks for your comments. The glyphs are different because they have different meaning. The star is supposed to mean a strict VI type (for type only). The box is meaning a static VI reference which can either be strict (as in the example) or non-strict.

  • Philippe Guerit (PJM_LabVIEW) Said:

    Ah, make sens (the srtict for type only). I did not realized that this was a “for type only” input.
    By the way, good job on the blog as well. Just by reading it, it is quite easy to figure out what are the intent of your examples (even for people like me that know nothing whatsoever about Erlang).

    PJM

  • CBL Said:

    Thanks so much for distributing this as ogp files.

    I have to admit when I read your Erlang blog article, I never once thought you might be considering adding Erlang type concurrency to LabVIEW. I thought you may just use Erlang for its strengths. It is great that you are trying to migrate a strength of Erlang to LabVIEW.

    I’m going through the examples now - it all looks very professional - thanks for making my Friday afternoon more enjoyable!

  • Todd Vangilder Said:

    I am intrested in trying out the active vi toolkit, but I cant download unless I am registered, and the regestration process is not sending out the E-mail with my password. I also tried the change pasword, even though I don’t have one, and it did not send me an E-mail either.

  • Tomi Maila Said:

    Todd, I’ll send you an email to troubleshoot the issue together with you. I tested registering myself a new user name and there were no problems. Maybe your internet operator or email program has regarded the email as spam. The subject of the email should be [ExpressionFlow] Your username and password. Anyway I can manually set the password for you.

  • Tushar Said:

    see this post
    http://forums.lavag.org/Tushar-s-Event-Architecture-t10360.html

    I was also working on something which can pass events between different VIs along with event data.
    but my approach was bit different than you.

    i do expect a comment from you

Comments RSS Feed   TrackBack URL

Leave a comment