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.

No able to read IR120 sensors after having change a CR1000 program


Otemohu Mar 28, 2024 10:20 PM

Hi,

I had a CR1000 program that ran perfectly with several sensors ( an air pressure sensor, a thermohygrometer, two raingauges three IR120 surface thermal camera).

I needed to add four radiations sensors with a scanrate (5sec) faster than the initial scanrate (30sec). So I created another scanrate (5 sec) and putted the slower one (30 sec) in a Slowsequence except raingauges measurements instructions since we cannot put pulse measurements in a slow sequence.

All measurements are going well except the IR120 for which I get NANS.

Here is the CR Basic code of the CR1000 datalogger (OSv31) 

'Variables and Table definitions
  ' Time and filename variables
  Public Outstat As Boolean
  Public Outstat2 As Boolean
  Public Lastfilename As String *50
  Public Lastfilename2 As String *50
  Public Lastfiletime As String *50
  Public Lastfiletime2 As String *50
  Public Newfilename  As String *50
  Public Newfilename2  As String *50
  Public timearray(7)  As String
  Public timearray2(7)  As String
  Public Desiredtime  As String *50 
  Public Desiredtime2 As String *50  
  
  'Vaisala HMD 30 YB variables
  Public HMD_TempAir                             : Units HMD_TempAir = deg_C
  Public HMD_RHair                               : Units HMD_RHair = %
  
  'Rainfall variables
  Public RainPM3029                             : Units RainPM3029 = mm
  Const  RainPM3029_mult = 0.2
  Public RainARG100                             : Units RainARG100 = mm
  Const  RainARG100_mult = 0.20354

  'Young 61302V variables 
  Const  Elevation  = 140     '105 metres au sol + 35 metres pour la tour                         
  Dim    BP_Poll As String,CR2 As String
  Dim    BP_raw As String
  Dim    BP_string As String  
  Public Pression                                : Units Pression = hPa 
  Public PressionkPa                             : Units PressionkPa = kPa 
    
  'IR120 variables et recuperation de  TempAir temp du profil a 37m
  Dim    Coeff_A(3), Coeff_B(3), Coeff_C(3), Coeff_X(3), Coeff_Y(3), Coeff_Z(3)
  Const  Emissivity = 0.94   'Emissivity of forest surface 
  Const  Film       = 0.79   'film IR transmission (camera window)
  Dim    IR120i
  Public    BR_Res(3)           'The Measured Bridge Resistance
  Public    IRSensor_Resis(3)   'Thermistor Resistance
  Public IRSensorCan_Temp(3) 'Thermistor Temperature in Celsius
  Public    IRSensor_Volt(3)    'The Measured Thermopile Voltage
  Public    IRSensor_Volt_TC(3) 'The Measured Thermopile Voltage – Temp Compensated
  Public    IRSensor_E(3)       'Energy Difference
  Public    IRSensor_T4(3)      'Black body surface temp to the power 4
  Public    IRSensor_T(3)       'Black body surface temp in Kelvin – Uncorrected
  Public    IRTFilm_T4(3)       'Temp after the film correction to the power 4
  Public IRTemp(3)           'Corrected Surface Temperatures in Celsius
  Alias  IRTemp(1) = IRTemp_E1178                 : Units IRTemp_E1178 = deg_C
  Alias  IRTemp(2) = IRTemp_E1179                 : Units IRTemp_E1179 = deg_C
  Alias  IRTemp(3) = IRTemp_E1180                 : Units IRTemp_E1180 = deg_C
  Dim TCPOpen_var
  Public ResultCode
  Public TempAir_37m                              : Units TempAir_37m  = deg_C
  
  'Thygan VTP37  variables
  Public stringDewpoint As String *8
  Public rawdataDewpoint As String *65
  Const  Comportdewpoint=Com2
  Const  CR1=CHR(13) 'caracteres retour chariot nouvelle ligne
  Public VTP37_TempAir                            : Units VTP37_TempAir   = deg_C
  Public VTP37_DewPoint                           : Units VTP37_DewPoint  = deg_C
  Public VTP37_RHair                              : Units VTP37_RHair     = %
  Public VTP37_HouseTemp                          : Units VTP37_HouseTemp = deg_C
  
  'Thermocouple profil 37m variable
  Public TempFiltre37m                            : Units TempFiltre37m   = deg_C
  Public Ptemp
  
  'Public Variables for LI190 PAR sensors
  Dim PPFD_BC_mult(4)
  Const   LI190_1_sens = 242.05'242.04 'sn 121825 
  Const   LI190_2_sens = 237.20'237.32 'sn 121826  
  Const   LI190_3_sens = 247.11'247.10 'sn 121827  
  Const   LI190_4_sens = 255.89'255.74 'sn 121828
  Dim i
  Public PPFD_BC_IU(4)                          : Units PPFD_BC_IU = mV 
  Alias PPFD_BC_IU(1)   = PPFD_BC_IN_IU_1_1_3
  Alias PPFD_BC_IU(2)   = PPFD_BC_OUT_IU_1_1_2
  Alias PPFD_BC_IU(3)   = PPFD_BC_IN_IU_1_1_4
  Alias PPFD_BC_IU(4)   = PPFD_BC_OUT_IU_1_1_3
  Public PPFD_BC(4)                             : Units PPFD_BC = micromol m-2 s-1
  Alias PPFD_BC(1)   = PPFD_BC_IN_1_1_3
  Alias PPFD_BC(2)   = PPFD_BC_OUT_1_1_2
  Alias PPFD_BC(3)   = PPFD_BC_IN_1_1_4
  Alias PPFD_BC(4)   = PPFD_BC_OUT_1_1_3
  
  'Definition of DataTables
  DataTable(FRFonTS01,True,-1)
	  TableFile ("USR:FRFonTS01.dat",11,7,0,1,Day,Outstat,Lastfilename)
	  Sample (1,TimeStamps,String)
	  Sample (1,VTP37_TempAir,IEEE4)
	  FieldNames("TA_1_1_2")
	  Sample (1,VTP37_RHair,IEEE4)
	  FieldNames("RH_1_1_2")	  
	  Sample (1,PressionkPa, IEEE4)
	  FieldNames("PA_1_1_1")
	  Totalize(1,RainARG100,IEEE4,False)
	  FieldNames("P_2_1_1")
	  Totalize(1,RainPM3029,IEEE4,False)
	  FieldNames("P_2_1_2")
	EndTable  
	
  DataTable(FRFonTS02,True,-1)
	  TableFile ("USR:FRFonTS02.dat",11,7,0,1,Day,Outstat2,Lastfilename2)
	  Sample (1,TimeStamps,String)
	  Sample (4,PPFD_BC_IU(),IEEE4)	  
	  Sample (4,PPFD_BC(),IEEE4)
	EndTable 
	
  DataTable(PPFD_GBOV,True,-1)
	  DataInterval(0,30,Min,10)
	  Average(4,PPFD_BC(),IEEE4,False)
  EndTable 
	  
  DataTable(Meteo,True,-1)
    DataInterval(0,30,Min,10)
	  Average (1,HMD_RHair,IEEE4,False)   
    Average (1,HMD_TempAir,IEEE4,False)
    Average (1,VTP37_TempAir,IEEE4, False)
    Average (1,VTP37_DewPoint,IEEE4, False)
    Average (1,VTP37_RHair,IEEE4, False)
    Average (1,VTP37_HouseTemp,IEEE4, False)  
    Sample  (1,Pression,IEEE4)
    Totalize(1,RainPM3029,IEEE4,False)
    Totalize(1,RainARG100,IEEE4,False)
  EndTable 
  
  DataTable(TempSurf,True,-1)
	  DataInterval(0,30,Min,10)
	  Average(1,IRTemp_E1178,IEEE4,False)   
    Average(1,IRTemp_E1179,IEEE4,False)
    Average(1,IRTemp_E1180,IEEE4,False)
  EndTable
  
