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.

Calibrate the HFP01sc every day to another time


Arno Jun 1, 2015 01:23 PM

Hello,
first sorry for my bad english skils.
I like to recalibrate the HFP01sc 4 times a day. So this should be not a problem. But the calibration interval should not happen at the same time the day after. So I like to move the calibration time one hour later on the next day. But nothing happens. The calibration never starts. What do I wrong?
Here you can see the program:
Public HFPsc
Public shf_calsc

Const HFP01SC_CAL_1 =(1000/64.7) '64.7 µV/W/m² Snr.:1479

Const OUTPUT_INTERVAL = 10 'Online mean output interval in minutes.
Const END_CAL = OUTPUT_INTERVAL-1 'End HFP01SC insitu calibration one minute before
Public CAL_INTERVAL As Long

'HFP01SC calibration variables.
Dim shf_mV
Dim shf_mV_run
Dim shf_mV_0
Dim shf_mV_180
Dim shf_mV_end
Dim V_Rf
Dim V_Rf_run
Dim V_Rf_180
Dim shf_cal_on As Boolean
Dim sw12_state As Boolean 'State of the switched 12Vdc port.

Alias HFPsc=SHFsc06
Alias shf_calsc=SHFsc06cal
Alias sw12_state=Cal_heat

Units HFPsc=W/(m^2)

'Define Data Tables
DataTable (Data1,True,-1)
DataInterval (0,10,Min,10)
Average(1,SHFsc06,IEEE4,shf_cal_on):FieldNames("SHFsc06")
Sample(1,SHFsc06cal,IEEE4)
Totalize(1,Cal_heat,FP2,False)
EndTable

'Main Program
BeginProg
'set the calibration interval before start scanning
CAL_INTERVAL=360

shf_calsc = HFP01SC_CAL_1
Scan(10,sec,1,0)
'Measure the HFP01SC soil heat flux plates.
VoltDiff (shf_mV_run,1,mV25,1,TRUE,0,_50Hz,1,0)

'Apply calibration to HFP01SC soil heat flux plates.

HFPsc = shf_mV_run*shf_calsc

'Power the HFP01SC heaters.
SW12(sw12_state)

'Measure voltage across the heater (Rf_V).
VoltDiff (V_Rf_run,1,mv5000,2,TRUE,0,_50Hz,0.001,0)
CallTable(Data1)

'If Cal_INTERVAL equal or bigger as 2x the CAL_INTERVAL then reset
If CAL_INTERVAL >= 720 Then
CAL_INTERVAL = 360
EndIf

'Begin HFP01SC calibration one minute into very CAL_INTERVAL minutes.
If ( IfTime (1,CAL_INTERVAL,Min) ) Then
shf_cal_on = TRUE
Move (shf_mV_0,1,shf_mV_run,1)
sw12_state = TRUE
EndIf

If ( IfTime (4,CAL_INTERVAL,Min) ) Then
Move (shf_mV_180,1,shf_mV_run),1)
Move (V_Rf_180,1,V_Rf_run,1)
sw12_state = FALSE
EndIf
'EndSub

'End HFP01SC calibration sequence.
If ( IfTime (9,CAL_INTERVAL,Min) ) Then
Move (shf_mV_end,1,shf_mV_run,1)
'Compute new HFP01SC calibration factors.
shf_calsc = V_Rf_180*V_Rf_180*128.7/ABS (((shf_mV_0+shf_mV_end/2)-shf_mV_180))
shf_cal_on = FALSE
'after calibration ad 60 minutes to the calibration interval
CAL_INTERVAL= CAL_INTERVAL+60
EndIf

NextScan
EndProg


Thanks for answering.


Sam Jun 14, 2015 07:31 AM

Seems like a logic error.


If you want to do the calibration 4 times per day with a roaming offset, seems to me that you would want

...
Public CAL_OFFSET
...
If IfTime ((CAL_OFFSET + 1),360,Min) Then
...
If IfTime ((CAL_OFFSET + 4),360,Min) Then
...
If IfTime ((CAL_OFFSET + 9),360,Min) Then
...
'restrict CAL_OFFSET to value between 0 and 359
CAL_OFFSET = (CAL_OFFSET + 60) MOD 360


Otemohu Sep 27, 2019 12:36 PM

Hi,

My issue is almost similar. I want to recalibrate four HFP01SC two times a day. The interval between calibration is 11 hours.
I tried using the folowing subroutine for calibration:

 

 Sub hfp01sc_cal(Plate As Long,TimeToCalib As Long)
    'Begin HFP01SC calibration on a fixed interval for G_x_1_1 (every 660 minutes)
    
    If (IfTime(TimeToCalib,FreqCalib,Min)) Then
      Ecal_on(Plate) = True : Bool(Plate) = 1
      Move (Vsen_0(Plate),1,Vsen_run(Plate),1)
      If Plate = 1 Then SW12(1)	Else 'heat ON
      If Plate = 2 Then PortSet(3,1) Else	
      If Plate = 3 Then PortSet(4,1) Else
      If Plate = 4 Then PortSet(5,1)
    EndIf
    
    If (IfTime(Timeheat+TimeToCalib,FreqCalib,Min)) Then
      Move (Vsen_180(Plate),1,Vsen_run(Plate),1)
      Move (Vcur_180(Plate),1,Vcur_run(Plate),1)
      If Plate = 1 Then SW12(0)	Else 'heat OFF
      If Plate = 2 Then PortSet(3,0) Else	
      If Plate = 3 Then PortSet(4,0) Else
      If Plate = 4 Then PortSet(5,0)
    EndIf
    
    If (IfTime(Totalcalibtime+TimeToCalib,FreqCalib,Min)) 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(Plate))
      Esen2(Plate) = 1000*2*Vamp(Plate)*(Rcur^2*Aself)/(Vcur_180(Plate)^2*Rself(Plate))
      Ecal_on(Plate) = False : Bool(Plate) = 0
    EndIf    
  EndSub

 

This subroutine is called every 30 seconds (scan rate) with 

For i = 1 To 4
      Call hfp01sc_cal(Plate(i),TimeToCalib(i))
    Next 

 Variables are declared at the beginning of the 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  		
    'Load HFP01SC total calibration time and plates
      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)

 

Unfortunately, the calculation of the new calibration factors does not work and I do not know why?

So I just tried this subroutine: 

 

 

