Author: Elijah Kerry, CLA
Last update: May 19th, 2018 (NIWeek 2018)
Overview of the Measurement Abstraction Framework
The attached code serves as a reference architecture for the core architecture of large-scale test and measurement systems, especially long-running tests that are commonly associated with the characterization and validation of a physical system.
The Measurement Abstraction Framework demonstrates solutions that address the following common requirements:
Example Overview
Version 5.0 has been used to build an EV Powertrain Validation test demonstration, which will appear on the Expo floor of NIWeek, as well as various locations around then world. The attached code includes the device plugins that were used for this particular application. Once installed, it can be run, but will almost certainly generate an error unless you happen to have the same hardware at your disposal. The primary reason these were included is to serve as helpful examples for how driver plugins should be written.
To run the example without hardware, we recommend simulating one or more DAQ devices for use with the Standard Measurement.
Setup and Installation
Extending or Customizing Measurements
The example measurement is installed by default to C:\ProgramData\Measurements
The included example only features one measurement, "Standard Measurement," which his a very basic implementation. However, it is possible to instantiate N instances of this type of measurement, which should cover most basic use-cases.
Reasons to override this measurement include:
Extending or Customizing Hardware
The example measurement is installed by default to C:\ProgramData\Hardware
Unlike previous versions, all devices inherit directly from the base Hardware.lvclass object. The measurement device implements the acquisition and generation interfaces. Device plugins wrap specific drivers and are called used a basic "Configure --> Acquire --> Generate --> Measure --> Repeat until Close" sequence. A device can specify specific interfaces that they implement if requested by the framework, but the default is for a device to support "all" interfaces.
All devices have both common and unique configuration options. The common capabilities are stored in the base "HW Configuration.lvclass," but extended by their own implementation for unique properties
Future Updates / Known Issues
Additional Information
The following articles describe core design decisions of the original framework:
This framework is not officially supported by NI, but will continue to be improved and developed based on input and feedback. The original version of this framework was published in 2012.
This is an extremely useful example of an application of the Actor Framework! Thanks so much for making this available. It helps a lot with understanding the AF, and some good practices for handling a large measurement application.
Glad you like it onnodb!
Thank you for the quick fix Elijah. Everything works fine now.
This is a really nice example!!, will certainly have a detailled look at it.
Elijah keep up the good work!!
Works like a charm! Thanks!
Hi Elijah,
First let me say that I love everything that you are posting!
I'm working on a MVC version for very large spaghetti app:
http://lavag.org/topic/15331-mvc-through-class-control-feedback-required/
The main difference in my general approach is that most of the LVOOP I see around requires a complete redesign while most companies don't have the time or money for that.
However, beside upgrading old code I'm working on some new code and I try to work with all the best practices I learned from your posts.
Now for this amazing post (HAL, MAL... what's next? PAL - programmer abstraction layer?):
I'm using newer versions of all the vimp packages you require and I thought that it is ok but now I see that it is working for other.
Besides that, everything looks great and I can't wait to play with the full version and post back my feedback and gratitude.
I have already implemented HAL and UI Framework using LVLibP based on https://decibel.ni.com/content/docs/DOC-15014 and https://decibel.ni.com/content/docs/DOC-19176
Now I'm trying to implement MVC in the lower level of a single module inside a LVLibP.
I'm using the class control as the Model, a vi FP as the View, and another vi BD as the Control/Logic. The main trick behind my implementation is a recursive vi that scans the View for all it's controls and allows a direct access by name or reference, thus, allowing, if I understand correctly, communication with less classes and coupling (in the state machine you need to know the name of the command and a class to cast it into while I only need the name of the control to be the same as the control mirror in the class) to the View.
However, even though I think my View and Model are inherited a bit better in my design (the lavag version is old and dirty but you can see the general approach) your logic is inherited much better than mine and I love the MAL.
This is not the only reason I prefer to use your code, I tend to prefer official implementation since there are many people debugging the code and there are updates from time to time with great documentation + a forum you can ask questions about a common tool.
Any chance you can compare our approaches and the other one I heard that is coming soon?
Keep on the great work,
Dror.
P.S. - I followed each of your posts since I read a post of yours that made me understand: here is someone that knows how LV looks underneath. It was something about why certain things can't be dynamically dispatched since the operation won't be atomic and a child and a parent will try to access the same data. Since then I hear your name everywhere, from G# to every OO field I'm getting into. Thanks for everything!
Thanks for the kind words GoofyWires. The issues you mentioned regarding missing dependencies were quickly resolved, and I removed the notifications from multiple users. Please download the latest version above and let me know if you continue to have any problems.
I do not use or test my slides in Open Office, but I do make extensive use of multiple objects that likely do not translate correctly. Just in case this is a recurring issue, I've uploaded the slides as a PDF.
Finally, I will download a copy of your application to review in the next few weeks, but I'm about to embark on several weeks of travel, so it may take some time.
Wow, thank you very much for this great information and example.
The third slide in your presentation makes me feel ill if I look at it too long. I'm convinced! No more disturbing pictures please .
You're welcome! Regarding slide 3, it has become my universal problem statement for most of my presentations - I've decided to rotate the block diagram annually (I have no shortage of examples). I always ask, "how many people have inherited code like this and been asked to add a feature or fix a bug? No big deal... right?"
It is working great now. Thanks!!!
A few questions:
1. How do I open the block diagram of the actor? I tried using http://zone.ni.com/devzone/cda/epd/p/id/4008 but I can't even see main.vi there.
2. How did G# help you with the actors? Will the project work for someone without G#?
3. The results view works just for the diode. Frequency+Resistance tests fail (guess they should but I can't see the graph in view) and strain doesn't show up in the results window at all.
Once it will be working I'll turn the plugins into lvlibps and test how does the AF communicate between exe and lvlibp. If you know the answer already please let me know.
Besides that, it is fast, clean and beautiful!
Dror.
1. I'm not sure I understand your question, as an actor is represented by a class. The methods of the class define the messages and actor can handle. These are processed within actor core. For the most part, only actors with a UI have a custom implementation of actor core.vi. You might be looking for the block diagram of the Operator UI, which can be found under the Operator UI.lvclass in actor core.vi. If I misunderstood you, please clarify what it is you're trying to see.
2. I like G#, but I did not use it for this project
3. If a custom result is not defined for a measurement, it will just show the default display for results.lvclass, which is just a graph and a pass/fail boolean. This display can be customized by overriding it in a child of the results class. Very few measurements have a custom display at this point - I would like to add more over time.
1. It is a general problem I have while debugging call by ref of a reentrant vi: I want to see the actor core during run. However, you can't step into a call by ref (and most of the time LabVIEW will hang saying it is resetting the paused vi and the only solution I know of is to kill LabVIEW) and you can't open in advance the actor core since it is a reentrant vi and another clone will be opened. Even debug application or shared library didn't help me. The best that I can do is add to each vi called by ref a request to open the block diagram. I thought the tool I mentioned will help me yet it didn't. Is there an easier way?
2. I thought that I recognized the actor and the msg icon is the one from G# interface. Moreover, for some reason the first time I run the project I had some G# items in memory. Probably some kind of glitch on my side.
3. I see.
Playing with the design some more I must say that it ties together most of the new practices out there.
I even added functionality and it wasn't hard at all.
Thanks.
GoofyWires:
Regarding #1: In LV 2012, we provide a way to open the VI from Launch Actor.vi, which helps a lot with this debugging.
Regarding #2: Nothing from G# here. 😉
> I even added functionality and it wasn't hard at all.
Good. That's the goal. 🙂
Excellent ... I am finally starting to understand how powerful OOP is.
Just a quick note:
The MAL.zip file in the download links at the top of the post refers to the older file and has some vi's missing.
Download the correct version from attachments at bottom of post.
Is there a recorded webcast of the presentation available, I did a quick search but couldn't find one.
Thanks a gain.
Thanks for the download tip @IanPhillips ...
a recorded webcast with the demo's would be awesome!!
Am I missing something, where is the MVC and MAL example project. It doesn't seem to be in the Actor Framework folder?
Just scroll up on this page, under the "attachments" section. Download the files you find there. (I already had v3 of the Actor framework installed along with everything else, so I got away without applying the vipc file).
Never mind, I confused the MAL.zip with MAL.vipm
The current plan is to post a webcast presentation by May 16th. I'll be sure to let this group know.
I just posted up a question related to planning an MVC application (and sequence diagrams) in the NI forum. It seems like it would be good to link to it from here, but if this type of cross-linking is discouraged, I appologize!
In general, if I wish to discuss large app topics, is it recommended to post in this group somewhere or is the forum the best place to do it or start in? (I'm somewhat of a "community noob" outside of the forum.. ) Here is the post http://forums.ni.com/t5/LabVIEW/UML-Sequence-diagrams-and-MVC-planning/td-p/1944387
Generally, just post the question in one place and only post the link if you think that the discussion is relevant to both places (making sure that you specify that the discussion is taking place in the other thread). If you're not convinced that the discussion is relevant to both places but you're only trying to get lots of people to read it so that you get help, generally, I just post to one forum, wait a couple days, and only post elsewhere if I don't get any responses.
What is the recommended way for the main.vi lifetime for an actor framework based program like this?
With supplied build config, I get an exe which when I click "Run UI", either closes directly since the main.vi closes before the UI comes up or the UI shows a second and the runtime closes with a Visaul C++ error R6025.
When window close in the main.vi is delayed for e.g. a second it seems to work, but that just not nice. Using window hide instead of close leads to a not exiting application.
Gbecker,
You have stumbled across a known issue in this version of the Actor Framework and how I wrote this application. In summary, there is a split-second between the launcher terminating and the Actor spinning up when no VI's UI is open. When this happens, the RTE considers open references invalid and you see the behavior you experienced. The easiest fix is to put a small delay in the launcher VI to ensure that it does not terminate before spinning up an actor.
This issue will be addressed in 2012 and the version of the Actor Framework that we are shipping in the product. I also plan to post a new copy of this application with that problem addressed.
Hope this helps,
Eli
Update: I have posted a new vipc file, which includes the latest version of the dependencies (inlcuindg AF 3.0.7.14) and an updated copy of the code that can be built into a working executable. Let me know if you have any other problems.
Eli
Goofywires wrote:
> What's next PAL - programmer abstraction layer
Actually, PAL is the acronym for something that National Instruments makes and you probably have installed. It's the Platform Abstraction Layer, to take care of differences between the machines you use for running your tests. It is unlikely that you would need to write a PAL of your own. But you might find yourself writing an ALAL if the component you're using has an AL but you're facing the possibility of changing components. 🙂
Remember the old admonition: Most problems in computer science can be solved with another layer of indirection. 🙂
Daklu wrote:
AristosQueue wrote:
Most problems in computer science can be solved with another layer of indirection. 🙂
Except too much indirection.
That's not a problem in computer science... that's a problem in computer scientists.
I'm afraid that the dependencies are all VI Package Files, so that would be a non-trivial task. The good news is that VI Package Manager will be included with the Platform DVDs in August, which may address some of the problems you currently face when installing third-party software.
VIPM does not need to be run with Admin access. Please try VIPM 2012.
That little tidbit of information is awesome...
Finally have a webcast recorded on this application. If you're interested, you can watch it here: http://zone.ni.com/wv/app/doc/p/id/wv-3364
Hi Eliah,
Could you, please, upgrade your MAL projecct to 2012 if you have time.
Thanks,
Buddy, absolutely! In fact, I'm getting ready to roll out a new version with several improvements that I'm very excited about. In addition to re-linking the code to the AF in 2012, I'm packaging all of the source for 2012 in a VIP file that installed the framework and a templatized measurements into the 'Create Project' dialog of 2012.
I'll go ahead and post a version for 2012 right now, but keep in mind that I plan to continue to refine and update the code - the good news is that since it'll be a VIP file, it'll be much easier to update as new versions become available!
UPDATE: Posted!
I'm assuming it is non-trivial to convert this code to 2010?
I have a few design questions regarding a project I have coming up using a cRIO. I'm assuming it wouldn't be the best idea to have each channel be a measurement, but rather reading all the channels and then distributing the values accordingly once they're read in. This way I know that each sample has essentially the same timestamp, and I don't have to loop over every channels every time I read (pretty much continuously). Therefore would my cRIO (or each module?) be a child of measurement? Instead of having say 10 pressure measurements, 5 temperature measurements, etc. I'm assuming then that my controller would have to know which channels belong to which physical instrument.
Is there a better, more established way to do this?
Elijah
After installing and reinstalling your Measurement Utility and creating a new sample project, the project is missing the document. I am a newbe on the Actor Framework and trying to understand how to use it, so all documentation is greatly appreciated.
Keep up the great work
Twyman
Which document are you missing?
Measurement Utility Script.doc specifically.
Thanks
Ah, I'm afraid that's just a placeholder for now. I'm working on it!
Great work!! thanks a lot
I cannot find where is the project file for the MVC presentation. I thought it would be included in the national_instruments_lib_measurement-1.0.0.23.vip, but not. Does nomeone knows where I can get the project file together with all the files that makes part of the Elijah's MVC actor framework example?
thanks
It should be included in the project that you open from the 'Create Project' dialog once this package is installed. You can also download the slides directly under the 'attachments' section above.
Loading the AF 4.1.1.33 using VIPM inside LV2012, opening the WebActor.lvproj file then Build All from the Build Specifications yields;
An error occurred while saving the following file:C:\Program Files\National Instruments\LabVIEW 2012\vi.lib\ActorFramework\Actor\Launch Actor.vi
Error 1502 occurred at AB_Source_VI.lvclass:Close_Reference.vi -> AB_Build.lvclass:Save.vi -> AB_Build.lvclass:Copy_Files.vi -> AB_Application.lvclass:Copy_Files.vi -> AB_EXE.lvclass:Copy_Files.vi -> AB_Build.lvclass:Build.vi -> AB_Application.lvclass:Build.vi -> AB_EXE.lvclass:Build.vi -> AB_Engine_Build.vi -> AB_Build_Invoke.vi -> AB_Build_Invoke.vi.ProxyCaller
Possible reason(s):
LabVIEW: Cannot save a bad VI without its block diagram.
Your insights are welcome.
Thanks!
This app was built against the version of ActorFramework that is shipped in 2012 - you shouldn't need to install 4.1.1.33. Granted, it shouldn't cause any probelms to have both installed, but I suspect it may be related. Try uninstalling the Actor Framework from VIPM and create a new instance of this app from the Create Project dialog.
Thanks, that works as advertised. Best!
Q1: I am using Labview 2012 which includes the actor framework. Will installing "national_instruments_lib_measurement-1.0.0.23.vip" cause a problem? i.e. How do I check the version of the actor framework that is currently installed?
Q2: I did read @edisler's and @QFang's posts about the MVC and MAL example projects, but I still don't see any example project files in the attachement section. All I see is the vip package, which according to the note preceding only includes the actor framework, ppt and pdf files.
A1: No - it is actually built against the AF that ships with 2012.
A2: This vip file will install the demonstrations to the create project dialog that illustrate MVC and MAL.