Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

What's happen in my CR1000 program?!?


Otemohu Jan 15, 2013 09:31 AM

Hi all (I posted the same message on the support page)

Since last year, I use a program on a CR1000 (see below) which monitors the following sensors:
(1) 20 thermocouple Type-T foir soil temperature
(2) 4 Enviroscan probes for soil moisture (60 sensors, 15 per prope)
(3) 4 HFP01SC heat flux plate for soil heat flux

(1) Thermocouples are connected to a multiplexer AM16/32B. (2)Communication with Enviroscans works through SDI12.
All sounds good for the thermocouple and Enviroscan.

(3) Heat flux plate need to be calibrated regularly. The HFP01SC has a resistor capable of heating to create a known heat flux through the plate.
During the calibrating phase, started by a subroutine (hfp01sc_cal), I put a Disable Var to avoid the flux data used in DataTable. I use the same DisVar in the DataTable that saves the soil temperatures (because of little effect of heat on thermocouples: they are relatively close to the HFP).

BUT, when calibration phase is ON (heating of resistance during 5 minutes), the Avg value for the half hour is very different of values before and value after calibration. Yet, with DisVar ON (True), I expect closed values in dynamics of heat flux.

If someone could explain me what's happen and help me?

*********************************************************
'HFP01SC heat flux plate sensitivities and constants
Const Esen_1 = 65.4 'sn 2685 fact. sens. = 65.4 microV/W/m2
Const Esen_2 = 63.1 'sn 2706 fact. sens. = 63.1 microV/W/m2
Const Esen_3 = 62.4 'sn 2707 fact. sens. = 62.4 microV/W/m2
Const Esen_4 = 64.5 'sn 2708 fact. sens. = 65.4 microV/W/m2
Const Rcur = 10 'Valeur de la resistance pour mesure du courant de chauffe 10ohm 1% 0.25W
Const Rself_1 = 103.3 'Rself_1 = Rself_sn2685 (98.3) + 0.1*(25*2) car 25 metres de cable
Const Rself_2 = 105.2 'Rself_2 = Rself_sn2707 (99.3) + 0.1*(30*2) car 30 metres de cable
Const Rself_3 = 105.3 'Rself_3 = Rself_sn2707 (99.4) + 0.1*(30*2) car 30 metres de cable
Const Rself_4 = 105.8 'Rself_4 = Rself_sn2707 (99.9) + 0.1*(30*2) car 30 metres de cable
Const Aself = 0.003885 'Surface d'echange du capteur en m2
Const Elambda = 0.8 'Conductivite thermique du capteur en W/m.K

'Public Variables
'Enviroscan Variables
Public ES_SF_1_1(9)
Public ES_SF_1_2(6)
Alias ES_SF_1_1(1) = ES_SF_1_010cm
Alias ES_SF_1_1(2) = ES_SF_1_020cm
Alias ES_SF_1_1(3) = ES_SF_1_030cm
Alias ES_SF_1_1(4) = ES_SF_1_040cm
Alias ES_SF_1_1(5) = ES_SF_1_050cm
Alias ES_SF_1_1(6) = ES_SF_1_060cm
Alias ES_SF_1_1(7) = ES_SF_1_070cm
Alias ES_SF_1_1(8) = ES_SF_1_080cm
Alias ES_SF_1_1(9) = ES_SF_1_090cm
Alias ES_SF_1_2(1) = ES_SF_1_100cm
Alias ES_SF_1_2(2) = ES_SF_1_110cm
Alias ES_SF_1_2(3) = ES_SF_1_120cm
Alias ES_SF_1_2(4) = ES_SF_1_130cm
Alias ES_SF_1_2(5) = ES_SF_1_140cm
Alias ES_SF_1_2(6) = ES_SF_1_150cm

Public ES_SF_2_1(9)
Public ES_SF_2_2(6)
Alias ES_SF_2_1(1) = ES_SF_2_010cm
Alias ES_SF_2_1(2) = ES_SF_2_020cm
Alias ES_SF_2_1(3) = ES_SF_2_030cm
Alias ES_SF_2_1(4) = ES_SF_2_040cm
Alias ES_SF_2_1(5) = ES_SF_2_050cm
Alias ES_SF_2_1(6) = ES_SF_2_060cm
Alias ES_SF_2_1(7) = ES_SF_2_070cm
Alias ES_SF_2_1(8) = ES_SF_2_080cm
Alias ES_SF_2_1(9) = ES_SF_2_090cm
Alias ES_SF_2_2(1) = ES_SF_2_100cm
Alias ES_SF_2_2(2) = ES_SF_2_110cm
Alias ES_SF_2_2(3) = ES_SF_2_120cm
Alias ES_SF_2_2(4) = ES_SF_2_130cm
Alias ES_SF_2_2(5) = ES_SF_2_140cm
Alias ES_SF_2_2(6) = ES_SF_2_150cm

