Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
topupheat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pmag
topupheat
Commits
8943f1b7
Commit
8943f1b7
authored
Jul 2, 2024
by
Pedro L. Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
Started revising simplified heat tranfer methods.
parent
b1dc662a
No related branches found
No related tags found
1 merge request
!1
Revised tests for simplified heat transfer methods in the trench test section....
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/topupheat/pipes/system.py
+53
-12
53 additions, 12 deletions
src/topupheat/pipes/system.py
with
53 additions
and
12 deletions
src/topupheat/pipes/system.py
+
53
−
12
View file @
8943f1b7
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment