Skip to content
Snippets Groups Projects
Commit 8943f1b7 authored by Pedro L. Magalhães's avatar Pedro L. Magalhães
Browse files

Started revising simplified heat tranfer methods.

parent b1dc662a
No related branches found
No related tags found
1 merge request!1Revised tests for simplified heat transfer methods in the trench test section....
...@@ -319,9 +319,6 @@ class SupplyReturnPipeSystem: ...@@ -319,9 +319,6 @@ class SupplyReturnPipeSystem:
# TODO: make it possible for the maximum specific pressure loss to be # TODO: make it possible for the maximum specific pressure loss to be
# expressed as a function of the fluid speed # expressed as a function of the fluid speed
# a) constant maximum specific pressure loss
# b) the maximum specific pressure loss as a function of the fluid speed
def rated_heat_capacity(self, recalculate: bool = False, **kwargs): def rated_heat_capacity(self, recalculate: bool = False, **kwargs):
if not hasattr(self, 'rhc') or recalculate or len(kwargs) != 0: if not hasattr(self, 'rhc') or recalculate or len(kwargs) != 0:
if self.pipes_are_different: if self.pipes_are_different:
...@@ -561,33 +558,76 @@ class SupplyReturnPipeSystem: ...@@ -561,33 +558,76 @@ class SupplyReturnPipeSystem:
raise NotImplementedError raise NotImplementedError
# ************************************************************************* # *************************************************************************
# TODO: test all 3 modes (single input, list, list of lists,)
def simplified_specific_heat_transfer_surroundings( def simplified_specific_heat_transfer_surroundings(
self, self,
specific_heat_transfer_coefficient: float or list, specific_heat_transfer_coefficient: float or list,
temperature_surroundings: float or list, temperature_surroundings: float or list,
unit_conversion_factor: float = 1.0 unit_conversion_factor: float = 1.0
): ):
"""
Calculates the specific heat transfer with the surroundings using a
constant specific heat transfer coefficient.
# specific_heat_transfer_coefficient >> options Parameters
# temperature_surroundings >> temporal ----------
specific_heat_transfer_coefficient : float or list
The heat transfer coefficient per unit length. For non-vector mode,
it must be supplied a float or as a list with one value per time
interval. For vector mode, it can be supplied as a list with one
value per option or, as a list with one list per option, each with
one value per time interval.
temperature_surroundings : float or list
The temperature of the surroundings, submitted per time interval.
If it concerns multiple time intervals, it must be submitted as a
list whose size is compatible with the other inputs.
unit_conversion_factor : float, optional
A factor to adjust the final units. The default is 1.0.
Raises
------
TypeError
This error is raised if the combination of inputs is incompatible.
Returns
-------
out : float, list or list of lists
The specific heat transfer rate(s) based on the inputs.
"""
# determine if the inputs are for temporal vector/normal mode # determine if the inputs are for temporal vector/normal mode
if isinstance(temperature_surroundings, Real): if isinstance(temperature_surroundings, Real):
# single u value: non-temporal vector mode
temporal_vector_mode = False temporal_vector_mode = False
elif (type(temperature_surroundings) == list or elif (type(temperature_surroundings) == list or
type(temperature_surroundings) == tuple): type(temperature_surroundings) == tuple):
# u values submitted a a list/tuple: temporal vector mode
temporal_vector_mode = True temporal_vector_mode = True
else: else:
raise ValueError('Incompatible inputs.') raise ValueError('Incompatible inputs.')
# confirm inputs are consistent with vector/normal mode # u:
# 1) non-vector mode, float = 1 option, 1 time interval
# 2) non-vector mode, list = 1 option, multiple time intervals
# 3) vector mode, list (options) =
# 4) vector mode, list of lists =
# rule out impossible combinations
# 1) non-vector mode and inconsistent u/temperature types
# 2) non-vector mode and u values in a list that does not match the size of the temperature list
# 3) vector mode and size of list with u values does not match the number of options
# 4) vector mode and the number of u values per list does not match the number of time intervals
if ((not self.vector_mode and if ((not self.vector_mode and
not isinstance(specific_heat_transfer_coefficient, Real)) or (type(specific_heat_transfer_coefficient) != type(temperature_surroundings) or
(self.vector_mode and len(specific_heat_transfer_coefficient) != len(temperature_surroundings))) or
len(self.supply_temperature) < 1 or (self.vector_mode and len(specific_heat_transfer_coefficient) != 0 and
len(specific_heat_transfer_coefficient) != self.number_options() (len(specific_heat_transfer_coefficient) != self.number_options() or
(type(specific_heat_transfer_coefficient[0]) == type(temperature_surroundings) and
len(specific_heat_transfer_coefficient[0]) != len(temperature_surroundings)))
) )
): ):
# all the aforementioned cases lead here
raise TypeError('Inconsistent inputs.') raise TypeError('Inconsistent inputs.')
if self.vector_mode: if self.vector_mode:
...@@ -655,6 +695,7 @@ class SupplyReturnPipeSystem: ...@@ -655,6 +695,7 @@ class SupplyReturnPipeSystem:
time_interval_duration: float or list, time_interval_duration: float or list,
unit_conversion_factor: float = 1.0 unit_conversion_factor: float = 1.0
): ):
""" """
Calculates the heat transfer with the surroundings using a constant Calculates the heat transfer with the surroundings using a constant
specific heat transfer coefficient. specific heat transfer coefficient.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment