Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx simulation signal

Solved!
Go to solution

I am a new user and am confounded by the signal provided by simulated devices in MAX and cannot seem to find an answer anywhere.  I am using Labview 8.2, MAX 4.2, DAQmx 8.5, cDAQ-9172 and the DAQ Assistant simulating a 9215 card.  I understand that the simulation is a noisy sine wave, but what is the frequency of that wave?  It seems that you can change it with the timing settings in the Assistant Configuration panel. 

 

It would seem to me that the timing settings would relate to the way the 9215 samples the incoming signal, right?  Instead it seems like those timing settings change the frequency of the signal itself.  For example, in the DAQ assistant if I run the a test plot acquiring N samples and read 1000 samples at 1k Hz, I see one cycle of a noisy sine wave that takes 1 sec.  If I read 100 samples at 1k Hz, I see one cycle of a noisy sine wave (with less resolution) that takes 100 ms.  Doesn't this mean my signal frequency has increased 10 fold?  I would have expected to see only a portion of a sine wave if the original frequency had stayed the same.

 

 

Also, when I run using continuous sample acquisition mode it seems like the time it takes to go from peak to peak is different again.  Here it doesn't seem to make any difference in what the sample size is, but rather what the sample rate is.  At 1k Hz it take about 10 secs and at 2k Hz it takes about 5 secs.

 

Please realize that as a newbie I am not far enough along to completely dissect the DAQ assistant VI to find out what is going on, although that will be next.  So, I would appreciate any simple explanations as to why I am seeing what I am.

0 Kudos
Message 1 of 12
(7,550 Views)
Solution
Accepted by topic author pfrank

Hi pfrank,

 

It's not documented, but the period of the simulated sine wave (measured in samples) appears to equal the task's input buffer size, at least for buffered tasks. The input buffer size is based on various factors (finite/continuous, samples per channel, sample rate). These are explained in the NI-DAQmx Help file that is installed on the Start Menu under National Instruments\NI-DAQ. Search for "How Is Buffer Size Determined?" (without the question mark)

 

Selecting N Samples causes the DAQ Assistant to set the sample mode to finite, so the buffer size is exactly equal to the samples per channel. If you select Continuous Samples instead, then the buffer size will be set to 10 kS because the sample rate is between 100 S/s and 10 kS/s, and the sine wave's period will be 10000 samples. If this doesn't make any sense, look at "How Is Buffer Size Determined?" in the NI-DAQmx Help.

 

DAQmx does not support providing your own simulated data for simulated devices. If you want control over the simulated signals, you'll need to add code to your application that replaces the data returned from DAQmx.

 

Brad

Message Edited by Brad K on 02-18-2010 12:44 PM
---
Brad Keryan
NI R&D
Message 2 of 12
(7,510 Views)

Hi, Brad.

 

It took me a while, but I finally figured it out thanks to your help.  The sine wave period (in samples) is equal to the buffer size.

 

If the acquisition is finite (N Samples in DAQ Assistant), the buffer (and sine wave period in samples) is equal to the samples per channel.  The time period of that sine wave would thus be the number of samples (buffer size) times the period between each sample (which is also the inverse of the sampling rate).  To simplify (and using DAQ Assistant terms), the time period of this sine wave is (Samples to Read) / (Rate).

 

If the acquisition is Continuous, the buffer (and sine wave period in samples) is determined by a table (found per your suggestion in NI DAQmx help).  The time period of that sine wave is the number of samples (buffer size from the table) times the period between each sample. This is the same as above which is (Samples to Read) / (Rate), although remember in this case the number of samples is determined by the table and not by your Samples to Read input.

 

The display of these waves in DAQ Assistant differ depending on whether you have selected N Samples or Continuous.  For N Samples, you see one complete cycle of the sine wave and associated time period.  For Continuous, you see a scrolling display with the display time period equal to what it takes your Rate to read your Samples to Read, or (Samples to Read) / (Rate).

 

Perhaps in the grand scheme of things all this doesn't make much difference, but it was bugging the heck out of me until now.  Thanks, Brad!

 

pfrank

0 Kudos
Message 3 of 12
(7,449 Views)

Thanks for posting Brad.

 

                                       Finally we know how the simulated sine wave behaves!,  

Do you have any idea why this idea is not documented?

 

Please keep using the forum Smiley Happy

 

 

Erwin Franz

Erlab

0 Kudos
Message 4 of 12
(6,428 Views)

Hi Erwin and forum users... I have read your post and i have a not asked question but i really want to ask. Due to similar topic about DAQ simulated signals: Is possible to measure from simulated DAQ module (e.g. 9203) two or more signals at same time?, i mean i tried to read ai0 and ai1 from the same module but i get the error: 

 

Error -50103 occurred at DAQmx Start Task.vi:6

 

Possible reason(s):

NI Platform Services: The specified resource is reserved. The operation could not be completed as specified.

 

Task Name: _unnamedTask<39>

 

If that is normal for simulated signals from DAQ assistant i have no problem, the issue is if that problem would be present when i get the physical module to really get different signals and read it at same time. I hope you help me.

0 Kudos
Message 5 of 12
(6,334 Views)
It has nothing to do with simulated signals. Do a search for the error and you will see that it is a very common one for new users. You have to do multiple channel acquisition in a single task. You have not attached your code but I'm guessing you have two DAQ Assistants. Use one.
0 Kudos
Message 6 of 12
(6,331 Views)

Thanks Dennis, I had a feeling you were going to answer that one.

 

Erwin: the exact behavior of the DAQmx simulated analog input signal is not documented because it's an implementation detail. If you want simulated data to behave in a certain way, you should add code to your application that replaces the data returned from DAQmx.

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 7 of 12
(6,324 Views)

Thanks... There is one thing i don´t understand, how use i a single DAQ assistant to read multiple channels?? I can´t get the single task matter... 

0 Kudos
Message 8 of 12
(6,318 Views)
When you started the assistant, it said to ctrl-shift or space-shift to select multiple channels. If you already have an assistant, open it and click the Add button.
0 Kudos
Message 9 of 12
(6,313 Views)

Ok, that was easy... And finally how i can read multiple cannels or change one for another according a case structure or similar?? I need to change the channel when user choose monitor some other variable... Thanks for your patience...

0 Kudos
Message 10 of 12
(6,310 Views)