Appendix C. Example CRBasic Data Logger Programs
C-5
Sample
(4,monitor(1),IEEE4)
EndTable
' Working Data
DataTable
(DataWindVec,TRUE,1)
DataInterval
(0,STATS_INTERVAL,Min,2)
'Compute wind direction from CSAT data.
WindVector
(1,wind_east,wind_north,IEEE4,disable_stats(1),0,1,2)
WindVector
(1,Uy,Ux,IEEE4,disable_stats(1),0,1,2)
EndTable
' Statistics data.
DataTable
(DataStats,TRUE,-1)
DataInterval
(0,STATS_INTERVAL,Min,2)
Average
(1,Ts,IEEE4,disable_stats(1))
StdDev
(1,Ts,IEEE4,disable_stats(1))
Average
(1,Ux,IEEE4,disable_stats(1))
StdDev
(1,Ux,IEEE4,disable_stats(1))
Average
(1,Uy,IEEE4,disable_stats(1))
StdDev
(1,Uy,IEEE4,disable_stats(1))
Average
(1,Uz,IEEE4,disable_stats(1))
StdDev
(1,Uz,IEEE4,disable_stats(1))
Sample
(1,wind_dir_compass,IEEE4)
Sample
(1,wind_dir_csat,IEEE4)
Sample
(1,wind_speed,IEEE4)
Sample
(1,result_wind_speed,IEEE4)
Sample
(1,standard_wind_dir,IEEE4)
Totalize
(1,N_STATS,IEEE4,disable_stats(1))
Totalize
(1,N_STATS,IEEE4,
NOT
(disable_stats(1)
OR
disable_stats(2)))
FieldNames
("csat_warnings")
Totalize
(1,N_STATS,IEEE4,
NOT
(Flag_LowAmp)
OR NOT
(disable_stats(2)))
FieldNames
("Flag_LowAmp_Tot")
Totalize
(1,N_STATS,IEEE4,
NOT
(Flag_HighAmp)
OR NOT
(disable_stats(2)))
FieldNames
("Flag_HighAmp_Tot")
Totalize
(1,N_STATS,IEEE4,
NOT
(Flag_Tracking)
OR NOT
(disable_stats(2)))
FieldNames
("Flag_Tracking_Tot")
Totalize
(1,N_STATS,IEEE4,
NOT
(Flag_HighDeltaC)
OR NOT
(disable_stats(2)))
FieldNames
("Flag_HighDeltaC_Tot")
Totalize
(1,N_STATS,IEEE4,
NOT
(Flag_Acq)
OR NOT
(disable_stats(2)))
FieldNames
("Flag_Acq_Tot")
Totalize
(1,N_STATS,IEEE4,
NOT
(Flag_LowVolt)
OR NOT
(disable_stats(2)))
FieldNames
("Flag_LowVolt_Tot")
Totalize
(1,N_STATS,IEEE4,
NOT
(Flag_MemErr)
OR NOT
(disable_stats(2)))
FieldNames
("Flag_MemErr_Tot")
Totalize
(1,N_STATS,IEEE4,
NOT
(Flag_ADCSkip)
OR NOT
(disable_stats(2)))
FieldNames
("Flag_ADCSkip_Tot")
Totalize
(1,N_STATS,IEEE4,
NOT
(Flag_TrigErr)
OR NOT
(disable_stats(2)))
FieldNames
("Flag_TrigErr_Tot")
Average
(1,panel_temp,IEEE4,FALSE)
Average
(1,battery_volt,IEEE4,FALSE)
Average
(1,board_temp,IEEE4,FALSE)
Average
(1,board_humidity,IEEE4,FALSE)
Average
(1,incline_pitch,IEEE4,FALSE)
Average
(1,incline_roll,IEEE4,FALSE)
EndTable
'---------------------------------------------
' Main Program
'---------------------------------------------
BeginProg
Move
(Ux,5,NaN,1)
'Set all CSAT3B variables to NaN
CPISpeed
(CPI_RATE)
'Set the SDM clock speed