Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Slow measurement with cDAQ-9174 and NI 9208

Solved!
Go to solution

Hi there,

 

I have an VB2008 Application in which I measure some data from displacement sensors (analogue input). So far the system was running with NI PCI-9225 and it was running very well. I am collecting data from up to 24 sensors and I could measure up to 20 sets per second which was perfect for my application.

 

The code was like this:

'the initiation of the task
myTaskAI = New Task()
aiKanaele = "dev1" & "/ai0:79"
myTaskAI.AIChannels.CreateVoltageChannel(aiKanaele, "", 
           CType(NationalInstruments.DAQmx.AITerminalConfiguration.Rse, AITerminalConfiguration), _
0.0#, 10.0#, AIVoltageUnits.Volts) readerAI = New AnalogMultiChannelReader(myTaskAI.Stream) 'the measurement: Dim dataai2(,) As Double = Nothing dataai2 = readerAI.ReadMultiSample(20)

 

Now the system was redesigned and the hardware was changed to the NI CompactDAQ 4-Slot USB Chassis NI cDAQ-9174 and with an NI-9208 module. I had to change my software slightly because it is a current input instead of the voltage input. My problem is that in this sytsem I get data from my sensors only once every 2 seconds which is far to slow.

 

The new code is:

'the initiation of the task
myTaskAI = New Task()
aiKanaele = "cDAQ1Mod1" & "/ai0:15"
myTaskAI.AIChannels.CreateCurrentChannel(aiKanaele, "", _
AITerminalConfiguration.Rse, 0.0#, 0.02#, AICurrentUnits.Amps) readerAI = New AnalogMultiChannelReader(myTaskAI.Stream) 'the measurement: Dim dataai2(,) As Double = Nothing dataai2 = readerAI.ReadMultiSample(20)

 

When I run the measurement from the Testpanel of the Measurement & Automation Explorer the speed is OK but it slows down when I run it form my VB-program.

 

What can I do? Do I need additional code to speed up the measurement from the VB code.

 

Any help is appreciated.

 

Axel

 

 

0 Kudos
Message 1 of 3
(3,774 Views)

Hi Redrhino,

 

I'm not working with Measurementstudio VB, but I think in your sourcecode the daqmx timing is missing, isn't it?

It seems to me, that the Daq-Device takes a kind of default timing or samplerate.

 

Additional you former use a PCI Card. This is not comparable to the USB-Device you are using now with regard to the speed, but one sample per 2sec is very slow.

 

Hope I could help.

Tobias

0 Kudos
Message 2 of 3
(3,757 Views)
Solution
Accepted by topic author RedRhino

Hi Tobias

 

Thank you for your suggestion. You are right, the a setting of the timing was requested.

I finally found out how to change the code:

 

'the initiation of the task
myTaskAI = New Task()
aiKanaele = "cDAQ1Mod1" & "/ai0:15"
myTaskAI.AIChannels.CreateCurrentChannel(aiKanaele, "", _
                    AITerminalConfiguration.Rse, 0.0#, 0.02#, AICurrentUnits.Amps)
myTaskAI.Timing.ConfigureSampleClock("", 1000.0#, _
                                SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, 20)
readerAI = New AnalogMultiChannelReader(myTaskAI.Stream)

'the measurement:
Dim dataai2(,) As Double = Nothing
myTaskAI.Stream.ReadRelativeTo = ReadRelativeTo.MostRecentSample
dataai2 = readerAI.ReadMultiSample(20)

 

Thanks again

Axel

 

 

0 Kudos
Message 3 of 3
(3,746 Views)