-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #210 from BioSTEAMDevelopmentGroup/minor_hxn_update
Allow sorting candidate heat utils by temperature in HeatExchangerNetwork
- Loading branch information
Showing
2 changed files
with
17 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# This module will be moved to a new reporsitory called "HXN: The automated Heat Exchanger Network design package." | ||
# Copyright (C) 2020-2023, Sarang Bhagwat <[email protected]>, Yoel Cortes-Pena <[email protected]> | ||
# Copyright (C) 2020-, Sarang Bhagwat <[email protected]>, Yoel Cortes-Pena <[email protected]> | ||
# | ||
# This module is under the UIUC open-source license. See | ||
# github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt | ||
|
@@ -108,7 +108,8 @@ class HeatExchangerNetwork(bst.Facility): | |
|
||
def __init__(self, ID='', T_min_app=5., units=None, ignored=None, Qmin=1e-3, | ||
force_ideal_thermo=False, cache_network=False, avoid_recycle=False, | ||
acceptable_energy_balance_error=None, replace_unit_heat_utilities=False): | ||
acceptable_energy_balance_error=None, replace_unit_heat_utilities=False, | ||
sort_hus_by_T=False): | ||
bst.Facility.__init__(self, ID, None, None) | ||
self.T_min_app = T_min_app | ||
self.units = units | ||
|
@@ -118,6 +119,7 @@ def __init__(self, ID='', T_min_app=5., units=None, ignored=None, Qmin=1e-3, | |
self.cache_network = cache_network | ||
self.avoid_recycle = avoid_recycle | ||
self.replace_unit_heat_utilities = replace_unit_heat_utilities | ||
self.sort_hus_by_T = sort_hus_by_T | ||
if acceptable_energy_balance_error is not None: | ||
self.acceptable_energy_balance_error = acceptable_energy_balance_error | ||
|
||
|
@@ -189,7 +191,8 @@ def _cost(self): | |
T_out_arr, pinch_T_arr, C_flow_vector, hx_heat_utils_rearranged, streams_inlet, stream_HXs_dict,\ | ||
hot_indices, cold_indices = \ | ||
synthesize_network(hx_utils, self.T_min_app, self.Qmin, | ||
self.force_ideal_thermo, self.avoid_recycle) | ||
self.force_ideal_thermo, self.avoid_recycle, | ||
self.sort_hus_by_T) | ||
new_HXs = HXs_hot_side + HXs_cold_side | ||
self.cold_indices = cold_indices | ||
self.original_heat_exchangers = hxs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# HXN: The automated Heat Exchanger Network design package. | ||
# Copyright (C) 2020-2023, Sarang Bhagwat <[email protected]> | ||
# Copyright (C) 2020-, Sarang Bhagwat <[email protected]> | ||
# | ||
# This module is under the UIUC open-source license. See | ||
# github.com/sarangbhagwat/hxn/blob/master/LICENSE.txt | ||
|
@@ -124,10 +124,16 @@ def get_sorted_life_cycle(self): | |
return self.life_cycle | ||
|
||
|
||
def temperature_interval_pinch_analysis(hus, T_min_app = 10, force_ideal_thermo=False): | ||
def temperature_interval_pinch_analysis(hus, | ||
T_min_app=10, | ||
force_ideal_thermo=False, | ||
sort_hus_by_T=False): | ||
hx_utils = hus | ||
hus_heating = [hu for hu in hx_utils if hu.duty > 0] | ||
hus_cooling = [hu for hu in hx_utils if hu.duty < 0] | ||
if sort_hus_by_T: | ||
hus_heating.sort(key=lambda i: i.unit.ins[0].T, reverse=True) | ||
hus_cooling.sort(key=lambda i: i.unit.ins[0].T) | ||
hx_utils_rearranged = hus_heating + hus_cooling | ||
hxs = [hu.unit for hu in hx_utils_rearranged] | ||
if force_ideal_thermo: | ||
|
@@ -249,10 +255,11 @@ def get_T_transient(pinch_T_arr, indices, T_in_arr): | |
return T_transient | ||
|
||
def synthesize_network(hus, T_min_app=5., Qmin=1e-3, force_ideal_thermo=False, | ||
avoid_recycle=False): | ||
avoid_recycle=False, sort_hus_by_T=False): | ||
pinch_T_arr, hot_util_load, cold_util_load, T_in_arr, T_out_arr,\ | ||
hxs, hot_indices, cold_indices, indices, streams_inlet, hx_utils_rearranged, \ | ||
streams_quenched = temperature_interval_pinch_analysis(hus, T_min_app, force_ideal_thermo) | ||
streams_quenched = temperature_interval_pinch_analysis(hus, T_min_app, force_ideal_thermo, | ||
sort_hus_by_T) | ||
H_out_arr = [i.H for i in streams_quenched] | ||
duties = np.array([abs(hx.Q) for hx in hxs]) | ||
dTs = np.abs(T_in_arr - T_out_arr) | ||
|