muse2/simulation/investment/appraisal/
costs.rs

1//! Costs for the optimisation problem.
2use crate::asset::{AssetRef, AssetState};
3use crate::units::{MoneyPerCapacity, Year};
4
5/// Calculates the annual fixed costs per unit of capacity for an asset.
6///
7/// The behaviour depends on whether the asset is commissioned or a candidate:
8/// - For a commissioned asset, this only includes operating costs.
9/// - For a candidate asset, this includes both operating and capital costs.
10///
11/// The return value is the annualised fixed cost expressed as `MoneyPerCapacity`.
12/// If `asset.state()` is neither `Commissioned` nor `Candidate` this function will panic.
13pub fn annual_fixed_cost(asset: &AssetRef) -> MoneyPerCapacity {
14    match asset.state() {
15        AssetState::Commissioned { .. } => annual_fixed_cost_for_existing(asset),
16        AssetState::Candidate => annual_fixed_cost_for_candidate(asset),
17        _ => {
18            panic!("annual_fixed_cost should only be called with Commissioned or Candidate assets")
19        }
20    }
21}
22
23fn annual_fixed_cost_for_existing(asset: &AssetRef) -> MoneyPerCapacity {
24    let fixed_operating_cost = asset.process_parameter().fixed_operating_cost;
25    fixed_operating_cost * Year(1.0)
26}
27
28fn annual_fixed_cost_for_candidate(asset: &AssetRef) -> MoneyPerCapacity {
29    let fixed_operating_cost = asset.process_parameter().fixed_operating_cost;
30    let annual_fixed_operating_cost = fixed_operating_cost * Year(1.0);
31    let capital_costs = asset.get_annual_capital_cost_per_capacity();
32    annual_fixed_operating_cost + capital_costs
33}