Skip to content

Commit

Permalink
Adhere to Black
Browse files Browse the repository at this point in the history
  • Loading branch information
p-snft committed Nov 27, 2023
1 parent b9aa489 commit da8f826
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/oemof/solph/flows/_non_convex_flow_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ def _create_variables(self):
self.status = Var(self.NONCONVEX_FLOWS, m.TIMESTEPS, within=Binary)
for o, i in self.NONCONVEX_FLOWS:
if m.flows[o, i].nonconvex.initial_status is not None:
for t in range(0, m.flows[o, i].nonconvex.first_flexible_timestep):
self.status[o, i, t] = m.flows[o, i].nonconvex.initial_status
for t in range(
0, m.flows[o, i].nonconvex.first_flexible_timestep
):
self.status[o, i, t] = m.flows[
o, i
].nonconvex.initial_status
self.status[o, i, t].fix()

# `status_nominal` is a parameter which represents the
Expand Down Expand Up @@ -470,7 +474,11 @@ def min_downtime_rule(_, i, o, t):
"""
Rule definition for min-downtime constraints of non-convex flows.
"""
if m.flows[i, o].nonconvex.first_flexible_timestep < t < m.TIMESTEPS.at(-1):
if (
m.flows[i, o].nonconvex.first_flexible_timestep
< t
< m.TIMESTEPS.at(-1)
):
expr = 0
expr += (
self.status[i, o, t - 1] - self.status[i, o, t]
Expand Down Expand Up @@ -516,7 +524,11 @@ def _min_uptime_rule(_, i, o, t):
"""
Rule definition for min-uptime constraints of non-convex flows.
"""
if m.flows[i, o].nonconvex.first_flexible_timestep < t < m.TIMESTEPS.at(-1):
if (
m.flows[i, o].nonconvex.first_flexible_timestep
< t
< m.TIMESTEPS.at(-1)
):
expr = 0
expr += (
self.status[i, o, t] - self.status[i, o, t - 1]
Expand Down

0 comments on commit da8f826

Please sign in to comment.