/GHEtool

GHEtool is an open-source tool for borefield sizing and ground temperature evolution plotting.

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

GHEtool: An open-source tool for borefield sizing

PyPI version Conda version Tests codecov DOI Downloads Downloads Read the Docs

What is GHEtool?

GHEtool is a Python package that contains all the functionalities needed to deal with borefield design. GHEtool has been developed as a joint effort of KU Leuven (The SySi Team), boydens engineering (part of Sweco) and FH Aachen and is currently being maintained by Enead BV. The core of this package is the automated sizing of borefield under different conditions. By making use of combination of just-in-time calculations of thermal ground responses ( using pygfunction) with intelligent interpolation, this automated sizing can be done in the order of milliseconds. Please visit our website https://GHEtool.eu for more information.

Read The Docs

GHEtool has an elaborate documentation were all the functionalities of the tool are explained, with examples, literature and validation. This can be found on https://docs.ghetool.eu.

Graphical user interface

There are two graphical user interfaces available which are built using GHEtool: GHEtool Pro and GHEtool Community

GHEtool Pro

GHEtool Pro is the official and supported version of GHEtool which supports drilling companies, engineering firms, architects, government organizations in their geothermal design process. With GHEtool Pro they can minimize the environmental and societal impact while maximizing the cost-effective utilization of geothermal projects. Visit our website at https://ghetool.eu to learn more about the synergy between this open-source package and GHEtool Pro.

GHEtool Community

Besides GHEtool Pro, an open-source alternative for the graphical user interface is available in the form of GHEtool Community. This version is built and maintained by the community, and has no official support like GHEtool Pro. You can read all about this GHEtool Community on their GitHub repo.

Development

GHEtool is in constant development with new methods, enhancements and features added to every new version. Please visit our project board to check our progress.

Requirements

This code is tested with Python 3.9, 3.10, 3.11 and 3.12 and requires the following libraries (the versions mentioned are the ones with which the code is tested)

  • matplotlib >= 3.5.2
  • numpy >= 1.23.1
  • pandas >= 1.4.3
  • pygfunction >= 2.2.3
  • scipy >= 1.8.1

For the tests

  • Pytest >= 7.1.2

For the active/passive example

  • optuna >= 3.6.1

Quick start

Installation

One can install GHEtool by running Pip and running the command

pip install GHEtool

or one can install a newer development version using

pip install --extra-index-url https://test.pypi.org/simple/ GHEtool

GHEtool is also available as a conda package. Therefore, you can install GHEtool with the command:

conda install GHEtool

Developers can clone this repository.

It is a good practise to use virtual environments (venv) when working on a (new) Python project so different Python and package versions don't conflict with eachother. For GHEtool, Python 3.8 or higher is recommended. General information about Python virtual environments can be found here and in this article.

Check installation

To check whether everything is installed correctly, run the following command

pytest --pyargs GHEtool

This runs some predefined cases to see whether all the internal dependencies work correctly. All test should pass successfully.

Get started with GHEtool

Building blocks of GHEtool

GHEtool is a flexible package that can be extend with methods from pygfunction. To work efficiently with GHEtool, it is important to understand the main structure of the package.

Borefield

The Borefield object is the central object within GHEtool. It is within this object that all the calculations and optimizations take place. All attributes (ground properties, load data ...) are set inside the borefield object.

Ground properties

Within GHEtool, there are multiple ways of setting the ground data. Currently, your options are:

  • GroundConstantTemperature: if you want to model your borefield with a constant, know ground temperature.

  • GroundFluxTemperature: if you want to model your ground with a varying ground temperature due to a constant geothermal heat flux.

  • GroundTemperatureGradient: if you want to model your ground with a varying ground temperature due to a geothermal gradient.

  • You can also use multiple ground layers to define your ground model. Please take a look at our example.

Please note that it is possible to add your own ground types by inheriting the attributes from the abstract _GroundData class.

Pipe data

Within GHEtool, you can use different structures for the borehole internals: U-tubes or coaxial pipes. Concretely, the classes you can use are:

  • Multiple U-tubes
  • Single U-tubes (special case of multiple U-tubes)
  • Double U-tubes (special case of multiple U-tubes)
  • Coaxial pipe

Please note that it is possible to add your own pipe types by inheriting the attributes from the abstract _PipeData class.

Fluid data

You can set the fluid data by using the FluidData class. In the future, more fluid data classes will be made available.

Efficiency data

