Skip to contents

Update the log reduction value for the decay barrier according to crop and population simulated

Usage

update_logreduction_decay(config, cropHeight, popID, barrierID, nb_day_decay)

Arguments

config

list configuration simulated

cropHeight

numeric, height of th crop simulated

popID

numeric, ID of the population simulated

barrierID

numeric, ID of the barrier simulated

nb_day_decay

numeric, number of day of natural decay for the simulated crop

Value

config_updated

Examples

scenario_example <- create_scenario(
  system.file("input_1culture_2pop.xlsx", package = "ambre")
)

scenario_example$config <- purrr::pmap(
  list(
    config = scenario_example$config,
    barrierID = scenario_example$SupplementaryProcessID,
    cropHeight = scenario_example$CropHeight,
    popID = scenario_example$PopulationID,
    decay = scenario_example$nb_day_decay
    
  ),
  function(config, barrierID, cropHeight, popID, decay) {

    if (barrierID %in% c(12)) {

      update_logreduction_decay(
        config = config,
        cropHeight = cropHeight,
        barrierID = barrierID,
        popID = popID,
        nb_day_decay = decay
      )

    } else {
      config
    }
  }
)