Tuesday, December 12, 2017

NOAA equations for solar data (sunrise, sunset, elevation, azimuth, Julian Day, Equation of Time, etc..



   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 calculate sunrise, sunset, and solar elevation and azimuth.

=============================================================

#This particular set was extracted from an Excel spreadsheet made available by NOAA.

#360 deg/2*pi=57.29578
#if in radians, do sin(x/r) to get degrees
#sin(45d)=.7071
#sin(45r)=0.8509

LT: Local Tiime
UT:Universal Time
TZ:Time Zone
LT=UT+TZ

JDg1=367*Y-int(7*(Y+int((M+9)/12))/4)-int(3*(int((Y+(M-9)/7)/100)+1)/4)+int(275*M/9)+D+1721028.5+UT/24
JDg2=367*Y-int(7*(Y+int((M+9)/12))/4)+int(275*M/9)+D+1721013.5+UT/24

#For the Day:
#B3=Latitude, + to N
#B4=Longitude + to E
#B5=Time Zone + to E    ( calculations use TZ)
#B7=Date
#H=Blank
#--------------------------

#D2=date
=date, mm/dd/yyyy , Calculations use JD

#E2=T past local midnight (used in TST and Elev refraction calc)
#sum of 0.1/24 from midnight to current with .1/24 increments (fraction of the day in tenths of an hour ; 6 min = 0.0041666 day)
=LT/24
# In the JD, the previous day +.5 is midnight since the calendar sarts at noon.
#F2=Julian Day
=D2+2415018.5+E2-TimeZone(TZ)/24
JDg2=D2+2415018.5+E2-TimeZone(TZ)/24


#G=Julian , used in other functions, translated into radians. Functions that make up S and T use G (P,R,Q).
=(F2-2451545)/36525

#H=Blank

#I=Geom Mean Long Sun
=MOD(280.46646+G2*(36000.76983+G2*0.0003032),360)
#mod()=a-int(a/b)*b

#J=Geometric Mean Anomaly of the Sun
=357.52911+G2*(35999.05029-0.0001537*G2)

#K=Eccentricity of Earth orbit
=0.016708634-G2*(0.000042037+0.0000001267*G2)

#L=Sun Eq of Ctr
=SIN(RADIANS(J2))*(1.914602-G2*(0.004817+0.000014*G2))+SIN(RADIANS(2*J2))*(0.019993-0.000101*G2)+SIN(RADIANS(3*J2))*0.000289

#M=Sun True Long degrees
=I2+L2

#N=Sun True Anomaly degrees
=J2+L2

#O=Sun Radius Vector, A.U.
=(1.000001018*(1-K2*K2))/(1+K2*COS(RADIANS(N2)))

#P=Sun Apparent Long
=M2-0.00569-0.00478*SIN(RADIANS(125.04-1934.136*G2))

#Q=Mean Oblique Ecliptic degrees
=23+(26+((21.448-G2*(46.815+G2*(0.00059-G2*0.001813))))/60)/60

#R=Oblique Correction factor
=Q2+0.00256*COS(RADIANS(125.04-1934.136*G2))

#S=Right Ascension degrees
=DEGREES(ATAN2(COS(RADIANS(P2)),COS(RADIANS(R2))*SIN(RADIANS(P2))))

#T=Declination in degrees
=DEGREES(ASIN(SIN(RADIANS(R2))*SIN(RADIANS(P2))))

#U=var y
=TAN(RADIANS(R2/2))*TAN(RADIANS(R2/2))

#V=EoT minutes
=4*DEGREES(U2*SIN(2*RADIANS(I2))-2*K2*SIN(RADIANS(J2))+4*K2*U2*SIN(RADIANS(J2))*COS(2*RADIANS(I2))-0.5*U2*U2*SIN(4*RADIANS(I2))-1.25*K2*K2*SIN(2*RADIANS(J2)))

#W=HA Sunrise degrees
=DEGREES(ACOS(COS(RADIANS(90.833))/(COS(RADIANS(Lat))*COS(RADIANS(T2)))-TAN(RADIANS(Lat))*TAN(RADIANS(T2))))

#X=Sun noon LST
=(720-4*Lon-V2+TZ*60)/1440

#Y=Sunrise time
#Y=Sunrise time
Y2=X-W*4/1440
#Z=Sunset time
Z2=X+W*4/1440

#AA2=Sunlight duration
=8*W2

#AB2=TST
=MOD(E2*1440+V2+4*Lon-60*TZ,1440)

#AC2=Hour Angle
=IF(AB2/4<0,AB2/4+180,AB2/4-180)

#AD2=Zenith
=DEGREES(ACOS(SIN(RADIANS(Lat))*SIN(RADIANS(T2))+COS(RADIANS(Lat))*COS(RADIANS(T2))*COS(RADIANS(AC2))))

#AE2= Sun elevation in degrees
90-AD2

#AF2=Atmospheric refraction un degrees
=IF(AE2>85,0,IF(AE2>5,58.1/TAN(RADIANS(AE2))-0.07/POWER(TAN(RADIANS(AE2)),3)+0.000086/POWER(TAN(RADIANS(AE2)),5),IF(AE2>-0.575,1735+AE2*(-518.2+AE2*(103.4+AE2*(-12.79+AE2*0.711))),-20.772/TAN(RADIANS(AE2)))))/3600

#AG2=Sun Elevation corrected for refraction
=AE2+AF2

#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))









=====================================================================





No comments:

Post a Comment

The cause of data gaps in CSV files

  There have been occasions when data gaps occurred in the CSV files collected daily. The problems are unique to the power file. The azimuth...