Hobnail spreadsheet software for gear trains

Advert

Hobnail spreadsheet software for gear trains

Home Forums Workshop Tools and Tooling Hobnail spreadsheet software for gear trains

Viewing 14 posts - 26 through 39 (of 39 total)
  • Author
    Posts
  • #748010
    Adam Harris
    Participant
      @adamharris13683

      My reason for wanting to see a gear train of 6 gears is that the large set of 64 gears belongs to a small hobbing machine I have (too small for the size of helical gear I am interested in making), whereas if at all possible I would like to use a much smaller set of Schaublin gears as my mill is already set up with quadrant/studs and dividing head for the bore of such gears. Hence a quick calculation of possible gear trains of 6 gears would be nice

      Advert
      #751552
      Adam Harris
      Participant
        @adamharris13683

        I have received authorisation from the program creator Gareth Evans to distribute Hobnail to those interested. PM me with your email address if you want a copy.

        #751574
        DC31k
        Participant
          @dc31k
          On Adam Harris Said:

          …a quick calculation of possible gear trains of 6 gears would be nice…

          Before you go too far down that path, perhaps do some rudmentary calculations on the number of possiblities you have to consider, and thus the time it will take to perform them.

          You can calculate the same numbers for your four gear train and see the factor by which the calculation time will be multiplied between the four gear time and the six gear time (given that four gears take two seconds).

          Start with something simple, so you understand the maths. Look up combinatorics or ‘n choose r’ (https://www.hackmath.net/en/calculator/n-choose-k). If you have a bag with four gears in, there is only one way of pulling four gears from that bag. From those four gears, you have to select two of them (as the drivers). There are 4 choose 2 = 6 ways of doing this. Hence you have six possible ratios from four gears.

          Now look at the 64 gears you have. There are 64 choose 4 = 635376 ways of choosing four gears and you get four choose two equals six possible ratios from each of those, so you have to consider 635376 x 6 = 3,812,256 total options. That takes two seconds.

          Now move onto a six gear train. 64 choose six is 74974368. Six choose three is 20, for a total of 1,499,487, 360 possibilities.

          1499487360 divided by 3812256 is 393, so what was a two second calculation is now a 787 second (13 minutes) calculation.

          You can refine this number downwards (let us be optimistic and say you can halve it), but anything you do with a spreadsheet will be painfully slow.

          #751577
          Adam Harris
          Participant
            @adamharris13683

            The program is written in Visual Basic for Applications. Using 58 gears it computes the best two combinations of 4 gears (combination more than and combination less than target ratio) in 1 second aprox. It would be interesting to see the speed of calculation for a 6 gear train if anyone can modify the program accordingly. As a hobbyist very happy to wait 5 -15 minutes for the calculation, no pain at all!

            #751616
            SillyOldDuffer
            Moderator
              @sillyoldduffer
              On Adam Harris Said:

              The program is written in Visual Basic for Applications. Using 58 gears it computes the best two combinations of 4 gears (combination more than and combination less than target ratio) in 1 second aprox. It would be interesting to see the speed of calculation for a 6 gear train if anyone can modify the program accordingly. As a hobbyist very happy to wait 5 -15 minutes for the calculation, no pain at all!

              I’ll have go please, also interested to see how hobnail solves the problem.   I’ll PM my email to Adam.

              Computers are very fast at this sort of job, though they might bog down if the number of gear combinations is large.    My python program for calculating lathe change gears, starts by generating all the 4-way permutations possible from the 11 gears provided with a metric WM280, or the 13 provided with the Imperial version.  Written to be obvious how it works, not optimised for speed.

              Performance:

              • For accuracy I convert the ratios into fractions, which are slow compared with floats, but even so generating and crunching all 17160 Imperial gear permutations is done in a smidge under 50milliseconds.
              • Then I remove duplicate permutations, which can occur in gear sets containing duplicate gears, bringing possibles down to 12540, taking 10mS
              • Finally, I sort the result (12540 records containing the tooth counts of gears a,b,c,d and the resulting ratio) into ratio order, taking another 50mS

              In theory metric is less work for the poor old computer, because fewer change gears reduce the number of permutations to only 7940, but in practice the program runs in much the same time.

              I’d expect VBA performance to be in the same ball-park.

              In any language, it takes much, much longer to print the results!

              Dave

              #751661
              DC31k
              Participant
                @dc31k

                In the spirit of enquiry, it might be useful if Adam could post the list of 64 gears he has. If he has this in the boot of his hobnail, that should be a simple copy ‘n paste.

                Please also post some sample ratios that you have calculated or require calculating and the 4-gear results you have obtained.

                This will verify that the software you have is behaving correctly and also check that it is indeed producing the closest possible solution to the desired ratio.

                We can then run the same ratio through a 6-gear progam to see how long it takes and how much ‘better’ results are obtained.

                However, this offer does come with conditions (quid pro quo). Choose one of the following options:

                (1) present calculations showing the real world difference between the closest four-gear train and the closest six-gear train. If we were approximating a thread pitch, we would talk in terms of (for example) 1mm error in 437metres of thread.

                (2) cut a gear using each train. Measure the difference between the two gears and tabulate the results.

                #751726
                SillyOldDuffer
                Moderator
                  @sillyoldduffer

                  Adam kindly emailed me a copy of hobnail last night and I looked at the code.

                  I was hoping to find it written in a way making it easy to modify the calculation to accommodate a 6 gear rather than 4 gear compound,  and then allow me to patch in some timing statements to measure performance.    Unfortunately, more work than I care to do out of curiosity:

                  • the VBA code is event driven by changing various cells in the spreadsheet, so there isn’t a single simple interface to a number-crunching function.
                  • the number-crunching is done by ‘for’ looping through a deep list of nested if statements, ending in the 4 gear calculation.   Not obvious to me what new ‘if’ blocks would be needed to do 6 gears, or how the ‘for’ loops should be modified.

                  By default the program arrives set up on the assumption that the hobber has 71 change gears available in increments of 1 tooth, from 30 teeth to 100 teeth.   Having the full range available makes it much easier to find a close match, but real hobbers are likely to come with a much smaller gear selection.   The user is expected to delete gears he doesn’t have from hobnail’s “Preferred Gears” table.   Begs the question, “what’s the smallest range of change gears needed to hob most gears?”  My gut reaction is that this is more difficult than identifying the minimum set of change gears needed by a lathe to produce most pitches/TPI.

                  To reiterate what Adam and others have said, hobnail isn’t a lathe pitch calculator.   Instead it calculates change gears and other parameters for a hobbing machine, possibly one model in particular.   (I don’t know enough about hobbing to confirm that the code is suitable for all machines.)   Two compounds are needed, one for the indexer, the other for the feed.

                  Helpful to see what hobnail looks like:

                  hobnail

                  Note that the program isn’t entirely deterministic – the operator is invited to play with the F starting value to get a better match.  Also, not shown for space reasons, it calculates different ratios for the other hand.   This is beyond my understanding of hobbing!

                  Although hobnail is implemented with VBA inside an Excel spreadsheet, implying it will only run on MS-Windows with Excel installed, I tried it first on Linux and LibreOffice Calc (also available free for Windows).   Pleased to report hobnail appears to work correctly without needing Microsoft.

                  Dave

                   

                   

                   

                   

                  #751763
                  Adam Harris
                  Participant
                    @adamharris13683

                    I haven’t tried out any of the buttons other than the top brown one “Free Hand Gear Calculator” for ratios and what I really like is that with the excel format you can have your various sets of change gears from different machines listed on different sheets (and any combinations you choose thereof or with theoretical additions to your sets, on different sheets) so you can simply cut and paste into the “Preferred Gears” sheet which is the one used for the calculation. Thus you can compare your different options for closeness to the target ratio you have set. You still need to calculate the target ratio manually for this, in the case of helical gears the how-to-do being spelt out very clearly in johnfsworkshop.org (“making helical gears on a vertical milling machine”). Furthermore your user defined set of gears do not have to be listed in any order and for duplicate gears you just enter the gear twice – simples. I am curious how much closer one could get with a 6-gear train calculation

                    #751764
                    Adam Harris
                    Participant
                      @adamharris13683

                      If it is of any interest Dave, he told me “I remember having to use double precision floating point because single precision was not accurate enough”, but other than that he couldn’t remember much about it that is not in the program notes

                      #751765
                      Adam Harris
                      Participant
                        @adamharris13683

                        I did copy and paste the entire code to ChatGPT requesting VBA amendment to a 6-gear train calculation  and I got a long list of code back within a couple of seconds , cut and pasted that code into Hobnail and nothing worked 🙂 . Of course I know nothing about software so almost certainly did it all wrong but I did think that coding was a strong point of AI / ChatGPT

                        #751847
                        SillyOldDuffer
                        Moderator
                          @sillyoldduffer

                          Gareth using double rather than single precision floats was sensible because it much reduces the risk of significant errors creeping in.    On my computer ⅓ is float  0.33333334, whereas double gets another 9 digits of precision = 0.3333333333333333.  The hobnail code is well-written and I guess Gareth has professional experience.  I used Python’s Fraction type because it’s easy to use and eliminates floating point error entirely.   Always a catch of course : it’s that calculating in fractions is much slower than floating point.

                          ChatGPT? Smart move, well worth trying!  I’ve used it on Python with mixed success.   When it didn’t get the answer by refining my question, I noticed it was learning from me. I tested suggestions and explained why the answer was wrong, and ChatGPT assimilated the improvements, getting a little closer each time.   Pretty sure human improvements are added to the neural-net, allowing ChatGPT to apply them to other problems later.

                          ChatGPT may have struggled with hobnail because there are three interlinked problems to solve : interfacing with the spread-sheet; understanding Gareth’s hobber set-up logic; and doing the maths.  Plus the human element – ChatGPT’s code has to be pasted back into the spreadsheet correctly, which is probably fiddly.

                          Dave

                          #752285
                          jim1956
                          Participant
                            @jim1956

                            If a required feature is that the program be local so that any modifications don’t have to be re-entered then I have a program I downloaded from the web called

                            Gear Change calculator.

                            It’s free to distribute, it’s an htm file with calculations done in Javascript.

                            Easy to run, just click on the file and it will run in your default browser.  Open with a text editor and you can modify the list of default gears.  It does handle six change gear setups.

                            Re-distribution permission blurb.

                            “Permission is hereby granted, free of charge, to any person obtaining a copy of
                            this software and associated documentation files (the “Software”), to deal in
                            the Software without restriction, including without limitation the rights to
                            use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
                            of the Software, and to permit persons to whom the Software is furnished to do
                            so, subject to the following conditions:

                            The above copyright notice and this permission notice shall be included in all
                            copies or substantial portions of the Software.”

                            The two pics below are the initial screen and my edit of the Javascript to enter my default list of gears.

                            If there is any interest I could upload the Gear Calculator.htm file.Capture1Capture2

                             

                            #753674
                            SillyOldDuffer
                            Moderator
                              @sillyoldduffer
                              On jim1956 Said:

                              If a required feature is that the program be local so that any modifications don’t have to be re-entered then I have a program I downloaded from the web called

                              Gear Change calculator.

                               

                              Just a clarification, but Jim’s program finds the lathe Change Gears needed for screw-cutting whilst Hobnail meets a different requirement, which is calculating the settings needed by a Gear Hobbing Machine.

                              Both calculators are useful, but only for what they’re intended to do.   Hobnail is no good for calculating lathe screw-cutting change gears and screw-cutting calculators are unsuited for setting up gear hobbers.

                              Jim’s program is more likely to be useful than Hobnail because we almost all own lathes and might need to cut an unusual thread.   Hobnail is good for Hobbing Machine owners, a relatively rare breed!

                              Dave

                               

                              #753763
                              DC31k
                              Participant
                                @dc31k
                                On SillyOldDuffer Said:

                                Both calculators are useful, but only for what they’re intended to do.

                                That is focussing on the differences. An alternative could be to look at the similiarities.

                                At their heart, both take a list of change gears and attempt to find the nearest combination of gears to a desired ratio.

                                The hobber one has some preceeding calculations, that take as input the machine parameters and gear-to-be-cut details and output a number – a ratio – that serves as input to the change gear calculation routine.

                                A screwcutting one has some preceeding calculations that take as input a thread pitch and a leadscrew pitch and output a number – a ratio – that serves as input to an identical change gear calculation routine.

                                If you kept your wits about you, you could use either program for the other purpose. Where you would need the dexterity is giving the program the correct setup data/calculations before the progtram started to look at gear tooth combinations.

                                To me, the two programs are like a Peugeot Boxer or Citroen Relay or Fiat Ducato van (VW Sharan or Ford Galaxy or Seat Alhambra people carrier): slight external differences but at heart (or the powerplant) very similar.

                              Viewing 14 posts - 26 through 39 (of 39 total)
                              • Please log in to reply to this topic. Registering is free and easy using the links on the menu at the top of this page.

                              Advert

                              Latest Replies

                              Viewing 25 topics - 1 through 25 (of 25 total)
                              Viewing 25 topics - 1 through 25 (of 25 total)

                              View full reply list.

                              Advert

                              Newsletter Sign-up