@@ -14,7 +14,8 @@ def _rotate_origin(x, y, rotation_deg):
1414
1515def generate_field_layout (gcr , collector_area , L_min , neighbor_order ,
1616 aspect_ratio = None , offset = None , rotation = None ,
17- layout_type = None , plot = False ):
17+ layout_type = None , slope_azimuth = 0 ,
18+ slope_tilt = 0 , plot = False ):
1819 """
1920 Generate a regularly-spaced collector field layout.
2021
@@ -51,19 +52,31 @@ def generate_field_layout(gcr, collector_area, L_min, neighbor_order,
5152 Counterclockwise rotation of the field in degrees. 0 <= rotation < 180
5253 layout_type: {square, square_rotated, hexagon_e_w, hexagon_n_s}, optional
5354 Specification of the special layout type (only depend on gcr).
54- plot: bool, default: True
55+ slope_azimuth : float, optional
56+ Direction of normal to slope on horizontal [degrees]
57+ slope_tilt : float, optional
58+ Tilt of slope relative to horizontal [degrees]
59+ plot: bool, default: False
5560 Whether to plot the field layout.
5661
5762 Returns
5863 -------
5964 X: array of floats
60- x coordinates of neighboring trackers.
65+ Distance of neighboring trackers to the reference tracker in the east-
66+ west direction. East is positive.
6167 Y: array of floats
62- y coordinates of neighboring trackers.
68+ Distance of neighboring trackers to the reference tracker in the north-
69+ south direction. North is positive.
70+ Z: array of floats
71+ Relative heights of neighboring trackers.
6372 tracker_distance: array of floats
64- Distances between neighboring trackers and reference tracker.
73+ Distances between neighboring trackers and the reference tracker.
6574 relative_azimuth: array of floats
66- Relative azimuth between neigboring trackers and reference tracker.
75+ Relative azimuth of neighboring trackers - measured clockwise from
76+ north [degrees].
77+ relative_slope: array of floats
78+ Slope between neighboring trackers and reference tracker. A positive
79+ slope means neighboring collector is higher than reference collector.
6780
6881 References
6982 ----------
@@ -128,6 +141,11 @@ def generate_field_layout(gcr, collector_area, L_min, neighbor_order,
128141 X = X * aspect_ratio
129142 # Apply field rotation
130143 X , Y = _rotate_origin (X , Y , rotation )
144+ # Calculate relative tracker height based on surface slope
145+ Z = - X * np .sin (np .deg2rad (slope_azimuth )) * \
146+ np .tan (np .deg2rad (slope_tilt )) \
147+ - Y * np .cos (np .deg2rad (slope_azimuth )) * \
148+ np .tan (np .deg2rad (slope_tilt ))
131149 # Calculate and apply the scaling factor based on GCR
132150 scaling = np .sqrt (collector_area / (gcr * aspect_ratio ))
133151 X , Y = X * scaling , Y * scaling
@@ -136,9 +154,12 @@ def generate_field_layout(gcr, collector_area, L_min, neighbor_order,
136154 tracker_distance = np .sqrt (X ** 2 + Y ** 2 )
137155 # The relative azimuth is defined clockwise eastwards from north
138156 relative_azimuth = np .mod (450 - np .rad2deg (np .arctan2 (Y , X )), 360 )
157+ # Relative slope of collectors
158+ # positive means collector is higher than reference collector
159+ relative_slope = - np .cos (np .deg2rad (slope_azimuth - relative_azimuth )) * slope_tilt # noqa: E501
139160
140161 # Visualize layout
141162 if plot :
142- plotting ._plot_field_layout (X , Y , L_min )
163+ plotting ._plot_field_layout (X , Y , Z , L_min )
143164
144- return X , Y , tracker_distance , relative_azimuth
165+ return X , Y , Z , tracker_distance , relative_azimuth , relative_slope
0 commit comments