Skip to contents

Calculate cost of the simulated collective treatment train

Usage

collective_treatment_cost_calculation(scenario, grant, allocation_key = NULL)

Arguments

scenario

data.frame scenario with irrigation_need_m3an column obtained with irrigation_need_calculation

grant

numeric amount of the grant in percentage

allocation_key

data.frame allocation key, NULL by default

Value

cost

Examples

scenario_apprentissage <- create_scenario(
  system.file("input_1culture_2pop.xlsx", package = "ambre")
)
irrigation_need <- irrigation_need_calculation(scenario_apprentissage)
collective_treatment_cost_calculation(scenario = irrigation_need, 
                                      grant = 0.5)
#> $scenario
#> # A tibble: 2 × 30
#>   CropName   Area PopulationName    nb_population PathName     STEPtreatmentName
#>   <chr>     <dbl> <chr>                     <dbl> <chr>        <chr>            
#> 1 Tomato       10 Irrigation staff              1 Ingestion o… Q.1 - Activated …
#> 2 Corn seed    35 Maintenance staff             1 Ingestion f… Q.1 - Activated …
#> # ℹ 24 more variables: CollectiveTreatmentName <chr>, InitialProcessName <chr>,
#> #   SupplementaryProcessName <chr>, nb_day_decay <dbl>, config <list>,
#> #   CropID <dbl>, CropHeight <dbl>, PopulationID <dbl>, PathID <dbl>,
#> #   MatrixID <dbl>, STEPtreatmentID <list>, CollectiveTreatmentID <list>,
#> #   InitialProcessID <list>, SupplementaryProcessID <list>,
#> #   InitialTrainName <list>, InitialTrainID <list>,
#> #   SupplementaryTrainName <list>, SupplementaryTrainID <list>, …
#> 
#> $allocation_key
#>   grant  CropName allocation
#> 1   0.5    Tomato     0.1111
#> 2   0.5 Corn seed     0.3889
#> 

crop <- scenario_apprentissage$CropName |> unique()
allocation_custom <- data.frame(CropName = crop,
                                allocation = c(0.5, 0.1, 0.1, 0.1, 0.1, 0.1))
collective_treatment_cost_calculation(scenario = irrigation_need, 
                                      grant = 0,
                                      allocation_key = allocation_custom)
#> $scenario
#> # A tibble: 6 × 30
#>   CropName   Area PopulationName    nb_population PathName     STEPtreatmentName
#>   <chr>     <dbl> <chr>                     <dbl> <chr>        <chr>            
#> 1 Tomato       10 Irrigation staff              1 Ingestion o… Q.1 - Activated …
#> 2 Tomato       10 Irrigation staff              1 Ingestion o… Q.1 - Activated …
#> 3 Tomato       10 Irrigation staff              1 Ingestion o… Q.1 - Activated …
#> 4 Corn seed    35 Maintenance staff             1 Ingestion f… Q.1 - Activated …
#> 5 Corn seed    35 Maintenance staff             1 Ingestion f… Q.1 - Activated …
#> 6 Corn seed    35 Maintenance staff             1 Ingestion f… Q.1 - Activated …
#> # ℹ 24 more variables: CollectiveTreatmentName <chr>, InitialProcessName <chr>,
#> #   SupplementaryProcessName <chr>, nb_day_decay <dbl>, config <list>,
#> #   CropID <dbl>, CropHeight <dbl>, PopulationID <dbl>, PathID <dbl>,
#> #   MatrixID <dbl>, STEPtreatmentID <list>, CollectiveTreatmentID <list>,
#> #   InitialProcessID <list>, SupplementaryProcessID <list>,
#> #   InitialTrainName <list>, InitialTrainID <list>,
#> #   SupplementaryTrainName <list>, SupplementaryTrainID <list>, …
#> 
#> $allocation_key
#>   grant  CropName allocation
#> 1     0    Tomato        0.5
#> 2     0    Tomato        0.1
#> 4     0 Corn seed        0.1
#>