Skip to content

Commit

Permalink
Fix periods in existing heatpipelines (due to solph v0.5.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
joroeder committed Feb 2, 2024
1 parent 907a6b0 commit 3abc40c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dhnx/optimization/oemof_heatpipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,14 @@ def _relation_rule(block, n, t):
o = list(n.outputs.keys())[0]

expr = 0
expr += - m.flow[n, o, t]
expr += m.flow[i, n, t]
try: # oemof.solph<=0.5.0
expr += - m.flow[n, o, t]
expr += m.flow[i, n, t]
except KeyError: # oemof.solph>=0.5.1
period = 0 # Periods are not (yet) supported in DHNx
expr += - m.flow[n, o, period, t]
expr += m.flow[i, n, period, t]

expr += - block.heat_loss[n, t]
return expr == 0

Expand Down

0 comments on commit 3abc40c

Please sign in to comment.