Skip to content

Commit

Permalink
Merge remote-tracking branch 'originwouter/main' into issue26-include…
Browse files Browse the repository at this point in the history
…-short-term-effects-in-sizing

# Conflicts:
#	GHEtool/VariableClasses/GFunction.py
  • Loading branch information
LoneMeertens committed Dec 3, 2024
2 parents b746ac8 + 63da23d commit 06aada5
Show file tree
Hide file tree
Showing 69 changed files with 1,131 additions and 33,629 deletions.
20 changes: 18 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,21 @@ our [project board](https://github.com/users/wouterpeere/projects/2) on GitHub.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [2.3.0] - unpublished
## [2.3.1] - unpublished

## Added

- __repr__ for every class (issue #310).

## Fixed

- Problem with optimise energy profile (issue #306).

## [2.3.0] - 2024-11-05

## Added

- Added the Separatus probe.
- Extra validation based on the work of Ahmadfard & Bernier (issue #243).
- Added the option to exclude DHW from the peak heating load (issue #252).
- Added vfr to Fluid Class (issue #262).
Expand All @@ -20,7 +31,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Added building laod classes (issue #288).
- Added __eq__ method for Result and Efficiency classes (issue #288).
- Added _time_array to building loads (issue #291).
- Added EERCombined for combined active and passive cooling efficiency (issue #291).
- Added EERCombined for combined active and passive cooling efficiency (issue #291, #296).
- Cluster Class (issue #298).

## Changed

Expand All @@ -40,6 +52,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
issue #283).
- Removed a couple of log messages (issue #288).
- Optimise load profile works with a variable COP/EER (issue #288).
- Rename cylindrical_correction.py (issue #298).

## Fixed

Expand All @@ -48,6 +61,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Problem in CI/CD and testing for python <3.12 (issue #274).
- Fix compatibility with numpy 2.0 (issue #274).
- Fix problem with start month and zero peak loads (issue #288).
- Problem with EERCombined (issue #300).

## [2.2.2] - 2024-05-16

Expand Down Expand Up @@ -350,6 +364,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- fixed bug in interpolation

[2.3.0]: https://github.com/wouterpeere/GHEtool/compare/v2.2.2...v2.3.0

[2.2.2]: https://github.com/wouterpeere/GHEtool/compare/v2.2.1...v2.2.2

[2.2.1]: https://github.com/wouterpeere/GHEtool/compare/v2.2.0...v2.2.1
Expand Down
35 changes: 26 additions & 9 deletions GHEtool/Borefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
from scipy.signal import convolve

from GHEtool.VariableClasses import FluidData, Borehole, GroundConstantTemperature, ResultsMonthly, ResultsHourly
from GHEtool.VariableClasses import CustomGFunction, load_custom_gfunction, GFunction, CalculationSetup
from GHEtool.VariableClasses import CustomGFunction, load_custom_gfunction, GFunction, CalculationSetup, Cluster, \
EERCombined
from GHEtool.VariableClasses.LoadData import *
from GHEtool.VariableClasses.LoadData import _LoadData, _LoadDataBuilding
from GHEtool.VariableClasses.PipeData import _PipeData
Expand Down Expand Up @@ -497,13 +498,13 @@ def set_investment_cost(self, investment_cost: list = None) -> None:
investment_cost = Borefield.DEFAULT_INVESTMENT
self.cost_investment: list = investment_cost

def set_load(self, load: _LoadData) -> None:
def set_load(self, load: Union[_LoadData, Cluster]) -> None:
"""
This function sets the _load attribute.
Parameters
----------
load : _LoadData
load : _LoadData or Cluster
Load data object
Returns
Expand All @@ -525,13 +526,13 @@ def load(self) -> HourlyGeothermalLoad | MonthlyGeothermalLoadAbsolute | \
return self._borefield_load

@load.setter
def load(self, load: _LoadData) -> None:
def load(self, load: Union[_LoadData, Cluster]) -> None:
"""
This function sets the _load attribute.
Parameters
----------
load : _LoadData
load : _LoadData or Cluster
Load data object
Returns
Expand Down Expand Up @@ -1706,25 +1707,30 @@ def calculate_temperatures(H, hourly=hourly):
def calculate_difference(results_old: Union[ResultsMonthly, ResultsHourly],
result_new: Union[ResultsMonthly, ResultsHourly]) -> float:
return max(
np.max((result_new.peak_injection - results_old.peak_injection) / self.load.max_peak_injection),
np.max((result_new.peak_extraction - results_old.peak_extraction) / self.load.max_peak_extraction))
np.max(result_new.peak_injection - results_old.peak_injection),
np.max(result_new.peak_extraction - results_old.peak_extraction))

if isinstance(self.load, _LoadDataBuilding):
# when building load is given, the load should be updated after each temperature calculation.
self.load.reset_results(self.Tf_min, self.Tf_max)
# check if active_passive, because then, threshold should be taken
if isinstance(self.load.eer, EERCombined) and self.load.eer.threshold_temperature is not None:
self.load.reset_results(self.Tf_min, self.load.eer.threshold_temperature)
else:
self.load.reset_results(self.Tf_min, self.Tf_max)
results_old = calculate_temperatures(H, hourly=hourly)
self.load.set_results(results_old)
results = calculate_temperatures(H, hourly=hourly)

# safety
i = 0
while calculate_difference(results_old,
results) > 0.01 and i < self._calculation_setup.max_nb_of_iterations:
results) > self._calculation_setup.atol and i < self._calculation_setup.max_nb_of_iterations:
results_old = results
self.load.set_results(results)
results = calculate_temperatures(H, hourly=hourly)
i += 1
self.results = results
self.load.set_results(results)
return

self.results = calculate_temperatures(H, hourly=hourly)
Expand Down Expand Up @@ -2001,3 +2007,14 @@ def calculate_quadrant(self) -> int:
# limited by minimum temperature
return 3
return 2

def __repr__(self):
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 [-]: {self.number_of_boreholes}\n' \
f'{self.ground_data.__repr__()}\n' \
f'{self.borehole.__repr__()}\n' \
f'{self.load.__repr__()}'
2 changes: 1 addition & 1 deletion GHEtool/Examples/combined_active_and_passive_cooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def default_cooling_in_summer():
# set variables
load.eer = eer
borefield.load = load

print(borefield)
borefield.print_temperature_profile(plot_hourly=True)

# get active cooling data
Expand Down
Loading

0 comments on commit 06aada5

Please sign in to comment.