1313
1414# relevant borefield data for the calculations
1515data = GroundConstantTemperature (3.5 , # conductivity of the soil (W/mK)
16- 10 ) # Ground temperature at infinity (degrees C)
16+ 10 ) # Ground temperature at infinity (degrees C)
1717
18- borefield_gt = gt .boreholes .rectangle_field (10 , 12 , 6.5 , 6.5 , 100 , 4 , 0.075 )
18+ borefield_gt = gt .borefield . Borefield .rectangle_field (10 , 12 , 6.5 , 6.5 , 100 , 4 , 0.075 )
1919
2020
2121def load_case (number ):
@@ -24,7 +24,8 @@ def load_case(number):
2424 if number == 1 :
2525 # case 1
2626 # limited in the first year by cooling
27- monthly_load_heating_percentage = np .array ([0.155 , 0.148 , 0.125 , .099 , .064 , 0. , 0. , 0. , 0.061 , 0.087 , 0.117 , 0.144 ])
27+ monthly_load_heating_percentage = np .array (
28+ [0.155 , 0.148 , 0.125 , .099 , .064 , 0. , 0. , 0. , 0.061 , 0.087 , 0.117 , 0.144 ])
2829 monthly_load_cooling_percentage = np .array ([0.025 , 0.05 , 0.05 , .05 , .075 , .1 , .2 , .2 , .1 , .075 , .05 , .025 ])
2930 monthly_load_heating = monthly_load_heating_percentage * 300 * 10 ** 3 # kWh
3031 monthly_load_cooling = monthly_load_cooling_percentage * 150 * 10 ** 3 # kWh
@@ -34,7 +35,8 @@ def load_case(number):
3435 elif number == 2 :
3536 # case 2
3637 # limited in the last year by cooling
37- monthly_load_heating_percentage = np .array ([0.155 , 0.148 , 0.125 , .099 , .064 , 0. , 0. , 0. , 0.061 , 0.087 , .117 , 0.144 ])
38+ monthly_load_heating_percentage = np .array (
39+ [0.155 , 0.148 , 0.125 , .099 , .064 , 0. , 0. , 0. , 0.061 , 0.087 , .117 , 0.144 ])
3840 monthly_load_cooling_percentage = np .array ([0.025 , 0.05 , 0.05 , .05 , .075 , .1 , .2 , .2 , .1 , .075 , .05 , .025 ])
3941 monthly_load_heating = monthly_load_heating_percentage * 160 * 10 ** 3 # kWh
4042 monthly_load_cooling = monthly_load_cooling_percentage * 240 * 10 ** 3 # kWh
@@ -44,7 +46,8 @@ def load_case(number):
4446 elif number == 3 :
4547 # case 3
4648 # limited in the first year by heating
47- monthly_load_heating_percentage = np .array ([0.155 , 0.148 , 0.125 , .099 , .064 , 0. , 0. , 0. , 0.061 , 0.087 , .117 , 0.144 ])
49+ monthly_load_heating_percentage = np .array (
50+ [0.155 , 0.148 , 0.125 , .099 , .064 , 0. , 0. , 0. , 0.061 , 0.087 , .117 , 0.144 ])
4851 monthly_load_cooling_percentage = np .array ([0.025 , 0.05 , 0.05 , .05 , .075 , .1 , .2 , .2 , .1 , .075 , .05 , .025 ])
4952 monthly_load_heating = monthly_load_heating_percentage * 160 * 10 ** 3 # kWh
5053 monthly_load_cooling = monthly_load_cooling_percentage * 240 * 10 ** 3 # kWh
@@ -54,7 +57,8 @@ def load_case(number):
5457 else :
5558 # case 4
5659 # limited in the last year by heating
57- monthly_load_heating_percentage = np .array ([0.155 , 0.148 , 0.125 , .099 , .064 , 0. , 0. , 0. , 0.061 , 0.087 , 0.117 , 0.144 ])
60+ monthly_load_heating_percentage = np .array (
61+ [0.155 , 0.148 , 0.125 , .099 , .064 , 0. , 0. , 0. , 0.061 , 0.087 , 0.117 , 0.144 ])
5862 monthly_load_cooling_percentage = np .array ([0.025 , 0.05 , 0.05 , .05 , .075 , .1 , .2 , .2 , .1 , .075 , .05 , .025 ])
5963 monthly_load_heating = monthly_load_heating_percentage * 300 * 10 ** 3 # kWh
6064 monthly_load_cooling = monthly_load_cooling_percentage * 150 * 10 ** 3 # kWh
@@ -65,7 +69,6 @@ def load_case(number):
6569
6670
6771def check_cases ():
68-
6972 """
7073 This function checks whether the borefield sizing gives the correct (i.e. validated) results for the 4 cases.
7174 If not, an assertion error is raised.
@@ -87,14 +90,14 @@ def check_cases():
8790 borefield .set_min_avg_fluid_temperature (0 ) # minimum temperature
8891
8992 borefield .size (100 , L2_sizing = True )
90- print (f'correct answer L2: { correct_answers_L2 [i - 1 ]} ; calculated answer L2: { round (borefield .H ,2 )} ; error: '
93+ print (f'correct answer L2: { correct_answers_L2 [i - 1 ]} ; calculated answer L2: { round (borefield .H , 2 )} ; error: '
9194 f'{ round (abs (1 - borefield .H / correct_answers_L2 [i - 1 ]) * 100 , 4 )} %' )
92- assert np .isclose (borefield .H , correct_answers_L2 [i - 1 ], rtol = 0.001 )
95+ assert np .isclose (borefield .H , correct_answers_L2 [i - 1 ], rtol = 0.001 )
9396
9497 borefield .size (100 , L3_sizing = True )
9598 print (f'correct answer L3: { correct_answers_L3 [i - 1 ]} ; calculated answer L3: { round (borefield .H , 2 )} ; error: '
9699 f'{ round (abs (1 - borefield .H / correct_answers_L3 [i - 1 ]) * 100 , 4 )} %' )
97- assert np .isclose (borefield .H , correct_answers_L3 [i - 1 ], rtol = 0.001 )
100+ assert np .isclose (borefield .H , correct_answers_L3 [i - 1 ], rtol = 0.001 )
98101
99102
100103def check_custom_datafile ():
@@ -107,7 +110,7 @@ def check_custom_datafile():
107110
108111 correct_answers = (56.75 , 117.23 , 66.94 , 91.32 )
109112
110- custom_field = gt .boreholes .rectangle_field (N_1 = 12 , N_2 = 10 , B_1 = 6.5 , B_2 = 6.5 , H = 110. , D = 4 , r_b = 0.075 )
113+ custom_field = gt .borefield . Borefield .rectangle_field (N_1 = 12 , N_2 = 10 , B_1 = 6.5 , B_2 = 6.5 , H = 110. , D = 4 , r_b = 0.075 )
111114
112115 for i in (1 , 2 , 3 , 4 ):
113116 borefield = Borefield (load = MonthlyGeothermalLoadAbsolute (* load_case (i )))
@@ -121,11 +124,11 @@ def check_custom_datafile():
121124 borefield .set_min_avg_fluid_temperature (0 ) # minimum temperature
122125
123126 borefield .size (100 , L3_sizing = True )
124- print (f'correct answer: { correct_answers [i - 1 ]} ; calculated '
125- f'answer: { round (borefield .H ,2 )} ; error: '
126- f'{ round (abs (1 - borefield .H / correct_answers [i - 1 ])* 100 ,4 )} %' )
127+ print (f'correct answer: { correct_answers [i - 1 ]} ; calculated '
128+ f'answer: { round (borefield .H , 2 )} ; error: '
129+ f'{ round (abs (1 - borefield .H / correct_answers [i - 1 ]) * 100 , 4 )} %' )
127130
128131
129- if __name__ == "__main__" : # pragma: no cover
132+ if __name__ == "__main__" : # pragma: no cover
130133 check_cases () # check different cases
131134 check_custom_datafile () # check if the custom datafile is correct
0 commit comments