energyCosts.Rd
A function that for a given world of possible movement calculates
the transition cost for each in terms of a pre-defined time, work, and energy
cost functions. energyCosts
calls timeCosts
if columns
named 'dt'
and 'dl_t'
are not present in the input data.table
timeCosts(DT, v_max, k, s, row_speed = NULL, water = FALSE)
energyCosts(
DT,
method = "kuo",
m = NULL,
BMR = NULL,
g = 9.81,
epsilon = 0.2,
l_s = NULL,
L = NULL,
gamma = NULL,
time = timeCosts,
water = FALSE,
row_work = NULL,
...
)
A data.table containing at minimum columns 'dz' representing the change in elevation and 'dl' representing planimetric distance
The maximum velocity of the animal moving across the landscape,
in meters per second; see getVelocity
.
The topographic sensitivity factor; see getVelocity
.
The dimensionless slope of maximum velocity;
see getVelocity
.
How fast can a person move over water? Default is row_speed = NULL
,
but required if water
are provided.
Logical. If FALSE
(the default), movement costs are calculated
as if over land. If water = TRUE
, movement costs are calculated considering
moving water.
A character string for the method that energy costs per
unit stride should be calculated. One of method %in% c('kuo','heglund','oscillator')
;
see references.
The mass of the animal moving across the landscape, in kilograms.
The base metabolic rate of the object moving across the landscape in Joules per second.
The acceleration due to gravity, in meters per second per second.
Default is g = 9.81
m/s^2, as for the surface of planet Earth.
The biomechanical efficiency factor for an animal moving across
the landscape. Default is epsilon = 0.2
.
The average stride length, in meters. Required for
method = 'kuo'
or 'oscillator'
, ignored for 'heglund'
The average leg length. Required for method = 'kuo'
,
ignored for 'heglund'
and 'oscillator'
.
The fractional maximal deviation from average velocity per stride.
Required for method = 'oscillator'
, ignored for 'kuo'
and 'heglund'
.
The method by which time costs should be calculated by energyCosts
should c('dt','dl_t')
not be column names in the input data.table.
Default is time = timeCosts
.
How much work in joules per second does a person use to move over water?
Default is row_work = NULL
, but required if water
is provided.
Additional parameters to pass to timeCosts
For timeCosts
, A data.table object with two columns:
(1) $dl_t
The predicted walking speed in meters per second
when walking between the from
and to
cells
(2) $dt
The predicted amount of time spent walking between
the from
and to
cells
For energyCosts
, a data.table object with five columns:
(1) $dt
The predicted amount of time spent walking between
the from
and to
cells
(2) $dU_l
The predicted work against gravitational potential energy
in Joules when walking between the from
and to
cells
(3) $dK_l
The predicted kinematic work in Joules when walking
between the from
and to
cells
(4) $dW_l
The total predicted energy lost due to biomechanical
work when walking between the from
and to
cells.
(5) $dE_l
The net metabolic expenditure exerted when walking
between the from
and to
cells.
Heglund, N. C., Cavagna, G. A., and Taylor, C. R. (1982). "Energetics and mechanics of terrestrial locomotion. III. Energy changes of the centre of mass as a function of speed and body size in birds and mammals." Journal of Experimental Biology 97(1):41-56. https://doi.org/10.1242/jeb.97.1.41. Kuo, Arthur D. (2007). "The six determinants of gait and the inverted pendulum analogy: A dynamic walking perspective." Human Movement Science 26(4):617-656. https://doi.org/10.1016/j.humov.2007.04.003.
# Generate a DEM
n <- 5
dem <- expand.grid(list(x = 1:(n * 100),
y = 1:(n * 100))) / 100
dem <- as.data.table(dem)
dem[, z := 250 * exp(-(x - n/2)^2) +
250 * exp(-(y - n/2)^2)]
#> x y z
#> 1: 0.01 0.01 1.0146139
#> 2: 0.02 0.01 1.0404641
#> 3: 0.03 0.01 1.0675194
#> 4: 0.04 0.01 1.0958300
#> 5: 0.05 0.01 1.1254477
#> ---
#> 249996: 4.96 5.00 1.0711366
#> 249997: 4.97 5.00 1.0428260
#> 249998: 4.98 5.00 1.0157707
#> 249999: 4.99 5.00 0.9899205
#> 250000: 5.00 5.00 0.9652271
dem <- rast(dem)
ext(dem) <- c(10000, 20000, 30000, 40000)
crs(dem) <- "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100 +datum=WGS84"
# Export it so it doesn't just exist on the memory
dir <- tempdir()
writeRaster(dem, paste0(dir,"/DEM.tif"),overwrite=TRUE)
# Import raster, get the grid
dem <- rast(paste0(dir,"/DEM.tif"))
grid <- makeGrid(dem = dem, nx = n, ny = n, sources = TRUE)
# Select all tiles that exist between x = (12000,16000) and y = (32000,36000)
tiles <- ext(c(12000,16000,32000,36000))
tiles <- as.polygons(tiles)
crs(tiles) <- crs(grid)
tiles <- whichTiles(region = tiles, polys = grid)
# Make a world but limit it to the DEM grid size
defineWorld(source = grid, cut_slope = 0.5,
res = res(dem), dir = dir, overwrite=TRUE)
# Calculate the energetic and temporal costs
calculateCosts(costFUN = energyCosts,
tiles = tiles, dir = dir,
m = 70, v_max = 1.5, BMR = 76, k = 3.5, s = 0.05, l_s = 1,
L = 0.8)
#> [1] "Cropping Tile SECTOR_01 (1 of 4)"
#> [1] "Cropping Tile SECTOR_02 (2 of 4)"
#> [1] "Cropping Tile SECTOR_06 (3 of 4)"
#> [1] "Cropping Tile SECTOR_07 (4 of 4)"
#> [1] "Cropping Tile SECTOR_03 (1 of 2)"
#> [1] "Cropping Tile SECTOR_08 (2 of 2)"
#> [1] "Cropping Tile SECTOR_11 (1 of 2)"
#> [1] "Cropping Tile SECTOR_12 (2 of 2)"
#> [1] "Cropping Tile SECTOR_13 (1 of 1)"
#> [1] "Cropping Tile SECTOR_16 (1 of 2)"
#> [1] "Cropping Tile SECTOR_17 (2 of 2)"
#> [1] "Cropping Tile SECTOR_18 (1 of 1)"
#> [1] "Cropping Tile SECTOR_09 (1 of 3)"
#> [1] "Cropping Tile SECTOR_14 (2 of 3)"
#> [1] "Cropping Tile SECTOR_19 (3 of 3)"
#> [1] "Cropping Tile SECTOR_21 (1 of 2)"
#> [1] "Cropping Tile SECTOR_22 (2 of 2)"
#> [1] "Cropping Tile SECTOR_23 (1 of 1)"
#> [1] "Cropping Tile SECTOR_04 (1 of 1)"
#> [1] "Cropping Tile SECTOR_05 (1 of 2)"
#> [1] "Cropping Tile SECTOR_10 (2 of 2)"
#> [1] "Cropping Tile SECTOR_15 (1 of 1)"
#> [1] "Cropping Tile SECTOR_24 (1 of 1)"
#> [1] "Cropping Tile SECTOR_20 (1 of 1)"
#> [1] "Cropping Tile SECTOR_25 (1 of 1)"