'SubRoutines
Sub ICOSTimeFormat
  Public TimeStamps As String *17
  Public rTime(9)
  Public YYYY As String *4
  Public MM As String *2
  Public DD As String *2
  Public hh As String *2
  Public mn As String *2
  Public ss As String *2    
  RealTime(rTime)
  YYYY = rTime(1)
  'forcage du zero devant l'unite a un chiffre (ex quand 8 --> 08)
  If rTime(2)<10 Then MM ="0"&rTime(2) Else MM = rTime(2)
  If rTime(3)<10 Then DD ="0"&rTime(3) Else DD = rTime(3)
  If rTime(4)<10 Then hh ="0"&rTime(4) Else hh = rTime(4)
  If rTime(5)<10 Then mn ="0"&rTime(5) Else mn = rTime(5)
  If rTime(6)<10 Then ss ="0"&rTime(6) Else ss = rTime(6)
  TimeStamps = YYYY&MM&DD&hh&mn&ss
EndSub

'Subroutine Aquisition dewpoint
  Sub Ask_ThyganVTP37
      Public SplitResultDewpoint(9) As String *(13)
      SerialOpen (Comportdewpoint,2400,0,0,100)
     'demande d'envoi d'une mesure
      SerialOut (Comportdewpoint,stringDewpoint,CR1,0,100)
      'recuperation de la mesure
      SerialIn (rawdataDewpoint,Comportdewpoint,1000,0,100)   
      'Extraction informations temperature AIR, DEWpoint mesure
      SplitStr (SplitResultDewpoint(1),rawdataDewpoint,",",9,5)
      'conversion string  en valeur numeric plus divison 100
      SplitStr(VTP37_TempAir,SplitResultDewpoint(3),"",1,0)  
      VTP37_TempAir=VTP37_TempAir/100.00
      'conversion string  en valeur numeric plus divison 100
      SplitStr(VTP37_DewPoint,SplitResultDewpoint(4),"",1,0)
      VTP37_DewPoint=VTP37_DewPoint/100.00
      'conversion string  en valeur numeric plus divison 100
      SplitStr(VTP37_RHair,SplitResultDewpoint(5),"",1,0)
      VTP37_RHair=VTP37_RHair/100.00'conversion string  en valeur numeric plus divison 100
      'conversion string  en valeur numeric plus divison 100
      SplitStr(VTP37_HouseTemp,SplitResultDewpoint(6),"",1,0)
      VTP37_HouseTemp=VTP37_HouseTemp/100.00
     SerialFlush (Comportdewpoint)
     SerialClose (Comportdewpoint)
  EndSub
  
  SequentialMode
  
