@@ -12,6 +12,18 @@ def rectangular_geometry():
1212 return collector_geometry , total_collector_area , l_min
1313
1414
15+ @pytest .fixture
16+ def square_field_layout ():
17+ # Corresponds to GCR 0.125 with the rectangular_geometry
18+ X = np .array ([- 8. , 0. , 8. , - 8. , 8. , - 8. , 0. , 8. ])
19+ Y = np .array ([- 8. , - 8. , - 8. , 0. , 0. , 8. , 8. , 8. ])
20+ tracker_distance = (X ** 2 + Y ** 2 )** 0.5
21+ relative_azimuth = np .array ([225. , 180. , 135. , 270. , 90. , 315. , 0. , 45. ])
22+ Z = np .zeros (8 )
23+ relative_slope = np .zeros (8 )
24+ return X , Y , Z , tracker_distance , relative_azimuth , relative_slope
25+
26+
1527def test_l_min_rectangle (rectangular_geometry ):
1628 # Test calculation of L_min for a rectangular collector
1729 l_min = layout ._calculate_l_min (rectangular_geometry [0 ])
@@ -106,6 +118,21 @@ def test_layout_generation_value_error(rectangular_geometry):
106118 gcr = 0.5 , total_collector_area = total_collector_area , L_min = L_min ,
107119 neighbor_order = 1 , rotation = 0 , offset = 0 , aspect_ratio = 1 )
108120
121+
122+ def test_square_field_layout (rectangular_geometry , square_field_layout ):
123+ # Test that a square field layout is returned correctly
124+ collector_geometry , total_collector_area , L_min = rectangular_geometry
125+ X_exp , Y_exp , Z_exp , tracker_distance_exp , relative_azimuth_exp , relative_slope_exp = \
126+ square_field_layout
127+
128+ X , Y , Z , tracker_distance , relative_azimuth , relative_slope = \
129+ layout .generate_field_layout (
130+ gcr = 0.125 ,
131+ total_collector_area = total_collector_area ,
132+ L_min = L_min ,
133+ neighbor_order = 1 ,
134+ layout_type = 'square' )
135+
109136# Test custom layout
110137# Test slope
111138# Test neighbor order
0 commit comments