Skip to content

Commit

Permalink
Adapt variable costs for representative multi-year-periods
Browse files Browse the repository at this point in the history
Representative year needs to be activated via flag while
energysystem creation. A representative year with timeseries
is then taken to account variable costs for all implicit years
in a multi-year-period.
  • Loading branch information
nailend committed Oct 12, 2023
1 parent 9d21452 commit bc1d808
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions src/oemof/solph/flows/_simple_flow_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,37 @@ def _objective_expression(self):
else:
for i, o in m.FLOWS:
if m.flows[i, o].variable_costs[0] is not None:
for p, t in m.TIMEINDEX:
variable_costs += (
m.flow[i, o, p, t]
* m.objective_weighting[t]
* m.flows[i, o].variable_costs[t]
* ((1 + m.discount_rate) ** -m.es.periods_years[p])
)
if self.use_representative_year_in_multi_year_periods:
for p, timesteps in m.TIMESTEPS_IN_PERIOD.items():
# sum variable costs of representative year
variable_costs_increment = sum(
m.flow[i, o, p, t]
* m.objective_weighting[t]
* m.flows[i, o].variable_costs[t]
* (
(1 + m.discount_rate)
** -m.es.periods_years[p]
)
for t in timesteps
)

# add variable costs of all years
variable_costs += sum(
variable_costs_increment
* ((1 + m.discount_rate) ** (-pp))
for pp in range(0, m.es.get_period_duration(p))
)
else:
for p, t in m.TIMEINDEX:
variable_costs += (
m.flow[i, o, p, t]
* m.objective_weighting[t]
* m.flows[i, o].variable_costs[t]
* (
(1 + m.discount_rate)
** -m.es.periods_years[p]
)
)

# Include fixed costs of units operating "forever"
if (
Expand Down

0 comments on commit bc1d808

Please sign in to comment.