|
| 1 | +from GHEtool import * |
| 2 | +from GHEtool.Methods.optimise_borefield_configuration import optimise_borefield_configuration |
| 3 | +from GHEtool.Validation.cases import load_case |
| 4 | + |
| 5 | + |
| 6 | +def borefield_case_1(): |
| 7 | + borefield = Borefield(ground_data=GroundConstantTemperature(3.5, 10), |
| 8 | + load=MonthlyGeothermalLoadAbsolute(*load_case(1))) |
| 9 | + borefield.create_rectangular_borefield(10, 6, 6.5, 6.5, 100, 4, 0.075) |
| 10 | + borefield.calculation_setup(use_neural_network=True) |
| 11 | + |
| 12 | + # optimise for minimum borehole length |
| 13 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150) |
| 14 | + borefield.borefield = result[0][-1] |
| 15 | + print( |
| 16 | + f'{len(result)} solutions are found. The optimal borehole length is: {result[0][0]:.2f}m. ' |
| 17 | + f'There are {result[0][2]} boreholes. The configuration is {result[0][1]}.') |
| 18 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150, optimise='nb') |
| 19 | + borefield.borefield = result[0][-1] |
| 20 | + print( |
| 21 | + f'{len(result)} solutions are found. The optimal number of boreholes {result[0][2]}. ' |
| 22 | + f'The total borehole lengths is {result[0][0]:.2f}m. The configuration is {result[0][1]}.') |
| 23 | + |
| 24 | + |
| 25 | +def borefield_case_2(): |
| 26 | + borefield = Borefield(ground_data=GroundConstantTemperature(3.5, 10), |
| 27 | + load=MonthlyGeothermalLoadAbsolute(*load_case(2))) |
| 28 | + borefield.create_rectangular_borefield(10, 6, 6.5, 6.5, 100, 4, 0.075) |
| 29 | + borefield.calculation_setup(use_neural_network=True) |
| 30 | + |
| 31 | + # optimise for minimum borehole length |
| 32 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150) |
| 33 | + borefield.borefield = result[0][-1] |
| 34 | + print( |
| 35 | + f'{len(result)} solutions are found. The optimal borehole length is: {result[0][0]:.2f}m. ' |
| 36 | + f'There are {result[0][2]} boreholes. The configuration is {result[0][1]}.') |
| 37 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150, optimise='nb') |
| 38 | + borefield.borefield = result[0][-1] |
| 39 | + print( |
| 40 | + f'{len(result)} solutions are found. The optimal number of boreholes {result[0][2]}. ' |
| 41 | + f'The total borehole lengths is {result[0][0]:.2f}m. The configuration is {result[0][1]}.') |
| 42 | + |
| 43 | + |
| 44 | +def borefield_case_3(): |
| 45 | + borefield = Borefield(ground_data=GroundConstantTemperature(3.5, 10), |
| 46 | + load=MonthlyGeothermalLoadAbsolute(*load_case(3))) |
| 47 | + borefield.create_rectangular_borefield(10, 6, 6.5, 6.5, 100, 4, 0.075) |
| 48 | + borefield.calculation_setup(use_neural_network=True) |
| 49 | + |
| 50 | + # optimise for minimum borehole length |
| 51 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150) |
| 52 | + borefield.borefield = result[0][-1] |
| 53 | + print( |
| 54 | + f'{len(result)} solutions are found. The optimal borehole length is: {result[0][0]:.2f}m. ' |
| 55 | + f'There are {result[0][2]} boreholes. The configuration is {result[0][1]}.') |
| 56 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150, optimise='nb') |
| 57 | + borefield.borefield = result[0][-1] |
| 58 | + print( |
| 59 | + f'{len(result)} solutions are found. The optimal number of boreholes {result[0][2]}. ' |
| 60 | + f'The total borehole lengths is {result[0][0]:.2f}m. The configuration is {result[0][1]}.') |
| 61 | + |
| 62 | + |
| 63 | +def borefield_case_4(): |
| 64 | + borefield = Borefield(ground_data=GroundConstantTemperature(3.5, 10), |
| 65 | + load=MonthlyGeothermalLoadAbsolute(*load_case(4))) |
| 66 | + borefield.create_rectangular_borefield(10, 6, 6.5, 6.5, 100, 4, 0.075) |
| 67 | + borefield.calculation_setup(use_neural_network=True) |
| 68 | + |
| 69 | + # optimise for minimum borehole length |
| 70 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150) |
| 71 | + borefield.borefield = result[0][-1] |
| 72 | + print( |
| 73 | + f'{len(result)} solutions are found. The optimal borehole length is: {result[0][0]:.2f}m. ' |
| 74 | + f'There are {result[0][2]} boreholes. The configuration is {result[0][1]}.') |
| 75 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150, optimise='nb') |
| 76 | + borefield.borefield = result[0][-1] |
| 77 | + print( |
| 78 | + f'{len(result)} solutions are found. The optimal number of boreholes {result[0][2]}. ' |
| 79 | + f'The total borehole lengths is {result[0][0]:.2f}m. The configuration is {result[0][1]}.') |
| 80 | + |
| 81 | + |
| 82 | +def borefield_office(): |
| 83 | + borefield = Borefield() |
| 84 | + borefield.create_rectangular_borefield(10, 10, 6, 6, 110, 4, 0.075) |
| 85 | + borefield.ground_data = GroundFluxTemperature(3, 10) |
| 86 | + borefield.fluid_data = ConstantFluidData(0.568, 998, 4180, 1e-3) |
| 87 | + borefield.flow_data = ConstantFlowRate(mfr=0.2) |
| 88 | + borefield.pipe_data = DoubleUTube(1, 0.015, 0.02, 0.4, 0.05) |
| 89 | + borefield.calculation_setup(use_constant_Rb=False) |
| 90 | + borefield.set_max_avg_fluid_temperature(17) |
| 91 | + borefield.set_min_avg_fluid_temperature(3) |
| 92 | + hourly_load = HourlyGeothermalLoad() |
| 93 | + hourly_load.simulation_period = 20 |
| 94 | + hourly_load.load_hourly_profile(FOLDER.joinpath("test\methods\hourly_data\office.csv"), header=True, separator=";", |
| 95 | + col_injection=0, col_extraction=1) |
| 96 | + borefield.load = hourly_load |
| 97 | + borefield.calculation_setup(use_neural_network=True) |
| 98 | + |
| 99 | + # optimise for minimum borehole length |
| 100 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150) |
| 101 | + borefield.borefield = result[0][-1] |
| 102 | + print( |
| 103 | + f'{len(result)} solutions are found. The optimal borehole length is: {result[0][0]:.2f}m. ' |
| 104 | + f'There are {result[0][2]} boreholes. The configuration is {result[0][1]}.') |
| 105 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150, optimise='nb') |
| 106 | + borefield.borefield = result[0][-1] |
| 107 | + print( |
| 108 | + f'{len(result)} solutions are found. The optimal number of boreholes {result[0][2]}. ' |
| 109 | + f'The total borehole lengths is {result[0][0]:.2f}m. The configuration is {result[0][1]}.') |
| 110 | + |
| 111 | + |
| 112 | +def borefield_auditorium(): |
| 113 | + borefield = Borefield() |
| 114 | + borefield.create_rectangular_borefield(10, 10, 6, 6, 110, 4, 0.075) |
| 115 | + borefield.ground_data = GroundFluxTemperature(3, 10) |
| 116 | + borefield.fluid_data = ConstantFluidData(0.568, 998, 4180, 1e-3) |
| 117 | + borefield.flow_data = ConstantFlowRate(mfr=0.2) |
| 118 | + borefield.pipe_data = DoubleUTube(1, 0.015, 0.02, 0.4, 0.05) |
| 119 | + borefield.calculation_setup(use_constant_Rb=False) |
| 120 | + borefield.set_max_avg_fluid_temperature(17) |
| 121 | + borefield.set_min_avg_fluid_temperature(3) |
| 122 | + hourly_load = HourlyGeothermalLoad() |
| 123 | + hourly_load.simulation_period = 20 |
| 124 | + hourly_load.load_hourly_profile(FOLDER.joinpath("test\methods\hourly_data\\auditorium.csv"), header=True, |
| 125 | + separator=";", col_injection=0, col_extraction=1) |
| 126 | + borefield.load = hourly_load |
| 127 | + borefield.calculation_setup(use_neural_network=True) |
| 128 | + |
| 129 | + # optimise for minimum borehole length |
| 130 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150) |
| 131 | + borefield.borefield = result[0][-1] |
| 132 | + print( |
| 133 | + f'{len(result)} solutions are found. The optimal borehole length is: {result[0][0]:.2f}m. ' |
| 134 | + f'There are {result[0][2]} boreholes. The configuration is {result[0][1]}.') |
| 135 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150, |
| 136 | + optimise='nb') |
| 137 | + borefield.borefield = result[0][-1] |
| 138 | + print( |
| 139 | + f'{len(result)} solutions are found. The optimal number of boreholes {result[0][2]}. ' |
| 140 | + f'The total borehole lengths is {result[0][0]:.2f}m. The configuration is {result[0][1]}.') |
| 141 | + |
| 142 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150, size_L3=False) |
| 143 | + |
| 144 | + |
| 145 | +def borefield_swimming_pool(): |
| 146 | + borefield = Borefield() |
| 147 | + borefield.create_rectangular_borefield(10, 10, 6, 6, 110, 4, 0.075) |
| 148 | + borefield.ground_data = GroundFluxTemperature(3, 10) |
| 149 | + borefield.fluid_data = ConstantFluidData(0.568, 998, 4180, 1e-3) |
| 150 | + borefield.flow_data = ConstantFlowRate(mfr=0.2) |
| 151 | + borefield.pipe_data = DoubleUTube(1, 0.015, 0.02, 0.4, 0.05) |
| 152 | + borefield.calculation_setup(use_constant_Rb=False) |
| 153 | + borefield.set_max_avg_fluid_temperature(17) |
| 154 | + borefield.set_min_avg_fluid_temperature(3) |
| 155 | + hourly_load = HourlyGeothermalLoad() |
| 156 | + hourly_load.simulation_period = 20 |
| 157 | + hourly_load.load_hourly_profile(FOLDER.joinpath("test\methods\hourly_data\swimming_pool.csv"), header=True, |
| 158 | + separator=";", col_injection=0, col_extraction=1) |
| 159 | + borefield.load = hourly_load |
| 160 | + borefield.calculation_setup(use_neural_network=True) |
| 161 | + |
| 162 | + # optimise for minimum borehole length |
| 163 | + result = optimise_borefield_configuration(borefield, 200, 200, 5, 7, 0.5, 60, 300) |
| 164 | + borefield.borefield = result[0][-1] |
| 165 | + print( |
| 166 | + f'{len(result)} solutions are found. The optimal borehole length is: {result[0][0]:.2f}m. ' |
| 167 | + f'There are {result[0][2]} boreholes. The configuration is {result[0][1]}.') |
| 168 | + result = optimise_borefield_configuration(borefield, 200, 200, 5, 7, 0.5, 60, 300, optimise='nb') |
| 169 | + borefield.borefield = result[0][-1] |
| 170 | + print( |
| 171 | + f'{len(result)} solutions are found. The optimal number of boreholes {result[0][2]}. ' |
| 172 | + f'The total borehole lengths is {result[0][0]:.2f}m. The configuration is {result[0][1]}.') |
| 173 | + |
| 174 | + |
| 175 | +def borefield_case_1_flow_rate(): |
| 176 | + borefield = Borefield(ground_data=GroundConstantTemperature(3.5, 10), |
| 177 | + load=MonthlyGeothermalLoadAbsolute(*load_case(1))) |
| 178 | + borefield.create_rectangular_borefield(10, 6, 6.5, 6.5, 100, 4, 0.075) |
| 179 | + borefield.ground_data = GroundFluxTemperature(3, 10) |
| 180 | + borefield.fluid_data = ConstantFluidData(0.568, 998, 4180, 1e-3) |
| 181 | + borefield.flow_data = ConstantFlowRate(mfr=0.3) |
| 182 | + borefield.pipe_data = DoubleUTube(1, 0.015, 0.02, 0.4, 0.05) |
| 183 | + borefield.calculation_setup(use_constant_Rb=False) |
| 184 | + borefield.calculation_setup(use_neural_network=True) |
| 185 | + |
| 186 | + # optimise for minimum borehole length |
| 187 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150) |
| 188 | + print( |
| 189 | + f'{len(result)} solutions are found for a constant flow/borehole. The optimal borehole length is: {result[0][0]:.2f}m. ' |
| 190 | + f'There are {result[0][2]} boreholes. The configuration is {result[0][1]}.') |
| 191 | + |
| 192 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150, |
| 193 | + flow_field=ConstantFlowRate(mfr=10)) |
| 194 | + print( |
| 195 | + f'{len(result)} solutions are found for a constant flow/borefield. The optimal number of boreholes {result[0][2]}. ' |
| 196 | + f'The total borehole lengths is {result[0][0]:.2f}m. The configuration is {result[0][1]}.') |
| 197 | + result = optimise_borefield_configuration(borefield, 80, 70, 5, 7, 0.5, 60, 150, |
| 198 | + flow_field=ConstantFlowRate(vfr=10)) |
| 199 | + |
| 200 | + |
| 201 | +if __name__ == "__main__": # pragma: no cover |
| 202 | + borefield_case_1() |
| 203 | + borefield_case_2() |
| 204 | + borefield_case_3() |
| 205 | + borefield_case_4() |
| 206 | + borefield_office() |
| 207 | + borefield_auditorium() |
| 208 | + borefield_swimming_pool() |
| 209 | + borefield_case_1_flow_rate() |
0 commit comments