Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterpeere committed Feb 13, 2025
1 parent 472f67f commit e2a2be6
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 7 deletions.
4 changes: 2 additions & 2 deletions GHEtool/Methods/optimise_load_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def optimise_load_profile_power(
if abs(min(borefield.results.peak_extraction) - borefield.Tf_min) > temperature_threshold:
# check if it goes below the threshold
if min(borefield.results.peak_extraction) < borefield.Tf_min:
if (dhw_preferential and peak_heat_load != 0.1) or (not dhw_preferential and peak_dhw_load == 0.1):
if (dhw_preferential and peak_heat_load != 0.1) or (not dhw_preferential and peak_dhw_load <= 0.1):
# first reduce the peak load in heating before touching the dhw load
peak_heat_load = max(0.1, peak_heat_load - 1 * max(1, 10 * (
borefield.Tf_min - min(borefield.results.peak_extraction))))
Expand All @@ -113,7 +113,7 @@ def optimise_load_profile_power(
borefield.Tf_min - min(borefield.results.peak_extraction))))
else:
if (dhw_preferential and peak_heat_load != init_peak_heating) or (
not dhw_preferential and init_peak_dhw == peak_dhw_load):
not dhw_preferential and 0 == peak_dhw_load):
peak_heat_load = min(init_peak_heating, peak_heat_load * 1.01)
else:
peak_dhw_load = min(init_peak_dhw, peak_dhw_load * 1.01)
Expand Down
5 changes: 3 additions & 2 deletions GHEtool/test/methods/method_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@
name='Optimise load profile (auditorium) (energy)', power=False,
hourly=False))
borefield = Borefield()
data = GroundConstantTemperature(3, 10)
borefield.set_ground_parameters(data)
borefield.set_Rb(0.2)
borefield.set_borefield(borefield_gt)
Expand All @@ -622,12 +623,12 @@
hourly_load.set_hourly_heating_load(np.zeros(8760))
hourly_load.cop_dhw = 10 ** 6
list_of_test_objects.add(OptimiseLoadProfileObject(borefield, hourly_load, 150, 99.976, 66.492,
643.137, 195.331, 33.278, 340.705,
643.137, 195.331, 0, 340.705,
name='Optimise load profile 1, reversed (power, dhw load)',
power=True,
hourly=False, dhw_preferential=True))
list_of_test_objects.add(OptimiseLoadProfileObject(borefield, hourly_load, 150, 99.971, 66.424,
639.283, 195.053, 37.132, 340.983,
639.283, 195.053, 0, 340.983,
name='Optimise load profile 1, reversed (power, hourly, dhw load)',
power=True,
hourly=True, dhw_preferential=True))
46 changes: 46 additions & 0 deletions GHEtool/test/methods/temp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from GHEtool import *
import pygfunction as gt
import numpy as np
from GHEtool.Methods.optimise_load_profile import optimise_load_profile_power

borefield_gt = gt.boreholes.rectangle_field(10, 12, 6, 6, 110, 1, 0.075)
hourly_load = HourlyBuildingLoad(efficiency_heating=10 ** 6, efficiency_cooling=10 ** 6, efficiency_dhw=10 ** 6)

borefield = Borefield()
data = GroundConstantTemperature(3, 10)
borefield.set_ground_parameters(data)
borefield.set_Rb(0.2)
borefield.set_borefield(borefield_gt)
borefield.set_max_avg_fluid_temperature(16)
borefield.set_min_avg_fluid_temperature(0)
hourly_load.load_hourly_profile(FOLDER.joinpath("test\methods\hourly_data\hourly_profile.csv"), col_heating=1,
col_cooling=0, col_dhw=1)
hourly_load.hourly_heating_load = np.zeros(8760)
borefield.load = hourly_load

result = optimise_load_profile_power(borefield, hourly_load, dhw_preferential=False)
print(result[1].max_peak_heating, result[1].max_peak_cooling)
# list_of_test_objects.add(OptimiseLoadProfileObject(borefield, hourly_load, 150, 99.976, 66.492,
# 643.137, 195.331, 33.278, 340.705,
# name='Optimise load profile 1, reversed (power, dhw not preferential)',
# power=True,
# hourly=False, dhw_preferential=False))
# list_of_test_objects.add(OptimiseLoadProfileObject(borefield, hourly_load, 150, 99.971, 66.424,
# 639.283, 195.053, 37.132, 340.983,
# name='Optimise load profile 1, reversed (power, hourly, dhw not preferential)',
# power=True,
# hourly=True, dhw_preferential=False))
# hourly_load.load_hourly_profile(FOLDER.joinpath("test\methods\hourly_data\hourly_profile.csv"), col_heating=1,
# col_cooling=0, col_dhw=0)
# hourly_load.set_hourly_heating_load(np.zeros(8760))
# hourly_load.cop_dhw = 10 ** 6
# list_of_test_objects.add(OptimiseLoadProfileObject(borefield, hourly_load, 150, 99.976, 66.492,
# 643.137, 195.331, 33.278, 340.705,
# name='Optimise load profile 1, reversed (power, dhw load)',
# power=True,
# hourly=False, dhw_preferential=True))
# list_of_test_objects.add(OptimiseLoadProfileObject(borefield, hourly_load, 150, 99.971, 66.424,
# 639.283, 195.053, 37.132, 340.983,
# name='Optimise load profile 1, reversed (power, hourly, dhw load)',
# power=True,
# hourly=True, dhw_preferential=True))
7 changes: 4 additions & 3 deletions GHEtool/test/methods/test_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ def test_optimise(input, result):
max_peak_cooling=max_peak_injection)
percentage_extraction, percentage_injection, peak_extraction_geo, peak_injection_geo, peak_extraction_ext, peak_injection_ext = \
result

_percentage_extraction = np.sum(borefield_load.hourly_heating_load_simulation_period) / \
np.sum(load.hourly_heating_load_simulation_period) * 100
_percentage_extraction = (np.sum(borefield_load.hourly_heating_load_simulation_period) + np.sum(
borefield_load.hourly_dhw_load_simulation_period)) / \
(np.sum(load.hourly_heating_load_simulation_period) + np.sum(
load.hourly_dhw_load_simulation_period)) * 100
_percentage_injection = np.sum(borefield_load.hourly_cooling_load_simulation_period) / \
np.sum(load.hourly_cooling_load_simulation_period) * 100
# print(_percentage_extraction)
Expand Down

0 comments on commit e2a2be6

Please sign in to comment.