'Main Program
  BeginProg 

  SetStatus("USRDriveSize",1500000)
     
  'Load calibration coefficient for IR120 sn E1178
  Coeff_A(1) = 9.395021E-4
  Coeff_B(1) = 2.196992E-4
  Coeff_C(1) = 1.373611E-7
  Coeff_X(1) = 8.146919E-6
  Coeff_Y(1) = 3.686217E-1
  Coeff_Z(1) = 3.810169E-1
  'Load calibration coefficient for IR120 sn E1179
  Coeff_A(2) = 9.471630E-4     
  Coeff_B(2) = 2.187062E-4
  Coeff_C(2) = 1.432039E-7
  Coeff_X(2) = 9.616962E-6
  Coeff_Y(2) = 3.663519E-1
  Coeff_Z(2) = 2.592757E-1
  'Load calibration coefficient for IR120 sn E1180
  Coeff_A(3) = 9.481884E-4
  Coeff_B(3) = 2.181001E-4
  Coeff_C(3) = 1.390689E-7
  Coeff_X(3) = 7.853477E-6
  Coeff_Y(3) = 3.653387E-1
  Coeff_Z(3) = 4.211229E-1
  
  'Thygan VTP37 initialisation
  stringDewpoint="A98Q1308"+CR1
  
  'Load the multipliers values for the LI190 sensors
  PPFD_BC_mult(1)  = LI190_1_sens
  PPFD_BC_mult(2)  = LI190_2_sens
  PPFD_BC_mult(3)  = LI190_3_sens
  PPFD_BC_mult(4)  = LI190_4_sens
   
  Scan(5,Sec,1,0)
    'Mesure des deux capteurs sur le bornier de la CR310 a partir de la DIFF2
	    VoltDiff(PPFD_BC_IU(1),2,mV25,6,True,0,50,1,0)
      VoltSe(PPFD_BC_IU(3),2,mV25,15,True,0,50,1,0)      
      For i = 1 To 4
         PPFD_BC(i) = PPFD_BC_IU(i)*PPFD_BC_mult(i) + 0
      Next
      
  'Precis Mecanique 3029/2 WMO rainfall sensor and ARG100 sn86224 raingauge
      PulseCount(RainPM3029,1,1,2,0,RainPM3029_mult,0) 
      PulseCount(RainARG100,1,2,2,0,RainARG100_mult,0)
  
  'Configuration du TimeStamps selon ICOS format YYYYMMDDhhmmss
      Call ICOSTimeFormat 
         
  'Appel des tables
      CallTable(FRFonTS02)
      CallTable(Meteo)
      CallTable(PPFD_GBOV)
      
  'File timing		
      If Outstat2 Then 
        Lastfiletime2 = FRFonTS02.Timestamp(3,5)
        SplitStr(timearray2(),Lastfiletime2,"",6,0)
        Desiredtime2 = timearray2(3)&timearray2(2)&timearray2(1)
        Newfilename2 = "USR:FR-Fon_BM_"+Desiredtime2+"_L03_F02.dat"
        FileRename(Lastfilename2,Newfilename2)     
      EndIf

  NextScan
 
  SlowSequence

  Scan(30,Sec,1,0)
 
    'Vaisala HMD 30 YB humidity and temperature sensor
      VoltSe(HMD_RHair,1,mV2500,1,False,0,_50Hz,0.1,0)
      VoltSe(HMD_TempAir,1,mV2500,2,False,0,_50Hz,0.1,-20)
      
    '61302V barometric sensor
      '*** 61302V Sensor Polling Variables ***
        'Configure ComPort 1 for use with the 61302V
        SerialOpen (Com1,9600,0,0,1000)
        BP_Poll = "M0!"
        CR2 = CHR(13)
        'Poll 61302V Sensor
        SerialFlush (Com1) 'Clear buffer before polling for a new measurement
        SerialOut (Com1,BP_Poll,"",0,100) 'Send sensor poll command
        SerialIn (BP_raw,Com1,100,CR2,100) 'Receive sensor response
        SplitStr (BP_string,BP_raw,"",1,0) 'Parse out BP value
        Pression = BP_string 'Convert ASCII to numeric value
        PressionkPa = Pression/10
      
    'IR120 radiothermometers (x3)    
      'Measure the IR120 Body Temperature
      '----------------------------------
      'Measure the thermistor using a half bridge by applying a negative
      'excitation voltage of -2.5V
      'Note that switching the bridge excitation is set to FALSE.
      'no settling time because short cable
      BrHalf(BR_Res(1),1,mV2500,3,Vx1,1,-2500,False,0,_50Hz,1,0)
      BrHalf(BR_Res(2),1,mV2500,5,Vx1,1,-2500,False,0,_50Hz,1,0)
      BrHalf(BR_Res(3),1,mV2500,7,Vx1,1,-2500,False,0,_50Hz,1,0)
      'Measure the IR120 Infrared Temperature
      '--------------------------------------
      'Measure the infrared temperature using a half bridge instruction
      'Note that switching the bridge excitation is set to FALSE.
      'Use 75 ms settling time, to allow amplified signal to settle
      'The multiplier is used to correct the ratiometric output to mV
      ExciteV(Vx1,2500,0)
      Delay(0,75,mSec)
      BrHalf(IRSensor_Volt(1),1,mV250,4,Vx1,1,2500,False,0,_50Hz,2500,0)
      ExciteV(Vx1,2500,0)
      Delay(0,75,mSec)
      BrHalf(IRSensor_Volt(2),1,mV250,6,Vx1,1,2500,False,0,_50Hz,2500,0)
      ExciteV(Vx1,2500,0)
      Delay(0,75,mSec)    
      BrHalf(IRSensor_Volt(3),1,mV250,8,Vx1,1,2500,False,0,_50Hz,2500,0)
      TCPOpen_var = TCPOpen("192.168.154.14",6785,0)
      GetVariables (ResultCode,TCPOpen_var,0,4,0,0,"Public","TempAir_37m",TempAir_37m,1)
      For IR120i = 1 To 3 Step 1
        'Multiply the ratio of measured voltage by a constant appropriate to the thermistor
        IRSensor_Resis(IR120i) = 77020 * (BR_Res(IR120i) / (1 - BR_Res(IR120i)))
        'Using Steinhart-hart, apply the calibration coefficients to arrive at a body temperature in Celsius
        IRSensorCan_Temp(IR120i) = 1 / (Coeff_A(IR120i) + Coeff_B(IR120i) * LN(IRSensor_Resis(IR120i)) + Coeff_C(IR120i) * (LN(IRSensor_Resis(IR120i)))^3) - 273.15
        'Apply temperature compensation
        IRSensor_Volt_TC(IR120i) = IRSensor_Volt(IR120i) * 1.0004 ^(IRSensorCan_Temp(IR120i) - 25)
        'Apply coefficients
        IRSensor_E(IR120i) = Coeff_X(IR120i) * IRSensor_Volt_TC(IR120i)^2 + Coeff_Y(IR120i) * IRSensor_Volt_TC(IR120i) + Coeff_Z(IR120i)
        'Add difference to absolute energy from the sensor body
        IRSensor_T4(IR120i) = (IRSensor_E(IR120i) / 5.67E-8) + ((IRSensorCan_Temp(IR120i) + 273.15)^4)
        'Resolve for remote surface temperature in Kelvin – NOTE this is the 'UNCORRECTED value
        IRSensor_T(IR120i) = (IRSensor_T4^0.25) - 273.15
        'Correct for the effects of the high infrared transmission film
        IRTFilm_T4(IR120i) = ((IRSensor_T4(IR120i) - ((TempAir_37m + 273.15)^4 * (1 - Film))) / Film)
        'Combine with the corrrection for Emissivity and Convert to Celsius
        IRTemp(IR120i) = ((IRTFilm_T4(IR120i)-((TempAir_37m + 273.15)^4*(1-Emissivity)))/Emissivity)^0.25 - 273.15
      Next
      
    'Thygan VTP37 dew point Thermo-Hygrometer     
      If IfTime (0,1,Min) Then Ask_ThyganVTP37
      
    'Thermocouple type T du filtre profil 37m
    PanelTemp(Ptemp,_50Hz)
    TCDiff(TempFiltre37m,1,mV25C,5,TypeT,Ptemp,True ,0,_50Hz,1.0,0)
    
    'Configuration du Timestamps selon ICOS format YYYYMMDDhhmmss
    Call ICOSTimeFormat
      
    'Call Data Tables and Store Data
    CallTable(FRFonTS01)
    CallTable(Meteo)
    CallTable(TempSurf)
    
    'File timing		
    If Outstat Then 
      Lastfiletime = FRFonTS01.Timestamp(3,5)      
      SplitStr(timearray(),Lastfiletime,"",6,0)
      Desiredtime = timearray(3)&timearray(2)&timearray(1)
      Newfilename = "USR:FR-Fon_BM_"+Desiredtime+"_L03_F01.dat"
      FileRename(Lastfilename,Newfilename)
    EndIf
      
  NextScan
  
EndProg

 and the first one (original one), before adding the radiation sensors :

 