Within GHEtool, you can work with both seasonal efficiencies (SCOP and SEER) and temperature dependent efficiencies (COP and SEER). These efficiencies can be used in the Building load classes (cf. infra). The different available efficiency classes are:

  • SCOP: Constant seasonal performance for heating
  • SEER: Constant seasonal performance for cooling
  • COP: Instant efficiency for heating, with inlet temperature, outlet temperature and part load dependency
  • EER: Instant efficiency for cooling, with inlet temperature, outlet temperature and part load dependency
  • EERCombined: EER for combined active and passive cooling

Load data

One last element which you will need in your calculations, is the load data. Within GHEtool, there are three important aspects when it comes to choosing the right load data class.

  1. Load type: Do you want to work with building (i.e. secondary) or geothermal (i.e. primary) load?
  2. Resolution type: Do you want to work with monthly or hourly data?
  3. Multiyear: Do you want to assume a building/geothermal demand that is constant over the simulation period or do you want to enter the load for multiple years?

Depending on your answer on these three questions, you can opt for one of eight different load classes:

  • MonthlyGeothermalLoadAbsolute: You can set one the monthly baseload and peak load for extraction and injection for one standard year which will be used for all years within the simulation period.
  • HourlyGeothermalLoad: You can set (or load) the hourly extraction and injection load of a standard year which will be used for all years within the simulation period.
  • HourlyGeothermalLoadMultiYear: You can set (or load) the hourly extraction and injection load for multiple years ( i.e. for the whole simulation period).
  • MonthlyGeothermalLoadMultiYear: You can set the monthly extraction and injection load for multiple years (i.e. for the whole simulation period).
  • MonthlyBuildingLoadAbsolute: You can set one the monthly baseload and peak load for heating and cooling for one standard year which will be used for all years within the simulation period.
  • HourlyBuildingLoad: You can set (or load) the hourly heating and cooling load of a standard year which will be used for all years within the simulation period.
  • HourlyBuildingLoadMultiYear: You can set (or load) the hourly heating and cooling load for multiple years ( i.e. for the whole simulation period).
  • MonthlyBuildingLoadMultiYear: You can set the monthly heating and cooling load for multiple years (i.e. for the whole simulation period).

On the other hand, you can also choose a Cluster load where you can add multiple loads together. Be careful however when mixing hourly and monthly loads!

All building load classes also have the option to add a yearly domestic hot water (DHW) demand and require you to define an efficiency for heating, cooling (and optionally DHW) (cf. supra).

Please note that it is possible to add your own load types by inheriting the attributes from the abstract _LoadData, _HourlyLoad, _LoadDataBuilding and _HourlyLoadBuilding classes.

Options for sizing methods

Like always with iterative methods, there is a trade-off between speed and accuracy. Within GHEtool (using the CalculationSetup class) one can alter different parameters to customize the behaviour they want. Note that these options are additive, meaning that, for example, the strongest criteria from the atol and rtol is chosen when sizing. The options are:

  • atol: For the sizing methods, an absolute tolerance in meters between two consecutive iterations can be set.
  • rtol: For the sizing methods, a relative tolerance in meters between two consecutive iterations can be set.
  • max_nb_of_iterations: For the sizing methods, a maximum number of iterations can be set. If the size is not converged, a RuntimeError is thrown.
  • use_precalculated_dataset: This option makes sure the custom g-function dataset (if available) is not used.
  • interpolate_gfunctions: Calculating the gvalues gives a large overhead cost, although they are not that sensitive to a change in borehole depth. If this parameter is True it is allowed that gfunctions are interpolated. (To change the threshold for this interpolation, go to the Gfunction class.)
  • deep_sizing: An alternative sizing method for cases with high injection (peaks) and a variable ground temperature. This method is potentially slower, but proves to be more robust.
  • force_deep_sizing: When the alternative method from above should always be used.

Simple example

To show how all the pieces of GHEtool work together, below you can find a step-by-step example of how, traditionally, one would work with GHEtool. Start by importing all the relevant classes. In this case we are going to work with a ground model which assumes a constant ground temperature (e.g. from a TRT-test), and we will provide the load with a monthly resolution.

from GHEtool import Borefield, GroundDataConstantTemperature, MonthlyGeothermalLoadAbsolute

After importing the necessary classes, the relevant ground data parameters are set.

data = GroundDataConstantTemperature(3,  # ground thermal conductivity (W/mK)
                                     10,  # initial/undisturbed ground temperature (deg C)
                                     2.4 * 10 ** 6)  # volumetric heat capacity of the ground (J/m3K) 

Furthermore, for our loads, we need to set the peak loads as well as the monthly base loads for extraction and injection.

