Skip to content

Commit

Permalink
Merge pull request #312 from wouterpeere/issue310-add-__repr__
Browse files Browse the repository at this point in the history
Issue310 add   repr
  • Loading branch information
wouterpeere authored Nov 29, 2024
2 parents d0948f8 + b7f4bce commit 63da23d
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 1,010 deletions.
6 changes: 3 additions & 3 deletions GHEtool/Borefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -2009,12 +2009,12 @@ def calculate_quadrant(self) -> int:
return 2

def __repr__(self):
return f'Maximum average fluid temperature [-]: {self.Tf_max}\n' \
f'Minimum average fluid temperature [-]: {self.Tf_min}\n' \
return f'Maximum average fluid temperature [°C]: {self.Tf_max}\n' \
f'Minimum average fluid temperature [°C]: {self.Tf_min}\n' \
f'Average buried depth [m]: {self.D}\n' \
f'Average borehole depth [m]: {self.H}\n' \
f'Borehole diameter [mm]: {self.r_b * 2000:.0f}\n' \
f'Number of boreholes [m]: {self.number_of_boreholes}\n' \
f'Number of boreholes [-]: {self.number_of_boreholes}\n' \
f'{self.ground_data.__repr__()}\n' \
f'{self.borehole.__repr__()}\n' \
f'{self.load.__repr__()}'
8 changes: 4 additions & 4 deletions GHEtool/VariableClasses/FluidData.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ def __eq__(self, other):
return True

def __repr__(self):
temp = f'Fluid parameters\n\tThermal conductivity of the fluid [W/(m·K)]: {self.k_f}\n\t' \
f'Density of the fluid [kg/m³]: {self.rho}\n\t' \
f'Thermal capacity of the fluid [J/(kg·K)]: {self.Cp}\n\t' \
f'Dynamic viscosity [Pa·s]: {self.mu}\n\t'
temp = f'Fluid parameters\n\tThermal conductivity of the fluid [W/(m·K)]: {self.k_f:.3f}\n\t' \
f'Density of the fluid [kg/m³]: {self.rho:.3f}\n\t' \
f'Thermal capacity of the fluid [J/(kg·K)]: {self.Cp:.3f}\n\t' \
f'Dynamic viscosity [Pa·s]: {self.mu:.3f}\n\t'
if self._vfr is not None:
temp += f'Volume flow rate [l/s]: {self.vfr}'
else:
Expand Down
8 changes: 4 additions & 4 deletions GHEtool/VariableClasses/GroundData/_GroundData.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def __init__(self, k_s: float = None,
Parameters
----------
k_s : float
Layer thermal conductivity [W/(mK)]
Layer thermal conductivity [W/(m·K)]
volumetric_heat_capacity : float
Layer volumetric heat capacity [J/m³K]
Layer volumetric heat capacity [J/(m³·K)]
thickness : float
Layer thickness [m]. None is assumed infinite depth
"""
Expand Down Expand Up @@ -65,8 +65,8 @@ def __eq__(self, other):
return True

def __repr__(self):
return f'- Thickness [m]: {self.thickness}, Conductivity [W/(mK)]: {self.k_s}, ' \
f'Volumetric heat capacity [MJ/(m³K)]: {self.volumetric_heat_capacity / 10 ** 6}'
return f'- Thickness [m]: {self.thickness}, Conductivity [W/(m·K)]: {self.k_s}, ' \
f'Volumetric heat capacity [MJ/(m³·K)]: {self.volumetric_heat_capacity / 10 ** 6}'


class _GroundData(BaseClass, ABC):
Expand Down
Loading

0 comments on commit 63da23d

Please sign in to comment.