cost_eco_model_linker.cost_calculations¶
Attributes¶
Functions¶
|
Calculate number of input Sobol samples, N, given number of total simulations required and number of factors. |
|
Calculate key cost codes: |
|
Initialize dataframe for storing sampled cost data. |
|
Sample cost model parameters. |
|
Update sampled cost model parameter dataframes with intervention specific parameters. |
|
Determine the number of devices to be produced and deployed in the years after the |
|
Sample costs for a set of interventions specified in ID_key, sampling nsims. |
Module Contents¶
- cost_eco_model_linker.cost_calculations.THIS_DIR¶
- cost_eco_model_linker.cost_calculations.get_NK(nsims, n_factors)¶
Calculate number of input Sobol samples, N, given number of total simulations required and number of factors. Want an output number of samples, N*K , as close to the required number of sims as possible, where K = (2*n_factors + 2). See https://salib.readthedocs.io/en/latest/api.html#sobol-sensitivity-analysis
- cost_eco_model_linker.cost_calculations.cost_types(cost, contingency, nsims)¶
Calculate key cost codes: - 1 : CAPEX, sum of production and deployment cost - 2 : Contingency CAPEX, % of CAPEX - 3 : OPEX, sum of production and deployment cost - 4 : Sustaining capital OPEX, set to zero for now (assumed to be included in OPEX through contract) - 5 : Contingency OPEX, % of OPEX - 6 : Vessel fuel, only relevant if volunteer vessels are used - set to zero for now - 7 : CAPEX-monitoring, set to zero (assumed no monitoring cost) - 8 : Contingency CAPEX-monitoring, % of CAPEX-monitoring - 9 : OPEX-monitoring, set to zero (assumed no monitoring cost) - 10 : Sustaining capital OPEX-monitoring, set to zero (assumed no monitoring cost) - 11 : Contingency OPEX-monitoring, % of OPEX-monitoring
- Parameters:
cost (dataframe) – Dataframe containing ‘capex’ and ‘opex’
contingency (float) – Contingency proportion.
nsims (int) – Total number of simulations (from metrics sampling)
- cost_eco_model_linker.cost_calculations.initialize_cost_df(years, nsims)¶
Initialize dataframe for storing sampled cost data.
Components: - 1 : CAPEX, sum of production and deployment cost - 2 : Contingency CAPEX, % of CAPEX - 3 : OPEX, sum of production and deployment cost - 4 : Sustaining capital OPEX, set to zero for now (assumed to be included in OPEX through contract) - 5 : Contingency OPEX, % of OPEX - 6 : Vessel fuel, only relevant if volunteer vessels are used - set to zero for now - 7 : CAPEX-monitoring, set to zero (assumed no monitoring cost) - 8 : Contingency CAPEX-monitoring, % of CAPEX-monitoring - 9 : OPEX-monitoring, set to zero (assumed no monitoring cost) - 10 : Sustaining capital OPEX-monitoring, set to zero (assumed no monitoring cost) - 11 : Contingency OPEX-monitoring, % of OPEX-monitoring
- Parameters:
years (np.array) – Intervention years
nsims (int) – Total number of simulations (from metrics sampling)
- Returns:
cost_df
- Return type:
dataframe
- cost_eco_model_linker.cost_calculations.sample_cost_model(nsims)¶
Sample cost model parameters.
- Parameters:
nsims (int) – Total number of simulations (from metrics sampling)
- Returns:
factor_specs_dep (dict) – Factor specification for sampling factors in the deployment cost model.
factors_df_dep (dataframe) – Sampled factors for the deployment cost model.
factor_specs_prod (dict) – Factor specification for sampling factors in the production cost model.
factors_df_prod (dataframe) – Sampled factors for the production cost model
- cost_eco_model_linker.cost_calculations.update_factors(deploy_factors, prod_factors, iv_spec, ecol_idx, nsims)¶
Update sampled cost model parameter dataframes with intervention specific parameters.
- Parameters:
deploy_factors (dataframe) – Factors dataframe for the deployment cost model.
prod_factors (dataframe) – Factors dataframe for the production cost model
iv_spec (dataframe) – Intervention specification dataframe containing intervention parameters.
ecol_idx (int) – Indices mapping scenario IDs in the RME results to samples in nsims.
nsims (int) – Number of simulations drawn (may be smaller than dataframe size to get correct number of samples for Sobol Sampling).
- cost_eco_model_linker.cost_calculations.calc_production_requirement(deploy_factors, prod_factors, iv_spec, ecol_idx, nsims)¶
Determine the number of devices to be produced and deployed in the years after the first intervention year. Setup costs should only be accrued for additional corals deployed relative to the previous year.
- Parameters:
deploy_factors (dataframe) – Factors dataframe for the deployment cost model.
prod_factors (dataframe) – Factors dataframe for the production cost model
iv_spec (dataframe) – Intervention specification dataframe containing intervention parameters.
ecol_idx (int) – Indices mapping scenario IDs in the RME results to samples in nsims.
nsims (int) – Number of simulations drawn (may be smaller than dataframe size to get correct number of samples for Sobol Sampling).
- cost_eco_model_linker.cost_calculations.calculate_costs(stores: cost_eco_model_linker.setup_results.OutputStores, ID_key_fn: str, nsims: int, deploy_model_filepath: str, prod_model_filepath: str, cont_p: float = 0.25, p_iter_id: int = 0)¶
Sample costs for a set of interventions specified in ID_key, sampling nsims.
- Parameters:
stores (OutputStores) – Data class holding output directory locations
ID_key_fn (str) – Target filename for output.
nsims (int) – Total number of draws to sample cost models, should match ecological metrics sampling.
deploy_model_filepath (string) – Path to deployment cost model.
prod_model_filepath (string) – Path to production cost model.
cont_p (float) – Contingency cost proportion.
p_iter_id (int) – ID used for parallel sampling to keep track of batches for ordered recombination.