'Variables and Table definitions
  ' Time and filename variables
  Public Outstat As Boolean
  Public Outstat2 As Boolean
  Public Lastfilename As String *50
  Public Lastfilename2 As String *50
  Public Lastfiletime As String *50
  Public Lastfiletime2 As String *50
  Public Newfilename  As String *50
  Public Newfilename2  As String *50
  Public timearray(7)  As String
  Public timearray2(7)  As String
  Public Desiredtime  As String *50 
  Public Desiredtime2 As String *50  
  
  'Vaisala HMD 30 YB variables
  Public HMD_TempAir                             : Units HMD_TempAir = deg_C
  Public HMD_RHair                               : Units HMD_RHair = %
  
  'Rainfall variables
  Public RainPM3029                             : Units RainPM3029 = mm
  Const  RainPM3029_mult = 0.2
  Public RainARG100                             : Units RainARG100 = mm
  Const  RainARG100_mult = 0.20354

  'Young 61302V variables 
  Const  Elevation  = 140     '105 metres au sol + 35 metres pour la tour                         
  Dim    BP_Poll As String,CR2 As String
  Dim    BP_raw As String
  Dim    BP_string As String  
  Public Pression                                : Units Pression = hPa 
  Public PressionkPa                             : Units PressionkPa = kPa 
    
  'IR120 variables et recuperation de  TempAir temp du profil a 37m
  Dim    Coeff_A(3), Coeff_B(3), Coeff_C(3), Coeff_X(3), Coeff_Y(3), Coeff_Z(3)
  Const  Emissivity = 0.94   'Emissivity of forest surface 
  Const  Film       = 0.79   'film IR transmission (camera window)
  Dim    IR120i
  Public    BR_Res(3)           'The Measured Bridge Resistance
  Public    IRSensor_Resis(3)   'Thermistor Resistance
  Public IRSensorCan_Temp(3) 'Thermistor Temperature in Celsius
  Public    IRSensor_Volt(3)    'The Measured Thermopile Voltage
  Public    IRSensor_Volt_TC(3) 'The Measured Thermopile Voltage – Temp Compensated
  Public    IRSensor_E(3)       'Energy Difference
  Public    IRSensor_T4(3)      'Black body surface temp to the power 4
  Public    IRSensor_T(3)       'Black body surface temp in Kelvin – Uncorrected
  Public    IRTFilm_T4(3)       'Temp after the film correction to the power 4
  Public IRTemp(3)           'Corrected Surface Temperatures in Celsius
  Alias  IRTemp(1) = IRTemp_E1178                 : Units IRTemp_E1178 = deg_C
  Alias  IRTemp(2) = IRTemp_E1179                 : Units IRTemp_E1179 = deg_C
  Alias  IRTemp(3) = IRTemp_E1180                 : Units IRTemp_E1180 = deg_C
  Dim TCPOpen_var
  Public ResultCode
  Public TempAir_37m                              : Units TempAir_37m  = deg_C
  
  'Thygan VTP37  variables
  Public stringDewpoint As String *8
  Public rawdataDewpoint As String *65
  Const  Comportdewpoint=Com2
  Const  CR1=CHR(13) 'caracteres retour chariot nouvelle ligne
  Public VTP37_TempAir                            : Units VTP37_TempAir   = deg_C
  Public VTP37_DewPoint                           : Units VTP37_DewPoint  = deg_C
  Public VTP37_RHair                              : Units VTP37_RHair     = %
  Public VTP37_HouseTemp                          : Units VTP37_HouseTemp = deg_C
  
  'Thermocouple profil 37m variable
  Public TempFiltre37m                            : Units TempFiltre37m   = deg_C
  Public Ptemp
  
  'Public Variables for LI190 PAR sensors
  Dim PPFD_BC_mult(4)
  Const   LI190_1_sens = 242.05'242.04 'sn 121825 
  Const   LI190_2_sens = 237.20'237.32 'sn 121826  
  Const   LI190_3_sens = 247.11'247.10 'sn 121827  
  Const   LI190_4_sens = 255.89'255.74 'sn 121828
  Dim i
  Public PPFD_BC_IU(4)                          : Units PPFD_BC_IU = mV 
  Alias PPFD_BC_IU(1)   = PPFD_BC_IN_IU_1_1_3
  Alias PPFD_BC_IU(2)   = PPFD_BC_OUT_IU_1_1_2
  Alias PPFD_BC_IU(3)   = PPFD_BC_IN_IU_1_1_4
  Alias PPFD_BC_IU(4)   = PPFD_BC_OUT_IU_1_1_3
  Public PPFD_BC(4)                             : Units PPFD_BC = micromol m-2 s-1
  Alias PPFD_BC(1)   = PPFD_BC_IN_1_1_3
  Alias PPFD_BC(2)   = PPFD_BC_OUT_1_1_2
  Alias PPFD_BC(3)   = PPFD_BC_IN_1_1_4
  Alias PPFD_BC(4)   = PPFD_BC_OUT_1_1_3
  
  'Definition of DataTables
  DataTable(FRFonTS01,True,-1)
	  TableFile ("USR:FRFonTS01.dat",11,7,0,1,Day,Outstat,Lastfilename)
	  Sample (1,TimeStamps,String)
	  Sample (1,VTP37_TempAir,IEEE4)
	  FieldNames("TA_1_1_2")
	  Sample (1,VTP37_RHair,IEEE4)
	  FieldNames("RH_1_1_2")	  
	  Sample (1,PressionkPa, IEEE4)
	  FieldNames("PA_1_1_1")
	  Totalize(1,RainARG100,IEEE4,False)
	  FieldNames("P_2_1_1")
	  Totalize(1,RainPM3029,IEEE4,False)
	  FieldNames("P_2_1_2")
	EndTable  
	
  DataTable(FRFonTS02,True,-1)
	  TableFile ("USR:FRFonTS02.dat",11,7,0,1,Day,Outstat2,Lastfilename2)
	  Sample (1,TimeStamps,String)
	  Sample (4,PPFD_BC_IU(),IEEE4)	  
	  Sample (4,PPFD_BC(),IEEE4)
	EndTable 
	
  DataTable(PPFD_GBOV,True,-1)
	  DataInterval(0,30,Min,10)
	  Average(4,PPFD_BC(),IEEE4,False)
  EndTable 
	  
  DataTable(Meteo,True,-1)
    DataInterval(0,30,Min,10)
	  Average (1,HMD_RHair,IEEE4,False)   
    Average (1,HMD_TempAir,IEEE4,False)
    Average (1,VTP37_TempAir,IEEE4, False)
    Average (1,VTP37_DewPoint,IEEE4, False)
    Average (1,VTP37_RHair,IEEE4, False)
    Average (1,VTP37_HouseTemp,IEEE4, False)  
    Sample  (1,Pression,IEEE4)
    Totalize(1,RainPM3029,IEEE4,False)
    Totalize(1,RainARG100,IEEE4,False)
  EndTable 
  
  DataTable(TempSurf,True,-1)
	  DataInterval(0,30,Min,10)
	  Average(1,IRTemp_E1178,IEEE4,False)   
    Average(1,IRTemp_E1179,IEEE4,False)
    Average(1,IRTemp_E1180,IEEE4,False)
  EndTable
  
'SubRoutines
Sub ICOSTimeFormat
  Public TimeStamps As String *17
  Public rTime(9)
  Public YYYY As String *4
  Public MM As String *2
  Public DD As String *2
  Public hh As String *2
  Public mn As String *2
  Public ss As String *2    
  RealTime(rTime)
  YYYY = rTime(1)
  'forcage du zero devant l'unite a un chiffre (ex quand 8 --> 08)
  If rTime(2)<10 Then MM ="0"&rTime(2) Else MM = rTime(2)
  If rTime(3)<10 Then DD ="0"&rTime(3) Else DD = rTime(3)
  If rTime(4)<10 Then hh ="0"&rTime(4) Else hh = rTime(4)
  If rTime(5)<10 Then mn ="0"&rTime(5) Else mn = rTime(5)
  If rTime(6)<10 Then ss ="0"&rTime(6) Else ss = rTime(6)
  TimeStamps = YYYY&MM&DD&hh&mn&ss
EndSub

'Subroutine Aquisition dewpoint
  Sub Ask_ThyganVTP37
      Public SplitResultDewpoint(9) As String *(13)
      SerialOpen (Comportdewpoint,2400,0,0,100)
     'demande d'envoi d'une mesure
      SerialOut (Comportdewpoint,stringDewpoint,CR1,0,100)
      'recuperation de la mesure
      SerialIn (rawdataDewpoint,Comportdewpoint,1000,0,100)   
      'Extraction informations temperature AIR, DEWpoint mesure
      SplitStr (SplitResultDewpoint(1),rawdataDewpoint,",",9,5)
      'conversion string  en valeur numeric plus divison 100
      SplitStr(VTP37_TempAir,SplitResultDewpoint(3),"",1,0)  
      VTP37_TempAir=VTP37_TempAir/100.00
      'conversion string  en valeur numeric plus divison 100
      SplitStr(VTP37_DewPoint,SplitResultDewpoint(4),"",1,0)
      VTP37_DewPoint=VTP37_DewPoint/100.00
      'conversion string  en valeur numeric plus divison 100
      SplitStr(VTP37_RHair,SplitResultDewpoint(5),"",1,0)
      VTP37_RHair=VTP37_RHair/100.00'conversion string  en valeur numeric plus divison 100
      'conversion string  en valeur numeric plus divison 100
      SplitStr(VTP37_HouseTemp,SplitResultDewpoint(6),"",1,0)
      VTP37_HouseTemp=VTP37_HouseTemp/100.00
     SerialFlush (Comportdewpoint)
     SerialClose (Comportdewpoint)
  EndSub
  
  SequentialMode
  
