Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting VB6 app. (CWSTAT) over to .NET

Relatively new to the .NET languange.  We are attempting to convert a VB6 app over to .NET.  The VB6 application uses CWStat ActiveX controls.  Is there some library that is similar to what the CWStat function did?

0 Kudos
Message 1 of 5
(4,489 Views)

Hi,

 

In your project properties, set a reference to the "NationalInstruments.Analysis.Enterprise" .NET library

 

import the math functions

 

add this to the statement to your form or module.

 

Imports NationalInstruments.Analysis.Math

 

that will expose all the functions you'll need. Check the object browser

 

ex

 

Dim average As Double

Dim myData(100) As Double

'load array with data

average = Statistics.Mean(myData)

 

Hope this helps

 

 

Curt

 

0 Kudos
Message 2 of 5
(4,459 Views)

Shop,

 

Measurement Studio has a very good analysis library that includes RMS. The .NET Class analysis library for (C# .NET and VB .NET) that includes RMS value comes with both the professional and enterprise versions of Measurement Studio. You need to add a .NET reference to "National Instruments Analysis <Professional/Enterprise>" in your VB project and the you should be able to use Statistics.RootMeanSquared Method (double[]). If you run into any problems please feel free to post back to this forum.
Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 3 of 5
(4,455 Views)

In the .NET example, ContAcqVoltageSamples_IntClk_ToFile, I have tried adding the references and code above but I am still getting errors.  In this particular example, it takes 100 samples per channel at a rate of 100Hz and writes the readings to a file.  I added a textbox and I simply want to display the average voltage of ALL the readings.  This was easily done in VB6 with CWstat.Mean.  The example acquires data in the sub AnalogInCallBack(ByVal ar As IAsyncResult) and puts it into a variable named "data".  The variable is dimensioned as Private data(,) as Double.  How can I get this data over to a usable array to analyze it?

 

 

Thanks

0 Kudos
Message 4 of 5
(4,432 Views)

I don't know what version of Measurement Studio you have, but you could check out this example i just made, and put in the new Community Examples. You can get the waveform data into an array of doubles using waveform.GetScaledData().

 

Dim values_array() As Double
values_array = waveform.GetScaledData()
NumericIndicator.Value = Statistics.Mean(values_array) 

 

 

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 5 of 5
(4,376 Views)