Skip to contents

Main function that processes and validates all species parameters, calculating derived parameters and preparing them for simulation.

Usage

process_species_parameters(species_params, n_days = NULL)

Arguments

species_params

Raw species parameters from user

n_days

Integer. Number of simulation days, used to build the predator energy density vector when `ED_ini`/`ED_end` are supplied (PREDEDEQ = 1). If `NULL` the vector length is inferred later.

Value

A named list containing one processed sub-list for each category present in species_params (e.g. consumption, respiration, egestion, excretion, predator, and optionally contaminant, nutrient, mortality, composition). Each sub-list holds the validated raw parameters plus any derived values required by the chosen equation. A processing_info element is always appended containing processed_at (POSIXct timestamp), validation_warnings (character vector), and categories_processed (character vector of processed category names).

Examples

sp <- list(
  consumption = list(CEQ = 1, CA = 0.303, CB = -0.275, CQ = 0.06),
  egestion    = list(EGEQ = 1, FA = 0.16),
  excretion   = list(EXEQ = 1, UA = 0.10),
  predator    = list(PREDEDEQ = 3, Alpha1 = 4800, Beta1 = 0.1),
  respiration = list(REQ = 2, RA = 0.0033, RB = -0.227,
                     RQ = 0.025, RTM = 30, RTO = 18),
  activity    = list(ACT = 1.5),
  sda         = list(SDA = 0.15)
)
process_species_parameters(sp)
#> $consumption
#> $consumption$CEQ
#> [1] 1
#> 
#> $consumption$CA
#> [1] 0.303
#> 
#> $consumption$CB
#> [1] -0.275
#> 
#> $consumption$CQ
#> [1] 0.06
#> 
#> 
#> $respiration
#> $respiration$REQ
#> [1] 2
#> 
#> $respiration$RA
#> [1] 0.0033
#> 
#> $respiration$RB
#> [1] -0.227
#> 
#> $respiration$RQ
#> [1] 0.025
#> 
#> $respiration$RTM
#> [1] 30
#> 
#> $respiration$RTO
#> [1] 18
#> 
#> $respiration$ACT
#> [1] 1.5
#> 
#> $respiration$SDA
#> [1] 0.15
#> 
#> $respiration$RY
#> [1] -51.64431
#> 
#> $respiration$RZ
#> [1] -44.26655
#> 
#> $respiration$RX
#> [1] 10.65566
#> 
#> 
#> $egestion
#> $egestion$EGEQ
#> [1] 1
#> 
#> $egestion$FA
#> [1] 0.16
#> 
#> 
#> $excretion
#> $excretion$EXEQ
#> [1] 1
#> 
#> $excretion$UA
#> [1] 0.1
#> 
#> 
#> $predator
#> $predator$PREDEDEQ
#> [1] 3
#> 
#> $predator$Alpha1
#> [1] 4800
#> 
#> $predator$Beta1
#> [1] 0.1
#> 
#> 
#> $processing_info
#> $processing_info$processed_at
#> [1] "2026-06-10 23:20:24 -04"
#> 
#> $processing_info$validation_warnings
#> character(0)
#> 
#> $processing_info$categories_processed
#> [1] "consumption" "respiration" "egestion"    "excretion"   "predator"   
#> 
#>