@@ -19,15 +19,16 @@ def singleaxis(SunZen, SunAz, Latitude=1,
19
19
required.
20
20
21
21
Rotation angle is determined in a panel-oriented coordinate system.
22
- The tracker azimuth AxisAzimuth defines the positive y-axis; the positive
23
- x-axis is 90 degress clockwise from the y-axis and parallel to the
24
- earth surface, and the positive z-axis is normal and oriented towards the sun.
22
+ The tracker azimuth AxisAzimuth defines the positive y-axis;
23
+ the positive x-axis is 90 degress clockwise from the y-axis
24
+ and parallel to the earth surface, and the positive z-axis is
25
+ normal and oriented towards the sun.
25
26
Rotation angle TrkrTheta indicates tracker position relative to horizontal:
26
27
TrkrTheta = 0 is horizontal, and positive TrkrTheta is a clockwise rotation
27
- around the y axis in the x, y, z coordinate system. For example, if tracker azimuth
28
- AxisAzimuth is 180 (oriented south), TrkrTheta = 30 is a rotation of
29
- 30 degrees towards the west, and TrkrTheta = -90 is a rotation to the
30
- vertical plane facing east.
28
+ around the y axis in the x, y, z coordinate system.
29
+ For example, if tracker azimuth AxisAzimuth is 180 (oriented south),
30
+ TrkrTheta = 30 is a rotation of 30 degrees towards the west,
31
+ and TrkrTheta = -90 is a rotation to the vertical plane facing east.
31
32
32
33
Parameters
33
34
----------
@@ -97,7 +98,7 @@ def singleaxis(SunZen, SunAz, Latitude=1,
97
98
98
99
pvl_logger .debug ('tracking.singleaxis' )
99
100
100
- # initial matlab to python conversion by
101
+ # MATLAB to Python conversion by
101
102
# Will Holmgren, U. Arizona, March, 2015. @wholmgren
102
103
103
104
# Calculate sun position x, y, z using coordinate system as in [1], Eq 2.
@@ -109,7 +110,8 @@ def singleaxis(SunZen, SunAz, Latitude=1,
109
110
# Equations in [1] assume solar azimuth is relative to reference vector
110
111
# pointed south, with clockwise positive. Here, the input solar azimuth
111
112
# is degrees East of North, i.e., relative to a reference vector pointed
112
- # north with clockwise positive. Rotate sun azimuth to coordinate system as in [1]
113
+ # north with clockwise positive.
114
+ # Rotate sun azimuth to coordinate system as in [1]
113
115
# to calculate sun position.
114
116
115
117
times = SunAz .index
@@ -123,27 +125,30 @@ def singleaxis(SunZen, SunAz, Latitude=1,
123
125
# translate array azimuth from compass bearing to [1] coord system
124
126
AxisAz = AxisAzimuth - 180
125
127
126
- # translate input array tilt angle axistilt to [1] coordinate system. In
127
- # [1] coordinates, axistilt is a rotation about the x-axis. For a system
128
- # with array azimuth (y-axis) oriented south, the x-axis is oriented west,
129
- # and a positive axistilt is a counterclockwise rotation, i.e, lifting the
130
- # north edge of the panel. Thus, in [1] coordinate system, in the northern
131
- # hemisphere a positive axistilt indicates a rotation toward the equator,
128
+ # translate input array tilt angle axistilt to [1] coordinate system.
129
+
130
+ # In [1] coordinates, axistilt is a rotation about the x-axis.
131
+ # For a system with array azimuth (y-axis) oriented south,
132
+ # the x-axis is oriented west, and a positive axistilt is a
133
+ # counterclockwise rotation, i.e, lifting the north edge of the panel.
134
+ # Thus, in [1] coordinate system, in the northern hemisphere a positive
135
+ # axistilt indicates a rotation toward the equator,
132
136
# whereas in the southern hemisphere rotation toward the equator is
133
- # indicated by axistilt<0. Here, the input axistilt is always positive and
134
- # is a rotation toward the equator.
137
+ # indicated by axistilt<0. Here, the input axistilt is
138
+ # always positive and is a rotation toward the equator.
135
139
136
140
# Calculate sun position (xp, yp, zp) in panel-oriented coordinate system:
137
141
# positive y-axis is oriented along tracking axis at panel tilt;
138
142
# positive x-axis is orthogonal, clockwise, parallel to earth surface;
139
143
# positive z-axis is normal to x-y axes, pointed upward.
140
144
# Calculate sun position (xp,yp,zp) in panel coordinates using [1] Eq 11
145
+ # note that equation for yp (y' in Eq. 11 of Lorenzo et al 2011) is
146
+ # corrected, after conversation with paper's authors.
147
+
141
148
xp = x * cosd (AxisAz ) - y * sind (AxisAz );
142
149
yp = (x * cosd (AxisTilt )* sind (AxisAz ) +
143
150
y * cosd (AxisTilt )* cosd (AxisAz ) -
144
151
z * sind (AxisTilt ))
145
- # note that equation for yp (y' in Eq. 11 of Lorenzo et al 2011) is
146
- # corrected, after conversation with paper's authors
147
152
zp = (x * sind (AxisTilt )* sind (AxisAz ) +
148
153
y * sind (AxisTilt )* cosd (AxisAz ) +
149
154
z * cosd (AxisTilt ))
@@ -160,11 +165,15 @@ def singleaxis(SunZen, SunAz, Latitude=1,
160
165
# can we use atan2?
161
166
162
167
# filter to avoid undefined inverse tangent
163
- #tmp(xp~=0) = atand(zp./xp) # angle from x-y plane to projection of sun vector onto x-z plane
164
- tmp = np .degrees (np .arctan (zp / xp )) # angle from x-y plane to projection of sun vector onto x-z plane
168
+
169
+ # angle from x-y plane to projection of sun vector onto x-z plane
170
+ #tmp(xp~=0) = atand(zp./xp)
171
+ # angle from x-y plane to projection of sun vector onto x-z plane
172
+ tmp = np .degrees (np .arctan (zp / xp ))
165
173
#tmp(xp==0 & zp>=0) = 90 # fill in when atan is undefined
166
174
#tmp(xp==0 & zp<0) = -90 # fill in when atan is undefined
167
175
#tmp=tmp(:); # ensure tmp is a column vector
176
+
168
177
# Obtain wid by translating tmp to convention for rotation angles.
169
178
# Have to account for which quadrant of the x-z plane in which the sun
170
179
# vector lies. Complete solution here but probably not necessary to
@@ -188,7 +197,11 @@ def singleaxis(SunZen, SunAz, Latitude=1,
188
197
pvl_logger .debug ('applying backtracking' )
189
198
Lew = 1 / GCR
190
199
temp = np .minimum (Lew * cosd (wid ), 1 )
191
- wc = np .degrees (np .arccos (temp )) # backtrack angle; always positive (acosd returns values between 0 and 180)
200
+
201
+ # backtrack angle
202
+ # (always positive b/c acosd returns values between 0 and 180)
203
+ wc = np .degrees (np .arccos (temp ))
204
+
192
205
v = wid < 0
193
206
widc = pd .Series (index = times )
194
207
widc [~ v ] = wid [~ v ] - wc [~ v ]; # Eq 4 applied when wid in QI
@@ -219,25 +232,27 @@ def singleaxis(SunZen, SunAz, Latitude=1,
219
232
AOI = np .degrees (np .arccos (np .abs (np .sum (P * Norm , axis = 0 ))))
220
233
#AOI(~u) = 0 # set to zero when sun is below panel horizon
221
234
222
- # calculate panel elevation SurfEl and azimuth SurfAz in a coordinate system where the
223
- # panel elevation is the angle from horizontal, and the panel azimuth is
224
- # the compass angle (clockwise from north) to the projection of the panel's
225
- # normal to the earth's surface. These outputs are provided for
226
- # convenience and comparison with other PV software which use these angle
227
- # conventions.
235
+ # calculate panel elevation SurfEl and azimuth SurfAz
236
+ # in a coordinate system where the panel elevation is the
237
+ # angle from horizontal, and the panel azimuth is
238
+ # the compass angle (clockwise from north) to the projection
239
+ # of the panel's normal to the earth's surface.
240
+ # These outputs are provided for convenience and comparison
241
+ # with other PV software which use these angle conventions.
228
242
229
- # project normal vector to earth surface. First rotate
230
- # about x-axis by angle -AxisTilt so that y-axis is also parallel to earth
231
- # surface, then project.
232
- #rotation matrix
243
+ # project normal vector to earth surface.
244
+ # First rotate about x-axis by angle -AxisTilt so that y-axis is
245
+ # also parallel to earth surface, then project.
246
+
247
+ # Calculate standard rotation matrix
233
248
Rot_x = np .array ([[1 , 0 , 0 ],
234
249
[0 , cosd (- AxisTilt ), - sind (- AxisTilt )],
235
250
[0 , sind (- AxisTilt ), cosd (- AxisTilt )]])
236
251
237
252
# temp contains the normal vector expressed in earth-surface coordinates
238
253
# (z normal to surface, y aligned with tracker axis parallel to earth)
239
254
temp = np .dot (Rot_x , Norm )
240
- temp = temp .T # ensure column format
255
+ temp = temp .T
241
256
242
257
# projection to plane tangent to earth surface,
243
258
# in earth surface coordinates
0 commit comments