ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

122 lines
4.1 KiB

  1. 10 ' Suntan Program
  2. 20 '
  3. 30 GOSUB 920: ' Initialize data arrays
  4. 40 '
  5. 50 INPUT "Latitude in degrees";L: LA=L/57.296
  6. 60 INPUT "Month (1-12)";M
  7. 70 INPUT "Hours from local noon";T: T=ABS(T)
  8. 80 DS=.408*SIN(.523*(M-3.7)): ' Decl. of Sun (radians)
  9. 90 HA=.262*T: ' Hour angle of Sun (radians)
  10. 100 CZ=SIN(LA)*SIN(DS)+COS(LA)*COS(DS)*COS(HA)
  11. 110 IF CZ<=0 THEN 70
  12. 120 ZS=ATN(SQR(1-CZ*CZ)/CZ): ' Sun's zenith dist. (rad)
  13. 130 '
  14. 140 ' OPTION -- These two lines could replace 50-120:
  15. 150 ' INPUT "Altitude of Sun (deg)";AL
  16. 160 ' ZS=(90-AL)/57.296
  17. 170 '
  18. 180 INPUT "Height above sea level (feet)";HH: H=HH/3280
  19. 190 INPUT "Aerosol extinction (V mag/airmass)";KK
  20. 200 BE=KK/2.36
  21. 210 INPUT "Surface albedo (%)";S1: SA=S1/100
  22. 220 '
  23. 230 ' Other adjustable parameters
  24. 240 '
  25. 250 ET=3600: ' Exposure time (seconds)
  26. 260 ZP=ZS: ' Angle (rad), zenith to surface normal
  27. 270 SS=0: ' Angle (rad), Sun to surface normal
  28. 280 TW=1: ' UV frac. transmitted by window, lotion...
  29. 290 F1=1: ' Fraction of sky that is clear
  30. 300 F2=1: ' Fraction of ground in sunlight
  31. 310 SH=1: ' Is Sun being shaded? (no=1, yes=0)
  32. 320 N=1: ' Normalization for skin type
  33. 330 RE=6378: ' Earth radius (km)
  34. 340 OL=0: ' Ozone loss (%)
  35. 350 HO=23: ' Height of ozone layer (km)
  36. 360 HG=8.2: ' Gas scale height (km)
  37. 370 HA=1.5: ' Aerosol scale height (km)
  38. 380 DS=1: ' Distance from Sun (a.u.)
  39. 390 '
  40. 400 ' Thickness of ozone layer
  41. 410 '
  42. 420 RA=30*(M-3.7)/57.296
  43. 430 DOSE=(1-OL/100)*(3+.4*(LA*COS(RA)-COS(3*LA)))
  44. 440 '
  45. 450 ' Airmass for each component
  46. 460 '
  47. 470 XO=(1-(SIN(ZS)/(1+((HO-H)/RE)))^2)^(-.5)
  48. 480 XG=1/(COS(ZS)+.01*SQR(HG)*EXP(-30*COS(ZS)/SQR(HG)))
  49. 490 XA=1/(COS(ZS)+.01*SQR(HA)*EXP(-30*COS(ZS)/SQR(HA)))
  50. 500 '
  51. 510 ' Do for each wavelength
  52. 520 '
  53. 530 PRINT "Wavelength Ozone Air Action Dose"
  54. 540 PRINT "(angstroms) trans. trans. spectr. "
  55. 550 ED=0
  56. 560 FOR J=1 TO 20
  57. 570 W=.275+J*.005: ' Wavelength (microns)
  58. 580 '
  59. 590 ' Brightness of sunlight, diffuse sky light,
  60. 600 ' and ground light
  61. 610 KO=OZ(J)*(DOSE/3)
  62. 620 KG=.0107*EXP(-H/HG)*(W^(-4))
  63. 630 KA=BE*(W^(-1.3))
  64. 640 OT=10^(-.4*(KO*XO))
  65. 650 TA=10^(-.4*(KG*XG+KA*XA))
  66. 660 D=.5*(COS(ZS)^.33)
  67. 670 IS=FS(J)*OT*TA*TW*SH*COS(SS)*(DS^(-2))
  68. 680 ID=FS(J)*OT*(1-TA)*D
  69. 690 ID=FS(J)*OT*(1-TA)*D*TA*SA+ID
  70. 700 ID=FS(J)*OT*((1-TA)^2)*SA*(D^2)+ID
  71. 710 ID=ID*TW*F1*(COS(ZS/2)^2)*(DS^(-2))
  72. 720 IG=FS(J)*OT*SA*(TA+D*(1-TA))
  73. 730 IG=IG*TW*F2*(SIN(ZS/2)^2)*(DS^(-2))
  74. 740 I=IS+ID+IG: ' Total flux on skin (erg/cm^2/sec/A)
  75. 750 '
  76. 760 ' Find effective dose by numerical integration
  77. 770 ' The "minimum erythema dose" at 2900A
  78. 780 ' is 2.3E6 erg/cm^2 (Parrish)
  79. 790 '
  80. 800 EF=I*ET*(AS(J)*N)*50/2.3E6
  81. 810 ED=ED+EF
  82. 820 PRINT USING F1$;W*10000;OT;TA;AS(J);EF
  83. 830 NEXT J
  84. 840 '
  85. 850 ' Report result
  86. 860 '
  87. 870 PRINT
  88. 880 PRINT USING "Total effective dose: ##.###";ED
  89. 890 PRINT USING " (exposure time ##.## hr)";ET/3600
  90. 895 PRINT USING "Burning starts after ##.## hr";ET/(3600*ED)
  91. 899 '
  92. 900 END
  93. 910 '
  94. 920 ' Set up data arrays
  95. 930 '
  96. 940 F1$= " ##### ##.#### ##.#### ##.## ##.###"
  97. 950 DIM OZ(20),FS(20),AS(20)
  98. 960 FOR J=1 TO 20: READ OZ(J): NEXT J
  99. 970 FOR J=1 TO 20: READ FS(J): NEXT J
  100. 980 FOR J=1 TO 20: READ AS(J): NEXT J
  101. 990 RETURN
  102. 1000 '
  103. 1010 ' OZ array (ozone effect)
  104. 1020 DATA 34, 25, 18, 9, 3.2, 1.8, .9, .46, .24, .17
  105. 1030 DATA .06, .05, .02, .01, .002, .001, 0, 0, 0, 0
  106. 1040 '
  107. 1050 ' FS array (solar flux at 1 A.U. in erg/cm^2/sec/A)
  108. 1060 DATA 24, 31, 38, 45, 52, 58, 64, 70, 75, 79
  109. 1070 DATA 83, 87, 91, 93, 95, 97, 99, 104, 107, 104
  110. 1080 '
  111. 1090 ' AS array (action spectrum, McKinley & Diffey)
  112. 1100 DATA 1, 1, 1, 1, .65, .22, .074, .025, .0086, .003
  113. 1110 DATA .0014, .0012, .00097, .00081, .00068, .00057
  114. 1120 DATA .00048, .0004, .00034, .00029
  115. 1200 '
  116. 1210 ' Bradley E. Schaefer's program takes into account many factors,
  117. 1220 ' including the ozone content of the atmosphere, and calculates
  118. 1230 ' the risk of getting a sunburn at any month of the year, at any
  119. 1240 ' hour of the day, and at any latitude on Earth. He explained how
  120. 1250 ' to interpret the results in the July 1993 issue of Sky & Telescope,
  121. 1260 ' page 83.