Certification

cancel
Showing results for 
Search instead for 
Did you mean: 

CLAD prep Q3 explanation needed please

Solved!
Go to solution
Highlighted

Hi,

 

I am preparing for the CLAD exam, and need some explanation regarding the following question:

 

Q3: The DAQmx Read Task is configured to continuously read between -10V and +10V.The DAQmx Write Task is configured to continuously write between -5V and +5V without regeneration.Both Read and Write tasks are sampling at 1 KHz, and regeneration is set to "none".If the signal read has samples along the full +/-10V range, which VI Snippet will eventually cause a buffer underrun error?

 

 

The attached photo contains the answer. I am having a hard time understanding why this would cause an underrun error.

 

Thanks very much,

 

George

0 Kudos
Message 1 of 9
(489 Views)
Highlighted

You get an underrun with an Analog Output when it runs out of data to output.  In this snippet, you are limiting the amount of data going into the write buffer, which will eventually causing the underrun.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 2 of 9
(473 Views)
Highlighted

Hi,

 

Thanks for the reply. I understand what the underrun error is, and I can see why the attached code would cause it. I am not quite sure I understand why the other 3 wouldn't?

 

Thanks again!

 

George

0 Kudos
Message 3 of 9
(452 Views)
Highlighted
Solution
Accepted by topic author gsrokmix

@gsrokmix wrote:

I am not quite sure I understand why the other 3 wouldn't?


None of the others change the array length.  The idea is that by the time you have written 100ms of data, you will also have read it and passed it on to be written.  When you shorten the array (as in option D), you do not quite have 100ms of data being written.  And when that happens, you will have written all of the data before the next read is complete and you will get the underrun error.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 4 of 9
(446 Views)
Highlighted

Hi crossrulz,

 

Thanks for the reply. I was pulled away to do other things at work last week, and couldn't respond.

 

So basically because the For Loop in (D) is "filtering out" some of the data elements, the output array is smaller, and therefore causes the DAQmx Write to finish before the Read, which in turn cause the underrun error?

 

Thanks again,

 

George

0 Kudos
Message 5 of 9
(384 Views)
Highlighted

@gsrokmix wrote:

So basically because the For Loop in (D) is "filtering out" some of the data elements, the output array is smaller, and therefore causes the DAQmx Write to finish before the Read, which in turn cause the underrun error?


Indeed, that is it.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 6 of 9
(381 Views)
Highlighted

Hi Everyone, 

 

I need answers to the following questions.

 

Thanks in Advance.

Aditya

Q4.PNGQ7.PNGQ5.PNG

0 Kudos
Message 7 of 9
(354 Views)
Highlighted

I don't know if you already received a reply for this.

But the logic goes like this:

A4:  The time taken to read samples by the DAQmx Read as per configuration:  No. of Samples()/Rate(1/s) = 5/1 = 5s.  This Read VI will make a loop Wait until it has achieved the samples target. 
1st Iter:
i=0, Elapsed Time = 0. DAQmx Read  reads 5 samples and indexes them in a Row.(this loop ends with Elapsed Time  = 4)
Key thing to note here is that the Elapsed Time VI is a x>4 ? loginc. NOT x>=4 !! So the 1st iter ends with a F input to Stop Terminal.

2nd Iteration
i = 0, Elapsed Time =  ~4. This will be the last iter since time > 4 but DAQmx will make the loop wait to get the 5 element and put them in the second row.

Result: (B) 2 Rows of 5 Coloumns


A5: The logic here is exactly like A4, except, time taken to read samples, 20000/10000 = 2 secs

(i:iteration, T= Elapsed Time)
i=0, T = 0, loop runs for 2 secs because that is the time need by DAQmx Read to achieve the target of reading 20000 samples. (1st Row)
i=1, T = 2, (2nd Row)
i= 2, T = 4, (3rd Row)
i= 3. T = 6. (4th Row) -->> Time has elapsed Loop will stop after collecting 4 Rows or 20000 samples.
Result: (C) 4 Rows of 20000 Coloumns


A7: For Questions of this type try eliminating the most obvious incorrect andwers, When a 2D array is indexed to a For Loop it processes elements Row-wise. For

Option A: the loop Outputs a Row as it is if it has a value >4 else empty Waveform (This is not what the Question asked.)
Option B; the loop filters all elements >4 in each Row and discards the rest. (This is not what the Question asked.)
Option 😧 whether a Row is passed or discarded depends only on the last element > 4 (This is not what the Question asked.)

Option C: It is the correct Answer. For every Row if the Max value is >4 the whole row is passed else discarded.

Hope it was clear. Good luck

0 Kudos
Message 8 of 9
(226 Views)
Highlighted

Thanks DeXteR_INIT for the explanations. I wish those were included with the answers by NI for the entire exam prep guide!

 

George

0 Kudos
Message 9 of 9
(193 Views)