Skip to content

Commit

Permalink
Add some minor docs and code formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jokochems committed Oct 13, 2023
1 parent 758be20 commit 2b7ab2c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 26 deletions.
5 changes: 4 additions & 1 deletion src/oemof/solph/_energy_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ def _extract_periods_matrix(self):
self.periods_matrix = np.array(periods_matrix)

def _extract_end_year_of_optimization(self):
"""Extract the end of the optimization in years"""
"""Extract the end of the optimization in years
Attribute `end_year_of_optimization` of int is set.
"""
duration_last_period = self.get_period_duration(-1)
self.end_year_of_optimization = (
self.periods_years[-1] + duration_last_period
Expand Down
8 changes: 4 additions & 4 deletions src/oemof/solph/components/_generic_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ class GenericStorageBlock(ScalarBlock):
whereby:
* :math:`DF=(1+dr)` is the discount factor with discount rate :math:`dr`
* :math:`DF=(1+dr)` is the discount factor with discount rate :math:`dr`.
* :math:`year_{max}` denotes the last year of the optimization
horizon, i.e. at the end of the last period.
Expand Down Expand Up @@ -606,7 +606,7 @@ def _objective_expression(self):
fixed_costs += sum(
n.nominal_storage_capacity
* n.fixed_costs[pp]
* ((1 + m.discount_rate) ** (-pp))
* (1 + m.discount_rate) ** (-pp)
for pp in range(m.es.end_year_of_optimization)
)
self.fixed_costs = Expression(expr=fixed_costs)
Expand Down Expand Up @@ -957,13 +957,13 @@ class GenericInvestmentStorageBlock(ScalarBlock):
.. math::
&
A(c_{invest,var}(p), l, ir) = c_{invest,var}(p) \cdot
\frac {(1+i)^l \cdot i} {(1+i)^l - 1}\\
\frac {(1+ir)^l \cdot ir} {(1+ir)^l - 1}\\
&\\
&
ANF(d, ir)=\frac {(1+ir)^d \cdot ir} {(1+ir)^d - 1}
They are retrieved, using oemof.tools.economics annuity function. The
interest rate :math:`i` for the annuity is defined as weighted
interest rate :math:`ir` for the annuity is defined as weighted
average costs of capital (wacc) and assumed constant over time.
The overall summed cost expressions for all *InvestmentFlowBlock* objects
Expand Down
36 changes: 18 additions & 18 deletions src/oemof/solph/components/experimental/_sink_dsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,22 +691,22 @@ def _objective_expression(self):
self.dsm_up[g, t]
* m.objective_weighting[t]
* g.cost_dsm_up[t]
* ((1 + m.discount_rate) ** -m.es.periods_years[p])
* (1 + m.discount_rate) ** (-m.es.periods_years[p])
)
variable_costs += (
(
self.dsm_do_shift[g, t] * g.cost_dsm_down_shift[t]
+ self.dsm_do_shed[g, t] * g.cost_dsm_down_shed[t]
)
* m.objective_weighting[t]
* ((1 + m.discount_rate) ** -m.es.periods_years[p])
* (1 + m.discount_rate) ** (-m.es.periods_years[p])
)

if g.fixed_costs[0] is not None:
fixed_costs += sum(
max(g.max_capacity_up, g.max_capacity_down)
* g.fixed_costs[pp]
* ((1 + m.discount_rate) ** (-pp))
* (1 + m.discount_rate) ** (-pp)
for pp in range(m.es.end_year_of_optimization)
)

Expand Down Expand Up @@ -840,13 +840,13 @@ class SinkDSMOemofInvestmentBlock(ScalarBlock):
.. math::
&
A(c_{invest,var}(p), l, ir) = c_{invest,var}(p) \cdot
\frac {(1+i)^l \cdot i} {(1+i)^l - 1}\\
\frac {(1+ir)^l \cdot ir} {(1+ir)^l - 1}\\
&\\
&
ANF(d, ir)=\frac {(1+dr)^d \cdot dr} {(1+dr)^d - 1}
They are retrieved, using oemof.tools.economics annuity function. The
interest rate :math:`i` for the annuity is defined as weighted
interest rate :math:`ir` for the annuity is defined as weighted
average costs of capital (wacc) and assumed constant over time.
See remarks in
Expand Down Expand Up @@ -2089,7 +2089,7 @@ def _objective_expression(self):
self.dsm_up[g, t]
* m.objective_weighting[t]
* g.cost_dsm_up[t]
* ((1 + m.discount_rate) ** -m.es.periods_years[p])
* (1 + m.discount_rate) ** (-m.es.periods_years[p])
)
variable_costs += (
(
Expand All @@ -2101,14 +2101,14 @@ def _objective_expression(self):
+ self.dsm_do_shed[g, t] * g.cost_dsm_down_shed[t]
)
* m.objective_weighting[t]
* ((1 + m.discount_rate) ** -m.es.periods_years[p])
* (1 + m.discount_rate) ** (-m.es.periods_years[p])
)

if g.fixed_costs[0] is not None:
fixed_costs += sum(
max(g.max_capacity_up, g.max_capacity_down)
* g.fixed_costs[pp]
* ((1 + m.discount_rate) ** (-pp))
* (1 + m.discount_rate) ** (-pp)
for pp in range(m.es.end_year_of_optimization)
)