Public ES_SF_3_1(9)
Public ES_SF_3_2(6)
Alias ES_SF_3_1(1) = ES_SF_3_010cm
Alias ES_SF_3_1(2) = ES_SF_3_020cm
Alias ES_SF_3_1(3) = ES_SF_3_030cm
Alias ES_SF_3_1(4) = ES_SF_3_040cm
Alias ES_SF_3_1(5) = ES_SF_3_050cm
Alias ES_SF_3_1(6) = ES_SF_3_060cm
Alias ES_SF_3_1(7) = ES_SF_3_070cm
Alias ES_SF_3_1(8) = ES_SF_3_080cm
Alias ES_SF_3_1(9) = ES_SF_3_090cm
Alias ES_SF_3_2(1) = ES_SF_3_100cm
Alias ES_SF_3_2(2) = ES_SF_3_110cm
Alias ES_SF_3_2(3) = ES_SF_3_120cm
Alias ES_SF_3_2(4) = ES_SF_3_130cm
Alias ES_SF_3_2(5) = ES_SF_3_140cm
Alias ES_SF_3_2(6) = ES_SF_3_150cm

Public ES_SF_4_1(9)
Public ES_SF_4_2(6)
Alias ES_SF_4_1(1) = ES_SF_4_010cm
Alias ES_SF_4_1(2) = ES_SF_4_020cm
Alias ES_SF_4_1(3) = ES_SF_4_030cm
Alias ES_SF_4_1(4) = ES_SF_4_040cm
Alias ES_SF_4_1(5) = ES_SF_4_050cm
Alias ES_SF_4_1(6) = ES_SF_4_060cm
Alias ES_SF_4_1(7) = ES_SF_4_070cm
Alias ES_SF_4_1(8) = ES_SF_4_080cm
Alias ES_SF_4_1(9) = ES_SF_4_090cm
Alias ES_SF_4_2(1) = ES_SF_4_100cm
Alias ES_SF_4_2(2) = ES_SF_4_110cm
Alias ES_SF_4_2(3) = ES_SF_4_120cm
Alias ES_SF_4_2(4) = ES_SF_4_130cm
Alias ES_SF_4_2(5) = ES_SF_4_140cm
Alias ES_SF_4_2(6) = ES_SF_4_150cm

'HFP01SC Variables
Public phi(4) : Units phi = W/m2
Alias phi(1) = Gsoil_1
Alias phi(2) = Gsoil_2
Alias phi(3) = Gsoil_3
Alias phi(4) = Gsoil_4
Public phi_cor(4) : Units phi_cor = W/m2
Alias phi_cor(1) = Gsoil_cor_1
Alias phi_cor(2) = Gsoil_cor_2
Alias phi_cor(3) = Gsoil_cor_3
Alias phi_cor(4) = Gsoil_cor_4
Public Esen(4) : Units Esen = microV/W/m2
Public Esen2(4) : Units Esen2 = microV/W/m2
Public Vsen(4) : Units Vsen = mV
Public Vsen_run(4) : Units Vsen_run = mV
Public Vsen_0(4) : Units Vsen_0 = mV
Public Vsen_180(4) : Units Vsen_180 = mV
Public Vsen_end(4) : Units Vsen_end = mV
Public Vamp(4) : Units Vamp = mV
Public Vcur(4) : Units Vcur = V
Public Vcur_run(4) : Units Vcur_run = V
Public Vcur_180(4) : Units Vcur_180 = V
Public Rself(4) : Units Rself = ohms
Public Lambda(4) : Units Lambda = W/m.K
Public Ecal_on As Boolean
Public SW12_state As Boolean
Public Error1(4) As Boolean
Public Error2(4) As Boolean
Public Error3(4) As Boolean
Public Error4(4) As Boolean
Dim j

