help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: program to compute gears, with table


From: Frank Krygowski
Subject: Re: program to compute gears, with table
Date: Fri, 8 Sep 2017 11:50:30 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

On 9/8/2017 4:46 AM, Graham wrote:

"Emanuel Berg" <moasen@zoho.com> wrote in message 
86bmmlu54a.fsf@zoho.com">news:86bmmlu54a.fsf@zoho.com...
Hey guys, does this look right to you?

;; (print-gears '(34 50) '(12 13 15 17 19 21 23 25) 622)
;;
;;                          =>
;;
;; 622 wheel
;;
;; chainring   sprocket   gear
;;
;;    34          25      2657.5360544880004
;;    34          23      2888.626146182609
;;    34          21      3163.7333982000005
;;    34          19      3496.7579664315795
;;    50          25      3908.1412566000004
;;    34          17      3908.1412566000004
;;    50          23      4247.97962673913
;;    34          15      4429.226757480001
;;    50          21      4652.549115000001
;;    34          13      5110.64625863077
;;    50          19      5142.291127105264
;;    34          12      5536.5334468500005
;;    50          17      5747.266553823531
;;    50          15      6513.568761
;;    50          13      7515.656262692309
;;    50          12      8141.960951250001

(require 'cl-lib)

(defun compute-gear (chainring sprocket wheel)
  (let*((pi     3.14159265)
        (radius (/ wheel 2.0))
        (circum (* 2 radius pi))
        (gear   (* (/ chainring sprocket 1.0) circum)))
    (list chainring sprocket gear)))

(defun gear (chainrings sprockets wheel)
  (let*((gears
         (cl-loop for c in chainrings
                  append (cl-loop for s in sprockets
                                  collect (compute-gear c s wheel) )
                  )))
        (cl-sort gears #'<= :key #'cl-caddr)))

(defun print-gears (chainrings sprockets wheel)
  (let ((out-buffer (get-buffer-create "*Gears*")))
    (with-current-buffer out-buffer
      (erase-buffer)
      (insert (format "%s wheel\n\n" wheel))
      (insert "chainring   sprocket   gear\n\n")
      (let ((gears (gear chainrings sprockets wheel)))
        (cl-loop for g in gears
                 do (let ((c (   car   g))
                          (s (   cadr  g))
                          (d (cl-caddr g)))
                      (insert (format "   %s          %s      %s\n" c s d)) ))))
    (pop-to-buffer out-buffer) ))

--
underground experts united
http://user.it.uu.se/~embe8573

Not sure about your code as I do not speak that language but a quick check 
gives:

622*3.142*50/25=3908.648mm

So if your definition of gear is roll out in mm then it looks close. Do not 
forget to include the tyre. See:

https://www.cateye.com/data/resources/Tire_size_chart_ENG.pdf

for approximate circumferences. Taking a 23mm tyre the above example would be:
2096*50/25=4192mm

Graham.

Right, don't forget to include the tire. 622 is bead seat diameter, but you want (effective) outside diameter instead.

I first did such a thing in the 1970s, using Fortran. But I formatted it as a compact table in rows and columns. You could have one row for each chainring, one column for each rear cog. A matrix, 2x8.

Another useful trick is to plot the gear development on a logarithmic scale, so the change from one gear to the next is scaled as the percentage change. Plotting using a separate row or a separate symbol for each chainring makes clear which gear is "next" in your gear progression.

These days, it's probably easiest to do all the above using a spreadsheet, such as LibreOffice Calc. Or Micros**t Excel.

BTW, back when there were only five rear cogs and a person wanted a wide range with uniform or other logical spacing, plotting gear development (or "gear inches," in "inch" countries) was a useful tool for the art of bike design. These days, with up to 11 cogs in back, the entire exercise isn't as valuable as it once was.

--
- Frank Krygowski


reply via email to

[Prev in Thread] Current Thread [Next in Thread]