Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Synergy Measurement Studio .NET and LabVIEW

I'd like to learn if the following is possible and if so, if some "design pattern" does exist to do it the "proper" way:

I want to generate a front panel (GUI) for my instrument (which can either correspond to a "standard" instrument, a PXI-based instrument or any other combination) using Measurement Studio .NET.
This virtual instrument (GUI) can be encapsulated in a class and I can provide it as part of a stand-alone application, such that a user could "play" with the instrument (or verify it is operating properly).

On the other hand, I want to make this virtual instrument and its front panel available in LabVIEW. I would like it to behave as a subVI (or should I say express VI), such that I could wire some inputs i
nto it and have some output wires which would allow a LabVIEW user to control some settings of this instrument and e.g. to retrieve some settings and/or data.

If I double-click on this subVI, it should pop up the Measurement Studio .NET - based front panel as if it was used from my original stand-alone application.

Has anyone considered and/or tried this ?
Has NI anticipated this kind of synergy between Measurement Studio .NET and LabVIEW ?

If you read upto this point, thanks.
Any feedback is very much appreciated!
0 Kudos
Message 1 of 7
(4,654 Views)
Frans -

I'm not clear on whether you are asking for 1) a way to create a sub VI that calls into .NET code, which might display a Windows Forms user interface that include Measurement Studio controls on it; 2) a way to create an Express VI, the configuration UI for which is written in .NET and uses Measurement Studio controls; or 3) something else.

LabVIEW does currently support (1) via call .NET library nodes. You can create a .NET assembly that displays a user interface and call this directly from within your LabVIEW code. This feature is available in LabVIEW versions 7.0 and later.

There currently is no direct support for (2) in the Express VI Toolkit, but you could accomplish (2) in the same way you would accomplish (1). Essentially, your Expre
ss VI configuration VI would use the call .NET library nodes to call into the .NET assembly that displays your user panel.

Have you thought at all about inverting your approach? That is, are you interested in being able to call an Express VI and/or its Configuration VI from .NET?

We are very interested in understanding your use case and the approach you want to take. Please post back to help us better understand what you are trying to do.
Message 2 of 7
(4,654 Views)
David,

(2) is "closest" to what I'm trying (to find out if it is possible) to do.

I would like to have the behaviour of an express VI, but with both the "source VI" and "configuration VI" built from within Measurement Studio.

This would allow us to develop an IVI-like interface for an instrument (in Measurement Studio .NET), allowing to set several parameters of the instrument and to configure its output, e.g. calibrated data which can be returned in different domains (time, freq) or in different formats.

On top of this interface we could build a GUI (again using Measurement Studio .NET), corresponding to a virtual frontpanel of that instrument, which would allow the user to interact with the instrument (change some settings) and look at the resulting data (in the domain and format of his/her choice).

We could use the above to create a stand-alone application, e.g. delivered with the instrument such that the user can immediately start to "play" with the instrument and e.g. verify its proper operation.

We also anticipate that many users may have LabVIEW and as such we would like to make the above, i.e. the interactive configuration, available in LabVIEW too. For this we would like to re-use the GUI developed in Measurement Studio.NET
On the other hand the user must be able to build a (LabVIEW) application around the instrument we provide, and as such programmatically be able to change its settings and capture the data of interest, meanwhile controlling other instruments. This requires input wires and output wires.
As with express VIs, the values of the input wires should overrule the interactive settings.
So the link with LabVIEW corresponds to an express VI. Double-clicking on the VI, would pop up our GUI.

Why not doing everything in LabVIEW and building custom express VIs ?
- One of the caveats reported in the Express VI Development Toolkit User Guide is that express VIs are optimized for ease of use, not for speed.
- Let's say we prefer to develop the basic interface for our instrument (let's call it the driver and GUI) in Measurement Studio .NET

I hope this better explains what I want to do and why.
Any comments/advise from your end are very much appreciated.

Frans.
0 Kudos
Message 3 of 7
(4,654 Views)
Frans -

Thanks for the additional detail. This is a good use case for us to consider as we evolve the Express VI Development Toolkit.

An engineer here did some prototyping to see how well it would work to use the call .NET library nodes from the configuration VI. He was able to successfully launch a .NET Form from a configuration VI and get the data back from the Form and into the VI. However, this worked only the first time he would launch the configuration panel in a given LabVIEW process; subsequent attempts to launch the Form would cause the LabVIEW process to hang. We did not investigate exactly why this occurs, so we don't know if it can be worked around externally to LabVIEW. Another problem was that it required quite a bit of La
bVIEW coding to launch the Form and then retrieve the data from it. Additionally, you have to code the source VI entirely in LabVIEW. Given how you describe what you are looking for, this is probably not acceptable for you.

So, I regret to recommend that you do not go down this path. If you want an Express interface to your instrument, you are better off coding it entirely in LabVIEW, even if it means duplication of effort.

This might become easier in the future, as we enhance .NET support in LabVIEW.
0 Kudos
Message 4 of 7
(4,654 Views)
David,

thanks for the feedback and advise, although of course I would have preferred that you had better news for me.

Is there a realistic chance that NI will take this apparently not-yet-considered use case into account for upcoming releases of the Express VI Toolkit ?
I'm convinced it creates a lot of added value, given the fact that NI provides both Measurement Studio.NET and LabVIEW.

Another question: is it or will it be possible in the near future to "export" a LabVIEW VI as a .NET assembly (DLL). Right now one can distribute a LabVIEW VI as stand-alone application using Application Builder.

Thanks.
Frans.
0 Kudos
Message 5 of 7
(4,654 Views)
There is a chance that at some point in the future, the Express VI Toolkit will support implementation of some part of the Express VI using a .NET language. However, I really cannot speculate as to how realistic this chance is at this time. I can speculate with some degree of certainty that even if this support is added, it will not be added in the short term (next 1-2 years). So, if you need to get this product out in the short term, I would advise you to take another approach.

With respect to your other question - it is currently possible to build DLLs, with standard C entry points, with LabVIEW. You can then use the standard .NET mechanisms to call into the LabVIEW-built C DLL. Things get tricky if you need to pass comp
lex data types, such as clusters or multi-dimensional arrays, between the .NET application and the LabVIEW-built DLL.

For this reason, a C DLL might not be the best approach to take to call a LabVIEW VI from .NET. Instead, consider using the ActiveX VI Server feature in LabVEIW. This way, LabVIEW will translate its data to COM data types. Translation between COM data types and .NET data types is fairly straightforward through .NET/COM interop.

If you need to really get into interop between .NET and C or .NET and COM, you might want to check out .NET and COM The Complete Interoperability Guide, by Adam Nathan. It contains a wealth of information on .NET interop.

We are looking at ways to make LabVIEW/.NET interoperabiltiy easier in future versions of the product. But again, given that LabVIEW has recently released and Measurement Studio is approaching release, I cannot recommend that you expect to see these features
in the short term.
0 Kudos
Message 6 of 7
(4,654 Views)
David,

Thanks for the additional information and for answering the additional question.

Frans
0 Kudos
Message 7 of 7
(4,654 Views)