'Thermocouples Type-T soil temperature variables
Dim AM1632_Count
Public PTemp : Units PTemp = degC
Public SoilTemp(20) : Units SoilTemp = degC
Alias SoilTemp(1) = SoilTemp_1_04cm
Alias SoilTemp(2) = SoilTemp_1_08cm
Alias SoilTemp(3) = SoilTemp_1_16cm
Alias SoilTemp(4) = SoilTemp_1_32cm
Alias SoilTemp(5) = SoilTemp_1_64cm
Alias SoilTemp(6) = SoilTemp_2_04cm
Alias SoilTemp(7) = SoilTemp_2_08cm
Alias SoilTemp(8) = SoilTemp_2_16cm
Alias SoilTemp(9) = SoilTemp_2_32cm
Alias SoilTemp(10) = SoilTemp_2_64cm
Alias SoilTemp(11) = SoilTemp_3_04cm
Alias SoilTemp(12) = SoilTemp_3_08cm
Alias SoilTemp(13) = SoilTemp_3_16cm
Alias SoilTemp(14) = SoilTemp_3_32cm
Alias SoilTemp(15) = SoilTemp_3_64cm
Alias SoilTemp(16) = SoilTemp_4_04cm
Alias SoilTemp(17) = SoilTemp_4_08cm
Alias SoilTemp(18) = SoilTemp_4_16cm
Alias SoilTemp(19) = SoilTemp_4_32cm
Alias SoilTemp(20) = SoilTemp_4_64cm

'Definition of DataTables
DataTable(Soil_Hum,True,-1)
DataInterval(0,1,Hr,10)
Sample(9,ES_SF_1_1(),IEEE4)
Sample(6,ES_SF_1_2(),IEEE4)
Sample(9,ES_SF_2_1(),IEEE4)
Sample(6,ES_SF_2_2(),IEEE4)
Sample(9,ES_SF_3_1(),IEEE4)
Sample(6,ES_SF_3_2(),IEEE4)
Sample(9,ES_SF_4_1(),IEEE4)
Sample(6,ES_SF_4_2(),IEEE4)
EndTable

DataTable(Soil_Temp,True,-1)
DataInterval(0,30,Min,10)
Average(20,SoilTemp(),IEEE4,Ecal_on)
EndTable

DataTable(Soil_Gflux,True,-1)
DataInterval(0,30,Min,10)
Average(4,Vsen(),IEEE4,Ecal_on)
Average(4,phi(),IEEE4,Ecal_on)
Average(4,phi_cor(),IEEE4,Ecal_on)
Sample (4,Esen2(),FP2)
Maximum (4,Vcur(),FP2,False,False)
Sample (4,Vamp(),FP2)
Sample (4,Lambda(),FP2)
Sample (4,Error1(),Boolean)
Sample (4,Error2(),Boolean)
Sample (4,Error3(),Boolean)
EndTable

'Subroutines
Sub hfp01sc_cal
'Begin HFP01SC calibration on a fixed interval
'calibration toutes les 180 min, duree chauffe = 4 min, duree total = 20 min
If (IfTime(1,180,Min)) Then
Ecal_on = True
Move (Vsen_0(1),4,Vsen_run(1),4)
SW12_state = True
SW12(1) 'mise en route de la chauffe
EndIf
If (IfTime(5,180,Min)) Then
Move (Vsen_180(1),4,Vsen_run(1),4)
Move (Vcur_180(1),4,Vcur_run(1),4)
SW12_state = False
SW12(0) 'arret de la chauffe
EndIf
If (IfTime(20,180,Min)) Then
Move (Vsen_end(1),4,Vsen_run(1),4)
'Compute new HFP01SC calibration factors
For j = 1 To 4
Vamp(j) = ABS(((Vsen_0(j)+Vsen_end(j))/2)-Vsen_180(j))
Esen2(j) = 1000*2*Vamp(j)*(Rcur^2*Aself)/(Vcur_180(j)^2*Rself(j))
Next j
Ecal_on = False
EndIf
EndSub

'Main Program
BeginProg
'Load HFP01SC resistances of heater + wires
Rself(1) = Rself_1
Rself(2) = Rself_2
Rself(3) = Rself_3
Rself(4) = Rself_4
'Load HFP01SC sensor factory sensitivity
Esen(1) = Esen_1
Esen(2) = Esen_2
Esen(3) = Esen_3
Esen(4) = Esen_4
'Load HFP01SC factory sensitivity that change over time after each calib processes
Esen2(1) = Esen_1
Esen2(2) = Esen_2
Esen2(3) = Esen_3
Esen2(4) = Esen_4

