Skip to content

Commit

Permalink
match opex pre- and postprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
rosphil committed Dec 19, 2024
1 parent 93c230f commit ca2bc77
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
17 changes: 10 additions & 7 deletions revoletion/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ def extrapolate_opex(self):
observation_horizon=self.scenario.prj_duration_yrs,
discount_rate=self.scenario.wacc,
occurs_at='end')
self.opex_ann = eco.annuity_due_recur(nominal_value=self.opex_yrl,
observation_horizon=self.scenario.prj_duration_yrs,
discount_rate=self.scenario.wacc)
self.opex_ann = eco.annuity_recur(nominal_value=self.opex_yrl,
observation_horizon=self.scenario.prj_duration_yrs,
discount_rate=self.scenario.wacc)
self.scenario.opex_sim += self.opex_sim
self.scenario.opex_yrl += self.opex_yrl
self.scenario.opex_prj += self.opex_prj
Expand Down Expand Up @@ -319,7 +319,10 @@ def __init__(self, name, scenario):

# runtime factor to compensate for difference between simulation and project timeframe
# opex is uprated in importance for short simulations
self.factor_opex = (1 / self.scenario.sim_yr_rat) if scenario.compensate_sim_prj else 1
self.factor_opex = eco.annuity_recur(nominal_value=utils.scale_sim2prj(value=1,
scenario=self.scenario),
observation_horizon=self.scenario.prj_duration_yrs,
discount_rate=self.scenario.wacc) if scenario.compensate_sim_prj else 1
self.opex_ep_spec = None # initial value
self.calc_opex_ep_spec() # uprate opex values for short simulations, exact process depends on class

Expand Down Expand Up @@ -639,9 +642,9 @@ def calc_opex_sim(self):
self.scenario.prj_duration_yrs,
self.scenario.wacc,
occurs_at='end')
self.opex_ann_ext = eco.annuity_due_recur(nominal_value=self.opex_yrl_ext,
observation_horizon=self.scenario.prj_duration_yrs,
discount_rate=self.scenario.wacc)
self.opex_ann_ext = eco.annuity_recur(nominal_value=self.opex_yrl_ext,
observation_horizon=self.scenario.prj_duration_yrs,
discount_rate=self.scenario.wacc)
self.scenario.opex_sim_ext += self.opex_sim_ext
self.scenario.opex_yrl_ext += self.opex_yrl_ext
self.scenario.opex_prj_ext += self.opex_prj_ext
Expand Down
26 changes: 22 additions & 4 deletions revoletion/economics.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ def annuity_due_capex(capex_init: float,
return annuity_due


def annuity_due_recur(nominal_value:float,
observation_horizon:float,
discount_rate:float):
def annuity_due_recur(nominal_value: float,
observation_horizon: float,
discount_rate: float):
"""
Calculate the annuity due of a yearly recurring (lifespan=1) and nonchanging (cost_change_ratio=1)
mainenance expense (the equivalent yearly sum to generate the same NPV) over a observation horizon.
mainenance expense (the equivalent yearly sum to generate the same NPV) over an observation horizon.
"""
annuity_due_recur = annuity_due_capex(capex_init=nominal_value,
capex_replacement=nominal_value,
Expand All @@ -134,3 +134,21 @@ def annuity_due_recur(nominal_value:float,
discount_rate=discount_rate,
cost_change_ratio=1)
return annuity_due_recur


def annuity_recur(nominal_value: float,
observation_horizon: float,
discount_rate: float):
"""
Calculate the annuity of a periodically recurring and nonchanging (cost_change_ratio=1)
expense (the equivalent yearly sum to generate the same NPV) over a observation horizon.
"""
present_value = acc_discount(nominal_value=nominal_value,
observation_horizon=observation_horizon,
discount_rate=discount_rate,
occurs_at='end')
annuity_recur = annuity(present_value=present_value,
observation_horizon=observation_horizon,
discount_rate=discount_rate,
occurs_at='end')
return annuity_recur
4 changes: 4 additions & 0 deletions revoletion/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ def scale_year2prj(value, scenario):
return value * scenario.prj_duration_yrs


def scale_sim2prj(value, scenario):
return scale_year2prj(scale_sim2year(value, scenario), scenario)


def read_demand_file(block):
"""
Read in a CommodityDemand csv file
Expand Down

0 comments on commit ca2bc77

Please sign in to comment.