From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculation of temperature using loops

Hi

 

I have been trying to measure the temperature and the time of its measurement from a thermocouple in a loop.

But when i run the program, i only get the value of the last output. The loop is reading only a single initial input and repeating itself for the complete cycle.

 

I am unable to store the previous values of the loop. Can some one please help me out with the solution so that i can get around 30 values of temperature in an array?

0 Kudos
Message 1 of 7
(2,403 Views)

Close file belongs outside of the loops.

 

Right now you are closing the file every iteration.

So LabVIEW needs to reopen the file when you write to it in the next iteration.  That puts the file pointer at the beginning of the file thus overwriting anything that was already in there.

 

Why are you turning the array into a matrix?  Matrices are rarely used in LabVIEW.  It is a special datatype used in linear algebra.  Arrays are used extremely frequently.  I really don't understand what you are trying to do with that array/matrix manipulation.

 

If you are only doing 30 x 2 data points, I would just autoindex at the tunnels, and write those 60 points in a single time at the end.

0 Kudos
Message 2 of 7
(2,399 Views)

I just want to know the first 30 temperature readings and its time of measurement, and then store it in an array and lastly save it in text file to view the values.

 

I am unable to understand why its only recording a single itteration.

So, please how should that be done?

 

 

0 Kudos
Message 3 of 7
(2,367 Views)

Like this.

 

The timing mechanism is in there to slow down the loop.  It may not be necessary depending on how you acquire the data.  For instance, a DAQmx Read with multiple samples will acquire at the rate of the sample clock.

0 Kudos
Message 4 of 7
(2,361 Views)

Retaining data options:  (go through the basic training courses)

1) auto-indexing output terminal from your loop

2) shift registers

3) Do not, i repeat, DO NOT use variables... it just makes things messy for what you want to do.

 

Upon exiting the loop, save your data.... One option is to use "Array to spreadsheet string" and then "write delimited spreadsheet.vi"

0 Kudos
Message 5 of 7
(2,360 Views)

Can you send me the program file for this?

 

I tried the program with shift registers, but still the same issue. It is reading only the first value and repeating.

0 Kudos
Message 6 of 7
(2,339 Views)

It's a snippet, so you can save the image from your browser out to the desktop, then drag that image file into the block diagram.

 

But here is the VI.

 

Your VI is inside out.  While loop should be outside, case structure inside.

And you are still stuck on using that matrix datatype and crazy manipulation of it.

 

 

0 Kudos
Message 7 of 7
(2,334 Views)