Optimise load profile

 1"""
 2This document is an example of load optimisation.
 3First an hourly profile is imported and a fixed borefield size is set.
 4Then, based on a load-duration curve, the heating and cooling load is altered in order to fit as much load as possible on the field.
 5The results are returned.
 6
 7"""
 8import numpy as np
 9
10# import all the relevant functions
11from GHEtool import *
12
13
14def optimise():
15
16    # initiate ground data
17    data = GroundConstantTemperature(3, 10)
18
19    # initiate borefield
20    borefield = Borefield()
21
22    # set ground data in borefield
23    borefield.set_ground_parameters(data)
24
25    # set Rb
26    borefield.Rb = 0.12
27
28    # set borefield
29    borefield.create_rectangular_borefield(10, 10, 6, 6, 150, 1, 0.075)
30
31    # load the hourly profile
32    load = HourlyGeothermalLoad()
33    load.load_hourly_profile("hourly_profile.csv", header=True, separator=";")
34    # optimise the load for a 10x10 field (see data above) and a fixed depth of 150m.
35    # first for an optimisation based on the power
36    borefield.optimise_load_profile_power(building_load=load, depth=150)
37
38    print(f'Max heating power (primary): {borefield.load.max_peak_heating:,.0f}kW')
39    print(f'Max cooling power (primary): {borefield.load.max_peak_cooling:,.0f}kW')
40
41    print(f'Total energy extracted from the borefield over simulation period: {np.sum(borefield.load.baseload_heating_simulation_period):,.0f}MWh')
42    print(f'Total energy injected in the borefield over simulation period): {np.sum(borefield.load.baseload_cooling_simulation_period):,.0f}MWh')
43    print('-----------------------------------------------------------------')
44    borefield.calculate_temperatures(hourly=True)
45    borefield.print_temperature_profile(plot_hourly=True)
46
47    # first for an optimisation based on the energy
48    borefield.optimise_load_profile_energy(building_load=load, depth=150)
49
50    print(f'Max heating power (primary): {borefield.load.max_peak_heating:,.0f}kW')
51    print(f'Max cooling power (primary): {borefield.load.max_peak_cooling:,.0f}kW')
52
53    print(
54        f'Total energy extracted from the borefield over simulation period: {np.sum(borefield.load.baseload_heating_simulation_period):,.0f}MWh')
55    print(
56        f'Total energy injected in the borefield over simulation period): {np.sum(borefield.load.baseload_cooling_simulation_period):,.0f}MWh')
57
58    borefield.calculate_temperatures(hourly=True)
59    borefield.print_temperature_profile(plot_hourly=True)
60
61
62if __name__ == "__main__":  # pragma: no cover
63    optimise()