home *** CD-ROM | disk | FTP | other *** search
/ The CIA World Factbook 1992 / k3bimage.iso / sel / 12 / 0087 / pool.bas < prev    next >
Encoding:
BASIC Source File  |  1991-12-02  |  5.5 KB  |  89 lines

  1. 10 CLS:LOCATE 10,20:PRINT "*** Pool Water Test Program ***":LOCATE 24,1
  2. 20 INPUT "What is the temperature of the pool water (Degrees F)? ",F
  3. 30 IF F<60 OR F>95 THEN PRINT "That temperature seems out of range. Try again":GOTO 20
  4. 40 INPUT "How many gallons are in the pool? ",G
  5. 50 INPUT "What is the Ph of the water? ",P1
  6. 60 INPUT "What is the Calcium Hardness (ppm)? ",H
  7. 70 IF H<1000 THEN GOTO 150
  8. 80 PRINT
  9. 90 PRINT "The hardness is too high. Drain";INT((H-950)/H*G);
  10. 100 PRINT "gallons of pool water and replace"
  11. 110 PRINT "with soft (tap?) water"
  12. 120 PRINT:PRINT "After refilling wait 4 hours and retest."
  13. 130 PRINT "Do not add additional chemicals at this time!"
  14. 140 END
  15. 150 INPUT "What is the Total Alkalinity (ppm)? ",A
  16. 160 INPUT "What is the Stabilizer (Cyanuric Acid) level (ppm)? ",S
  17. 170 INPUT "What is the Free Available Chlorine level (ppm)? ",C
  18. 180 INPUT "What is the Total (free and combined) Chlorine level (ppm)? ",X
  19. 190 IF X<C THEN PRINT "Total (free and combined) chlorine must be greater than Free Chlorine level!":GOTO 180
  20. 200 X=X-C
  21. 210 PRINT
  22. 220 '
  23. 230 'do calculations
  24. 240 IF S=0 THEN GOTO 270           P1<7.5 THEN A=A-(.21+(P1-7!)*.18)                                             S
  25. 250 IF P1<6! THEN A=A-.04*S ELSE IF P1<6.5 THEN A=A-(.04+.12*(P1-6!))*S ELSE IF P1<7! THEN A=A-(.1+(P1-6.5)*.2)*S ELSE IF P1<7.5 THEN A=A-(.21+(P1-7!)*.18)*S ELSE IF P1<8! THEN A=A-(.3+(P1-7.5)*.12)*S ELSE A=A-.38*S
  26. 260 'adjust Ph for pool temperature
  27. 270 IF F>85 THEN P2=P1+.1 ELSE IF F>80 THEN P2=P1 ELSE P2=P1-.1
  28. 280 '
  29. 290 'compute desired total alkalinity using ph and calcium hardness
  30. 300 IF H>700 THEN P2=7.2 ELSE IF H>500 THEN P2=7.3 ELSE IF H>325 THEN P2=7.4 ELSE IF H>250 THEN P2=7.5 ELSE IF H>200 THEN P2=7.6 ELSE T=100:GOTO 360
  31. 310 '
  32. 320 'compute total alkalinity based on ph and hardness
  33. 330  IF P2=7.2 THEN T=50000!/H ELSE IF P2=7.3 THEN T=40000!/H ELSE IF P2=7.4 THEN T=30000/H ELSE IF P2=7.5 THEN T=25000/H ELSE IF P2=7.6 THEN T=20000/H
  34. 340 '
  35. 350 'if ph is out of desirable range, force it to optimum level
  36. 360 IF P1<7.2 OR P1>7.6 THEN P2=7.4
  37. 370 '
  38. 380 'adjust ph for total alkalinity if total alkalinity is out of desired range
  39. 390 IF T<50 THEN P2=P2-.1:GOTO 330 ELSE IF T>125 THEN P2=P2+.1:GOTO 330
  40. 400 PRINT USING "The Ph is #.#. It should be #.#.";P1;P2
  41. 410 PRINT
  42. 420 PRINT USING "The Calcium Hardness is ####. It should be 200 to 1000 ppm.";H
  43. 430 PRINT
  44. 440 PRINT USING "The Total Alkalinity, adjusted for stabilizer, is ###.";A
  45. 450 PRINT USING "It should be ### plus or minus 5 ppm.";T
  46. 460 PRINT
  47. 470 PRINT USING "The Stabilizer level is ###. It should be 25 to 70 ppm.";S
  48. 480 PRINT
  49. 490 PRINT "To balance your pool, do the following:"
  50. 500 IF S<25 THEN PRINT USING "Pool is not stabilized. To stabilize to 25 ppm., add ###.# lb";(25-S)/25*G/10000*4:PRINT "of HTH Stabilizer (Cyanuric Acid).":PRINT:GOTO 550
  51. 510 IF S<=100 THEN GOTO 550
  52. 520 PRINT "The Stabilizer level is too high. Drain";INT((S-50)/S*G);
  53. 530 PRINT "gallons of pool water and replace with tap water"
  54. 540 PRINT:PRINT "When refilled, test and run POOL again.":END
  55. 550 IF H<200 THEN PRINT USING "Calcium hardness is too low. Add ###.# lb. of";1.4*(250-H)*G/10000/16:PRINT USING "HTH Calcium Plus (or ###.# lb. of Calcium Chloride).";.125*(250-H)*G/10000:PRINT
  56. 560 IF A<T-5 THEN PRINT USING "The Total Alkalinity is low. Add ###.# lb. of";2.4*(T-A)*G/10000/16:PRINT "HTH Alkanity Plus (Sodium Bicarbonate or Baking Soda)":PRINT "This will raise Ph somewhat. Recheck the Ph after 4 hours.":PRINT:GOTO 690
  57. 570 IF A<T+5 THEN GOTO 640
  58. 580 PRINT USING "The Total Alkalinity is high. To lower, add ###.# lb. of HTH Ph Minus";3.2*(A-T)*G/10000/16
  59. 590 PRINT "Add no more than 1 to 2 lbs. per day."
  60. 600 PRINT "Add at one spot in the deepest part of the pool."
  61. 610 PRINT
  62. 620 PRINT "This will affect the Ph. After Total Alkalinity is in the proper range,"
  63. 630 PRINT "retest for Ph and adjust."
  64. 635 GOTO 690
  65. 640 IF P1=P2 THEN PRINT "The Ph is OK.":PRINT:GOTO 690
  66. 650 IF P1>P2 THEN PRINT USING "Add ### oz. of HTH Ph Minus.";20*(P1-P2)*G/10000:PRINT:GOTO 690
  67. 660 IF P1<6.4 THEN PRINT USING "Add ### oz. of HTH Ph Plus. Retest after 4 hours and adjust.";110*(P2-P1)*G/10000:PRINT:GOTO 690
  68. 670 IF P1<6.6 THEN PRINT USING "Add ### oz. of HTH Ph Plus. Retest after 4 hours and adjust.";80*(P2-P1)*G/10000:PRINT:GOTO 690
  69. 680 IF P1<P2 THEN PRINT USING "Add ### oz. of HTH Ph Plus. Retest after 4 hours and adjust.";25*(P2-P1)*G/10000:PRINT:GOTO 690
  70. 690 'compute desired chlorine level based on ph and stabilizer
  71. 700 IF S<25 THEN C1=1!:GOTO 729
  72. 701 IF P2>7.4 THEN GOTO 703
  73. 702 C1=(S-25)/25*.2+1!:GOTO 729
  74. 703 IF P2>7.6 THEN GOTO 705
  75. 704 C1=(S-25)/25*.2+1.4:GOTO 729
  76. 705 IF P2>7.8 THEN GOTO 707
  77. 706 C1=(S-25)/25*.4+1.6:GOTO 729
  78. 707 C1=(S-25)/25*.3+2.5:GOTO 729
  79. 729 IF C>=C1 THEN GOTO 750                                                      C1
  80. 730 PRINT USING "The Total Available Chlorine is ##.#. It should be #.# ppm.";C;C1
  81. 740 PRINT USING "Add ### oz. of HTH Dry Chlorinator.";8*(C1-C)*G/10000:PRINT
  82. 750 IF X<.3 THEN GOTO 780
  83. 760 PRINT "The Combined Chlorine level is too high. Shock Treat the pool"
  84. 770 PRINT USING "by adding ### oz. of HTH Shock.";X*10*G/10000
  85. 780 IF S=0 THEN PRINT USING "Add ## oz. of HTH Dry Chlorinator Daily.";8*G/10000:GOTO 800
  86. 790 PRINT USING "Add approximately ## oz. of HTH Dry Chlorinator every";3*G/10000:PRINT "other day for stabilized pools.":GOTO 800
  87. 800 PRINT "Superchlorinate (shock) the pool as necessary according to label directions."
  88. 810 END
  89.