Hello
I would like to sample sonic anemometer and radiometer at 100 ms and 1 sec respectively. while radiometer samples and store data in radiation_table at every 1 sec, anemometer sampling is not perfect at 100 ms scan interval. I am expecting sonic should provide 10-data strings in one second. It however skips some of the records in between. Another code to read sonic alone provides out put at every 100 ms without any problems but when I integrate it with radiation code then problem starts. Below is the code I am using. Below listed code declaration and unit has been taken out to shorten the code length.
Any help is appreciated.
Thanks,v
'------------------------------------
'Define sonic data Tables
DataTable (Table_sonic,True,-1)
DataInterval (0,100,mSec,0)
'CardOut(1,-1)
Sample(4,sonic (1),FP2)
Sample(1,sonic_K,String)
EndTable
'----------------------------------------------------------
DataTable (Rad_data,True,-1) ' radiation data
DataInterval (0,1,Sec,0)
'CardOut (1,-1)
Sample (1,rad(1),FP2)
Sample (1,rad(2),FP2)
Sample (1,rad(3),FP2)
Sample (1,rad(4),FP2)
Sample (1,long_up_corr,FP2)
Sample (1,long_dn_corr,FP2)
Sample (1,Rs_net,FP2)
Sample (1,Rl_net,FP2)
Sample (1,Rn,FP2)
Average (1,Rs_net,FP2,False)
Average (1,Rl_net,FP2,False)
Average (1,Rn,FP2,False)
Average (1,long_up_corr,FP2,False)
Average (1,long_dn_corr,FP2,False)
EndTable
'---------------------------------------------------------
'----------------------------------------------------------
DataTable (rad_ts,True,-1) 'temperature
DataInterval (0,1,Sec,0)
'CardOut (1,-1)
Minimum (1,batt_volt,FP2,0,False)
Sample (1,logger_temp,FP2)
Sample (1,temp_C,FP2)
'Sample (1,temp_K,IEEE4)
Sample(1,Vs_Vx,FP2)
Sample(1,Vx1,FP2)
EndTable
'----------------------------------------------------------
'Main Program
BeginProg
'--------sonic measurement--------------------------------
SerialOpen(Com1,9600,10,0,200)
Scan(100,mSec,10,0)
SerialFlush(Com1)
SerialIn(sonic_K,Com1,100,13,200)
SplitStr(sonic(1),sonic_K,"",4,0)
CallTable(Table_sonic)
NextScan
'
'
SlowSequence
'--------CN4 measurement-----------------------------------
Rad_mult(1) = pyranometer_up_mult
Rad_mult(2) = pyranometer_dn_mult
Rad_mult(3) = pyrgeometer_up_mult
Rad_mult(4) = pyrgeometer_dn_mult
Scan (1,Sec,3,0)
PanelTemp (logger_temp,250)
Battery (batt_volt)
'VoltDiff (rad(1),4,mV20C,1,True ,0,_50Hz,rad_mult(1),0)
'BrHalf (Vs_Vx,1,mV5000,15,Vx1,1,2500,True,0,_50Hz,1.0,0)
VoltDiff (rad(1),4,mV20C,1,True,0,250,rad_mult(1),0)
BrHalf (Vs_Vx,1,mV5000,15,Vx1,1,2500,True,0,250,1.0,0)
Rs = 1000*(Vs_Vx/(1-Vs_Vx))
Temp_C=1/(1.0295e3+2.391e4*LN(Rs)+1.568e7*LN(Rs))^3)-273.15
Temp_K = Temp_C+273.15
long_up_corr = long_up+5.67e-8*Temp_K^4
long_dn_corr = long_dn+5.67e-8*Temp_K^4
Rs_net = short_up - short_dn
Rl_net = long_up - long_dn
Rn = Rs_net + Rl_net
CallTable rad_data
CallTable rad_ts
NextScan
EndProg
sorted-out the problem... thanks