Skip to content

Commit

Permalink
Merge pull request #55 from tarao1006/hotfix/heat-exchanger-area
Browse files Browse the repository at this point in the history
Hotfix/heat exchanger area
  • Loading branch information
tarao1006 authored Jul 15, 2021
2 parents 6c29cc9 + 3875783 commit a6d11d3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.0
0.3.1
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'tarao1006'

# The full version, including alpha/beta/rc tags
release = '0.3.0'
release = '0.3.1'


# -- General configuration ---------------------------------------------------
Expand Down
20 changes: 12 additions & 8 deletions src/pyheatintegration/heat_exchanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class HeatExchanger:
hot_temperature_range (TemperatureRange): 与熱流体の温度領域。
cold_temperature_range (TemperatureRange): 受熱流体の温度領域。
lmtd (float): 対数平均温度差。
area (float): 向流の場合の必要面積 [m2]。
hot_plot_segment (PlotSegment): 与熱流体のプロットセグメント。
cold_plot_segment (PlotSegment): 受熱流体のプロットセグメント。
reboiler_or_reactor (bool): リボイラーもしくは反応器で用いるか。
Expand All @@ -108,18 +107,11 @@ def __init__(
self.cold_stream_state = self.cold_plot_segment.state
self.reboiler_or_reactor = self.hot_plot_segment.reboiler_or_reactor | self.cold_plot_segment.reboiler_or_reactor

self.overall_heat_transfer_coefficient = get_overall_heat_transfer_coefficient(
self.hot_stream_state,
self.cold_stream_state
)

if counterflow:
self.lmtd = self.init_lmtd_counterflow()
else:
self.lmtd = self.init_lmtd_pararell_flow()

self.area = self.heat_range.delta / self.lmtd / self.overall_heat_transfer_coefficient

def __repr__(self) -> str:
return (
'HeatExchanger('
Expand Down Expand Up @@ -181,6 +173,18 @@ def init_lmtd_counterflow(self) -> float:

return (start_temp_diff - finish_temp_diff) / math.log(start_temp_diff / finish_temp_diff)

def get_area(self, ignore_unknown: bool = True) -> float:
try:
overall_heat_transfer_coefficient = get_overall_heat_transfer_coefficient(
self.hot_stream_state,
self.cold_stream_state
)
return self.heat_range.delta / self.lmtd / overall_heat_transfer_coefficient
except Exception as e:
if ignore_unknown:
return 1.0
raise e


def merge_heat_exchangers(heat_exchanger: HeatExchanger, other: HeatExchanger) -> HeatExchanger:
"""熱交換器を結合します。
Expand Down
17 changes: 8 additions & 9 deletions src/pyheatintegration/pinch_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class PinchAnalyzer:
minimum_approach_temp_diff_range (TemperatureRange): 最小接近温度差の指定可能範囲。
pinch_point_temp (float): ピンチポイントの温度 [℃]。
heat_exchangers (list[HeatExchanger]): 熱交換器のリスト。
heat_exchanger_cost (float): 熱交換器のコスト。
external_heating_demand (float): 必要加熱量[W]。
external_cooling_demand (float): 必要冷却熱量[W]。
Expand Down Expand Up @@ -134,14 +133,6 @@ def __init__(
HeatExchanger(heat_range, hot_plot_segment, cold_plot_segment)
)

self.heat_exchanger_cost = sum(
calculate_heat_exchanger_cost(
heat_exchanger.area,
heat_exchanger.reboiler_or_reactor
)
for heat_exchanger in self.heat_exchangers
)

def create_grand_composite_curve(self) -> tuple[list[float], list[float]]:
"""グランドコンポジットカーブを描くために必要な熱量と温度を返します。
"""
Expand Down Expand Up @@ -178,3 +169,11 @@ def create_tq_merged(self) -> tuple[list[Line], list[Line]]:
self.tq.hot_lines_merged,
self.tq.cold_lines_merged
)

def get_heat_exchanger_cost(self, ignore_unknown: bool = True) -> float:
return sum(
calculate_heat_exchanger_cost(
heat_exchanger.get_area(ignore_unknown),
heat_exchanger.reboiler_or_reactor
) for heat_exchanger in self.heat_exchangers
)

0 comments on commit a6d11d3

Please sign in to comment.