Skip to content

Commit

Permalink
Add is_finished flag to exit outer loop
Browse files Browse the repository at this point in the history
  • Loading branch information
tarao1006 committed Nov 6, 2021
1 parent 2037d96 commit 1116fbb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pyheatintegration/grand_composite_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,15 @@ def _update_external_streams_heat(
or (stream.is_cold() and target_temperature > pinch_point_temp):
continue

is_finished = False
for i in range(len(heats)):
if i == len(heats) - 1:
# 与熱流体の場合は、流体温度がtemps[i]よりも大きい時、受熱流体の場合は、
# 流体温度がtemps[i]より小さい時、外部流体として用いることができる。
if (stream.is_hot() and target_temperature >= temps[i]) \
or (stream.is_cold() and target_temperature <= temps[i]):
stream.update_heat(not_heated)
is_finished = True
break
start_temp = temps[i]
finish_temp = temps[i + 1]
Expand All @@ -160,6 +162,8 @@ def _update_external_streams_heat(
heated += heat
not_heated -= heat
break
if is_finished:
break

return streams

Expand Down

0 comments on commit 1116fbb

Please sign in to comment.