📄 3d_li_nohmp_v2_2.cr1
字号:
'CR1000 Series Datalogger
'Copyright (c) 2002, 2006 Campbell Scientific, Inc. All rights reserved.
'4 December 06
'version 2.2
' This datalogger program measures turbulence sensors at 10 or 20 Hz. The time series
'can be saved to a card. The datalogger will also compute online turbulent fluxes
'from the measured data. The flux table saves all the cross products that are
'required to rotate the online fluxes into natural wind coordinates in post
'processing as described in Kaimal and Finnigan (1994), and Tanner and Thurtell (1969).
'The following sensors are measured:
'
'CSAT3 three dimensional sonic anemometer
'LI-7500 open path infrared gas analyzer (CO2 and H2O)
' The sign convention for the fluxes is positive away from the surface and negative
'towards the surface.
'
' The datalogger will introduce lags into the CSAT3, LI-7500, and datalogger Panel
'Temperature data so that all measurements are aligned in time. The lags are a
'function of the Scan Interval and are computed automatically by the program.
'
' The site attendant must load in several constants and calibration values. Search
'for the text string "unique" to find the locations where unique constants and
'calibration values are entered.
'*** Unit Definitions ***
'Units Units
'C Celsius
'degrees degrees (angle)
'g grams
'J Joules
'kg kilograms
'kPa kilopascals
'm meters
'mg milligrams
'mmol millimoles
'mol moles
's seconds
'umol micromols
'V volts
'W Watts
'*** Wiring ***
'SDM INPUT
'C1 CSAT3 SDM Data (green)
' LI-7500 SDM Data (gray)
'C2 CSAT3 SDM Clock (white)
' LI-7500 SDM Clock (blue)
'C3 CSAT3 SDM Enable (brown)
' LI-7500 SDM Enable (brown)
'G CSAT3 SDM reference (black)
' CSAT3 SDM shield (clear)
' LI-7500 SDM reference (black)
' LI-7500 SDM shield (white)
'POWER IN
'12V datalogger (red)
'G datalogger (black)
'EXTERNAL POWER SUPPLY
'POS CSAT3 power (red)
' LI-7500 power (red with white)
' datalogger (red)
'NEG CSAT3 power reference (black)
' CSAT3 power shield (clear)
' LI-7500 power reference (red with black)
' LI-7500 ground (green)
' datalogger (black)
PipeLineMode
'*** Constants ***
'Measurement Rate '10 Hz
Const SCAN_INTERVAL = 100 '100 mSec
'Output period
Const OUTPUT_INTERVAL = 30 'Online flux data output interval in minutes.
Const NUM_DAY_CPU = 7 'Number of days of data to store on the CPU.
'Const CSAT3_AZIMUTH = 0 'Unique value.
'Compass azimuth of the -x axis. For the figure
' below, CSAT3_AZIMUTH = 90.
' () -> Compass coordinate system
' {} -> Right handed coordinate system
'
'
' (N)
' {-y}
' |
' |
' |
' |
' |
' (W) {+x} <-------[ ]----X--- {-x} (E)
' / | \
' CSAT3 Block | CSAT3 Transducers
' |
' |
' v
' {+y}
' (S)
'
'The program computes the compass wind direction, using the constant
' CSAT3_AZIMUTH, and a CSAT3 wind direction. Good CSAT3 wind directions
' are between -90 to 0 and 0 to 90 degrees, e.g. the wind is blowing into
' the CSAT3 sensor head.
Const OFFSET = 16 'An offset delay that will be introduced to the CSAT3 and LI-7500 data.
Const DELAY_CSAT = 2 'Fixed inherent lag of the CSAT3 data (two scans).
Const DELAY_IRGA = INT (300/SCAN_INTERVAL) 'Fixed inherent lag of the LI-7500 data (three scans at 10 Hz or six scans at 20 Hz).
'Determine scan buffer size, CSAT3 Execution Parameters and fixed lags for CSAT3 and LI-7500.
Const SCAN_BUFFER_SIZE = 300*INT (1000/SCAN_INTERVAL) 'Compute a 5 minute scan buffer.
Const CSAT_OPT = INT (1000/SCAN_INTERVAL) 'Compute CSAT3 Execution Parameter (10 or 20 Hz).
Const CSAT_REC_BCK = OFFSET-DELAY_CSAT 'Number of records back to align CSAT3 data.
Const IRGA_REC_BCK = OFFSET-DELAY_IRGA 'Number of records back to align LI-7500 data.
'Compute CPU and card storage size for the FLUX DataTables.
Const FLUX_SIZE_CPU = (NUM_DAY_CPU*1440)/OUTPUT_INTERVAL'Size of flux DataTable on CPU [days].
Const CP = 1004.67 'Estimate of heat capacity of air [J/(kg K)].
Const LV = 2440 'Estimate of the latent heat of vaporization [J/g].
Const SDM_PER = 30 'Default SDM clock speed.
Const MU_WPL = 29/18 'Ratio of the molecular weight of dry air to that of water vapor.
Const R = 8.3143e-3 'Universal gas constant [kPa m^3/(K mol) ].
Const RD = R/29 'Gas constant for dry air [kPa m^3/(K g)].
Const RV = R/18 'Gas constant for water vapor [kPa m^3/(K g)].
'*** Variables ***
'Online lagged CSAT3 and LI-7500 data.
Public aligned_data(5)
Alias aligned_data(1) = panel_temp
'Alias aligned_data(2) = Ux
'Alias aligned_data(3) = Uy
'Alias aligned_data(4) = Uz
'Alias aligned_data(5) = Ts
'Alias aligned_data(6) = diag_csat
Alias aligned_data(2) = co2
Alias aligned_data(3) = h2o
Alias aligned_data(4) = press
Alias aligned_data(5) = diag_irga
Units panel_temp = C
'Units Ux = m/s
'Units Uy = m/s
'Units Uz = m/s
'Units Ts = C
'Units diag_csat = unitless
Units co2 = mg/m^3
Units h2o = g/m^3
Units press = kPa
Units diag_irga = unitless
Public co2_um_m
Public h2o_mm_m
Units co2_um_m = umol/mol
Units h2o_mm_m = mmol/mol
Public diag_bits(4) As Boolean 'Warning flags.
'Alias diag_bits(1) = del_T_f 'Delta temperature warning flag.
'Alias diag_bits(2) = sig_lck_f 'Poor signal lock warning flag.
'Alias diag_bits(3) = amp_h_f 'Amplitude high warning flag.
'Alias diag_bits(4) = amp_l_f 'Amplitude low warning flag.
Alias diag_bits(1) = chopper_f 'Chopper warning flag.
Alias diag_bits(2) = detector_f 'Detector warning flag.
Alias diag_bits(3) = pll_f 'PLL warning flag.
Alias diag_bits(4) = sync_f 'Synchronization warning flag.
Units diag_bits = samples
Public agc AS Long 'Automatic gain control.
Units agc = unitless
'No delay meteorological variables.
Dim rho_a_mean 'Mean air density.
Public batt_volt 'Datalogger battery voltage.
Units rho_a_mean = kg/m^3
Units batt_volt = V
'Flux variables.
Dim Fc_wpl 'Carbon dioxide flux (LI-7500), with Webb et al. term.
Dim LE_wpl 'Latent heat flux (LI-7500), with Webb et al. term.
Dim Hs 'Sensible heat flux using sonic temperature.
Dim Hc 'Sensible heat flux computed from Hs and LE_wpl.
Dim tau 'Momentum flux.
Dim u_star 'Friction velocity.
Dim Fc_irga 'Carbon dioxide flux (LI-7500), without Webb et al. term.
Dim LE_irga 'Latent heat flux (LI-7500), without Webb et al. term.
Dim co2_wpl_LE 'Carbon dioxide flux (LI-7500), Webb et al. term due to latent heat flux.
Dim co2_wpl_H 'Carbon dioxide flux (LI-7500), Webb et al. term due to sensible heat flux.
Dim h2o_wpl_LE 'Latent heat flux (LI-7500), Webb et al. term due to latent heat flux.
Dim h2o_wpl_H 'Latent heat flux (LI-7500), Webb et al. term due to sensible heat flux.
Dim cov_out(30) 'Covariances of scalars and wind, wind vector, Ts_mean, h2o_mean, co2_mean, and press_mean.
Units Fc_wpl = mg/(m^2 s)
Units LE_wpl = W/m^2
Units Hs = W/m^2
Units Hc = W/m^2
Units tau = kg/(m s^2)
Units u_star = m/s
Units Fc_irga = mg/(m^2 s)
Units LE_irga = W/m^2
Units co2_wpl_LE = mg/(m^2 s)
Units co2_wpl_H = mg/(m^2 s)
Units h2o_wpl_LE = W/m^2
Units h2o_wpl_H = W/m^2
'Aliases for covariances.
'Alias cov_out(1) = stdev_Ts
'Alias cov_out(2) = cov_Ts_Ux
'Alias cov_out(3) = cov_Ts_Uy
'Alias cov_out(4) = cov_Ts_Uz
'Alias cov_out(5) = stdev_Ux
'Alias cov_out(6) = cov_Ux_Uy
'Alias cov_out(7) = cov_Ux_Uz
'Alias cov_out(8) = stdev_Uy
'Alias cov_out(9) = cov_Uy_Uz
'Alias cov_out(10) = stdev_Uz
Alias cov_out(1) = stdev_co2
'Alias cov_out(2) = cov_co2_Ux
'Alias cov_out(3) = cov_co2_Uy
'Alias cov_out(4) = cov_co2_Uz
Alias cov_out(2) = stdev_h2o
'Alias cov_out(6) = cov_h2o_Ux
'Alias cov_out(7) = cov_h2o_Uy
'Alias cov_out(8) = cov_h2o_Uz
'Units stdev_Ts = C
'Units cov_Ts_Ux = m C/s
'Units cov_Ts_Uy = m C/s
'Units cov_Ts_Uz = m C/s
'Units stdev_Ux = m/s
'Units cov_Ux_Uy = (m/s)^2
'Units cov_Ux_Uz = (m/s)^2
'Units stdev_Uy = m/s
'Units cov_Uy_Uz = (m/s)^2
'Units stdev_Uz = m/s
'Units stdev_co2 = mg/m^3
'Units cov_co2_Ux = mg/(m^2 s)
'Units cov_co2_Uy = mg/(m^2 s)
'Units cov_co2_Uz = mg/(m^2 s)
'Units stdev_h2o = g/m^3
'Units cov_h2o_Ux = g/(m^2 s)
'Units cov_h2o_Uy = g/(m^2 s)
'Units cov_h2o_Uz = g/(m^2 s)
'
''Wind directions and speed.
''Alias cov_out(19) = wnd_spd - in compass coordinate system, same as CSAT3.
''Alias cov_out(20) = rslt_wnd_spd - in compass coordinate system, same as CSAT3.
'Alias cov_out(21) = wnd_dir_compass
''Alias cov_out(22) = std_wnd_dir - in compass coordinate system, same as CSAT3.
'Alias cov_out(23) = wnd_spd
'Alias cov_out(24) = rslt_wnd_spd
'Alias cov_out(25) = wnd_dir_csat3
'Alias cov_out(26) = std_wnd_dir
'Alias cov_out(27) = Ts_mean
Alias cov_out(3) = h2o_mean
Alias cov_out(4) = co2_mean
Alias cov_out(5) = press_mean
'Units wnd_dir_compass = degrees
'Units wnd_spd = m/s
'Units rslt_wnd_spd = m/s
'Units wnd_dir_csat3 = degrees
'Units std_wnd_dir = degrees
'Units Ts_mean = C
Units co2_mean = mg/m^3
Units press_mean = kPa
'Diagnostic variables.
Dim disable_flag_on(2) As Boolean 'Intermediate processing disable flags.
'disable_flag_on(1) 'TRUE when CSAT3 diagnostic warning flags are on or CSAT3 has no data.
'disable_flag_on(2) 'TRUE when LI-7500 diagnostic warning flags are on or LI-7500 failed to send data.
'disable_flag_on(3) 'TRUE when CSAT3 diagnostic warning flags are on.
' Used to filter the sum of CSAT3 diagnostic warning flags.
'disable_flag_on(4) 'TRUE when LI-7500 diagnostic warning flags are on.
' Used to filter the sum of LI-7500 diagnostic warning flags.
'Dim cov_disable_flag As Boolean 'TRUE when CSAT3 or LI-7500 reports bad data.
Dim n 'Number of samples in the online covariances.
Units n = samples
''No delay CSAT3 data.
'Dim wind_raw(5)
'Alias wind_raw(1) = Ux_raw
'Alias wind_raw(2) = Uy_raw
'Alias wind_raw(3) = Uz_raw
'Alias wind_raw(4) = Ts_raw
'Alias wind_raw(5) = diag_csat_raw
'Units wind_raw = m/s
'Units Ts_raw = C
'Units diag_csat_raw = unitless
'No delay LI-7500 data.
Dim irga_raw(4)
Alias irga_raw(1) = co2_raw
Alias irga_raw(2) = h2o_raw
Alias irga_raw(3) = press_raw
Alias irga_raw(4) = diag_irga_raw
Units co2_raw = umol/m^3
Units h2o_raw = mmol/m^3
Units press_raw = kPa
Units diag_irga_raw = unitless
'No delay analog measurements.
Dim panel_temp_raw
Units panel_temp_raw = C
'Working variables.
'Dim cov_array(3,4) 'Arrays used to hold the input data for the covariance instructions.
Dim co2_mm_m3 'Carbon dioxide concentration [mmol/m^3], used to compute umol/mol concentration.
Dim h2o_mm_m3 'Water vapor concentration [mmol/m^3], used to compute vapor pressure and mmol/mol concentration.
Dim sigma_wpl 'Webb et al. sigma = density of water vapor / density of dry air.
'Dim j 'Generic counter variable.
Dim scan_count As Long 'Number scans executed.
'Dim wind_east 'East wind in compass coordinate system.
'Dim wind_north 'Nort.h wind in compass coordinate system
Dim save_ts_flag_on As Boolean 'Used to synchronize the time series output to the even minute.
Dim dly_data_out(5) 'Variable used to temporarily store the lagged record.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -