From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultanously input read and output write signals via VBA / DAQmx same time at different sample rates

This seems to be a fundamental mesurement topic to me. I recently working on my first DAQmx project for a automotive testing company using Excel 2013 VBA. I am trying to generate a voltage signal and simultanously sample voltage and current signals at different sample rates.

 

Based on some old confusing posts in this forum and due to driver error message "The specified resource is reserved. The operation could not be completed as specified.", i was afraid, if i have to install a second DAQ board in to my PC, to aquire additional inputs or to let additional tasks run simultanously, i.e. at different sample rates?

 

One of these confusing posts are found in topic "Re: DAQmx digital slow compared to Trad DAQ" from member Jonathan_Brumley, which is mentionen here as "principal software architect for the NI-DAQmx driver framework". So it should be relevant Information.

 

He said: "With DAQmx, you can have input and output tasks at the same time as long as the tasks are not reading and writing at the same time."

 

Is that correct and what does this mean in practice, if so?

 

This would be disappointing. But I did more investigation and tried out program code to run a write-task and read-task at the same time for analog-voltage-signals on a 6259 Card (M-Series) and it worked!
 
The only thing what doesn't work - so far i understand the concepts - is reading on multiple channels at different speeds at the same time, due to limited count on timing engines. The documentation says somewhere, there is exactly one timing engine for each subsystem on most of the NI-cards. For example as subsystems on a 6259 i see AnalogIn, AnalogOut, DigitalIn, DigitalOut, Counter1 and Counter2, if i understood it correctly (also reflected in the count of DMA-channels available/reserved using a PCI-card version of the 6259).
 
So for me it's possible to generate a signal via output while reading another signal via inputs the same time!

 

But not reading many inputs at different rates. Still i find this disappointing, that only one timing engine per subsystem is available on most NI-cards.

 

And even more frustrating i find the fact, that an analog-input task couldn't be started, while another analog-input task at another sample rate is already running, even the second task is using aquisition mode ON DEMAND only! This means, i cannot even read a slowly varying temperature signal not even once per minute, while i have a high-speed input task running. This limitation shouldn't exist on a high class hardware.
 
Or does anybody know a work around how to AnalogIn highspeed signal and lowspeed signals same time without adding the low-speed signal to the high speed signals task, which would cause a lot of redundant data and bus traffic? At least reading single values without timing (just on demand only) should be possible.

 

0 Kudos
Message 1 of 4
(4,365 Views)

When designing hardware, many variables enter into the equation.  I'm guessing that when NI designed the particular board you are using, they designed it to get "the most bang for the buck", i.e. providing the best performance for the most common task at the lowest manufacturing cost.  These decisions undoubtedly affected the design of your device, which is clearly quite old if you have a reference to "Traditional DAQ" (thankfully replaced by DAQmx more than a decade ago).

 

Depending on your particular needs, you can buy a USB Multifunction DAQ device for <$400 to use as a second DAQ Input device that can acquire data independently (and thus at a different frequency).

 

Bob Schor

0 Kudos
Message 2 of 4
(3,263 Views)

Hello Bob.

 

thanks for your suggestions.

 

For now the temperature is measured between running high speed tasks.

The temperature is measured inside climate chamber while the device under test is adjusting to a new temperature.

When the desired temperature is reached, another test is automatically performed on high speed rates (voltage generation and voltage & current measurements up to 350 kHz & 100 kHz).

 

For the said application, this is sufficient, eventhough i would prefer to monitor the temperature during the core test time and measurements.

It doesnt make sence to sample temperature at 100 kHz and skip the incomming data, which costs CPU perferformance and consumes data memory space. Especially in 32-bit VBA-applications memory is limited.

 

Johannes.

0 Kudos
Message 3 of 4
(3,259 Views)

This task would, I think, be almost trivial to do in LabVIEW (without VBA), as LabVIEW allows processes to run in parallel.

 

I don't quite understand the parameters of your task.  It seems to me that it is something like the following (ideally):

  • A (constant) record of Temperature at some (relatively low) rate, say 100 Hz.
  • At some point a high-speed "test" is run that gets voltage and current measurements at high rates (say 100 kHz).  During this time, you want the (low frequency) Temperature readings to continue.

This might not be the most elegant way to do this, but this is what I'd try first:

  • Set up a Producer/Consumer Design Pattern.  In the Producer, sample from 3 channels (Temperature, Voltage, and Amperage) at 100 kHz with a sample size of 1000.
  • The Consumer is a State Machine.  If it's in the "Waiting for Temperature" state, throw away the Voltage and Amperage channel, average (or take the first value of) the Temperature Channel, and save Temperature in its own file.
  • If it is in the Testing Phase, save the Voltage and Amperage data (all of it) in an appropriate file, and treat the Temperature as in the "Waiting" state).
  • At the end of any State, make a decision of what State to do next (or maybe add another state to handle opening and closing of files, ending of Experiment, etc.).

Bob Schor

0 Kudos
Message 4 of 4
(3,256 Views)