Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Shared Library and using it in c#

Hi,

I am using Labview 8.2. I want to detect peaks, area under the curve, peak's height, Start X , Start Y , End X and End Y position. I am developing my application using C# and Measurement Studio. I tried detecting the above parameters using Labview ( I had used Peaks 3.0.vi). I was not able to use annotations in Labview to mark the peaks. I tried to create a shared library ( dll ) in Labview ( using the Peaks 3.0.vi ), but the problem I am facing is that while building dll, when I select the VI that I have created and click on Define Prototype, I cannot add any Input / Output Parameters. The "ADD PARAMETERS (+)" button remains disabled.
Can anyone help me out in this matter and suggest me a way to do this. I want a good performance for the application that i am developing. Any help would be highly appreciated...

0 Kudos
Message 1 of 10
(8,356 Views)

Hi Nileshv,

 

I wanted to mention a couple of things. First, in regards to the LabVIEW issue of having the Add button dimmed, this is because you did not set up the connector pane for the VI. You need to assign terminals to the controls and indicators. Once you have done this, you will be able to add parameters. Check out the LabVIEW Help for information on how to do this. Just in case you have not done this before, once inside LabVIEW, select Help >> Search the LabVIEW Help.  Then switch to the Contents tab and navigate to Fundamentals >> Creating VIs and SubVIs >> How-To >> Creating SubVIs >> Setting up the Connector Pane.

 

The other thing I wanted to mention was that you may find some use out of the PeakDetector class that comes with Measurement Studio. That class allows you to Calculates the location, amplitude, and second derivatives of peaks or valleys in the input array.  If you are curious about it, check out the <MeasurementStudioVS2005>\DotNET\Examples\Analysis\PeakDetector shipping example.

 

Also, Measurement Studio does have annotations that also may be of use to you. Just drop a graph onto the Windows Form and then right-click and select Edit Annotations...

 

If you can find everything you are looking for in Measurement Studio, then you might want to just use Measurement Studio. However, since LabVIEW does have more analysis functions, then you might be better off building a DLL and calling that from .NET.

 

Hope this helps!


Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 2 of 10
(8,355 Views)
Thanks Jonathan,

About the connector pane suggestion, i was not aware of that. I will surely try it. I tried using the PeakDetector class, but could not figure out how to get the Area under the curve and other things....I was just wondering if I do make a dll in labview and access it from C#, then what will be the effect on the performance of my application....How much overheads am i going to inject in my application by this approach....If you could suggest a more better alternative for determining the area under the curve and Start X Start Y etc it would be of great help....

Thanks anyways for ur suggestion
0 Kudos
Message 3 of 10
(8,350 Views)
Hi Nileshv,

To find the area under the curve, you can use the NumericIntegration method that is part of the Calculus class (part of NationalInstruments.Analysis.Math namespace; you need the Professional or Enterprise Edition of Measurement Studio for this).

As far as performance, I wouldn't expect to see much of a difference between calling a LabVIEW DLL directly verse using one of our built in .NET classes. The only difference in that scenario is calling that calling a LabVIEW DLL is the scenario of calling calling unmanaged code (LabVIEW DLL) in a managed environment (.NET). This is down through the P/Invoke (Platform Invoke) mechanism and that's just part of the .NET Framework. There could be a very slight difference (nothing worth worrying about) because you are going through an extra layer when calling unmanaged code compared to calling managed code.

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 4 of 10
(8,345 Views)
Hi again,

Well thanks for ur advice.. Actually I tried This whole excersice in Labview. But i could not figure out a way to solve two issues. Let me explain what i actually want to do...

I want to collect an analog data ( raw) from external device thru USB. I want to save this raw data to binary / spreadsheet. Also, I want to plot the data on a graph in real time. While plotting the data, as per the peak width and threshhold limit settings , i want to detect the peaks. Once the peak is detected , I want to give a label / mark with cursor or annotation to the detected peak . This label / cursor / annotation should be displayed vertically (i.e, the text should be rotated by 90 deg). Also, once the peak is detected, I want to compare the x x-axis paramater ( inthis case time ) with th values in another text file and if a value of X- axis is found in the said range then, name the detected peak with corresponding Y value in text file. Also, I have to simultaneously enter the detected peaks details in a table ( details should include Peak Name ( if matched), peak height, start X, Start Y, End X, End Y and Area under the curve.

Well hope u got what i intend to do. When I tried doing this in Labview, I was not able to...

1. Display the peak Lable vertically ( i had used cursors)
2. My peak marking was one peak late. i.e, when second peak was detected, my first peak used to get marked.
3. According to me the Vi that i had made was not efficient.

I thus shifted to .net using measurement studio. For displaying vertical text, i used annotation. If you could help me in doing the above said task in Labview effeciently, I think i would get better performance....

0 Kudos
Message 5 of 10
(8,342 Views)
Hi Nileshv,

I would suggest that you post in the LabVIEW forums with regards to your LabVIEW questions. When it comes time to pulling that DLL into .NET, feel free to post back on these forums. This way we can give you expertise from both sides. This forum is used just for Measurement Studio issues in .NET.

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 6 of 10
(8,339 Views)

In my lab, we have built a labview peakdetector dll to be called by C/C#.

I was curious if we want to run the application on another machine, whether we must install labview run-time on the host machine to be able to call the dll.

 

0 Kudos
Message 7 of 10
(7,562 Views)

Any target machine that will be using that LabVIEW built-DLL will require the LabVIEW Run-Time Engine to be installed. So in your case, the RTE must be installed on your lab systems.

 

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 8 of 10
(7,561 Views)

Jonathan

Our priority is saving disk space (running the system on a PC 104, with Flash Drive).

Since we do have subscription to Developers suite, if all we need are the number of peaks and estimated locations, do you expect peak detector in Measurement Studio to give the similar or same results as the one in LabVIEW?

 

Thanks,

Santiago

0 Kudos
Message 9 of 10
(7,557 Views)

Hi Santiago,

 

The Peak Detector class in the Measurement Studio libraries does provide the calculations you need. LabVIEW does have several different peak detector VIs and so I'm not sure if all of them use the same underlying source as we do. However, with that said, I would expect you to see the same results with Measurement Studio as you are seeing with LabVIEW with regards to the calculations our are wanting.

 

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 10 of 10
(7,551 Views)