'Main Program
  BeginProg 

  SetStatus("USRDriveSize",1500000)
     
  'Load calibration coefficient for IR120 sn E1178
  Coeff_A(1) = 9.395021E-4
  Coeff_B(1) = 2.196992E-4
  Coeff_C(1) = 1.373611E-7
  Coeff_X(1) = 8.146919E-6
  Coeff_Y(1) = 3.686217E-1
  Coeff_Z(1) = 3.810169E-1
  'Load calibration coefficient for IR120 sn E1179
  Coeff_A(2) = 9.471630E-4     
  Coeff_B(2) = 2.187062E-4
  Coeff_C(2) = 1.432039E-7
  Coeff_X(2) = 9.616962E-6
  Coeff_Y(2) = 3.663519E-1
  Coeff_Z(2) = 2.592757E-1
  'Load calibration coefficient for IR120 sn E1180
  Coeff_A(3) = 9.481884E-4
  Coeff_B(3) = 2.181001E-4
  Coeff_C(3) = 1.390689E-7
  Coeff_X(3) = 7.853477E-6
  Coeff_Y(3) = 3.653387E-1
  Coeff_Z(3) = 4.211229E-1
  
  'Thygan VTP37 initialisation
  stringDewpoint="A98Q1308"+CR1
  
  'Load the multipliers values for the LI190 sensors
  PPFD_BC_mult(1)  = LI190_1_sens
  PPFD_BC_mult(2)  = LI190_2_sens
  PPFD_BC_mult(3)  = LI190_3_sens
  PPFD_BC_mult(4)  = LI190_4_sens
   
  Scan(5,Sec,1,0)
    'Mesure des deux capteurs sur le bornier de la CR310 a partir de la DIFF2
	    VoltDiff(PPFD_BC_IU(1),2,mV25,6,True,0,50,1,0)
      VoltSe(PPFD_BC_IU(3),2,mV25,15,True,0,50,1,0)      
      For i = 1 To 4
         PPFD_BC(i) = PPFD_BC_IU(i)*PPFD_BC_mult(i) + 0
      Next
      
  'Precis Mecanique 3029/2 WMO rainfall sensor and ARG100 sn86224 raingauge
      PulseCount(RainPM3029,1,1,2,0,RainPM3029_mult,0) 
      PulseCount(RainARG100,1,2,2,0,RainARG100_mult,0)
  
  'Configuration du TimeStamps selon ICOS format YYYYMMDDhhmmss
      Call ICOSTimeFormat 
         
  'Appel des tables
      CallTable(FRFonTS02)
      CallTable(Meteo)
      CallTable(PPFD_GBOV)
      
  'File timing		
      If Outstat2 Then 
        Lastfiletime2 = FRFonTS02.Timestamp(3,5)
        SplitStr(timearray2(),Lastfiletime2,"",6,0)
        Desiredtime2 = timearray2(3)&timearray2(2)&timearray2(1)
        Newfilename2 = "USR:FR-Fon_BM_"+Desiredtime2+"_L03_F02.dat"
        FileRename(Lastfilename2,Newfilename2)     
      EndIf

  NextScan
 
  SlowSequence

  Scan(30,Sec,1,0)
 
    'Vaisala HMD 30 YB humidity and temperature sensor
      VoltSe(HMD_RHair,1,mV2500,1,False,0,_50Hz,0.1,0)
      VoltSe(HMD_TempAir,1,mV2500,2,False,0,_50Hz,0.1,-20)
      
    '61302V barometric sensor
      '*** 61302V Sensor Polling Variables ***
        'Configure ComPort 1 for use with the 61302V
        SerialOpen (Com1,9600,0,0,1000)
        BP_Poll = "M0!"
        CR2 = CHR(13)
        'Poll 61302V Sensor
        SerialFlush (Com1) 'Clear buffer before polling for a new measurement
        SerialOut (Com1,BP_Poll,"",0,100) 'Send sensor poll command
        SerialIn (BP_raw,Com1,100,CR2,100) 'Receive sensor response
        SplitStr (BP_string,BP_raw,"",1,0) 'Parse out BP value
        Pression = BP_string 'Convert ASCII to numeric value
        PressionkPa = Pression/10
      
    'IR120 radiothermometers (x3)    
      'Measure the IR120 Body Temperature
      '----------------------------------
      'Measure the thermistor using a half bridge by applying a negative
      'excitation voltage of -2.5V
      'Note that switching the bridge excitation is set to FALSE.
      'no settling time because short cable
      BrHalf(BR_Res(1),1,mV2500,3,Vx1,1,-2500,False,0,_50Hz,1,0)
      BrHalf(BR_Res(2),1,mV2500,5,Vx1,1,-2500,False,0,_50Hz,1,0)
      BrHalf(BR_Res(3),1,mV2500,7,Vx1,1,-2500,False,0,_50Hz,1,0)
      'Measure the IR120 Infrared Temperature
      '--------------------------------------
      'Measure the infrared temperature using a half bridge instruction
      'Note that switching the bridge excitation is set to FALSE.
      'Use 75 ms settling time, to allow amplified signal to settle
      'The multiplier is used to correct the ratiometric output to mV
      ExciteV(Vx1,2500,0)
      Delay(0,75,mSec)
      BrHalf(IRSensor_Volt(1),1,mV250,4,Vx1,1,2500,False,0,_50Hz,2500,0)
      ExciteV(Vx1,2500,0)
      Delay(0,75,mSec)
      BrHalf(IRSensor_Volt(2),1,mV250,6,Vx1,1,2500,False,0,_50Hz,2500,0)
      ExciteV(Vx1,2500,0)
      Delay(0,75,mSec)    
      BrHalf(IRSensor_Volt(3),1,mV250,8,Vx1,1,2500,False,0,_50Hz,2500,0)
      TCPOpen_var = TCPOpen("192.168.154.14",6785,0)
      GetVariables (ResultCode,TCPOpen_var,0,4,0,0,"Public","TempAir_37m",TempAir_37m,1)
      For IR120i = 1 To 3 Step 1
        'Multiply the ratio of measured voltage by a constant appropriate to the thermistor
        IRSensor_Resis(IR120i) = 77020 * (BR_Res(IR120i) / (1 - BR_Res(IR120i)))
        'Using Steinhart-hart, apply the calibration coefficients to arrive at a body temperature in Celsius
        IRSensorCan_Temp(IR120i) = 1 / (Coeff_A(IR120i) + Coeff_B(IR120i) * LN(IRSensor_Resis(IR120i)) + Coeff_C(IR120i) * (LN(IRSensor_Resis(IR120i)))^3) - 273.15
        'Apply temperature compensation
        IRSensor_Volt_TC(IR120i) = IRSensor_Volt(IR120i) * 1.0004 ^(IRSensorCan_Temp(IR120i) - 25)
        'Apply coefficients
        IRSensor_E(IR120i) = Coeff_X(IR120i) * IRSensor_Volt_TC(IR120i)^2 + Coeff_Y(IR120i) * IRSensor_Volt_TC(IR120i) + Coeff_Z(IR120i)
        'Add difference to absolute energy from the sensor body
        IRSensor_T4(IR120i) = (IRSensor_E(IR120i) / 5.67E-8) + ((IRSensorCan_Temp(IR120i) + 273.15)^4)
        'Resolve for remote surface temperature in Kelvin – NOTE this is the 'UNCORRECTED value
        IRSensor_T(IR120i) = (IRSensor_T4^0.25) - 273.15
        'Correct for the effects of the high infrared transmission film
        IRTFilm_T4(IR120i) = ((IRSensor_T4(IR120i) - ((TempAir_37m + 273.15)^4 * (1 - Film))) / Film)
        'Combine with the corrrection for Emissivity and Convert to Celsius
        IRTemp(IR120i) = ((IRTFilm_T4(IR120i)-((TempAir_37m + 273.15)^4*(1-Emissivity)))/Emissivity)^0.25 - 273.15
      Next
      
    'Thygan VTP37 dew point Thermo-Hygrometer     
      If IfTime (0,1,Min) Then Ask_ThyganVTP37
      
    'Thermocouple type T du filtre profil 37m
    PanelTemp(Ptemp,_50Hz)
    TCDiff(TempFiltre37m,1,mV25C,5,TypeT,Ptemp,True ,0,_50Hz,1.0,0)
    
    'Configuration du Timestamps selon ICOS format YYYYMMDDhhmmss
    Call ICOSTimeFormat
      
    'Call Data Tables and Store Data
    CallTable(FRFonTS01)
    CallTable(Meteo)
    CallTable(TempSurf)
    
    'File timing		
    If Outstat Then 
      Lastfiletime = FRFonTS01.Timestamp(3,5)      
      SplitStr(timearray(),Lastfiletime,"",6,0)
      Desiredtime = timearray(3)&timearray(2)&timearray(1)
      Newfilename = "USR:FR-Fon_BM_"+Desiredtime+"_L03_F01.dat"
      FileRename(Lastfilename,Newfilename)
    EndIf
  
  NextScan