Expand Down Expand Up @@ -2269,13 +2269,13 @@ class SinkDSMDIWInvestmentBlock(ScalarBlock):
.. math::
&
A(c_{invest,var}(p), l, ir) = c_{invest,var}(p) \cdot
\frac {(1+i)^l \cdot i} {(1+i)^l - 1}\\
\frac {(1+ir)^l \cdot ir} {(1+ir)^l - 1}\\
&\\
&
ANF(d, ir)=\frac {(1+dr)^d \cdot dr} {(1+dr)^d - 1}
They are retrieved, using oemof.tools.economics annuity function. The
interest rate :math:`i` for the annuity is defined as weighted
interest rate :math:`ir` for the annuity is defined as weighted
average costs of capital (wacc) and assumed constant over time.
See remarks in
Expand Down Expand Up @@ -3177,7 +3177,7 @@ def _objective_expression(self):
fixed_costs += sum(
self.invest[g, p]
* g.investment.fixed_costs[pp]
* ((1 + m.discount_rate) ** (-pp))
* (1 + m.discount_rate) ** (-pp)
for pp in range(
m.es.periods_years[p],
range_limit,
Expand Down Expand Up @@ -4188,7 +4188,7 @@ def _objective_expression(self):
* g.cost_dsm_up[t]
)
* m.objective_weighting[t]
* ((1 + m.discount_rate) ** -m.es.periods_years[p])
* (1 + m.discount_rate) ** (-m.es.periods_years[p])
)
variable_costs += (
(
Expand All @@ -4201,14 +4201,14 @@ def _objective_expression(self):
+ self.dsm_do_shed[g, t] * g.cost_dsm_down_shed[t]
)
* m.objective_weighting[t]
* ((1 + m.discount_rate) ** -m.es.periods_years[p])
* (1 + m.discount_rate) ** (-m.es.periods_years[p])
)

if g.fixed_costs[0] is not None:
fixed_costs += sum(
max(g.max_capacity_up, g.max_capacity_down)
* g.fixed_costs[pp]
* ((1 + m.discount_rate) ** (-pp))
* (1 + m.discount_rate) ** (-pp)
for pp in range(m.es.end_year_of_optimization)
)

Expand Down Expand Up @@ -4446,13 +4446,13 @@ class SinkDSMDLRInvestmentBlock(ScalarBlock):
.. math::
&
A(c_{invest,var}(p), l, ir) = c_{invest,var}(p) \cdot
\frac {(1+i)^l \cdot i} {(1+i)^l - 1}\\
\frac {(1+ir)^l \cdot ir} {(1+ir)^l - 1}\\
&\\
&
ANF(d, ir)=\frac {(1+dr)^d \cdot dr} {(1+dr)^d - 1}
They are retrieved, using oemof.tools.economics annuity function. The
interest rate :math:`i` for the annuity is defined as weighted
interest rate :math:`ir` for the annuity is defined as weighted
average costs of capital (wacc) and assumed constant over time.
See remarks in
Expand Down Expand Up @@ -5585,7 +5585,7 @@ def _objective_expression(self):
fixed_costs += sum(
self.invest[g, p]
* g.investment.fixed_costs[pp]
* ((1 + m.discount_rate) ** (-pp))
* (1 + m.discount_rate) ** (-pp)
for pp in range(
m.es.periods_years[p],
range_limit,
Expand All @@ -5602,7 +5602,7 @@ def _objective_expression(self):
fixed_costs += sum(
g.investment.existing
* g.investment.fixed_costs[pp]
* ((1 + m.discount_rate) ** (-pp))
* (1 + m.discount_rate) ** (-pp)
for pp in range(range_limit)
)

Expand Down
3 changes: 2 additions & 1 deletion src/oemof/solph/flows/_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class Flow(on.Edge):
:class:`~oemof.solph.flows._simple_flow_block.SimpleFlowBlock`.
fixed_costs : numeric (iterable or scalar), :math:`c_{fixed}`
The fixed costs associated with a flow.
Note: These are only applicable for a multi-period model.
Note: These are only applicable for a multi-period model
and given on a yearly basis.
lifetime : int, :math:`l`
The lifetime of a flow (usually given in years);
once it reaches its lifetime (considering also
Expand Down
4 changes: 2 additions & 2 deletions src/oemof/solph/flows/_investment_flow_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,13 +842,13 @@ def _objective_expression(self):
.. math::
&
A(c_{invest,var}(p), l, ir) = c_{invest,var}(p) \cdot
\frac {(1+i)^l \cdot i} {(1+i)^l - 1}\\
\frac {(1+ir)^l \cdot ir} {(1+ir)^l - 1}\\
&\\
&
ANF(d, ir)=\frac {(1+ir)^d \cdot ir} {(1+ir)^d - 1}
They are retrieved, using oemof.tools.economics annuity function.
The interest rate :math:`i` for the annuity is defined as weighted
The interest rate :math:`ir` for the annuity is defined as weighted
average costs of capital (wacc) and assumed constant over time.
"""
if not hasattr(self, "INVESTFLOWS"):
Expand Down

0 comments on commit 2b7ab2c

Please sign in to comment.