Advertisement
the_lad

Valve Bucket Tool

Jul 26th, 2023
908
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.38 KB | Science | 0 0
  1. #########################################
  2. # Valve Bucket Tool                     #
  3. # For measuring bucket-to-cam tolerance #
  4. # in OHC engines                        #
  5. #  Version: 1.0                         #
  6. #########################################
  7. #
  8. # NOTE: Im not perfect and neither is my code or computers, Use this program at your own discretion
  9. #
  10. #############################################################
  11. # 1) Number all of your intake and exhaust valve buckets; 1-4 and 9-12 should be intake valves; 5-8 and should be echaust valves
  12. #       this is important because intake and exhaust valve buckets require different clearances
  13. #
  14. # 2) Measue the existing clearances for each valve buket and enter them into the 'measuredclerance' table on line 30,
  15. #       enter them in sequential order so that valve 1 is the first entry and valve 16 is the last entry.
  16. #
  17. # 3) Measure the size of the valve buckets with a micrometer and enter them into the 'bucketsize' table, like the last step
  18. #       you should enter them in sequential order so that bucket 1 is first and bucket 16 is last.
  19. #
  20. #####################   WARNING!   ##########################
  21. # Failure to enter the clearances and bucket sizes in order #
  22. # WILL result in incorrect calculations.                    #
  23. # Incorrectly inputing values into the tables will also     #
  24. # give incorrect calculations, be careful and double check  #
  25. # everything.                                               #
  26. #############################################################
  27. #
  28. # 4) Your setup may call for a set of tolerances different than what Subaru OEM specifies, the current values are what Subaru specifies
  29. #       for a 2006 Impreza STI EJ257, refer to your years manual to get the correct values for your year and model. For aftermarket cams,
  30. #       you should refer to datasheets provided by the manufacturer or a shops reccomendations like OUTFRONT MOTORSPORTS INC.
  31. #       To change the tolerance specifications, simply edit the values of 'tolintakemax', 'tolintakemin' for intake cams, and 'tolexhaustmax', 'tolexhaustmin'
  32. #       for exhaust cams. Variables with 'min' at the end are the tightest tolerance you want to run, and 'max' is the maximum tolerance.
  33. #
  34. # 5) Finally, you can tweak the precision of the round() calculations, its set to 3 which should be sufficient for imperial measurements but for metric you may
  35. #       want to use a higher value like 4 or 5
  36. #
  37. # 6) RUN THE CODE! The program should spit out two data tables in the terminal, the first is a condensed reference and gives you a quick look at the minimum,
  38. #       maximum, and reccomended values for bucket sizes, as well as telling you which valves the program thinks are exhaust and intake valves, just so you know
  39. #       exactly what calculation was taking place.
  40. #       The second table tells you which valve buckets are still suitable and where you can use them! This should help you save a good bit of money if you need
  41. #       new buckets. Cheers, hope this program helps you with your engine rebuild!
  42. #
  43. #########################################  TWEAKABLE VARIABLES ##########################################
  44.  
  45. ## Which valve to start and end on, use numbers greater than 0 and not more than the maximum of your car
  46. currentvalve = 1
  47. maxvalve = 16
  48.  
  49. ##Feeler gauge measurments
  50. measuredclearance = [0.009, 0.013, 0.015, 0.012, 0.010, 0.011, 0.005, 0.014, 0.004, 0.003, 0.0025, 0.003, 0.006, 0.005, 0.006, 0.006]
  51.  
  52. ##Micrometered bucket sizes
  53. bucketsize =        [0.199, 0.195, 0.195, 0.194, 0.196, 0.197, 0.198, 0.195, 0.197, 0.196, 0.197, 0.196, 0.196, 0.197, 0.191, 0.188]
  54.  
  55. ##Intake
  56. tolintakemax = .0079 + .0008
  57. tolintakemin = .0079 - .0008
  58.  
  59. ##Exhaust
  60. tolexhaustmax = .0138 + .0008
  61. tolexhaustmin = .0138 - .0008
  62.  
  63. ##Precision
  64. P=3
  65.  
  66. ##################################################### ACTUAL CODE ########################################################
  67. #get recommended bucket size for a given valve
  68. #Smallest bucket, largest gap
  69. def recBucketSizemin(mclear, bsize, valve) :
  70.     if determine(valve) == "intake" :
  71.         buck = (mclear + bsize) - tolintakemax
  72.         return buck
  73.     elif  determine(valve) == "exhaust" :
  74.         buck = (mclear + bsize) - tolexhaustmax
  75.         return buck
  76. ##largest bucket, smallest gap
  77. def recBucketSizemax(mclear, bsize, valve) :
  78.     if determine(valve) == "intake" :
  79.         buck = (mclear + bsize) - tolintakemin
  80.         return buck
  81.     elif  determine(valve) == "exhaust" :
  82.         buck = (mclear + bsize) - tolexhaustmin
  83.         return buck
  84. ##Reccomended, right in the middle
  85. def recBucketSize(mclear, bsize, valve) :
  86.     if determine(valve) == "intake" :
  87.         buck = ((mclear + bsize) - ((tolintakemax+tolintakemin)/2))
  88.         return buck
  89.     elif  determine(valve) == "exhaust" :
  90.         buck = ((mclear + bsize) - ((tolexhaustmax+tolexhaustmin)/2))
  91.         return buck
  92.  
  93. #decide if valve is intake or exhaust
  94. def determine(cvalve):
  95.     #print(valve)
  96.     if (cvalve == 1) or (cvalve == 2) or (cvalve == 3) or (cvalve == 4) or (cvalve == 9) or (cvalve == 10) or (cvalve == 11) or (cvalve == 12):
  97.         return "intake"
  98.     else:
  99.         return "exhaust"
  100.    
  101. #checks which valves are valid
  102. def checkBuckets(valve):
  103.     bmin = round(recBucketSizemin(measuredclearance[valve-1], bucketsize[valve-1], valve), P)
  104.     bmax = round(recBucketSizemax(measuredclearance[valve-1], bucketsize[valve-1], valve), P)
  105.     buckets = []
  106.     for i in bucketsize:
  107.         if (i>=bmin) and (i<=bmax):
  108.             buckets.append(i)
  109.     return buckets
  110. ##spacer
  111. print("----------------------------------------------------")
  112. #main loop
  113. while currentvalve <= maxvalve:
  114.     bmin = round(recBucketSizemin(measuredclearance[currentvalve-1], bucketsize[currentvalve-1], currentvalve), P)
  115.     bmax = round(recBucketSizemax(measuredclearance[currentvalve-1], bucketsize[currentvalve-1], currentvalve), P)
  116.     brec = round(recBucketSize(measuredclearance[currentvalve-1], bucketsize[currentvalve-1], currentvalve), P)
  117.     print(currentvalve, ": min:", bmin, ": max:", bmax, ": rec:", brec, ":", determine(currentvalve))
  118.     currentvalve +=  1
  119. ##spacer
  120. print("----------------------------------------------------")
  121. ## data loop
  122. currentvalve = 1
  123. #reset count
  124. while currentvalve <= maxvalve :
  125.     print(currentvalve, ":", checkBuckets(currentvalve))
  126.     currentvalve += 1
  127. ##spacer
  128. print("----------------------------------------------------")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement