MLA - Multi-Loop Architecture
MLA is a simple, powerful framework for LabVIEW application development. And it is free!
IntroductionLabVIEW is a powerful programming language. Its graphical nature makes it very approachable and easy to get started, even without a lot of programming experience. But scaling it to solve complex problems can be a challenge.
In this presentation, we will discuss some of the challenges of programming in LabVIEW and how to overcome them with this simple yet powerful framework called MLA. |
Frameworks for Developing in LabVIEWThere are many design patterns and frameworks that have been developed for LabVIEW. Starting with the examples and basics training from N.I., you can learn some simple ones to get you started. First, three-step applications (acquire, analyze, present), then a state machine. As you learn, you start using queues, and step up to a QSM (queued state machine) or QMH (queued message handler).
QMH is great but it has its limits. Quickly you end up with multiple QMH loops interacting with each other, requiring communication and coordination that is all left up to you to build. Advanced LabVIEW users have other tools to choose from. Tools such as Actor Framework are great, but can have a steep learning curve, leaving it out of reach of many developers. We were frustrated by the gap between the simple design patterns and the more capable but complex frameworks. That space is filled by a lot of custom code by programmers just finding ways to make things work, but often lacking in planning and structure. We saw this as an opportunity to create MLA, to help bridge that gap. |
Actor-based ProgrammingActor-based programming is a powerful way of representing complex systems. It is used to describe the design of concurrent systems where objects, also called actors, are self-contained components which interact with the other actors by sending messages. Each actor has a different role and responsibility. The communication between the actors is the way they coordinate with each other to form an application.
The LabVIEW Actor Framework is one implementation of this type of a system. MLA also uses a variation of the actor model. |
Actor Benefits with a Simple Framework
MLA provides the benefits of actor programming with a simple framework.
The design goals for MLA focused on making a simple, productive programming experience.
To achieve this, MLA provides a number of features.
With these simple features, MLA lets you think in terms of actors, but code in the familiar producer-consumer loop structure of LabVIEW. |
Think in Actor, Code in Loops |
Parts of MLAAn MLA app consists of three parts, the setup, the loops, and the cleanup. The setup and cleanup provide code that runs just once, as the name suggests, to set up the program and to clean up after the program is done running. The loops contain the real working code of the program.
The loops are the actors, as we discussed earlier, which work together to make the application. Each loop has certain responsibilities within the program, such as providing data acquisition, handling the GUI, or generating a report. |
An MLA App ExampleHere is an example of what an MLA application looks like. The setup code on the left provides the program name and revision documentation. It can also be used to do various initialization and other housekeeping tasks. Each of the loops is an actor with a role. The top loop, is generally the GUI loop of an MLA application. It interacts with the front panel and sends messages to the other actors as functions are requested.
The messages of MLA are broadcast messages. When a message is sent, it is received by all the other actors. Imagine a director giving stage directions to the actors. They all hear it, and each actor decides whether or not to take action. Some actors make take direct action, some may be interested in knowing what another actor is doing, and others may ignore the message altogether. This style of communication can be very useful over the usual directed messages of a point-to-point queue. It has a distinct advantage of simplicity as well. As more actors are added to the system, the messaging system does not increase in complexity. Any actor can talk to any other actor at any time. The messages can be general, such as “Start a Test Run”. But they can also be directed to another actor, such as “Report, generate PDF”. As applications become more complex, it can be helpful to move an actor to its own module. A loop can be implemented in a sub V I. You can see two of them at the bottom of the block diagram. They work the same way as the other loops. They are running in parallel with all of the same features, but it removes clutter from the main V I. . . This is also very helpful to support development by multiple programmers, with each working on their own actor V I’s. |
Summary
MLA is a simple, powerful LabVIEW framework. It gives you the benefits of actor programming with a much easier learning curve. You can be up and productive with MLA very quickly, using the producer-consumer loop structure you are already familiar with.
MLA’s benefits provide a productive programming experience.
MLA lets you think in terms of actors, but code in the familiar producer-consumer loop structure of LabVIEW.
The best part is that MLA is provided as an absolutely free tool. You can download it using the link below.
It is open source, free to download, free to use, and free to modify in any way you would like, for internal use as well as using it to produce software that you sell to others.
If you have any questions, or need help with your LabVIEW application, please contact us at [email protected].
Thanks for your interest in learning more about MLA. We trust it can become a valuable tool for you on your next LabVIEW project.
MLA’s benefits provide a productive programming experience.
- Easy to extend functionality
- Easy to modify, debug, maintain
- Easy to hand off to another developer
- Shallow learning curve so you can be productive quickly.
MLA lets you think in terms of actors, but code in the familiar producer-consumer loop structure of LabVIEW.
The best part is that MLA is provided as an absolutely free tool. You can download it using the link below.
It is open source, free to download, free to use, and free to modify in any way you would like, for internal use as well as using it to produce software that you sell to others.
If you have any questions, or need help with your LabVIEW application, please contact us at [email protected].
Thanks for your interest in learning more about MLA. We trust it can become a valuable tool for you on your next LabVIEW project.
Where does MLA Fit Compared to ALOHA?The Multi-Loop Architecture is a simplified LabVIEW architecture, based on some of the ALOHA core components. Think of it as ALOHA Lite. It fills a niche between a simple QMH and full-blown ALOHA application.
It provides many useful housekeeping tasks and a convenient way of modularizing your program into functional blocks, all with a fully-connected communication system.
|
Download MLA
MLA is provided to the LabVIEW community free of charge. It is provided without warranty or support. It is a tool we have used extensively on projects internally with great success. It is an ever-evolving tool. Use it. Enhance it. Stay in touch with us to help build it into a better tool.