home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / basic / astrmenu.lbr / SUNSHI.BZS / SUNSHI.BAS
BASIC Source File  |  1987-04-26  |  1KB  |  49 lines

  1. 1 PRINT "From the September 1984 SKY & TELESCOPE, pp. 254-5."
  2. 2 PRINT
  3. 3 PRINT "This program calculates the theoretical amount of sunshine over a"
  4. 4 PRINT "given period for a given place."
  5. 5 PRINT
  6. 6 PRINT "INPUT:  Latitude of the place with fraction (degrees), start and end"
  7. 7 PRINT "days in 1986 (1 to 365)." : PRINT
  8. 8 PRINT "OUTPUT:  Total amount of sunshine between, and including, the days"
  9. 9 PRINT "given (min, h)." : PRINT
  10. 10 REM    SUNSHINE
  11. 12 REM
  12. 14 P=3.14159265#: R=P/180
  13. 16 INPUT "LATITUDE (DEGREES)";F
  14. 18 F=F*R
  15. 20 S=SIN(F): C=COS(F)
  16. 22 INPUT "START DAY IN 1986 ";J1
  17. 24 INPUT "END DAY IN 1986   ";J2
  18. 26 IF J2<J1 THEN 24
  19. 28 Z=0
  20. 30 FOR D=J1 TO J2
  21. 32 M=357.1663+.9856*D
  22. 34 M=M*R
  23. 36 L=279.8603+.985647*D
  24. 38 L=L+1.91533*SIN(M)
  25. 40 L=L+.02001*SIN(2*M)
  26. 42 L=L+.00029*SIN(3*M)
  27. 44 L=L*R
  28. 46 G=.3978062*SIN(L)
  29. 48 K=SQR(1-G*G)
  30. 50 U=(-.01454-S*G)/(K*C)
  31. 52 IF ABS(U)<1 THEN 58
  32. 54 IF U>1 THEN 70
  33. 56 Z=Z+1440: GOTO 70
  34. 58 F=.9043+.03023*COS(M)
  35. 60 F=F/(1-.15825*SIN(L)*SIN(L))
  36. 62 A=ATN(SQR(1-U*U)/U)
  37. 64  A=A/R
  38. 66 IF U<0 THEN A=A+180
  39. 68 Z=Z+2880*A/(360.985647#-F)
  40. 70 NEXT D
  41. 72 PRINT
  42. 74 PRINT "SUNSHINE = "
  43. 76 PRINT INT(Z+.5);" MINUTES"
  44. 78 PRINT INT((Z+30)/60);" HOURS"
  45. 80 RUN "ASTRMENU.BAS"
  46. T D
  47. 72 PRINT
  48. 74 PRINT "SUNSHINE = "
  49. 76 PRINT INT(Z