09-20-2009 07:52 PM
Hello. I have been trying to write some code to get temperatures through thermocouples with a USB-TC. The temperature output is a 1D array. I am trying to make a 2-D array. Time and Temperature and then put them in a graph. The hard part is, I want to be able to pick which thermocouples are in use and show up on a graph/chart. The graph needs to update with each reading. I am thinking a queing system will work but am not sure. Does the picture look like I am on the right track? Any help would be well appreciated.
Thanks
Solved! Go to Solution.
09-20-2009 11:38 PM
I assume the board number is 0, the low channel is 0 and the high channel is 7. If it is the case, you obtain an array of 8 doubles (8 temperatures) and one value for the time. The two arrays will not have the same lenght. Try something like this.
Jean-Marc
09-21-2009 03:42 PM
Just a comment on J-M's code.
It is correct and functional, however there is a slightly easier way to do it.
Since the data collected will be at a regular interval (in his case 10 / second) you do not need an XY graph.
You can use a waveform chart, and just format the X-Axis to 'Absolute Time'.
Then, you also do not to build an array, because a Chart has a built in history.
09-21-2009 09:40 PM - edited 09-21-2009 09:41 PM
Does this look close to what both of you are talking about?
09-21-2009 09:50 PM
Hmm, not quite.
On your x-axis, you will have time.
But on your y-axis, you will have 2 plots:
1) Time
2) Temperature
You only need the second one.
Also, you do not need the For loop.
By doing that, you are building an array with only 1 element in it every iteration.
Just remove the For loop, cluster elements, and time stamp.
09-21-2009 09:50 PM - edited 09-21-2009 09:51 PM
Well, the -1 going into your For Loop N node means the For Loop will never run.
Just eliminate the For loop completely.
You don't need the time functions and certainly don't bundle them with the data into waveform chart.
Just take your Array of data, convert it to a cluster (set the size on that function to however many channels you have) and wire it to the waveform chart.
09-21-2009 09:54 PM
I dont have the TIn function, so just pretend that this numeric control is your TIn.
You can just wire it straight to the chart, since the chart has a history.
Then right click the graph and go to Formatting.
Change the x-axis to Absolute Time.
09-24-2009 10:00 AM
09-24-2009 09:39 PM
Do you want to find the first time it passes 100? Or all points above 100 degrees?
If you want the former of the two:
If your Time array and Temperature array are the same size, just run through your temperature array until it passes 100 degrees.
When it does, stop looping, and index the time at that same index.
09-25-2009 03:27 PM - edited 09-25-2009 03:31 PM
The picture is without the hardware plugged in so all the values are 0. Nevertheless, I am unable to read, in an array, the time at which temps are taken.