energyCosts: Calculate time and energy costs

energyCostsR Documentation

Calculate time and energy costs

Description

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

Usage

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,
  ...
)

Arguments

DT

A data.table containing at minimum columns 'dz' representing the change in elevation and 'dl' representing planimetric distance

v_max

The maximum velocity of the animal moving across the landscape, in meters per second; see getVelocity.

k

The topographic sensitivity factor; see getVelocity.

s

The dimensionless slope of maximum velocity; see getVelocity.

row_speed

How fast can a person move over water? Default is row_speed = NULL, but required if water are provided.

water

Logical. If FALSE (the default), movement costs are calculated as if over land. If water = TRUE, movement costs are calculated considering moving water.

method

A character string for the method that energy costs per unit stride should be calculated. One of method %in% c('kuo','heglund','pontzer','oscillator'); see references.

m

The mass of the animal moving across the landscape, in kilograms.

BMR

The base metabolic rate of the object moving across the landscape in Joules per second.

g

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.

epsilon

The biomechanical efficiency factor for an animal moving across the landscape. Default is epsilon = 0.2.

l_s

The average stride length, in meters. Required for method = 'kuo', 'pontzer' or 'oscillator', ignored for 'heglund'

L

The average leg length. Required for method = 'kuo', ignored for 'heglund', 'pontzer' and 'oscillator'.

gamma

The fractional maximal deviation from average velocity per stride. Required for method = 'oscillator', ignored otherwise

time

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.

row_work

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

Value

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.

References

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. \Sexpr[results=rd]{tools:::Rd_expr_doi("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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.humov.2007.04.003")}.

Pontzer, Herman (2023). "Correction: 'A unified theory for the energy cost of legged locomotion' (2016), by Pontzer" Biology Letters 19(12): 20230492. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1098/rsbl.2023.0492")}

Examples

# 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)]
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)

andresgmejiar/lbmech documentation built on Feb. 2, 2025, 12:37 a.m.