07-16-2009 08:34 AM
I am student and would like to take continuous temperature measurements using thermocouples. I am using anSCXI-1000 chassis, an SXCI 1102-B module, an SCXI-1303 terminal block and the PCI-6034E board.
I am taking the temperature readings using the Cont Acq Thermocouple Samples-HW Timed.vi.
My problem is that i would like to see in the front panel a continuous updated waveform, while in the end concentrateall the samples taken in a txt file. If I place outside the loop the export waveform to spreadsheet.vi then I will onlytake the last measurements. If i place it inside the loop, the vi will ask me in each iretation to save the samples.
How can solve it?
I have also a of question regarding the Cont Acq Thermocouple Samples-HW Timed.vi. Is it necessary first to adjust in MAX the temperature range that i would like take measures or it is automatically adjusted when I configure therange in the Cont Acq Thermocouple Samples-HW Timed.vi.
Thank you in advance
Papakonstantinou Georgios
07-17-2009 11:10 AM - edited 07-17-2009 11:11 AM
07-17-2009 11:11 AM - edited 07-17-2009 11:12 AM
07-17-2009 11:13 AM
07-18-2009 07:51 AM
Thank for your answer and your time Brandon.
I did what you told me but other problems arise.
At first I had to add the array to spreadsheet string.vi. Because array to spreadsheet string.vi could not read an 1-D array of waveforms I had to change also the polymorfic DAQmx Read.vi from analog 1D Waveform NChan NSamp (default) to the analog 2D DBL NChan NSamp.
Consequently, I got a text file which has 10 columns and under each column tons of data (temperatures).
What do I want to do??
1. I want to build a vi that will take temperature measurements from 5 thermocouples (5 channels). This vi must take finite samples (for example 2000 samples/channel) and then stop .
2. Additionally, I want to see in the front panel a continually updated waveform graph (with 5 plots) depending on the rate that I give in the front panel.
3. Finally, I want to export those samples into a txt file which will have 5 columns (as many as the thermocouples) and as many rows as the samples I have given in the front panel.
It must be so easy to build this vi. Nevertheless, no matter what I do I cannot make it work!!!! And believe me I have spend many hours on this vi before I post to the forum. Plus, I do not have anybody else to ask because noone knows how to use labview in the whole university (Greece..).
Thank you very much Brandon.
P.S.: I have uploaded the vi that I built, as you instructed me with the changes that I told you above and the txt file that it generates.
07-20-2009 11:25 AM
The VI that you have is a pretty good start. I would say the one thing that you are missing is a Transpose 2D Array VI (found in Programming>>Array palette). This VI should fix the problem with your colums. You will want to place this before the Array to Spreadsheet String VI. Please let me know if you have anymore problems regarding this issue.
Have a nice day,
07-21-2009 06:00 PM
Thank you very much Brandon and sorry for the delay. We are almost done!!
It worked although i could not quite understand why the 2D array should be transposed.
Another thing that I would like you to help me is how to get this vi to take finite measurements while the waveforms update constantly, because this vi keeps running until i press the stop button.
For example I would like this vi to take 2000 Samples/channel at a rate of 100Hz as I described you in the previous message. As a consequence this vi will run 20 seconds and I will be able to watch the the waveforms updating until the vi finishes. I hope that you understood my problem.
I would not be able to solve it in another 20 years if it weren't you. Thanks again!
07-22-2009 11:28 AM
Hello ginos,
The array needed to be transposed because of the way LabVIEW was trying to format the spreadsheet file. LabVIEW was putting the channels in the rows and each sample was a different column. By transposing the array, you basically flip that around so now each column is a different channel and each row is a new sample.
As for being able to take finite samples, the most common practice is to set your DAQmx Timing VI to Finite Samples, rather than Continous Samples as you have it set now, and then specifying the number of samples you would like to read. This method does not use a while loop because it runs through one time, reads the specified number of samples, and then stops. A good example of finite sampling can be found in the NI Example Finder under Hardware Input and Output>>DAQmx>>Analog Measurements>>Voltage>>Acq&Graph Voltage-Int Clk.vi. Since you already have a while loop in your program, an easier method for you would be to just insert another stop condition for the while loop. You are acquiring 10 samples per channel each iteration of the loop, and you want 2000 samples per channel total, so you would like your loop to stop after 200 iterations.
I've included a screenshot of what this will look like. You want to use the Compound Arithmetic VI (found in the Numeric palette) along with an Equal? comparison VI. Once the loop iteration count reaches 200 you want the while loop to stop. While loops are a little tricky though because the loop will always iterate one time initially before it begins counting. Because of this, you will actually want to set your comparison to one less than the total iteration count you are looking for (in this case 199). I hope this answers your question and please let me know if you run into anymore problems.
Have a nice day,
07-23-2009 11:33 PM
Hello Brandon, thank you very much for the help. I followed your instructions and I made a couple of similar vi's. The first one is made with a while loop and the second one is with made with a for loop. Please take a look at them and tell me which of this is best. In my opinion it is better to use the one with the while loop.
I have two questions although we have come up to a solution. At first, I think by setting the DAQmx Timing.vi to take continuous measurements and setting the Read.vi to take 10 Samples per iteration I lose some measurement. Am I right?
Finally I have not quite understood what does the timeout parameter do in the Read.vi
Thanks again for the solution
I won't be able to answer earlier than Monday because I won't have access to the internet.
Have a nice weekend!
07-27-2009 10:57 AM
Ginos,
I looked over your VIs, and in the one that uses a For loop, I think you will end up getting 10 times as many samples as in the one with the While loop. (You should divide the Samples per channel by the number of samples you are acquiring each iteration, and then wire that to the iterations terminal of the For loop.) However, aside from that, I think that I agree with you about using the While loop rather than the For loop. That VI has the advantage that you can stop it before it finishes, if you need to, and also it will stop iterating if there is an error.
To answer your questions: you should not be losing any measurements because you set up the task to be hardware timed. The Samples per iteration just sets the size of the buffer that the samples are read into. The Timeout parameter sets the amount of time in seconds that the read VI will wait for the samples to be in the buffer. So, in your case, if the DAQmx Read VI has been waiting 10 seconds and 10 samples (the number of samples to read) are not in the buffer then the code will produce a timeout error.
Let me know if this clarifies things, or if you have further questions.
-Christina