CENTER FOR EMBEDDED NETWORKED SENSING Further Investigations of Energy Balanc 1. Sap flow theory and sensors 1. Visit sap flow tree to see installation 2. Lucas downloads sap flow data wirelessly 2. Henry presents R Survey 3. More energy balance equations! 4. Modeling sub-surface soil temperatures: 1. Analytical model 2. Damping depth 3. Fourier Transforms for periodic data
89
Embed
CENTER FOR EMBEDDED NETWORKED SENSING Further Investigations of Energy Balance 1.Sap flow theory and sensors 1.Visit sap flow tree to see installation.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
CENTER FOR EMBEDDED NETWORKED SENSING
Further Investigations of Energy Balance
1. Sap flow theory and sensors
1. Visit sap flow tree to see installation
2. Lucas downloads sap flow data wirelessly
2. Henry presents R Survey
3. More energy balance equations!
4. Modeling sub-surface soil temperatures:
1. Analytical model
2. Damping depth
3. Fourier Transforms for periodic data
CENTER FOR EMBEDDED NETWORKED SENSING
Science Motivation
1. CO2 fluxes that are observed in forest soil environments are spatially and temporally heterogeneous and are difficult to predict, influencing estimates of total carbon fluxes of forests (Davidson et al. 1998; Trumbore 2006).
2. Thermal environments in soils along costal areas influence the composition of algae, plant, and animal communities (Whitecraft and Levin 2007; Bortolus et al., 2002)
Being able to model and predict sub-surface soil temperatures will allow us to better understand the interactions of temperature with the biological components of the soil. For instance:
CENTER FOR EMBEDDED NETWORKED SENSING
Science Motivation
Surface measurements are much more easy to conduct than sub-surface measurements with buried probes.
Because the soil surface temperature depends on periodic energy inputs, we should be able to measure a few parameters, then calculate the soil temperatures at depth using a Fourier series and an analytical model.
A Fourier series decomposes a periodic function or periodic signal into a sum of simple sines and cosines.
“Fourier series were introduced by Joseph Fourier (1768–1830) for the purpose of solving the heat equation in a metal plate. It led to a revolution in mathematics…”
(solar) (change in temp) (air/water) (evaporation)
CENTER FOR EMBEDDED NETWORKED SENSING
Soil Temperature
Soil temperatures decrease in amplitude and shift in time with depth.
Different locations with different solar input (shading) will have different water content and soil characteristics. These differences will result in different “damping depths”, the parameter that describes the attenuation and delay of the daily temperature peak.
CENTER FOR EMBEDDED NETWORKED SENSING
First Approximation – a sine wave
CENTER FOR EMBEDDED NETWORKED SENSING
Modeling Sub-surface Temperatures
d
z
p
t
p
teTTT dzsurfsurf
zmax/ 22
cos
CENTER FOR EMBEDDED NETWORKED SENSING
Modeling Sub-surface Temperatures
d
z
p
t
p
teTTT dzsurfsurf
zmax/ 22
cos
• z is the depth at which we want to model temperature.• is the average temperature at the surface• is the amplitude of the temperature fluctuation• d is the damping depth• t is the time• p is the period• tmax is the time at which the surface temperature wave
is at its maximum.
surfTsurfT
CENTER FOR EMBEDDED NETWORKED SENSING
Modeling Sub-surface Temperatures
d
z
p
t
p
teTTT dzsurfsurf
zmax/ 22
cos
• z is the depth at which we want to model temperature.• is the average temperature at the surface• is the amplitude of the temperature fluctuation• d is the damping depth• t is the time• p is the period• tmax is the time at which the surface temperature wave
is at its maximum.
surfTsurfT
CENTER FOR EMBEDDED NETWORKED SENSING
Calculating damping depth based on decrease in amplitude and phase shifts
JR soil Avg. T (°C)
T max(°C)
Amplitude (°C)
e-1 damp(37%)
time for max (d)
Surface 27.18 72.60 30.95 26.71 1.58428
8 cm depth 23.52 33.13 8.44 12.19 1.65270
Modeling Sub-surface Temperatures
dzeTT /surfcm8 Decrease in amplitude (damping)
d
z
p
t
2
Phase shift (delay)
CENTER FOR EMBEDDED NETWORKED SENSING
cm16.6)ln()ln(
-
s8
d
TT
zd
cm61.18)58428.16527.1(2
81
2
dt
zpd
Modeling Sub-surface Temperatures
Calculating damping depth based on decrease in amplitude and phase shifts
JR soil Avg. T (°C)
T max(°C)
Amplitude (°C)
e-1 damp(37%)
time for max (d)
Surface 27.18 72.60 30.95 26.71 1.58428
8 cm depth 23.52 33.13 8.44 12.19 1.65270
CENTER FOR EMBEDDED NETWORKED SENSING
Modeling Sub-surface Temperatures
22 Cd
Damping depth can also be calculated from soil physical properties.
Example here is dry soil from a temperate forest.
Damping depth is related to frequency of the temperature pulse ( = 2π/period) and:
Damping depth can also be calculated from a finite difference equation, provided enough data:
Example sine waves (time interval is 0.5 minutes between temperature readings). n is the sequential measurement and j is the depth of that measurement.
Use R to fit the data to the model (we will fit data to a model a little later).
Parameters: Estimate Std. Error t value Pr(>|t|)
= 7.796e-06 7.939e-09 982 <2e-16 *** d = 14.64 cm
CENTER FOR EMBEDDED NETWORKED SENSING
Fourier Transforms
Fourier frequency decomposition.
A Fourier transform will take a signal and decompose it into a series of superimposed sine waves, each with a shorter period (higher frequency) and each with a magnitude that determines the sine wave’s influence on the original signal.
CENTER FOR EMBEDDED NETWORKED SENSING
Fourier Transforms
tnbtnaFtf nn
n 01
00 sin)2(cos)2()(
CENTER FOR EMBEDDED NETWORKED SENSING
Fourier Transforms
tnbtnaFtf nn
n 01
00 sin)2(cos)2()(
CENTER FOR EMBEDDED NETWORKED SENSING
Fourier Transforms
CENTER FOR EMBEDDED NETWORKED SENSING
PASI Soil Temperature Exercise #1
• Look at some built-in R time series functions.• Explore some visualizations in R.• Fourier Transform the data near the surface and reconstruct
the temperature signal for a check of the method.• Estimate damping depth using a few methods.• Apply the analytical equation with damping depth to a Fourier
series to predict sub-surface temperatures.• Calculate the heat stored and lost in a daily and annual cycle.
Practice with one year of soil temperature data from Puerto Cuatreros, provided by Cintia.
Exercise: Explore the data that Cintia provided on Tuesday, estimating damping depths and calculating heat lost and stored and soil heat flux.
CENTER FOR EMBEDDED NETWORKED SENSING
R – an Integrated Statistical Package
R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS.
www.r-project.org
Program installation should be on the server for both Mac OS X and for Windows
CENTER FOR EMBEDDED NETWORKED SENSING
R – Install and change working directory
After R is installed, copy the files included in the subdirectory “R” on the CD to your hard drive.
Next, start R and then change the working directory to the subdirectory you just copied onto your hard drive.
We are now ready to start playing in R!
R-sig-ecology list serve:https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
CENTER FOR EMBEDDED NETWORKED SENSING
Puerto Cuatreros Soil Temperature DataCommands in black
Comments in green
Output in blue
R Cursor in red
CENTER FOR EMBEDDED NETWORKED SENSING
Puerto Cuatreros Soil Temperature Data
> temps = read.table(file=file.choose(), header=TRUE, sep=",")
## navigate to the file, composite_data_set_interpolated.csv and click OK
## display first 10 rows; data in the array are [rows, columns]
CENTER FOR EMBEDDED NETWORKED SENSING
> attach(temps)> summary(temps)
Fecha Hora running_time T_sed_25cm T_sed_5cm… Min. :37622 Min. :37622 Min. : 1.00 Min. : 4.86 Min. :-0.800 1st Qu.:37713 1st Qu.:37713 1st Qu.: 92.25 1st Qu.: 9.70 1st Qu.: 9.168 Median :37804 Median :37804 Median :183.50 Median : 15.54 Median :15.020 Mean :37804 Mean :37804 Mean :183.50 Mean : 14.66 Mean :14.432 3rd Qu.:37896 3rd Qu.:37896 3rd Qu.:274.74 3rd Qu.: 19.60 3rd Qu.:19.610 Max. :37987 Max. :37987 Max. :365.99 Max. :1081.83 Max. :31.920
> T_aire_agua_5cm[1:10] ## use column names to explore the data
> plot(running_time, T_sed_5cm)
## plot the first column (day) vs. surface temperature
Puerto Cuatreros Soil Temperature Data
## get summary statistics for each column## “attach” the data so we can use column names
“Traditional” Seasonal-Trend Decomposition (STL)Seasonal effects tend to obscure the trends and short term variation present in a time series. A time series can be considered to comprise three components: a trend component T (m), a seasonal component S(m) and a remainder R(m), sometimes referred to as the irregular component:
Y (m) = T (m) + S(m) + R(m)
Where Y (m) is the time series of interest. This is often used in predicting trends in stock markets or housing prices.
The locally weighted regression smoothing technique (Loess) developed by Cleveland (1979) has been widely used in data analysis. The STL method consists of a series of applications of a Loess smoother with different moving window widths chosen to extract different frequencies within a time series.
Time-series Data in R - decomposition
Cleveland, W. S.: Robust Locally Weighted Regression And Smoothing Scatterplots, JournalOf The American Statistical Association, 74(368), 829–836, 1979.
CENTER FOR EMBEDDED NETWORKED SENSING
Measurements were recorded once every 10 min, so we will consider these data on a daily-cycle.
Turn a week of data into an R time series object:
> data_week = ts(T_sed_5cm[which(running_time ==190):+ which(running_time == 197)], freq=144) ## “seasonal” window of 1 day
> data_year = ts(T_sed_5cm,freq=144) ## turn a year of data into a time series
• z is the depth at which we want to model temperature.• is the average temperature at the surface• is the amplitude of the temperature fluctuation• d is the damping depth for a specific period• t is the time• p is the Fourier period• tmax is the time at which the surface temperature wave
is at its maximum.
surfTsurfT
CENTER FOR EMBEDDED NETWORKED SENSING
Modeling Sub-surface Temperatures
ωκ2
ωλ2 Cd
What is the damping depth?
Example here is tidal flat soil (Beigt et al. 2003) with of about 3.78 × 10-7 .
Damping depth is related to frequency of the temperature pulse ( = 2π/period) and:
Estimate Std. Error t value Pr(>|t|) k 1.253e-06 2.476e-08 50.61 <2e-16 ***
2)(
bigTdT
zt
CENTER FOR EMBEDDED NETWORKED SENSING
Modeling Sub-surface Temperatures
22 Cd
Damping depth from the finite difference model and the relationship between damping depth and thermal diffusivity (and thermal conductivity and volumetric heat capacity):
> k = as.numeric(coef(model))> sqrt(2 * k / (2 * pi / 86400))
[1] 0.1856545
Which equals 18.5 cm for a 24 h damping depth
CENTER FOR EMBEDDED NETWORKED SENSING
Modeling Sub-surface Temperatures
d
z
p
t
p
teTTT dzsurfsurf
zmax/ 22
cos
Damping depth can also be calculated using a period of the Fourier decomposition for two different depths. Let’s use the week’s worth of data from before:
> T_5_7d_fft = fft(T_5_7d) ## get the Fourier transform for the 5 cm depth> T_15_7d_fft = fft(T_15_7d)
## get the single day component> n = 8> T_5_7d_trans = ((2 * Re(T_5_7d_fft[n+1]) * cos(omega * n * week_time)) -+ (2 * Im(T_5_7d_fft[n+1]) * sin(omega * n * week_time))) / length(T_5_7d_fft)
Each Fourier transform starts at time = 0, so if there is a delay or shift in time between different Fourier transforms, then we need to add that back in.
We used d = 18.56 cm, which istoo big. Plus an absolute value shift.
Use d = 12 as a next guess,(k = 0.5e-6), and move up by 1°Cbecause of multi-day trends that arenot represented:
> summation = summation + 1
Modeling Sub-surface Temperatures
CENTER FOR EMBEDDED NETWORKED SENSING
Modeling Sub-surface Temperatures
CENTER FOR EMBEDDED NETWORKED SENSING
Exercise: Explore the data that Cintia provided on Tuesday, estimating damping depths and calculating heat lost and stored and soil heat flux. Data has been put into one file and missing data have been interpolated: St_all_data.csv
Let’s determine:
1. Damping depth using…?
2. Model sub-surface temperatures from surface measurements (using 5 cm estimate 15 cm and using 25 cm estimate 50 cm).1. Fourier transform the shallow depth.2. Apply the analytical model for the first n frequencies.3. Plot against the actual values.
3. Calculate heat stored in the soil down to 25 cm and 50 cm.
4. Calculate the heat flux at 5 cm using 50 cm estimated temperatures.
11 CmW
soilp
soilsurface K
t
TZC
z
TKG
CENTER FOR EMBEDDED NETWORKED SENSING
Modeling Sub-surface Temperatures
CENTER FOR EMBEDDED NETWORKED SENSING
We modeled the 5 cm depth using Fourier transformed data and then reconstructed (in the red).
We will now take each component sine wave of the reconstruction and apply the sub-surface prediction model to it. Then we will sum them up and see how well the model did at predicting temperature at 15 cm.
Modeling Sub-surface Temperatures
CENTER FOR EMBEDDED NETWORKED SENSING
This is how we reconstructed it last time:Sum the first 25 elements (up to a ¼ day cycle):
Now the estimated temperature and the actual sub-sufrace temperature have similar magnitudes (good) and the predicted values are delayed at a more reasonable value.
For such a short time period, multi-day patterns influence the signals and the structure is not as matched as desirable... but it’s not horrible….
CENTER FOR EMBEDDED NETWORKED SENSING
Light (PAR) sensing
CENTER FOR EMBEDDED NETWORKED SENSING
$6000
$15 $320
Light (PAR) sensing
CENTER FOR EMBEDDED NETWORKED SENSING
Soil Temperature Sensing
CENTER FOR EMBEDDED NETWORKED SENSING
Soil surface energy example
CENTER FOR EMBEDDED NETWORKED SENSING
Soil surface energy example
Data for 24 h on July 16, 2007 along a 10.75 m transect in a temperate forest:
(A) measured soil surface temperatures every 0.25 m.
(B) measured (indicated with arrows) and calculated soil temperatures at 8 cm depth using the soil model and Fourier transforms.
(C) calculated soil heat flux at the surface.
(D) calculated heat storage between the surface and 8 cm depth.
CENTER FOR EMBEDDED NETWORKED SENSING
Soil surface energy example
Data for 24 h on March 3, 2008 along the same 10.75 m transect:
(A) measured soil surface temperatures every 0.25 m.
(B) measured (indicated with arrows) and calculated soil temperatures at 8 cm depth using the soil model and Fourier transforms.
(C) calculated soil heat flux at the surface.
(D) calculated heat storage between the surface and 8 cm depth.
CENTER FOR EMBEDDED NETWORKED SENSING
Thermistors:
• Accurate over a wide temperature range.• Good stability over a long life.• Excellent price/performance ratio (they’re cheap).• Low heat conductivity through small diameter leads (depends on application).
Calibration:
• Steinhart-Hart equation• Polynomial
Temperature sensing
CENTER FOR EMBEDDED NETWORKED SENSING
Temperature sensing
fixedthermistor
thermistorinout RR
RVV
Vout
Vin
CENTER FOR EMBEDDED NETWORKED SENSING
Temperature sensing
CENTER FOR EMBEDDED NETWORKED SENSING
Temperature sensing
CENTER FOR EMBEDDED NETWORKED SENSING
Temperature sensing
CENTER FOR EMBEDDED NETWORKED SENSING
Soil Heat Flux
Soil heat flux at the surface can be based upon:
• The heat flux at some depth (measured with a heat flux plate) and the volumetric heat capacity of soil, or
• A temperature difference in the soil and the thermal conductivity and volumetric heat capacity of the soil.