EndProg

Any suggestions are more than welcome.

All the best,
Daniel

And I invite you to look at the RTMC Pro monitoring webpage of our forest research station :
http://www.barbeau.universite-paris-saclay.fr/realtime.html


JDavis Mar 28, 2024 10:52 PM

I think the answer is in this comment in the help about the ExciteV() delay parameter.

If the Delay is set to 0, the excitation channel will be enabled and the voltage will be held until the end of the program scan, until another instruction sets an excitation voltage, or until the instruction is interrupted by a measurement (this behavior of 0 delay is not applicable in a SlowSequence scan).

The power to the signal amplifier is being interrupted.

Regrouping measurements, using the delay parameter, and adding semaphores might fix it.

If the measurements still don't turn out correctly, the IR120 measurements would need to move to the main scan. Rewiring to allow use of repetitions could save about 200ms of measurement time if needed.

 

'Variables and Table definitions
' Time and filename variables
Public Outstat As Boolean
Public Outstat2 As Boolean
Public Lastfilename As String *50
Public Lastfilename2 As String *50
Public Lastfiletime As String *50
Public Lastfiletime2 As String *50
Public Newfilename  As String *50
Public Newfilename2  As String *50
Public timearray(7)  As String
Public timearray2(7)  As String
Public Desiredtime  As String *50
Public Desiredtime2 As String *50

'Vaisala HMD 30 YB variables
Public HMD_TempAir                             : Units HMD_TempAir = deg_C
Public HMD_RHair                               : Units HMD_RHair = %

'Rainfall variables
Public RainPM3029                             : Units RainPM3029 = MM
Const  RainPM3029_mult = 0.2
Public RainARG100                             : Units RainARG100 = MM
Const  RainARG100_mult = 0.20354

'Young 61302V variables
Const  Elevation  = 140     '105 metres au sol + 35 metres pour la tour
Dim    BP_Poll As String,CR2 As String
Dim    BP_raw As String
Dim    BP_string As String
Public Pression                                : Units Pression = hPa
Public PressionkPa                             : Units PressionkPa = kPa

'IR120 variables et recuperation de  TempAir temp du profil a 37m
Dim    Coeff_A(3), Coeff_B(3), Coeff_C(3), Coeff_X(3), Coeff_Y(3), Coeff_Z(3)
Const  Emissivity = 0.94   'Emissivity of forest surface
Const  Film       = 0.79   'film IR transmission (camera window)
Dim    IR120i
Public    BR_Res(3)           'The Measured Bridge Resistance
Public    IRSensor_Resis(3)   'Thermistor Resistance
Public IRSensorCan_Temp(3) 'Thermistor Temperature in Celsius
Public    IRSensor_Volt(3)    'The Measured Thermopile Voltage
Public    IRSensor_Volt_TC(3) 'The Measured Thermopile Voltage – Temp Compensated
Public    IRSensor_E(3)       'Energy Difference
Public    IRSensor_T4(3)      'Black body surface temp to the power 4
Public    IRSensor_T(3)       'Black body surface temp in Kelvin – Uncorrected
Public    IRTFilm_T4(3)       'Temp after the film correction to the power 4
Public IRTemp(3)           'Corrected Surface Temperatures in Celsius
Alias  IRTemp(1) = IRTemp_E1178                 : Units IRTemp_E1178 = deg_C
Alias  IRTemp(2) = IRTemp_E1179                 : Units IRTemp_E1179 = deg_C
Alias  IRTemp(3) = IRTemp_E1180                 : Units IRTemp_E1180 = deg_C
Dim TCPOpen_var
Public ResultCode
Public TempAir_37m                              : Units TempAir_37m  = deg_C

'Thygan VTP37  variables
Public stringDewpoint As String *8
Public rawdataDewpoint As String *65
Const  Comportdewpoint=Com2
Const  CR1=CHR(13) 'caracteres retour chariot nouvelle ligne
Public VTP37_TempAir                            : Units VTP37_TempAir   = deg_C
Public VTP37_DewPoint                           : Units VTP37_DewPoint  = deg_C
Public VTP37_RHair                              : Units VTP37_RHair     = %
Public VTP37_HouseTemp                          : Units VTP37_HouseTemp = deg_C

'Thermocouple profil 37m variable
Public TempFiltre37m                            : Units TempFiltre37m   = deg_C
Public Ptemp

