This is an instance of the translation of an Excel spreadsheet formula into the Python equivalent.
EXCEL:
#AH2=Sun Azimuth degrees clockwise from North
=IF(AC2>0,MOD(DEGREES(ACOS(((SIN(RADIANS(Lat))*COS(RADIANS(AD2)))-SIN(RADIANS(T2)))/(COS(RADIANS(Lat))*SIN(RADIANS(AD2)))))+180,360),MOD(540-DEGREES(ACOS(((SIN(RADIANS(Lat))*COS(RADIANS(AD2)))-SIN(RADIANS(T2)))/(COS(RADIANS(Lat))*SIN(RADIANS(AD2))))),360))
PYTHON:
#AH2=Sun Azimuth degrees clockwise from North
AH2a1=math.acos(((math.sin((B3/r)) * math.cos((AD2/r))) - math.sin((T2/r))) / ((math.cos((B3/r)) * math.sin(AD2/r))))*r + 180
AH2b1=360
AH2a2=540-math.acos(((math.sin(B3/r)*math.cos(AD2/r))-math.sin(T2/r))/((math.cos(B3/r)*math.sin(AD2/r))))*r
AH2b2=AH2b1
if AC2 > 0 : AH2=AH2a1-int(AH2a1/AH2b1)*AH2b1
else : AH2=AH2a2-int(AH2a2/AH2b2)*AH2b2
Subscribe to:
Post Comments (Atom)
Major update
A lot has been done since the last post. Previously, I had 580 watts of solar panel power. One of the panels, on examination, had lost a s...
-
In a recent post I presented the equation for energy incident on a solar panel (Sm). Here I present the set of equations used to calcu...
-
Actuator power relay switch installed. I ordered and received a two-relay card. I use a four-channel version to reverse the actuator p...
-
Two scripts run during boot and write headers to daily log files. Recently, the headers are not written but the data is logged. The problem...
No comments:
Post a Comment