Skip to content

Commit

Permalink
Change examples
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterpeere committed Feb 13, 2025
1 parent 68f35e5 commit 6301132
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
19 changes: 10 additions & 9 deletions GHEtool/Examples/optimise_load_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,35 @@ def optimise():
borefield.create_rectangular_borefield(10, 10, 6, 6, 150, 1, 0.075)

# load the hourly profile
load = HourlyBuildingLoad(efficiency_heating=10 ** 6, efficiency_cooling=10 ** 6)
load = HourlyBuildingLoad(efficiency_heating=5, efficiency_cooling=25)
load.load_hourly_profile("hourly_profile.csv", header=True, separator=";")
load.dhw = 100000 # add domestic hot water

# optimise the load for a 10x10 field (see data above) and a fixed depth of 150m.
# first for an optimisation based on the power
borefield.optimise_load_profile_power(building_load=load, depth=150)
borefield.optimise_load_profile_power(building_load=load)

print(f'Max heating power (primary): {borefield.load.max_peak_extraction:,.0f}kW')
print(f'Max cooling power (primary): {borefield.load.max_peak_injection:,.0f}kW')
print(f'Max extraction power (primary): {borefield.load.max_peak_extraction:,.0f}kW')
print(f'Max injection power (primary): {borefield.load.max_peak_injection:,.0f}kW')

print(
f'Total energy extracted from the borefield over simulation period: {np.sum(borefield.load.monthly_baseload_extraction_simulation_period):,.0f}MWh')
print(
f'Total energy injected in the borefield over simulation period): {np.sum(borefield.load.monthly_baseload_injection_simulation_period):,.0f}MWh')
f'Total energy injected in the borefield over simulation period: {np.sum(borefield.load.monthly_baseload_injection_simulation_period):,.0f}MWh')
print('------------------------------------------------------------------------')
borefield.calculate_temperatures(hourly=True)
borefield.print_temperature_profile(plot_hourly=True)

# first for an optimisation based on the energy
borefield.optimise_load_profile_energy(building_load=load, depth=150)
borefield.optimise_load_profile_energy(building_load=load)

print(f'Max heating power (primary): {borefield.load.max_peak_extraction:,.0f}kW')
print(f'Max cooling power (primary): {borefield.load.max_peak_injection:,.0f}kW')
print(f'Max extraction power (primary): {borefield.load.max_peak_extraction:,.0f}kW')
print(f'Max injection power (primary): {borefield.load.max_peak_injection:,.0f}kW')

print(
f'Total energy extracted from the borefield over simulation period: {np.sum(borefield.load.monthly_baseload_extraction_simulation_period):,.0f}MWh')
print(
f'Total energy injected in the borefield over simulation period): {np.sum(borefield.load.monthly_baseload_injection_simulation_period):,.0f}MWh')
f'Total energy injected in the borefield over simulation period: {np.sum(borefield.load.monthly_baseload_injection_simulation_period):,.0f}MWh')

borefield.calculate_temperatures(hourly=True)
borefield.print_temperature_profile(plot_hourly=True)
Expand Down
2 changes: 1 addition & 1 deletion GHEtool/Examples/optimise_load_profile_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def optimise():
# borefield.print_temperature_profile(plot_hourly=False)
# optimise the load for a 10x10 field (see data above) and a fixed length of 150m.
# first for an optimisation based on the power
borefield.optimise_load_profile_energy(building_load=load, length=100)
borefield.optimise_load_profile_energy(building_load=load)

print(f'Max heating power (primary): {borefield.load.max_peak_extraction:,.0f}kW')
print(f'Max cooling power (primary): {borefield.load.max_peak_injection:,.0f}kW')
Expand Down
6 changes: 6 additions & 0 deletions GHEtool/test/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,9 @@ def test_tilted(monkeypatch):
monkeypatch.setattr(plt, 'show', lambda: None)
from GHEtool.Examples.tilted_borefield import tilted
tilted()


def test_optimise(monkeypatch):
monkeypatch.setattr(plt, 'show', lambda: None)
from GHEtool.Examples.optimise_load_profile import optimise
optimise()

0 comments on commit 6301132

Please sign in to comment.