'Public Variables for LI190 PAR sensors
Dim PPFD_BC_mult(4)
Const   LI190_1_sens = 242.05'242.04 'sn 121825
Const   LI190_2_sens = 237.20'237.32 'sn 121826
Const   LI190_3_sens = 247.11'247.10 'sn 121827
Const   LI190_4_sens = 255.89'255.74 'sn 121828
Dim i
Public PPFD_BC_IU(4)                          : Units PPFD_BC_IU = mV
Alias PPFD_BC_IU(1)   = PPFD_BC_IN_IU_1_1_3
Alias PPFD_BC_IU(2)   = PPFD_BC_OUT_IU_1_1_2
Alias PPFD_BC_IU(3)   = PPFD_BC_IN_IU_1_1_4
Alias PPFD_BC_IU(4)   = PPFD_BC_OUT_IU_1_1_3
Public PPFD_BC(4)                             : Units PPFD_BC = micromol m-2 s-1
Alias PPFD_BC(1)   = PPFD_BC_IN_1_1_3
Alias PPFD_BC(2)   = PPFD_BC_OUT_1_1_2
Alias PPFD_BC(3)   = PPFD_BC_IN_1_1_4
Alias PPFD_BC(4)   = PPFD_BC_OUT_1_1_3

'Definition of DataTables
DataTable(FRFonTS01,True,-1)
  TableFile ("USR:FRFonTS01.dat",11,7,0,1,Day,Outstat,Lastfilename)
  Sample (1,TimeStamps,String)
  Sample (1,VTP37_TempAir,IEEE4)
  FieldNames("TA_1_1_2")
  Sample (1,VTP37_RHair,IEEE4)
  FieldNames("RH_1_1_2")
  Sample (1,PressionkPa, IEEE4)
  FieldNames("PA_1_1_1")
  Totalize(1,RainARG100,IEEE4,False)
  FieldNames("P_2_1_1")
  Totalize(1,RainPM3029,IEEE4,False)
  FieldNames("P_2_1_2")
EndTable

DataTable(FRFonTS02,True,-1)
  TableFile ("USR:FRFonTS02.dat",11,7,0,1,Day,Outstat2,Lastfilename2)
  Sample (1,TimeStamps,String)
  Sample (4,PPFD_BC_IU(),IEEE4)
  Sample (4,PPFD_BC(),IEEE4)
EndTable

DataTable(PPFD_GBOV,True,-1)
  DataInterval(0,30,Min,10)
  Average(4,PPFD_BC(),IEEE4,False)
EndTable

DataTable(Meteo,True,-1)
  DataInterval(0,30,Min,10)
  Average (1,HMD_RHair,IEEE4,False)
  Average (1,HMD_TempAir,IEEE4,False)
  Average (1,VTP37_TempAir,IEEE4, False)
  Average (1,VTP37_DewPoint,IEEE4, False)
  Average (1,VTP37_RHair,IEEE4, False)
  Average (1,VTP37_HouseTemp,IEEE4, False)
  Sample  (1,Pression,IEEE4)
  Totalize(1,RainPM3029,IEEE4,False)
  Totalize(1,RainARG100,IEEE4,False)
EndTable

DataTable(TempSurf,True,-1)
  DataInterval(0,30,Min,10)
  Average(1,IRTemp_E1178,IEEE4,False)
  Average(1,IRTemp_E1179,IEEE4,False)
  Average(1,IRTemp_E1180,IEEE4,False)
EndTable

'SubRoutines
Sub ICOSTimeFormat
  Public TimeStamps As String *17
  Public rTime(9)
  Public YYYY As String *4
  Public MM As String *2
  Public DD As String *2
  Public hh As String *2
  Public mn As String *2
  Public ss As String *2
  RealTime(rTime)
  YYYY = rTime(1)
  'forcage du zero devant l'unite a un chiffre (ex quand 8 --> 08)
  If rTime(2)<10 Then MM ="0"&rTime(2) Else MM = rTime(2)
  If rTime(3)<10 Then DD ="0"&rTime(3) Else DD = rTime(3)
  If rTime(4)<10 Then hh ="0"&rTime(4) Else hh = rTime(4)
  If rTime(5)<10 Then mn ="0"&rTime(5) Else mn = rTime(5)
  If rTime(6)<10 Then ss ="0"&rTime(6) Else ss = rTime(6)
  TimeStamps = YYYY&MM&DD&hh&mn&ss
EndSub

'Subroutine Aquisition dewpoint
Sub Ask_ThyganVTP37
  Public SplitResultDewpoint(9) As String *(13)
  SerialOpen (Comportdewpoint,2400,0,0,100)
  'demande d'envoi d'une mesure
  SerialOut (Comportdewpoint,stringDewpoint,CR1,0,100)
  'recuperation de la mesure
  SerialIn (rawdataDewpoint,Comportdewpoint,1000,0,100)
  'Extraction informations temperature AIR, DEWpoint mesure
  SplitStr (SplitResultDewpoint(1),rawdataDewpoint,",",9,5)
  'conversion string  en valeur numeric plus divison 100
  SplitStr(VTP37_TempAir,SplitResultDewpoint(3),"",1,0)
  VTP37_TempAir=VTP37_TempAir/100.00
  'conversion string  en valeur numeric plus divison 100
  SplitStr(VTP37_DewPoint,SplitResultDewpoint(4),"",1,0)
  VTP37_DewPoint=VTP37_DewPoint/100.00
  'conversion string  en valeur numeric plus divison 100
  SplitStr(VTP37_RHair,SplitResultDewpoint(5),"",1,0)
  VTP37_RHair=VTP37_RHair/100.00'conversion string  en valeur numeric plus divison 100
  'conversion string  en valeur numeric plus divison 100
  SplitStr(VTP37_HouseTemp,SplitResultDewpoint(6),"",1,0)
  VTP37_HouseTemp=VTP37_HouseTemp/100.00
  SerialFlush (Comportdewpoint)
  SerialClose (Comportdewpoint)
EndSub

SequentialMode

