'{CR1000} ' '================================================================================== '=========================== TP 01 =========================== '================================================================================== 'Program by Sebastian Hoch - leaning heavily on: 'Sample program for the TP01 'Programming by Arjan Verduijn of Hukseflux, 'Revised by Konrad van den Berg 'Version v0902 'date: 31-10-06 'Changelog v0902 'date: 17-3-2009 'by: Konrad van den Berg 'Changes: '1. Corrected diffusivity calculation. '2. Added a lists of variables ' Written for a CR1000 datalogger. ' The purpose of the program is to be able to demonstrate the working of a TP01 ' Thermal Properties sensor using manual control and indoor experiments. ' The usual way of demonstrating is to put TP01 in two media and to perform ' 2 measurements. ' The calibration constants of the sensor are entered into the program ' using the numeric display of LoggerNet, once the value is set the data logger ' preserves these set values. ' The parameters are the 3 usual ones, Re (resistance of heater Ohms), E_l (sensitivity of TP01) ' and the time that is needed for the setup to become thermally stable, Time_cycl in seconds. ' The program demonstrates the ability to measure thermal conductivity, but also ' makes an estimate of the medium thermal diffusivity and volumetric heat capacity. ' For the thermal diffusivity measurement there are two additions: reference thermal diffusivity td_ref ' and the time constant in medium with the referemce thermal diffusivity, td_reftim. ' A measurement cycle is started, by manually changing 'Start' or automatically, on default ' every 3 hrs. The result is an estimate of the medium thermal conductivity, of the thermal ' diffusivity and volumetric heat capacity. During the measurement of the latter parameters, ' 'Running' will be indicated high. If, for some reason the system is not correctly connected ' or the environment has thermally changed during the measurement 'ContactPrblm' will be set high and ' the measurement will be terminated. ' The thermal conductivity is estimated by measuring the power and the ' signal amplitude. The thermal diffusivity is estimated from the time it takes to ' resettle to 37% (63% is the 1/e time, systems specific reaction time) of the signal ' amplitude. ' The volumetric heat capacity is simply obtained by a division of lambda and td. ' This addition is extremely useful for estimating the storage term in Bowen Ratio systems. ' The thermal diffusivity and thermal conductivity values, when monitored over a long time ' for instance in a field experiment, can give a the water content as well. ' For this you need the information on the soil in a dry condtion. ' N.B. In this program version the measurements are made by looking at the voltage ' differences over the used input channels. This will give the highest resolution with ' lowest noise. However, if there is a shortage of input channels on the logger, the ' temperature sensor measurement can be made on a single-ended channel with little degradation ' of accuracy, compared to other errors of this measurement. ' ' ' The connection of the heater and sensor is as follows ' '1H(#1), 2H(#2), 3H(#3) --white------------------------------------- ' | ' TP01 differential temperature sensor ' | '1L(#1), 2L(#2), 3L(#3) --green------------------------------------- ' ' AG---shield ' ' SW 12 V --Resistance +/- 150 ohm -brown-------------------- ' | '5H(#1), 6H(#2), 7H(#3)--red----------------------------------------| ' | ' Heater +/- 15 ohm ' | ' at SW12 G --yellow------------------------------------------- ' | '5L(#1), 6L(#2), 7L(#3) --blue-------------------------------------- ' ' ' Both measurements can also be made in the single ended mode. The accuracy will be a little lower ' In case of the TP01 sensor measurement, 5L will be omitted, and connected to AG. ' In case of the heater voltage measurement, 6L must be disconnected, but G must remain connected ' to the yellow wire ' The value of the resistor used to limit the current trough the heater element when 12 Volt ' is applied must be about 150 Ohms, 1 Watt. ' List of Variables ' td = themal diffusivity [*10^-6 m^2/s] ' td_time = 63% response time [s] ' td_ref = themal diffusivity of reference sample [*10^-6 m^2/s] ' td_reftim = 63% response time of reference sample [s] ' Re = tp01 heaterwire resistance [Ohm] ' E1 = tp01 (thermopile) sensitivity [uV/K] ' Q = Power per unit length [W/m] ' L_heat = tp01 heaterwire lenght [m] ' lambda = sample thermal conductivity [W/mK] ' U_heat = voltage across tp01 heaterwire [V] ' U_senamp = tp01 thermopile respone amplitude [mV] ' rocp = sample volumetric heat capacity [*10^6 J/(K m^3)] 'Preserve values of variables once changed by user input PreserveVariables 'Declare Public Variables Public Batt_volt Public U_sen0, U_sen, error4, error5 'Public Time_cycl, U_senmax, U_heatmax, U_heat, Q Public U_senmax, U_heatmax, U_heat, Q 'Public Re, L_heat, U_senamp, lambda, E1, U_sen63, U_comp Public U_senamp, lambda, U_sen63, U_comp 'Public td, td_time, rocp, td_ref Public td, td_time, rocp 'Public td_reftim, First_execution, E1_Q Public First_execution, E1_Q 'Declare boolean controls Public Start as Boolean, DiffCap as Boolean, Running as Boolean, ContactPrblm as Boolean Public LambdaOutOfRange as Boolean 'Define units to be displayed in the data file header Units U_sen, U_sen0, U_senamp = mV Units U_heat = V Units lambda = W/m.K 'Units E1 = uV/K Units Q = W/m 'Enter the resistance of TP01 heating wire in ohms. 'The value can be between 10 and 20, nominal 15,7 'Re = 16.2 '200642: 16.0 Ohms '200656: 17.4 Ohms Const Re= 16.0 'Enter in exceptional cases the length of the heating wire 'Nominal value 0.06 m. Const L_heat = 0.06 'Enter the sensitivity of TP01 for thermal conductivity in uV/K. 'Called E lambda in manual, specified on calibration certificate. 'Nominal value 0.2. '200642: 133.1 uV/K '200656: 151.9 uV/K Const E1 = 133.1 ' Enter in exceptional cases the reference time for thermal diffusivity, not indicated on a TP01 calibration certificate. ' This reference is in seconds, and could for instance indicate the 63% (1/e) response time in water. ' Nominal value 19 seconds for water as reference material Const td_reftim = 19000 ' Enter in exceptional cases the reference value for the thermal diffusivity, ' not indicated on a calibration certificate the value of water thermal ' diffusivity, namely 0.14 10^-6 m^2/s. The value of "td_reftim" should then be set ' to 0.14 because this reference is in um^2/s. ' The absolute value of the thermal diffusivity is not very accurate (est +/- 20%. ' However, it can be used to indicate changes in water content of the medium. Const td_ref = 0.14 ' Enter in exceptional cases the time of the heating cycle. ' Recommended value 180 seconds, applicable in most soils. Const Time_cycl = 180000 ' Sensor output values in cold, stable state in addition also the actual battery ' voltage is saved. DataTable (DataCold,true,-1) DataInterval (0,0,Sec,0) Minimum (1,Batt_volt,FP2,0,False) Sample (1,U_sen,FP2) Sample (1,U_heat,FP2) EndTable 'Sensor output values and computed parameters in warm, stable state DataTable (DataWarm,true,-1) DataInterval (0,0,mSec,0) Sample (1,U_sen0,FP2) Sample (1,U_senamp,FP2) Sample (1,lambda,FP2) Sample (1,E1,FP2) E1_Q = E1 * 1e-3 * Q Sample (1,E1_Q,FP2) EndTable 'Save data computed using the found time constant DataTable (DynaData,true,-1) DataInterval (0,0,mSec,0) Sample (1,td,FP2) Sample (1,rocp,FP2) EndTable DataTable (AllDataSave,true,-1) DataInterval (0,0,mSec,0) 'Cold Stuff - Measured Prior to Heating Sample (1,U_sen0,IEEE4) 'Hot Stuff - Measured at End of Heating Sample (1,U_senmax,IEEE4) 'Sensor Output at Max heating Sample (1,U_heatmax,IEEE4) 'Voltage of heater Sample (1,Q,IEEE4) 'Power Heater Sample (1,U_senamp,IEEE4) 'U_sensmax - U_sens0' Sample (1,E1,IEEE4) ' Calib Coeff Sample (1,lambda,IEEE4) 'lambda = E1 * 1e-3 * Q / U_senamp 'Dynamic Stuff - Determined after Heating Sample (1,td_ref,IEEE4) Sample (1,td_reftim,IEEE4) Sample (1,td_time,IEEE4) 'td = td_ref * td_reftim / td_time Sample (1,td,IEEE4) Sample (1,rocp,IEEE4) EndTable '------------------------------------------------------------------------------------------ 'Subroutines; a) Initialize b) MaxTemp '------------------------------------------------------------------------------------------ '------------------------------------------------------------------------------------------ Sub(Initialize) '------------------------------------------------------------------------------------------ 'Copy the reading of the TP01 differential temperature sensor just before the measurement U_sen0 = U_sen 'Switch the heater on SW12(1) Running = true 'Start a timer Timer(1,mSec,2) 'reset error status parameters LambdaOutOfRange = false EndSub '------------------------------------------------------------------------------------------ Sub(MaxTemp) '------------------------------------------------------------------------------------------ ' Save data in warm, stable condition; ' Take the sensor output. U_senmax = U_sen ' Take the voltage over the heater U_heatmax = U_heat ' Now the power is calculated in W/m. Q = U_heat^2 / (Re * L_heat) ' Calculate the mV difference caused due to the heater, which is proportional to ' the temperature difference. U_senamp = U_senmax - U_sen0 ' Thermal conductivity calculation. lambda = E1 * 1e-3 * Q / U_senamp ' create an error message if the thermal conductivity is out of range If (lambda >= 4 or lambda < 0.3) then LambdaOutOfRange = true EndIf ' Determination of 63% of the signal amplitude, with respect to the initial cold ' temperature U_sen63 = 0.63 * U_senamp ' The value to compare with is U_comp. ' We take the absolute value to avoid any problems with the polarity. U_comp = abs(U_senmax - U_sen63) EndSub '------------------------------------------------------------------------------------------ 'Main Program '------------------------------------------------------------------------------------------ BeginProg ' Every one tenth-of-a-second a measurement is performed because we need this accuracy to ' determine the thermal diffusivity with a resonable accuracy Scan (100,mSec,0,0) ' Stores actual battery voltage to "Batt_volt" Battery (Batt_volt) 'Initialize to default calibration values only the very first time the program is 'run. If NOT(First_execution = 1) Then 'Put flags on default values Start = false DiffCap = false First_execution = 1 EndIf ' Connection to channel 5, if possible in the differential mode. VoltDiff (U_sen,1,AutorangeC,5,True,0,_60Hz,1.0,0) ' Connection to channel 6, if possible in the differential mode. Value is stored ' in Volts Voltdiff (U_heat,1,mV2500,6,True ,0,_60Hz,0.001,0) ' The measurement is started here by putting 'Start' high or automatically every 3 hrs If (Start or TimeIntoInterval(0,180,min)) then 'Save sensor output in cold, stable situation CallTable(DataCold) 'Set parameters, switch on heater and start timer Call Initialize 'Reset 'start' Start = false EndIf 'Once "Time_cycl" seconds have passed, the TP01 output is assumed to be stable 'and the measurement can be made ' If ( Timer(1,mSec,4) = Time_cycl ) Then If ( Timer(1,mSec,4) >= Time_cycl ) Then Call(MaxTemp) CallTable(DataWarm) 'The heater is put off again. SW12(0) 'Set 'DiffCap' true to start the determination of the time constant DiffCap = true 'Restart timer no. 1 Timer (1,mSec,2) EndIf ' If 'DiffCap' is high we are going to determine the thermal diffusivity and ' volumetric heat capacity. If DiffCap then 'Wait until the temperature has decreased to (1-0.63)*100%=37% of its initial 'value with respect to the warm, stable state. If ( abs(U_sen) <= U_comp ) then ' Compare the sensor output to the 37% value ' The timer information is stored in td_time ' Now we know how much time it took to resettle. td_time = Timer (1,mSec,4) ' The thermal diffusivity is made by multiplcation of the reference ' thermal diffusivity and this ratio. td = td_ref * td_reftim / td_time ' The volumetric heat capacity equals lambda/td. rocp = lambda / td ' Stop timer Timer(1,mSec,1) ' Store thermal diffusity and and "rocp" data. CallTable(DynaData) CallTable(AllDataSave) 'Reset DiffCap = false Running = false EndIf 'Terminate process and set 'ContactPrblm' high if it appears that the 63% limit will 'never be reached. If ( Timer(1,mSec,4) >= Time_cycl ) Then ContactPrblm = true td = 0 ' Stop timer Timer(1,mSec,1) 'Reset DiffCap = false Running = false EndIf EndIf NextScan EndProg