Skip to contents

This function sets the metabolic respiration rate so that the total consumption matches the parameter consumption_observed for each species. The function preserves the energy available for growth and reproduction by increasing external encounter rates to compensate for changes in metabolic loss.

Usage

matchConsumption(params, species = NULL)

Arguments

params

A MizerParams object

species

A vector of species names or indices. If NULL, applies to all species with a provided consumption_observed. #' @return A MizerParams object with adjusted encounter and metabolic respiration rates.

Details

Thus the function also adjusts the external encounter rate to compensate for the changed respiration rate. To do this the function assumes that both the encounter rate and the metabolic respiration rate are given by power laws with the same exponent n, so it sets the species parameter p to the same value as n. A warning is issued if the exponent p had to be changed for any species.

Any of the selected species for which consumption_observed is NA will be quietly ignored.

If the resulting metabolic loss rate is less than 10% of the production rate, the function will set the metabolic loss rate to 10% of the production rate and issue a warning.

Unless the function issues a warning that it has changed p, the energy available for growth and reproduction is not changed and hence the steady state spectra are also unchanged.

Examples

params <- matchConsumption(celtic_params)
# The consumption now matches the observation
all.equal(getConsumption(params),
          species_params(params)$consumption_observed,
          check.attributes = FALSE)
#> [1] TRUE
# The energy available for growth and reproduction is not changed
all.equal(getEReproAndGrowth(params),
          getEReproAndGrowth(celtic_params))
#> [1] TRUE