Scan (30,Sec,3000,0)
'Humidite du sol via sondes SENTEK Enviroscan connectes en SDI12 sur C3

'SONDE Sentek 1 : -010, -020, -030, -040, -050, -060, -070, -080, -090
' -100, -110, -120, -130, -140, -150 (cm)
SDI12Recorder(ES_SF_1_1(),3,"1","M!",1,0)
SDI12Recorder(ES_SF_1_2(),3,"1","M1!",1,0)
'SONDE Sentek 2 : -010, -020, -030, -040, -050, -060, -070, -080, -090
' -100, -110, -120, -130, -140, -150 (cm)
SDI12Recorder(ES_SF_2_1(),3,"2","M!",1,0)
SDI12Recorder(ES_SF_2_2(),3,"2","M1!",1,0)
'SONDE Sentek 3 : -010, -020, -030, -040, -050, -060, -070, -080, -090
' -100, -110, -120, -130, -140, -150 (cm)
SDI12Recorder(ES_SF_3_1(),3,"3","M!",1,0)
SDI12Recorder(ES_SF_3_2(),3,"3","M1!",1,0)
'SONDE Sentek 4 : -010, -020, -030, -040, -050, -060, -070, -080, -090
' -100, -110, -120, -130, -140, -150 (cm)
SDI12Recorder(ES_SF_4_1(),3,"4","M!",1,0)
SDI12Recorder(ES_SF_4_2(),3,"4","M1!",1,0)

'Temperatures du sol

'Wiring Panel Temperature measurement PTemp
PanelTemp(PTemp,_50Hz)
'Turn AM16/32 Multiplexer On
PortSet(2,1)
Delay(0,150,mSec)
AM1632_Count=1
SubScan(0,uSec,20)
'Switch to next AM16/32 Multiplexer channel
PulsePort(1,10000)
'Type T (copper-constantan) Thermocouple measurements SoilTemp() on the AM16/32 Multiplexer:
TCDiff(SoilTemp(AM1632_Count),1,mV2_5C,1,TypeT,PTemp,True,0,_50Hz,1,0)
AM1632_Count=AM1632_Count+1
NextSubScan
'Turn AM16/32 Multiplexer Off
PortSet(2,0)
Delay(0,150,mSec)

'Flux de chaleur du sol

'Measure the HFP01SC soil heat flux plates (Vsen en mV)
VoltDiff(Vsen(1),4,mV250C,2,True,0,_50Hz,1,0)
'Apply calibration to HFP01SC soil heat flux plates
For j= 1 To 4
phi(j) = 1000*Vsen(j)/Esen(j)
phi_cor(j) = 1000*Vsen(j)/Esen2(j)
Next j
'Measure voltage accross the heater (Vcur en V)
VoltSe(Vcur(1),4,mv5000,11,True,0,_50Hz,0.001,0)
AvgRun(Vsen_run(1),4,Vsen(1),2)
AvgRun(Vcur_run(1),4,Vcur(1),2)

'Quality checks of the measurement
For j = 1 To 4
'Error1 and Error2: check for temperature dependance
If Esen2(j) < 0.8*Esen(j) Then
Error1(j) = True
ElseIf Esen2 >1.05*Esen(j) Then
Error2(j) = True
Else
Error1(j) = False AND Error2(j) = False
EndIf
'Error3: check for too much fluctuation between of Gsoil during calibration process
If Vsen_0(j) - Vsen_end(j) < 0.1*Vamp Then
Error3(j) = True
Else
Error3(j) = False
EndIf
'Error4: estimation of medium thermal conductivity
Lambda(j) = (Esen(j)-Esen2(j)) / (Elambda*Esen(j))
If Lambda(j) < 0.2 or Lambda(j) > 4 Then
Error4(j) = True
Else
Error4(j) = False
EndIf
Next j

'Call subroutine for HFP01SC calibration
Call hfp01sc_cal

'Call Data Tables and Store Data
CallTable(Soil_Hum)
CallTable(Soil_Temp)
CallTable(Soil_Gflux)

NextScan

EndProg

Log in or register to post/reply in the forum.