Support Forums
Scripting: What is the best way to detect stable temps

here what what I need to do. I have 4 thermocouples they are channels 2,3,5,6. I need to be able to have the datataker decide when the temperature has leveled off on all of them. The way I would do this in a high level language would be to have 4 lists each 5 variables long.

Then each sample would be pushed on to the list and the oldest one dropped off. Then just do a comparison each time to see how far apart the highest and the lowest values are. When they are within half a degree I would set a variable to true. When all 4 variables are set true I would set an output to true.

Is there a way to do this with the "Command language" that we have access to in the datataker?

here what what I need to do. I have 4 thermocouples they are channels 2,3,5,6. I need to be able to have the datataker decide when the temperature has leveled off on all of them. The way I would do this in a high level language would be to have 4 lists each 5 variables long. Then each sample would be pushed on to the list and the oldest one dropped off. Then just do a comparison each time to see how far apart the highest and the lowest values are. When they are within half a degree I would set a variable to true. When all 4 variables are set true I would set an output to true. Is there a way to do this with the "Command language" that we have access to in the datataker?

Tech support got back to me an suggestion like this. it looks like a good solution. I'll have to expand on it though.

The logger does have a command language to do what you want. It's not real pretty but here's a stab at the command code to do what you want:

1TK(=1CV) 'Store newest in 1CV
10CV=1CV 'New Min
11CV=1CV 'New Max

IF(2CV<10CV){10CV=2CV}
IF(2CV>11CV){11CV=2CV}

IF(3CV<10CV){10CV=3CV}
IF(3CV>11CV){11CV=3CV}

IF(4CV<10CV){10CV=4CV}
IF(4CV>11CV){11CV=4CV}

IF(5CV<10CV){10CV=5CV}
IF(5CV>11CV){11CV=5CV}

6CV=5CV-4CV 'cal max - min
7CV=0
IF(6CV<.5){7CV=1} 'flag that channel 1 is settled

5CV=4CV 'roll oldest reading
4CV=3CV 'roll 3rd oldest reading
3CV=2CV 'roll 2nd oldest reading
2CV=1CV 'roll newest reading

NOTE need to add similar code for other 3 Channels here

'Final check to see if all are settled
'This assumes that individual settled flags are in 7,17,27 and 37CV
'for channels 1, 2, 3, and 4 respectively

40CV=0 'initalize count of settled channels
40CV=7CV+17CV+27CV+37CV '40CV contains number of settled channels
41CV=0 'initialize global flag
IF(40CV>3){41CV=1} 'if 41CV=1 all 4 channels are settled

Tech support got back to me an suggestion like this. it looks like a good solution. I&#039;ll have to expand on it though. The logger does have a command language to do what you want. It&#039;s not real pretty but here&#039;s a stab at the command code to do what you want: 1TK(=1CV) &#039;Store newest in 1CV 10CV=1CV &#039;New Min 11CV=1CV &#039;New Max IF(2CV&lt;10CV){10CV=2CV} IF(2CV&gt;11CV){11CV=2CV} IF(3CV&lt;10CV){10CV=3CV} IF(3CV&gt;11CV){11CV=3CV} IF(4CV&lt;10CV){10CV=4CV} IF(4CV&gt;11CV){11CV=4CV} IF(5CV&lt;10CV){10CV=5CV} IF(5CV&gt;11CV){11CV=5CV} 6CV=5CV-4CV &#039;cal max - min 7CV=0 IF(6CV&lt;.5){7CV=1} &#039;flag that channel 1 is settled 5CV=4CV &#039;roll oldest reading 4CV=3CV &#039;roll 3rd oldest reading 3CV=2CV &#039;roll 2nd oldest reading 2CV=1CV &#039;roll newest reading ***NOTE need to add similar code for other 3 Channels here *** &#039;Final check to see if all are settled &#039;This assumes that individual settled flags are in 7,17,27 and 37CV &#039;for channels 1, 2, 3, and 4 respectively 40CV=0 &#039;initalize count of settled channels 40CV=7CV+17CV+27CV+37CV &#039;40CV contains number of settled channels 41CV=0 &#039;initialize global flag IF(40CV&gt;3){41CV=1} &#039;if 41CV=1 all 4 channels are settled

Hi theColonel26,

You may also refer to DT code example for running minimum and running maxima, please check this link under Statistic:

http://www.thermofisher.com.au/show.aspx?page=/ContentAUS/Manufacturing-Processing/Industrial-Loggers/DataTaker/DataTaker-FAQ/Program-Code/General-Codes.html

Best regards,
Rudy Gunawan

Hi theColonel26, You may also refer to DT code example for running minimum and running maxima, please check this link under Statistic: http://www.thermofisher.com.au/show.aspx?page=/ContentAUS/Manufacturing-Processing/Industrial-Loggers/DataTaker/DataTaker-FAQ/Program-Code/General-Codes.html Best regards, Rudy Gunawan

Good morning to theColonel26,

Here is another approach you could try.
1/ The channel option DF will report the difference between the last reading and the current reading
2/ In V9.10 firmware we introduced running averages

We could combine the two methods to create a process to detect a stable temperature

It would go some thing like this:

Begin
RA1S
1TK("Temperature~deg C",=1CV) 'Record the temperature
1CV(DF,RAV5,"AveDifT",=2CV) 'Calculate the Difference between readings and calculate the average difference of the last 5 readings
Alarm1(2CV><-0.2,0.2)"Temperature stable^M^J"
End

Cheers,
Roger

Good morning to theColonel26, Here is another approach you could try. 1/ The channel option DF will report the difference between the last reading and the current reading 2/ In V9.10 firmware we introduced running averages We could combine the two methods to create a process to detect a stable temperature It would go some thing like this: Begin RA1S 1TK(&quot;Temperature~deg C&quot;,=1CV) &#039;Record the temperature 1CV(DF,RAV5,&quot;AveDifT&quot;,=2CV) &#039;Calculate the Difference between readings and calculate the average difference of the last 5 readings Alarm1(2CV&gt;&lt;-0.2,0.2)&quot;Temperature stable^M^J&quot; End Cheers, Roger
8
3
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft