From ceacacd4b8b78a2fff810c0c830d6a2553982743 Mon Sep 17 00:00:00 2001 From: Yalin Date: Fri, 12 Jul 2024 15:27:18 -0400 Subject: [PATCH] update with newer biosteam --- qsdsan/_sanunit.py | 5 +++ qsdsan/sanunits/_heat_exchanging.py | 68 +++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 18 deletions(-) diff --git a/qsdsan/_sanunit.py b/qsdsan/_sanunit.py index 30f0bdcf..2a9cbbb0 100644 --- a/qsdsan/_sanunit.py +++ b/qsdsan/_sanunit.py @@ -208,6 +208,11 @@ def __init__(self, ID='', ins=None, outs=(), thermo=None, init_with='WasteStream #: value. self.parallel: dict[str, int] = {} + #: Unit design decisions that must be solved to satisfy specifications. + #: While adding responses is optional, simulations benefit from responses + #: by being able to predict better guesses. + self.responses: set[bst.GenericResponse] = set() + if not kwargs.get('skip_property_package_check'): self._assert_compatible_property_package() diff --git a/qsdsan/sanunits/_heat_exchanging.py b/qsdsan/sanunits/_heat_exchanging.py index d539d8b7..2c707d1e 100644 --- a/qsdsan/sanunits/_heat_exchanging.py +++ b/qsdsan/sanunits/_heat_exchanging.py @@ -106,16 +106,21 @@ class HXprocess(SanUnit, HXP): _N_ins = HXP._N_ins _N_outs = HXP._N_outs - def __init__(self, ID='', ins=None, outs=(), thermo=None, - init_with='Stream', F_BM_default=None, - *, U=None, dT=5., T_lim0=None, T_lim1=None, - material="Carbon steel/carbon steel", - heat_exchanger_type="Floating head", - N_shells=2, ft=None, - phase0=None, - phase1=None, - H_lim0=None, - H_lim1=None): + def __init__( + self, ID='', ins=None, outs=(), thermo=None, + init_with='Stream', F_BM_default=None, *, + U=None, dT=5., T_lim0=None, T_lim1=None, + material="Carbon steel/carbon steel", + heat_exchanger_type="Floating head", + N_shells=2, ft=None, + phase0=None, + phase1=None, + H_lim0=None, + H_lim1=None, + inner_fluid_pressure_drop=None, + outer_fluid_pressure_drop=None, + neglect_pressure_drop=True, + ): SanUnit.__init__(self, ID, ins, outs, thermo, init_with=init_with, F_BM_default=F_BM_default) @@ -155,6 +160,15 @@ def __init__(self, ID='', ins=None, outs=(), thermo=None, self.material = material self.heat_exchanger_type = heat_exchanger_type self.reset_streams_at_setup = False + + #: Optional[float] Pressure drop along the inner fluid. + self.inner_fluid_pressure_drop = inner_fluid_pressure_drop + + #: Optional[float] Pressure drop along the outer fluid. + self.outer_fluid_pressure_drop = outer_fluid_pressure_drop + + #: [bool] Whether to assume a negligible pressure drop. + self.neglect_pressure_drop = neglect_pressure_drop class HXutility(SanUnit, HXU): @@ -176,6 +190,7 @@ class HXutility(SanUnit, HXU): line = HXU.line _graphics = HXU._graphics + _units = {'Area': 'ft^2', 'Total tube length': 'ft', 'Inner pipe weight': 'kg', @@ -190,14 +205,22 @@ class HXutility(SanUnit, HXU): 'Horizontal vessel diameter': (3, 21), 'Vertical vessel length': (12, 40)} - def __init__(self, ID='', ins=None, outs=(), thermo=None, - init_with='Stream', F_BM_default=None, - include_construction=True, - *, T=None, V=None, rigorous=False, U=None, H=None, - heat_exchanger_type="Floating head", - material="Carbon steel/carbon steel", - N_shells=2, ft=None, heat_only=None, cool_only=None, - heat_transfer_efficiency=None): + def __init__( + self, ID='', ins=None, outs=(), thermo=None, + init_with='Stream', F_BM_default=None, + include_construction=True, + T=None, V=None, rigorous=False, U=None, H=None, + heat_exchanger_type="Floating head", + material="Carbon steel/carbon steel", + N_shells=2, + ft=None, + heat_only=None, + cool_only=None, + heat_transfer_efficiency=None, + inner_fluid_pressure_drop=None, + outer_fluid_pressure_drop=None, + neglect_pressure_drop=True, + ): SanUnit.__init__(self, ID, ins, outs, thermo, init_with=init_with, F_BM_default=F_BM_default, include_construction=include_construction,) @@ -226,6 +249,15 @@ def __init__(self, ID='', ins=None, outs=(), thermo=None, self.material = material self.heat_exchanger_type = heat_exchanger_type + #: Optional[float] Pressure drop along the inner fluid. + self.inner_fluid_pressure_drop = inner_fluid_pressure_drop + + #: Optional[float] Pressure drop along the outer fluid. + self.outer_fluid_pressure_drop = outer_fluid_pressure_drop + + #: [bool] Whether to assume a negligible pressure drop. + self.neglect_pressure_drop = neglect_pressure_drop + #: [bool] User enforced heat transfer efficiency. A value less than 1 #: means that a fraction of heat transferred is lost to the environment. #: If value is None, it defaults to the heat transfer efficiency of the