Announcement

Collapse
No announcement yet.

gear calculation - algorithm and small helper

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    gear calculation - algorithm and small helper

    Hello Everybody,

    I am a big fan of this community and the outstanding infos that are provided, especially on MSS54! This allowed me to solve a lot of stuff on my 2005 e46 M3 and also enabled me to adjust everything that was necessary to get the resent engine transfer to an e36 coupe up and running (unfortunately I wrecked the e46 after 16 years of ownership...).
    Based on the amazing work of karter16 I recently also started to dive into the disassembly fun and took a small issue as my first "lesson". I transfered the cluster including shift lights to the e36 but somehow this did not work too well. Reason being a wrong calculation of the current gear due to smaller diameter wheels (235/40 R17) in combination with a shorter diff ratio (3.91). Looking into karter16 's dissassembly I was able to find the calculation algorithm and created a small tool which could help to calculate the right "K_GANG_GRENZE*_*" if significantly different wheels and/or transmission are used.

    Remaining question for me is, the background of the calculation of GEAR_NV being (V_ANTRIEB*16 + N*64)/(V_ANTRIEB*16*2)/2 (including all conversions). Can anybody imagine why V_ANTRIEB is addes to the engine speed?



    As mentioned, just a very small contribution but I nice start for me.

    Cheers,
    Peter
    Attached Files

    #2
    Nice one! and glad to see someone is using the disassembly! I'll put up the most recent archive as well when I get a chance as might be useful to you!

    This is really cool. I think that the reason for adding V_ANTRIEB in the numerator is a trick to round to the nearest integer. By default integer division truncates. By adding the equivalent of 0.5 to the numerator it has the effect of rounding to whatever the actual nearest integer is.

    Given the denominator is 2*V_ANTRIEB, adding V_ANTRIEB to the numerator gives V_ANTRIEB/2*V_ANTRIEB which is always 0.5.

    fwiw pretty much any time you see odd math in this code it's either a trick to help perform floating-point-like calculations or it's to check for/prevent over/underflows.
    2005 ///M3 SMG Coupe Silbergrau Metallic/CSL bucket seats/CSL airbox/CSL console/6 point RACP brace/Apex ARC-8s
    Build Thread:
    https://nam3forum.com/forums/forum/m...e46-m3-journal

    Comment


      #3
      Hi Matt,

      Thanks for this hint - really helps! sometimes physics is not everything someone should consider..

      Comment

      Working...
      X