peak_injection = [0., 0, 34., 69., 133., 187., 213., 240., 160., 37., 0., 0.]  # Peak injection in kW
peak_extraction = [160., 142, 102., 55., 0., 0., 0., 0., 40.4, 85., 119., 136.]  # Peak extract in kW

monthly_load_extraction = [46500.0, 44400.0, 37500.0, 29700.0, 19200.0, 0.0, 0.0, 0.0, 18300.0, 26100.0, 35100.0,
                           43200.0]  # in kWh
monthly_load_injection = [4000.0, 8000.0, 8000.0, 8000.0, 12000.0, 16000.0, 32000.0, 32000.0, 16000.0, 12000.0, 8000.0,
                          4000.0]  # in kWh

# set load object
load = MonthlyGeothermalLoadAbsolute(monthly_load_extraction, monthly_load_injection, peak_extraction, peak_injection)

Next, we create the borefield object in GHEtool and set the temperature constraints and the ground data. Here, since we do not use a pipe and fluid model ( see Examples if you need examples were no borehole thermal resistance is given), we set the borehole equivalent thermal resistance.

# create the borefield object
borefield = Borefield(load=load)

# set ground parameters
borefield.set_ground_parameters(data)

# set the borehole equivalent resistance
borefield.Rb = 0.12

# set temperature boundaries
borefield.set_max_avg_fluid_temperature(16)  # maximum temperature
borefield.set_min_avg_fluid_temperature(0)  # minimum temperature

Next we create a rectangular borefield.

# set a rectangular borefield
borefield.create_rectangular_borefield(10, 12, 6, 6, 110, 4, 0.075)

Note that the borefield can also be set using the pygfunction package, if you want more complex designs.

import pygfunction as gt

# set a rectangular borefield
borefield_gt = gt.boreholes.rectangle_field(10, 12, 6, 6, 110, 1, 0.075)
borefield.set_borefield(borefield_gt)

Once a Borefield object is created, one can make use of all the functionalities of GHEtool. One can for example size the borefield using:

depth = borefield.size()
print("The borehole depth is: ", depth, "m")

Or one can plot the temperature profile by using

borefield.print_temperature_profile(legend=True)

A full list of functionalities is given below.

Functionalities

GHEtool offers functionalities of value to all different disciplines working with borefields. The features are available both in the code environment and in the GUI. For more information about the functionalities of GHEtool, please visit the documentation on https://docs.ghetool.eu.

License

GHEtool is licensed under the terms of the 3-clause BSD-license (see GHEtool license). For professional licenses, contact us at info@ghetool.eu.

Contact GHEtool

  • Do you want to support GHEtool financially or by contributing to our software?
  • Do you have a great idea for a new feature?
  • Do you have a specific remark/problem?

Please do contact us at info@ghetool.eu.

Citation

Please cite GHEtool using the JOSS paper.

Peere, W., Blanke, T.(2022). GHEtool: An open-source tool for borefield sizing in Python. Journal of Open Source Software, 7(76), 4406, https://doi.org/10.21105/joss.04406

For more information on how to cite GHEtool, please visit the ReadTheDocs at https://docs.ghetool.eu.

References

Development of GHEtool

Meertens, L., Peere, W., Helsen, L. (2024). Influence of short-term dynamic effects on geothermal borefield size. In Proceedings of International Ground Source Heat Pump Association. Montréal (Canada), 28-30 May 2024.

Coninx, M., De Nies, J., Hermans, L., Peere, W., Boydens, W., Helsen, L. (2024). Cost-efficient cooling of buildings by means of geothermal borefields with active and passive cooling. Applied Energy, 355, Art. No. 122261, https://doi.org/10.1016/j.apenergy.2023.122261.

Peere, W., Hermans, L., Boydens, W., and Helsen, L. (2023). Evaluation of the oversizing and computational speed of different open-source borefield sizing methods. In Proceedings of International Building Simulation Conference 2023. Shanghai (Belgium), 4-6 September 2023.

Coninx, M., De Nies, J. (2022). Cost-efficient Cooling of Buildings by means of Borefields with Active and Passive Cooling. Master thesis, Department of Mechanical Engineering, KU Leuven, Belgium.

Peere, W., Blanke, T. (2022). GHEtool: An open-source tool for borefield sizing in Python. Journal of Open Source Software, 7(76), 4406, https://doi.org/10.21105/joss.04406

