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
35    # optimise the load for a 10x10 field (see data above) and a fixed depth of 150m.
36    # first for an optimisation based on the power
37    borefield.optimise_load_profile_power(building_load=load, depth=150)
38
39    print(f'Max heating power (primary): {borefield.load.max_peak_heating:,.0f}kW')
40    print(f'Max cooling power (primary): {borefield.load.max_peak_cooling:,.0f}kW')
41
42    print(f'Total energy extracted from the borefield over simulation period: {np.sum(borefield.load.baseload_heating_simulation_period):,.0f}MWh')
43    print(f'Total energy injected in the borefield over simulation period): {np.sum(borefield.load.baseload_cooling_simulation_period):,.0f}MWh')
44    print('-----------------------------------------------------------------')
45    borefield.calculate_temperatures(hourly=True)
46    borefield.print_temperature_profile(plot_hourly=True)
47
48    # first for an optimisation based on the energy
49    borefield.optimise_load_profile_energy(building_load=load, depth=150)
50
51    print(f'Max heating power (primary): {borefield.load.max_peak_heating:,.0f}kW')
52    print(f'Max cooling power (primary): {borefield.load.max_peak_cooling:,.0f}kW')
53
54    print(
55        f'Total energy extracted from the borefield over simulation period: {np.sum(borefield.load.baseload_heating_simulation_period):,.0f}MWh')
56    print(
57        f'Total energy injected in the borefield over simulation period): {np.sum(borefield.load.baseload_cooling_simulation_period):,.0f}MWh')
58
59    borefield.calculate_temperatures(hourly=True)
60    borefield.print_temperature_profile(plot_hourly=True)
61
62
63if __name__ == "__main__":  # pragma: no cover
64    optimise()