Arduino: Prayer Time

From OnnoWiki
Jump to navigation Jump to search


Rumus / Calculation


Y	2023		
M	4		
D	4		
H	16		
m	25		
s	0		
Z	7		
PI	3.14159265359		
LAT	-6.16858549901122		
LONG	106.865053367193		
FAJR_ANGLE	20		
ISHA_ANGLE	18
SF	1		Imam Safii		
DESCEND CORRECTION = 2/60			
A = INT( Y/100 )			
B = 2 + INT( A/4 ) - A			
JD = 1720994.5 + INT(365.25*Y) + INT(30.6001(M + 1)) + B + D + ((H*3600 + m*60 + s) / 86400) - (Z / 24 )			
T = 2 * PI * (JD - 2451545) / 365.25			
DELTA = 0.37877 + 23.264 * SIN( (57.297*T - 79.547) * PI/180 ) + 0.3812 * SIN( (2*57.297*T - 82.682) * PI/180 ) + 0.17132 * SIN( (3*57.297*T - 59.722) * PI/180 )
U = (JD - 2451545) / 36525			
L0 = 280.46607 + 36000.7698*U			
ET1000 = -(1789 + 237*U) * SIN(L0 * PI/180) - (7146 - 62*U) * COS(L0 * PI/180) + (9934 - 14*U) * SIN(2*L0 * PI/180) - (29 + 5*U) * COS(2*L0 * PI/180) + (74 + 10*U) * SIN(3*L0 * PI/180) + (320 - 4*U) * COS(3*L0 * PI/180) - 212*SIN(4*L0 * PI/180)			
ET = ET1000 / 1000			
TT = 12 + Z - (LONG / 15) - (ET / 60)
SA_FAJR = -(FAJR_ANGLE) = -20
SA_MAGHRIB = -0.8333 - (0.0347 * SQRT(H))
SA_SUNRISE = SA_MAGHRIB
SA_ASR = ACOT(SF + TAN(ABS(DELTA – LAT)*PI/180))*PI/180
SA_ISHA = -(ISHA_ANGLE) = -18
COS(HA_FAJR) = (SIN(SA_FAJR *PI/180) - SIN(LAT*PI/180) * SIN(DELTA*PI/180)) / (COS(LAT*PI/180) * COS(DELTA*PI/180))	
COS(HA_MAGHRIB) = (SIN(SA_SUNRISE*PI/180) - SIN(LAT*PI/180) * SIN(DELTA*PI/180)) / (COS(LAT*PI/180) * COS(DELTA*PI/180))		
COS(HA_SUNRISE) = COS(HA_MAGHRIB)
COS(HA_ASR) = (SIN(SA_ASR*PI/180) - SIN(LAT*PI/180) * SIN(DELTA*PI/180)) / (COS(LAT*PI/180) * COS(DELTA*PI/180))	
COS(HA_ISHA) = (SIN(SA_ISHA*PI/180) - SIN(LAT*PI/180) * SIN(DELTA*PI/180)) / (COS(LAT*PI/180) * COS(DELTA*PI/180))
HA_FAJR = ACOS(COS(HA_FAJR))*180/PI
HA_MAGHRIB = ACOS(COS(HA_SUNRISE))*180/PI	
HA_SUNRISE = HA_MAGHRIB
HA_ASR = ACOS(COS(HA_ASR))*180/PI	
HA_ISHA = ACOS(COS(HA_ISHA))*180/PI
FAJR = TT - HA_FAJR / 15
SUNRISE = TT - HA_SUNRISE / 15
ZUHR = TT + DESCEND_CORRECTION
ASR = TT + HA_ASR / 15
MAGHRIB = TT + HA_MAGHRIB / 15
ISHA = TT + HA_ISHA / 15