Main functionalities of GHEtool

  1"""
  2This file contains all the main functionalities of GHEtool being:
  3    * sizing of the borefield
  4    * sizing of the borefield for a specific quadrant
  5    * plotting the temperature evolution
  6    * plotting the temperature evolution for a specific depth
  7    * printing the array of the temperature
  8"""
  9
 10import numpy as np
 11
 12# import all the relevant functions
 13from GHEtool import Borefield, FluidData, DoubleUTube, GroundConstantTemperature, MonthlyGeothermalLoadAbsolute
 14
 15
 16def main_functionalities():
 17    # relevant borefield data for the calculations
 18    data = GroundConstantTemperature(3,             # conductivity of the soil (W/mK)
 19                                     10,            # Ground temperature at infinity (degrees C)
 20                                     2.4 * 10**6)   # ground volumetric heat capacity (J/m3K)
 21
 22    # monthly loading values
 23    peak_cooling = np.array([0., 0, 34., 69., 133., 187., 213., 240., 160., 37., 0., 0.])  # Peak cooling in kW
 24    peak_heating = np.array([160., 142, 102., 55., 0., 0., 0., 0., 40.4, 85., 119., 136.])  # Peak heating in kW
 25
 26    # annual heating and cooling load
 27    annual_heating_load = 300 * 10 ** 3  # kWh
 28    annual_cooling_load = 160 * 10 ** 3  # kWh
 29
 30    # percentage of annual load per month (15.5% for January ...)
 31    monthly_load_heating_percentage = np.array([0.155, 0.148, 0.125, .099, .064, 0., 0., 0., 0.061, 0.087, 0.117, 0.144])
 32    monthly_load_cooling_percentage = np.array([0.025, 0.05, 0.05, .05, .075, .1, .2, .2, .1, .075, .05, .025])
 33
 34    # resulting load per month
 35    monthly_load_heating = annual_heating_load * monthly_load_heating_percentage   # kWh
 36    monthly_load_cooling = annual_cooling_load * monthly_load_cooling_percentage   # kWh
 37
 38    # set the load
 39    load = MonthlyGeothermalLoadAbsolute(monthly_load_heating, monthly_load_cooling, peak_heating, peak_cooling)
 40
 41    # create the borefield object
 42    borefield = Borefield(load=load)
 43
 44    # one can activate or deactive the logger, by default it is deactivated
 45    # borefield.activate_logger()
 46    # borefield.deactivate_logger()
 47
 48    borefield.set_ground_parameters(data)
 49    borefield.create_rectangular_borefield(10, 12, 6, 6, 100, 4, 0.075)
 50
 51    borefield.Rb = 0.12  # equivalent borehole resistance (K/W)
 52
 53    # set temperature boundaries
 54    borefield.set_max_avg_fluid_temperature(16)   # maximum temperature
 55    borefield.set_min_avg_fluid_temperature(0)    # minimum temperature
 56
 57    # size borefield
 58    depth = borefield.size()
 59    print("The borehole depth is: ", depth, "m")
 60
 61    # print imbalance
 62    print("The borefield imbalance is: ", borefield._borefield_load.imbalance, "kWh/y. (A negative imbalance means the the field is heat extraction dominated so it cools down year after year.)") # print imbalance
 63
 64    # plot temperature profile for the calculated depth
 65    borefield.print_temperature_profile(legend=True)
 66
 67    # plot temperature profile for a fixed depth
 68    borefield.print_temperature_profile_fixed_depth(depth=75, legend=False)
 69
 70    # print gives the array of monthly temperatures for peak cooling without showing the plot
 71    borefield.calculate_temperatures(depth=90)
 72    print("Result array for cooling peaks")
 73    print(borefield.results.peak_cooling)
 74    print("---------------------------------------------")
 75
 76    # size the borefield for quadrant 3
 77    # for more information about borefield quadrants, see (Peere et al., 2021)
 78    depth = borefield.size(quadrant_sizing=3)
 79    print("The borehole depth is: ", str(round(depth, 2)), "m for a sizing in quadrant 3")
 80    # plot temperature profile for the calculated depth
 81    borefield.print_temperature_profile(legend=True)
 82
 83    # size with a dynamic Rb* value
 84    # note that the original Rb* value will be overwritten!
 85
 86    # this requires pipe and fluid data
 87    fluid_data = FluidData(0.2, 0.568, 998, 4180, 1e-3)
 88    pipe_data = DoubleUTube(1, 0.015, 0.02, 0.4, 0.05)
 89    borefield.set_fluid_parameters(fluid_data)
 90    borefield.set_pipe_parameters(pipe_data)
 91
 92    # disable the use of constant_Rb with the setup, in order to plot the profile correctly
 93    # when it is given as an argument to the size function, it will size correctly, but the plot will be with
 94    # constant Rb* since it has not been changed in the setup function
 95    borefield.calculation_setup(use_constant_Rb=False)
 96    depth = borefield.size()
 97    print("The borehole depth is: ", str(round(depth, 2)), "m for a sizing with dynamic Rb*.")
 98    borefield.print_temperature_profile(legend=True)
 99
100
101if __name__ == "__main__":  # pragma: no cover
102    main_functionalities()