Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

how to acquire a finite number of samples from different channels simultaneously

Hi there,

I am using PCI 4472-B DSA card. I want to acquire data from 8 different channels but the thing is that i want to acquire the data in such a way that i acquire 1000 samples from every channel in one minute and then i take the average of all channel's data one by one and display it. Currently what i have done is that i am using ReadAnalogChannle.vi in 1DWfrm NChanNSamp mode. I dont know i am doing it right or not but i have used the wait untill next multiple function to control the repeatation rate of the loop that is the loop repeats itself after each second.

 

I am posting the Vi also kindly take a look at it and point out the mistakes and if possible suggest a better solution i know there is something wrong in my VI. What i want to change in this vi is that i wana read the channels constantly for minute such that the channles read a 1000 values in one minute and then i wana take the average of all channle's data separately and then disply it.kindly suggest possible solutions.

Hoping for a quick response from you guys as always.

0 Kudos
Message 1 of 10
(8,182 Views)

HI there, I think i didnot make my self clear in the above posting so i am posting my question again.

 

I want to acquire data from 8 different channels of DSA Card in such a way that the channels are read after every 1 second and 1000 samples or values are taken from each channel. Then i want to take the average of the values and disply it.

 

My current VI is using just two channels and i am using 1DWfrm NChanNSamp configuration to read the Values (not taking the average currently) kindly tell me am i doing it correctly or not? Also suggest a smipler way to update the values in the text boxes i had to put 20 different case structures to write data in 40 different text boxes. It will become very difficult if i use the data from all 8 channels. So kindly suggest me a smipler and better way also.

0 Kudos
Message 2 of 10
(8,180 Views)

Hi shami81,

 

The acquisition portion of the code looks fine and should work as you need it to. If you could use arrays instead of text boxes on the front panel, it would be things much easier. This will allow you to programatically concatenate strings and build them into an array if you choose. It seems like you are off to a good start but there are always things that can be improved upon.

 

Regards,

Kent

Applications Engineer

0 Kudos
Message 3 of 10
(8,158 Views)

Thanks Kent, I have changed the code a little bit in the acquisition portion and i am now getting the required number of samples as i want to acquire. But if i use arrays for display purpose instead of text boxes how will i save the results as i am saving right now. Kindly explain a little more what do you mean by programatically concatenating strings and how this can be done? I have not done this thing yet i mean i have no idea about this so please explain a little more in this regard.

 

Best regards

Ehtisham Safdar.

0 Kudos
Message 4 of 10
(8,151 Views)

Hi Ehtisham,

 

To save the data from an array in a file, you can continue to convert the array to a string and manual format it in LabVIEW. You can also use the built in File I/O functions if that is suitable for you. You can use the iteration terminal in your loop to make logical decisions or you can even convert than number to a string. I mentioned this just because it seemed like you had many cases which were the same and just required a different text box. 

 

Regards,

Kent

Applications Engineer

 

0 Kudos
Message 5 of 10
(8,133 Views)

Safdar,

 

Iam not sure what changes you made to the code that u have posted. But here are some things that u can change in the first one. Ignore this if you have already made those changes.

 

1. You want to read 1000 samples from N channels. In this case as your sampling rate is 1000 Samples/sec, in the DAQmx Read VI use the option NChan NSamp and wire the number of samples to read as 1000.

 

2. You don't need that 1sec wait inside the while loop. DAQmx Read will return the data only  after the required number of samples are available. In you case 1000 samples will be available only after 1 sec since yor sampling rate is 1000 Samples/Sec.

 

3. The way you have used the filter VI is not correct. Here the filter VI will consider the entire data as single channel data. 

 

4. Instead of duplicating the acqusition code in all the case, you can put the acuisition code outside the case structure.

 

5. Instaed of using a case structure you can use a 2D array with each row corresponding to one iteration and keep building the result. So u can do away with the case structure. Use a shift registers to store the 2D arrays.

------

"A VI inside a Class is worth hundreds in the bush"
യവന്‍ പുലിയാണു കേട്ടാ!!!
0 Kudos
Message 6 of 10
(8,105 Views)

Thanks kikiduu,

 

I was thinking of making the same changes that you have mentioned. But i have understood all the things except the last one i mean no. 5

 

"5. Instaed of using a case structure you can use a 2D array with each row corresponding to one iteration and keep building the result. So u can do away with the case structure. Use a shift registers to store the 2D arrays."

 

I have used the timing vi why? let me explain a little bit more my programme sequence an then you will suggest me am i doing it right or wrong.

 

The acquisition part looks good and i have changed it just as you have said that i am using NChan NSamp now and multiple samples and using a 2D array. I am posting the new modified VI also but look at the case 1 only as i have just modified the 1st one.

 

My prog sequence should follow these steps.

 

1. Acquire data from 8 different channels (but currently i am reading only 2 channels for simplicity and testing purposes).

 

2. Split the data using index array and then pass it through filters.

 

3. Then read the channels when the system is at position one. At each position data will be read in such a way that it will take data each second then take the average of 1000 samples and display it on a temporary place and then the value from the final averaged value will be displayed the first text boxes labeled as Pos1 Uacc and Ts.

 

4. Once this is done i mean 10 seconds are over the test at position1 is done and the prog asks the operator to change the system to pos2 and then repeat the process but this time the final value will be displayed in the next position text boxes but the current value whcih is a temporary one and is generated each iteration should be displayed in the same old temporary Text box or some kinda array.

 

Can i use some kind of list box which will show the values which are generated each iteration like it will be 10 values that i will get after 10 iterations and i wana display them in some list box or table and then read the last values of 2 channels from that table or list box and then display these in the text boxes. I will need the text boxes as i need to save these values at the completion of the test.

 

so now kindly sugggest me a good solution for this one.

 

 

0 Kudos
Message 7 of 10
(8,070 Views)

Hello Shami81!

 

Thanks for your post back!

 

I believe the step 5 he was talking about is that you could build arrays and then send that data through a shift register to the next iteration of the loop. See the picture attached for an example of how this is done for one element per loop iteration. This allows you to have an array of data for the different loop iterations. I would take a look at doing this with your data before moving on to your new steps 1 - 4. It will allow you to simplify your code tremendously. Let me us know if this helps you with your application.

 

Cheers!

 

Corby_B

http://www.ni.com/supportg 

0 Kudos
Message 8 of 10
(8,060 Views)

Hello there, thanks for all the help but i am still stuck. guys please help me out.

I want to use a table or any thing like a table to show the current values of the two channels after i take the average of the values. I m attacthing a picture to clearify what i want. I have filled the table with fake values myself just to show what i want to get.

I need to use the same table for writing the acquired data from the two channels each time a read button press event happens. But guys i am stuck on it for  along time and not been able to find out the solution kindly help me out.

 

Some ppl have suggested the use of arrays instead of table but i am not getting the point actually can some one please change the code i have written to explain how can i use arrays in my program.

 

If possible then kindly make some necessary changes in the code i have submitted earlier with the name of 4-tumble finite samples i am attaching it here also. I will be very thankful to you guys. Thanking you in anticipation

0 Kudos
Message 9 of 10
(8,013 Views)

Hi Shami,

 

I apologize for not having much time to go through your code again. However, I can direct you to some more information about the point above that you had questions about. Using autoindexed loops, you can replace your case structure. Examples of how to use this can be found in the Example Finder in LabVIEW under the Help menu. If you browse by task to Fundamentals » Arrays and Clusters, you can find a few examples which demonstrate this concept such as Building Arrays and Building Tables. Hopefully this gives you some direction.

 

Regards,

Kent

Applications Engineer

0 Kudos
Message 10 of 10
(7,997 Views)