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.

Sequential calibration of HFP01SC plates


Otemohu Jul 19, 2019 01:52 PM

Hello,

I'm trying to sequentially start the calibration of my HFP01SC plates. To do this, I use a subroutine with different time. Here is the code.
But what is occuring is that all the plates are calibrated together at the same time. I checked again for the code and do not understand why it occurs? Did I forget something?

'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. = 64.5 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.i

'HFP01SC Variables
Dim i
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.i
Public Ecal_on(4) 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

'HFP01SC calibration variables and constantes
Dim j
Public Plate(4)
Const FreqCalib = 660 'freq 2x/day
Public TimeToCalib(4)
Const TimeToCalib_G1 = 0 'G1 en min (0h)
Const TimeToCalib_G2 = 180 'G2 en min (+3h)
Const TimeToCalib_G3 = 360 G3en min (+6h)
Const TimeToCalib_G4 = 540 'G4 en min (+9h)
Const Timeheat = 6 'heating time (min)
Const Totalcalibtime = 40 'total calib time (min)

'Subroutine de calibration des HFP01SC
Sub hfp01sc_cal(Plate As Long,TimeToCalib As Long)

If (IfTime(TimeToCalib,FreqCalib,Sec)) Then
Ecal_on(Plate) = True
Move (Vsen_0(Plate),1,Vsen_run(Plate),1)
SW12_state = True
SW12(1) 'mise en route de la chauffe
EndIf

If (IfTime(Timeheat+TimeToCalib,FreqCalib,Sec)) Then
Move (Vsen_180(Plate),1,Vsen_run(Plate),1)
Move (Vcur_180(Plate),1,Vcur_run(Plate),1)
SW12_state = False
SW12(0) 'arret de la chauffe
EndIf

If (IfTime(Totalcalibtime+TimeToCalib,FreqCalib,Sec)) Then
Move (Vsen_end(Plate),1,Vsen_run(Plate),1)
'Compute new HFP01SC calibration factors
Vamp(Plate) = ABS(((Vsen_0(Plate)+Vsen_end(Plate))/2)-Vsen_180(1))
Esen2(Plate) = 1000*2*Vamp(Plate)*(Rcur^2*Aself)/(Vcur_180(Plate)^2*Rself(Plate))
Ecal_on(Plate) = False
EndIf
EndSub

DataTable(Soil_Gflux,True,-1)
DataInterval(0,30,Sec,10)
Sample (3,Vsen(),IEEE4)
FieldNames("G_IU_1_1_1,G_IU_2_1_1,G_IU_3_1_1")
Sample (3,phi_cor(),IEEE4)
FieldNames("G_1_1_1,G_2_1_1,G_3_1_1")
Sample(3,Esen2(),FP2)
FieldNames("G_SF_1_1_1,G_SF_2_1_1,G_SF_3_1_1")
Sample(3,Ecal_on(),Boolean)
FieldNames("G_ISCAL_1_1_1,G_ISCAL_2_1_1,G_ISCAL_3_1_1")
EndTable

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
'Load HFP01SC total calibration Time and Plate
TimeToCalib(1) = TimeToCalib_G1
TimeToCalib(2) = TimeToCalib_G2
TimeToCalib(3) = TimeToCalib_G3
TimeToCalib(4) = TimeToCalib_G4
Plate(1) = 1
Plate(2) = 2
Plate(3) = 3
Plate(4) = 4

Scan(30,Sec,3000,0)


'Measure the HFP01SC soil heat flux plates (Vsen en mV)
VoltDiff(Vsen(),4,mV250C,2,True,0,_50Hz,1,0)

'Apply calibration to HFP01SC soil heat flux plates
For i= 1 To 4
phi(i) = 1000*Vsen(i)/Esen(i)
phi_cor(i) = 1000*Vsen(i)/Esen2(i)
Next i

'Measure voltage accross the heater (Vcur en V)
VoltSe(Vcur(),4,mv5000,11,True,0,_50Hz,0.001,0)
AvgRun(Vsen_run(),4,Vsen(),2)
AvgRun(Vcur_run(),4,Vcur(),2)

'Quality checks of the measurement
For i = 1 To 4

'Error1 and Error2: check for temperature dependance
If Esen2(i) < 0.8*Esen(i) Then
Error1(i) = True
ElseIf Esen2 >1.05*Esen(i) Then
Error2(i) = True
Else
Error1(i) = False AND Error2(i) = False
EndIf

'Error3: check for too much fluctuation between of Gsoil during calibration process
If Vsen_0(i) - Vsen_end(i) < 0.1*Vamp Then
Error3(i) = True
Else
Error3(i) = False
EndIf

'Error4: estimation of medium thermal conductivity
Lambda(i) = (Esen(i)-Esen2(i)) / (Elambda*Esen(i))
If Lambda(i) < 0.2 OR Lambda(i) > 4 Then
Error4(i) = True
Else
Error4(i) = False
EndIf
Next i

'Call subroutine for HFP01SC calibration
For j = 1 To 4
Call hfp01sc_cal(Plate(j),TimeToCalib(j))
Next

'Call Data Tables and Store Data
CallTable(Soil_Gflux)

NextScan
EndProg


Otemohu Jul 25, 2019 12:35 PM

Up ! please help

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