'Main Program
BeginProg

  SetStatus("USRDriveSize",1500000)

  'Load calibration coefficient for IR120 sn E1178
  Coeff_A(1) = 9.395021E-4
  Coeff_B(1) = 2.196992E-4
  Coeff_C(1) = 1.373611E-7
  Coeff_X(1) = 8.146919E-6
  Coeff_Y(1) = 3.686217E-1
  Coeff_Z(1) = 3.810169E-1
  'Load calibration coefficient for IR120 sn E1179
  Coeff_A(2) = 9.471630E-4
  Coeff_B(2) = 2.187062E-4
  Coeff_C(2) = 1.432039E-7
  Coeff_X(2) = 9.616962E-6
  Coeff_Y(2) = 3.663519E-1
  Coeff_Z(2) = 2.592757E-1
  'Load calibration coefficient for IR120 sn E1180
  Coeff_A(3) = 9.481884E-4
  Coeff_B(3) = 2.181001E-4
  Coeff_C(3) = 1.390689E-7
  Coeff_X(3) = 7.853477E-6
  Coeff_Y(3) = 3.653387E-1
  Coeff_Z(3) = 4.211229E-1

  'Thygan VTP37 initialisation
  stringDewpoint="A98Q1308"+CR1

  'Load the multipliers values for the LI190 sensors
  PPFD_BC_mult(1)  = LI190_1_sens
  PPFD_BC_mult(2)  = LI190_2_sens
  PPFD_BC_mult(3)  = LI190_3_sens
  PPFD_BC_mult(4)  = LI190_4_sens

  Scan(5,Sec,1,0)
    'Mesure des deux capteurs sur le bornier de la CR310 a partir de la DIFF2
    SemaphoreGet(1)
      VoltDiff(PPFD_BC_IU(1),2,mV25,6,True,0,50,1,0)
      VoltSe(PPFD_BC_IU(3),2,mV25,15,True,0,50,1,0)
      For i = 1 To 4
        PPFD_BC(i) = PPFD_BC_IU(i)*PPFD_BC_mult(i) + 0
      Next
    SemaphoreRelease(1)
    'Precis Mecanique 3029/2 WMO rainfall sensor and ARG100 sn86224 raingauge
    PulseCount(RainPM3029,1,1,2,0,RainPM3029_mult,0)
    PulseCount(RainARG100,1,2,2,0,RainARG100_mult,0)

    'Configuration du TimeStamps selon ICOS format YYYYMMDDhhmmss
    Call ICOSTimeFormat

    'Appel des tables
    CallTable(FRFonTS02)
    CallTable(Meteo)
    CallTable(PPFD_GBOV)

    'File timing
    If Outstat2 Then
      Lastfiletime2 = FRFonTS02.Timestamp(3,5)
      SplitStr(timearray2(),Lastfiletime2,"",6,0)
      Desiredtime2 = timearray2(3)&timearray2(2)&timearray2(1)
      Newfilename2 = "USR:FR-Fon_BM_"+Desiredtime2+"_L03_F02.dat"
      FileRename(Lastfilename2,Newfilename2)
    EndIf

  NextScan

  SlowSequence

  Scan(30,Sec,1,0)

    'Vaisala HMD 30 YB humidity and temperature sensor
    VoltSe(HMD_RHair,1,mV2500,1,False,0,_50Hz,0.1,0)
    VoltSe(HMD_TempAir,1,mV2500,2,False,0,_50Hz,0.1,-20)

    '61302V barometric sensor
    '*** 61302V Sensor Polling Variables ***
    'Configure ComPort 1 for use with the 61302V
    SerialOpen (Com1,9600,0,0,1000)
    BP_Poll = "M0!"
    CR2 = CHR(13)
    'Poll 61302V Sensor
    SerialFlush (Com1) 'Clear buffer before polling for a new measurement
    SerialOut (Com1,BP_Poll,"",0,100) 'Send sensor poll command
    SerialIn (BP_raw,Com1,100,CR2,100) 'Receive sensor response
    SplitStr (BP_string,BP_raw,"",1,0) 'Parse out BP value
    Pression = BP_string 'Convert ASCII to numeric value
    PressionkPa = Pression/10

    'IR120 radiothermometers (x3)
    'Measure the IR120 Body Temperature
    '----------------------------------
    'Measure the thermistor using a half bridge by applying a negative
    'excitation voltage of -2.5V
    'Note that switching the bridge excitation is set to FALSE.
    'no settling time because short cable
    'Measure the IR120 Infrared Temperature
    '--------------------------------------
    'Measure the infrared temperature using a half bridge instruction
    'Note that switching the bridge excitation is set to FALSE.
    'Use 75 ms settling time, to allow amplified signal to settle
    'The multiplier is used to correct the ratiometric output to mV
    SemaphoreGet(1)
      BrHalf(BR_Res(1),1,mV2500,3,Vx1,1,-2500,False,0,_50Hz,1,0)
      ExciteV(Vx1,2500,75000)
      BrHalf(IRSensor_Volt(1),1,mV250,4,Vx1,1,2500,False,0,_50Hz,2500,0)
    SemaphoreRelease(1)
    SemaphoreGet(1)
      BrHalf(BR_Res(2),1,mV2500,5,Vx1,1,-2500,False,0,_50Hz,1,0)
      ExciteV(Vx1,2500,75000)
      BrHalf(IRSensor_Volt(2),1,mV250,6,Vx1,1,2500,False,0,_50Hz,2500,0)
    SemaphoreRelease(1)
    SemaphoreGet(1)
      BrHalf(BR_Res(3),1,mV2500,7,Vx1,1,-2500,False,0,_50Hz,1,0)
      ExciteV(Vx1,2500,75000)
      BrHalf(IRSensor_Volt(3),1,mV250,8,Vx1,1,2500,False,0,_50Hz,2500,0)
    SemaphoreRelease(1)
    TCPOpen_var = TCPOpen("192.168.154.14",6785,0)
    GetVariables (ResultCode,TCPOpen_var,0,4,0,0,"Public","TempAir_37m",TempAir_37m,1)
    For IR120i = 1 To 3 Step 1
      'Multiply the ratio of measured voltage by a constant appropriate to the thermistor
      IRSensor_Resis(IR120i) = 77020 * (BR_Res(IR120i) / (1 - BR_Res(IR120i)))
      'Using Steinhart-hart, apply the calibration coefficients to arrive at a body temperature in Celsius
      IRSensorCan_Temp(IR120i) = 1 / (Coeff_A(IR120i) + Coeff_B(IR120i) * LN(IRSensor_Resis(IR120i)) + Coeff_C(IR120i) * (LN(IRSensor_Resis(IR120i)))^3) - 273.15
      'Apply temperature compensation
      IRSensor_Volt_TC(IR120i) = IRSensor_Volt(IR120i) * 1.0004 ^(IRSensorCan_Temp(IR120i) - 25)
      'Apply coefficients
      IRSensor_E(IR120i) = Coeff_X(IR120i) * IRSensor_Volt_TC(IR120i)^2 + Coeff_Y(IR120i) * IRSensor_Volt_TC(IR120i) + Coeff_Z(IR120i)
      'Add difference to absolute energy from the sensor body
      IRSensor_T4(IR120i) = (IRSensor_E(IR120i) / 5.67E-8) + ((IRSensorCan_Temp(IR120i) + 273.15)^4)
      'Resolve for remote surface temperature in Kelvin – NOTE this is the 'UNCORRECTED value
      IRSensor_T(IR120i) = (IRSensor_T4^0.25) - 273.15
      'Correct for the effects of the high infrared transmission film
      IRTFilm_T4(IR120i) = ((IRSensor_T4(IR120i) - ((TempAir_37m + 273.15)^4 * (1 - Film))) / Film)
      'Combine with the corrrection for Emissivity and Convert to Celsius
      IRTemp(IR120i) = ((IRTFilm_T4(IR120i)-((TempAir_37m + 273.15)^4*(1-Emissivity)))/Emissivity)^0.25 - 273.15
    Next

    'Thygan VTP37 dew point Thermo-Hygrometer
    If IfTime (0,1,Min) Then Ask_ThyganVTP37

    'Thermocouple type T du filtre profil 37m
    PanelTemp(Ptemp,_50Hz)
    TCDiff(TempFiltre37m,1,mV25C,5,TypeT,Ptemp,True ,0,_50Hz,1.0,0)

    'Configuration du Timestamps selon ICOS format YYYYMMDDhhmmss
    Call ICOSTimeFormat

    'Call Data Tables and Store Data
    CallTable(FRFonTS01)
    CallTable(Meteo)
    CallTable(TempSurf)

    'File timing
    If Outstat Then
      Lastfiletime = FRFonTS01.Timestamp(3,5)
      SplitStr(timearray(),Lastfiletime,"",6,0)
      Desiredtime = timearray(3)&timearray(2)&timearray(1)
      Newfilename = "USR:FR-Fon_BM_"+Desiredtime+"_L03_F01.dat"
      FileRename(Lastfilename,Newfilename)
    EndIf

  NextScan

EndProg

 

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