'Subroutine de calibration des HFP01SC
   Sub hfp01sc_cal(Plate As Long)
    'Begin HFP01SC calibration on a fixed interval for G_x_1_1     
    Const FreqCalib = 660       'freq de calibration des plaques en min (2x/jour soit ttes les 11h)
    Const Timeheat = 6          'duree chauffe = 6 min
    Const Totalcalibtime = 40   'duree total = 40 min
    'decalage des calibrations de 3 heures avec 0 min G1, 180min pour G2, 360min pour G3 et 540min pour G4
    Select Case Plate
    Case 1
      If (IfTime(0,FreqCalib,Min)) Then
        Ecal_on(1) = True : Bool(1) = 1
        Move (Vsen_0(1),1,Vsen_run(1),1)
        SW12(1) 'mise en route de la chauffe
      EndIf      
      If (IfTime(Timeheat,FreqCalib,Min)) Then
        Move (Vsen_180(1),1,Vsen_run(1),1)
        Move (Vcur_180(1),1,Vcur_run(1),1)
        SW12(0)	'arret de la chauffe     
      EndIf      
      If (IfTime(Totalcalibtime,FreqCalib,Min)) Then
        Move (Vsen_end(1),1,Vsen_run(1),1)
        'Compute new HFP01SC calibration factors
        Vamp(1) = ABS(((Vsen_0(1)+Vsen_end(1))/2)-Vsen_180(1))
        Esen2(1) = 1000*2*Vamp(1)*(Rcur^2*Aself)/(Vcur_180(1)^2*Rself(1))
        Ecal_on(1) = False : Bool(1) = 0
      EndIf 
      
    Case 2
      If (IfTime(180,FreqCalib,Min)) Then
        Ecal_on(2) = True : Bool(2) = 1
        Move (Vsen_0(2),1,Vsen_run(2),1)
        PortSet(3,1) 'mise en route de la chauffe
      EndIf      
      If (IfTime(180+Timeheat,FreqCalib,Min)) Then
        Move (Vsen_180(2),1,Vsen_run(2),1)
        Move (Vcur_180(2),1,Vcur_run(2),1)
        PortSet(3,0)'arret de la chauffe     
      EndIf      
      If (IfTime(180+Totalcalibtime,FreqCalib,Min)) Then
        Move (Vsen_end(2),1,Vsen_run(2),1)
        'Compute new HFP01SC calibration factors
        Vamp(2) = ABS(((Vsen_0(2)+Vsen_end(2))/2)-Vsen_180(2))
        Esen2(2) = 1000*2*Vamp(2)*(Rcur^2*Aself)/(Vcur_180(2)^2*Rself(2))
        Ecal_on(2) = False : Bool(2) = 0
      EndIf
    
    Case 3
      If (IfTime(360,FreqCalib,Min)) Then
        Ecal_on(3) = True : Bool(3) = 1
        Move (Vsen_0(3),1,Vsen_run(3),1)
        PortSet(4,1)  'mise en route de la chauffe
      EndIf      
      If (IfTime(360+Timeheat,FreqCalib,Min)) Then
        Move (Vsen_180(3),1,Vsen_run(3),1)
        Move (Vcur_180(3),1,Vcur_run(3),1)
        PortSet(4,0)	'arret de la chauffe     
      EndIf      
      If (IfTime(360+Totalcalibtime,FreqCalib,Min)) Then
        Move (Vsen_end(3),1,Vsen_run(3),1)
        'Compute new HFP01SC calibration factors
        Vamp(3) = ABS(((Vsen_0(3)+Vsen_end(3))/2)-Vsen_180(3))
        Esen2(3) = 1000*2*Vamp(3)*(Rcur^2*Aself)/(Vcur_180(3)^2*Rself(3))
        Ecal_on(3) = False : Bool(3) = 0
      EndIf
    
    Case 4
      If (IfTime(540,FreqCalib,Min)) Then
        Ecal_on(4) = True : Bool(4) = 1
        Move (Vsen_0(4),1,Vsen_run(4),1)
        PortSet(5,1)	'mise en route de la chauffe
      EndIf      
      If (IfTime(540+Timeheat,FreqCalib,Min)) Then
        Move (Vsen_180(4),1,Vsen_run(4),1)
        Move (Vcur_180(4),1,Vcur_run(4),1)
        PortSet(5,0)	'arret de la chauffe     
      EndIf      
      If (IfTime(540+Totalcalibtime,FreqCalib,Min)) Then
        Move (Vsen_end(4),1,Vsen_run(4),1)
        'Compute new HFP01SC calibration factors
        Vamp(4) = ABS(((Vsen_0(4)+Vsen_end(4))/2)-Vsen_180(4))
        Esen2(4) = 1000*2*Vamp(4)*(Rcur^2*Aself)/(Vcur_180(4)^2*Rself(4))
        Ecal_on(4) = False : Bool(4) = 0
      EndIf      
     EndSelect 
  EndSub

 

This subroutine gives the same result so I do not know what happens.

If someone have an idea, it will we very welcome.

Best regards,


Otemohu Oct 4, 2019 01:55 PM

Hello,

Does anyone have a suggestion to do concerning my script ? I do not know how to manage this.

Best,


Otemohu Oct 6, 2019 09:23 AM

Hi again,

I would be very happy if anyone could help me.

Best


Otemohu Oct 10, 2019 08:39 AM

There is no people in Campbell Sci able to help me ?


Terri Oct 11, 2019 06:02 PM

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.