Peere, W., Picard, D., Cupeiro Figueroa, I., Boydens, W., and Helsen, L. (2021). Validated combined first and last year borefield sizing methodology. In Proceedings of International Building Simulation Conference 2021. Brugge (Belgium), 1-3 September 2021. https://doi.org/10.26868/25222708.2021.30180

Peere, W. (2020). Methode voor economische optimalisatie van geothermische verwarmings- en koelsystemen. Master thesis, Department of Mechanical Engineering, KU Leuven, Belgium.

Applications/Mentions of GHEtool

Meertens, L. (2024). Reducing Capital Cost for Geothermal Heat Pump Systems Through Dynamic Borefield Sizing. IEA HPT Magazine 42(2), https://doi.org/10.23697/9r3w-jm57.

Blanke, T., Born, H., Döring, B. et al. Model for dimensioning borehole heat exchanger applied to mixed-integer-linear-problem (MILP) energy system optimization. Geotherm Energy 12, 30 ( 2024). https://doi.org/10.1186/s40517-024-00301-w.

Dion G., Pasquier, P., Perraudin, D. (2024). Sizing equation based on the outlet fluid temperature of closed-loop ground heat exchangers. In Proceedings of International Ground Source Heat Pump Association. Montréal (Canada), 28-30 May

Peere, W. (2024). Are Rules of Thumb Misleading? The Complexity of Borefield Sizing and the Importance of Design Software. IEA HPT Magazine 42(1), https://doi.org/10.23697/7nec-0g78.

Meertens, L. (2024). Invloed van dynamische korte-termijneffecten op de dimensionering van geothermische boorvelden. Master thesis, Department of Mechanical Engineering, KU Lueven, Belgium.

Weynjes, J. (2023). Methode voor het dimensioneren van een geothermisch systeem met regeneratie binnen verschillende ESCO-structuren. Master thesis, Department of Mechanical Engineering, KU Leuven, Belgium.

Hermans, L., Haesen, R., Uytterhoeven, A., Peere, W., Boydens, W., Helsen, L. (2023). Pre-design of collective residential solar districts with seasonal thermal energy storage: Importance of level of detail. Applied thermal engineering 226, Art.No. 120203, 10.1016/j.applthermaleng.2023.120203

Cimmino, M., Cook., J. C. (2022). pygfunction 2.2 : New Features and Improvements in Accuracy and Computational Efficiency. In Proceedings of IGSHPA Research Track 2022. Las Vegas (USA), 6-8 December

  1. https://doi.org/10.22488/okstate.22.000015.

Verleyen, L., Peere, W., Michiels, E., Boydens, W., Helsen, L. (2022). The beauty of reason and insight: a story about 30 years old borefield equations. IEA HPT Magazine 40(3), 36-39, https://doi.org/10.23697/6q4n-3223.

Peere, W., Boydens, W., Helsen, L. (2022). GHEtool: een open-sourcetool voor boorvelddimensionering. Presented at the 15e warmtepompsymposium: van uitdaging naar aanpak, Quadrivium, Heverlee, België.

Peere, W., Coninx, M., De Nies, J., Hermans, L., Boydens, W., Helsen, L. (2022). Cost-efficient Cooling of Buildings by means of Borefields with Active and Passive Cooling. Presented at the 15e warmtepompsymposium: van uitdaging naar aanpak, Quadrivium, Heverlee, België.

Peere, W. (2022). Technologieën voor de energietransitie. Presented at the Energietransitie in meergezinswoningen en kantoorgebouwen: uitdagingen!, VUB Brussel Bruxelles - U Residence.

Sharifi., M. (2022). Early-Stage Integrated Design Methods for Hybrid GEOTABS Buildings. PhD thesis, Department of Architecture and Urban Planning, Faculty of Engineering and Architecture, Ghent University.

Coninx, M., De Nies, J. (2022). Cost-efficient Cooling of Buildings by means of Borefields with Active and Passive Cooling. Master thesis, Department of Mechanical Engineering, KU Leuven, Belgium.

Michiels, E. (2022). Dimensionering van meerdere gekoppelde boorvelden op basis van het type vraagprofiel en de verbinding met de gebruikers. Master thesis, Department of Mechanical Engineering, KU Leuven, Belgium.

Vanpoucke, B. (2022). Optimale dimensionering van boorvelden door een variabel massadebiet. Master thesis, Department of Mechanical Engineering, KU Leuven, Belgium.

Haesen R., Hermans L. (2021). Design and Assessment of Low-carbon Residential District Concepts with (Collective) Seasonal Thermal Energy Storage. Master thesis, Departement of Mechanical Engineering, KU Leuven, Belgium.