Transmission Applet

Note:

This is a reproduction of the page that originally appeared on Gene Cash's Page, but is now missing. This reproduction is based on the version available from archive.org. Unfortunately, some images are missing, but the animation has been rebuilt and is working.

The work reflected here is not my own, but Gene Cash's.

Jython/Java3D motorcycle transmission applet

Mouse Controls
ButtonDrag Action
LeftRotate pitch/yaw
MiddleZoom in/out
RightTranslate left/right/up/down
This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

3D using OpenGL drivers
This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

3D using DirectX on Windows

If you get red Xs, you need to download and install Sun's Java Runtime Environment as well as Java3D for this applet to work. For Windows, please choose the "Typical" install option.

Java3D 1.5 on Windows now depends on having OpenGL drivers available for your video card. If this isn't available or doesn't work, you might want to install DirectX 9.0 or later and use the bottom applet button. If you don't want to install MS "Genuine Advantage", I have dxwebsetup.exe available. You can also try installing older versions, such as Java 1.3.1 and Java3D 1.3.1.

On Windows you must uninstall previous versions of Java/Java3D before installing a new version, and you must uninstall and reinstall Java3D after installing a new version of Java. Whew.

If you're using Debian Linux, you should do an apt-get install libgl1-mesa-swx11-i686 to install the correct version of GLX.

The performance of this applet will vary according to your computer hardware, especially it's CPU speed and your video card's ability to do 3D acceleration. If you have problems, please email me at email address and I'll try to help.

sim screenshot
sim screenshot

Motorcycle Constant-Mesh Sequential Transmission Theory

"Constant mesh" means that each gear on one shaft has a matching free-spinning gear on the opposing shaft, which are meshed with each other at all times. This means there's no synchromesh mechanism as there's no need to bring a gear up to speed before meshing it. Gears transfer power by pinning one of the free-spinning gears to its shaft, and in a motorcycle transmission this is done by having one of the non-free-spinning gears slide over to engage dogs into slots in the free-spinning gear.

"Sequential" means that gears are selected in a rigid sequence, as in a Formula One race car. From 3rd gear, you can only shift to 2nd or 4th, and you can't skip gears like you can with a car style "H" shift pattern. On a motorcycle this is done by releasing the clutch and clicking the foot lever up or down. The foot lever is connected to a ratchet mechanism that rotates the shift cam, which causes the shift forks to move, which moves the gears.

In the simulation, the gear pair currently transmitting power is highlighted in red. The input shaft from the clutch is green, and the output shaft to the drive chain is red. The shift forks are yellow. Free-spinning gears are silver, and sliding gears are pink.

You might want to refer to this parts layout generated from Figures 19, 20, and 21 of the Suzuki SV-650 parts microfiche using GIMP. You will notice there are a lot of shims and circlips used to properly position things. Most of the gears can be removed from the shafts, and a lot of the work consists in shimming the stack and making sure all the clearances are right.

There are 4 ways to design a motorcycle gear case:

  1. Non-unit construction where the transmission is in its own separate housing with its own oil. This is how Harleys, BMWs, and old British bikes do it, but the disadvantage is you need a big primary chain or belt to transfer power from the crankshaft to the transmission. BMW avoids the primary chain by having the transmission longitudinally mounted, with the huge automotive-style single-plate clutch between the engine and the transmission. The two shafts run fore-aft instead of left-right.
  2. Horizontally split cases where the bottom of the case separates from the top of the case. Most inline-4s do this. It's easy to work on because you can put the transmission parts and crankshaft in place, bearings and all, and bolt things together at your leisure.
  3. Vertically split cases where the left half of the case separates from the right half. Modern V-twins like the SV-650 are designed this way. It's more difficult to assemble because things have to go together "just right" but it's strong and light.
  4. Cassette transmissions where you can remove a side plate and the whole transmission slides out. This is mainly a race-only design so that gear ratios can easily be changed for different tracks.
2001 Yamaha YZF-R6 transmission

Transmission Components

Fixed Gears (yellow)

Fixed gears are rigidly attached to the shaft. These gears will be either be machined as part of the shaft (as is first gear on the SV-650), splined to the shaft, or pressed onto the shaft. A fixed gear always rotates at the same speed as the shaft to which it is attached. If it's splined to the shaft, then circlips are usually used to keep the gear in place, while allowing you to remove it for maintenance.


gear showing dogs

Sliding Gears (pink)

Sliding gears may slide along the shaft to which they're attached, and this motion is controlled by the shift forks. They are splined to the shaft so they always rotate at shaft speed. A sliding gear has protrusions (dogs) on its sides which are designed to engage slots in the freewheeling gears and cause it to transmit power. Only one sliding gear can be engaged to a freewheeling gear at any particular time, and this is what determines which gear the transmission is currently in.

In this picture you can see three of these gear dogs, and the center splines.

This gear is out of a Honda CB400. This is a substitute image of unknown origin.


gear showing slots

Freewheeling Gears (silver)

Freewheeling gears rotate freely on the shaft to which they're attached, but are always held in the same place on the shaft by retaining rings or some other mechanism. For a constant-mesh transmission to operate correctly, there must be a freewheeling gear meshing with a sliding gear or fixed gear on the opposite shaft. The shift dogs in the gear above engage into the large holes in this gear.

These gears always rotate on a splined insert that goes over the shaft to provide a smooth bearing surface. It usually has a couple of holes which match holes in the hollow shft and provide oil. When you reassemble a transmission, you have to make sure these holes line up correctly.

In the picture you can see that the bearing surface in the center has been badly overheated, which turned the metal black. There are also several cracks in the webs between the holes, and the gear dogs have worn grooves into the webs.

This gear is from the GS1100GL. This is a substitute image of unknown origin.


Main Shaft (green)

The main shaft is connected to the engine through the clutch, and rotates at engine speed when the clutch is engaged. In the simulation, the main shaft spins at a constant speed.

main shaft

Countershaft (red)

The output sprocket is attached to the countershaft, and the countershaft spins at the speed dictated by the current gear ratio and the current main shaft speed.

This output shaft is from a Suzuki GSX1300R.

output shaft

Shift Forks (yellow) - Indexing Star Cam (green) - Shift Cam (silver) - Spring-loaded Roller (red)

shift cam

The shift cam controls the movement of the sliding gears through the shift forks. The shift forks have pins that set into grooves machined into the cam, and they have tines that engage slots in the side of the sliding gears.

When the shift cam rotates, the pins and grooves force the shift forks to slide along a shaft, which in turn forces the sliding gear to move. The shift cam is rotated by a ratcheting pawl mechanism that's operated by the foot lever. This cam is hollow, and the square in the top-center is actually a hole.

There is also an indexing mechanism which ensures that the shift cam stays in the correct position for each of the gears, as well as neutral. This is usually a star shaped wheel with a roller on a spring loaded finger. On this cam, the pit on the right end makes it easier to find neutral, and it has notches inside the left for indexing the gears.

This shift cam is from a 1982 RC125.

star cam, shift ratchet, and indexing finger

Star cam on a GSXR-1000 (visible by removing side cover, clutch & clutch basket)

How I developed this applet

I had to overhaul a Yamaha RZ-350 transmission once, and since the cases split horizontally, you could lay the parts in the case and watch things move as you shifted the gears. This was a lot of fun, and I wanted to reproduce this on a computer so other people could see how it all works, and that it's a really elegant mechanism.

My favorite scripting language is Python which is written in C. There is Jython which is Python implemented in "100% Pure Java" instead of C. This means you can run Python on any Java platform, including browsers, seamlessly integrated with any Java libraries. The Java objects automatically become Python objects.  One such library is Java3D which allows you to build and render complex 3D objects and visual environments. I stumbled across this page and realized that I could write 3D Python code using a standard and debugged 3D rendering toolkit, not have to deal with the nasty parts of Java, and the resulting application would be in a web-friendly form.

The gear ratios, gear tooth counts, gear positions and movements were determined from the service manual and parts microfiche for my '02 Suzuki SV-650, plus my blurry old photographs of the RZ-350 transmission in various positions.

There are several code modules:

  • Gear.py - implements the Gear object, which is the code behind making the gears look good. Lots of heavy-duty computational geometry going on here. Originally they were solid like real gears, but you could not get a feel for the different speed of each gear. I added a texture mapping, but then I discovered that was detrimental to frame rate. I decided to make the gears rather hollow, despite that being a departure from real life.
  • GearBox.py - the main application code.
  • Shaft.py - implements the Shaft object which are simply cylinders with end faces, but lighter weight than the built-in Cylinder object. The shift cam is a Shaft object that is also texture-mapped.
  • ShiftFork.py - implements the ShiftFork object.
  • Disk.py - implements a really lightweight disk object used by the other modules.
  • Star.py - implements the green indexing star cam on the end of the shift cam.

I did most of my development on an old 450MHz Pentium III system running Linux & XFree86 with an equally ancient 3Dfx Voodoo 3 graphics card. I edited the code using python-mode under EMACS. I used Jython 2.1, Java3D 1.3.1, and the Sun 1.4.2 Java SDK.

The command line to compile everything to a JAR file suitable for a Java applet is:

jythonc --core --jar transmission_demo.jar GearBox.py

Please note that there is a bug in Jython 2.1 regarding package-accessible constructors. This affects the subclassing of RotationInterpolator in Star.py. You need to apply the following patch to "proxies.py" in the "Tools/jythonc" directory:

      def addConstructors(self, c):
          for constructor in c.getDeclaredConstructors():
              access = constructor.modifiers
              if isPrivate(access):
                  continue
              if isNative(access):
                  access = access & ~NATIVE
              if isProtected(access):
                  access = access & ~PROTECTED | PUBLIC
+             if not access:
+                 continue
              parameters = tuple(constructor.parameterTypes)
              throws = constructor.exceptionTypes
              self.jconstructors.append((access, parameters, throws))

I've submitted a bug report, but there haven't been too many releases of Jython recently. There's also a bug in Java3D where JMainFrame adds a WindowListener that exits the JVM when you close the window. This crashes the browser. You work around it by removing the listener. I'm not even going to bother to submit a bug report.

For security reasons, you can't load anything not contained inside the jar, so I add the shift cam texture map image using:

jar -uvf transmission_demo.jar cam_texture.gif

The jar must also be signed using my personal security certificate so that it can access this file. This simply says that the jar came from me, and the browser pops up a window warning you not to run the applet unless you trust my code.

jarsigner -storepass mypwd transmission_demo.jar mykey

I originally generated the security certificate using:

keytool -genkey -alias mykey -keypass mypwd

The "mypwd" in both places is the security certificate password, and "mykey" is the name assigned to it. You only need to generate a certificate once, and you can pay big bucks to have Thawte or whoever make you an "official" one. Since they're listed in most browsers as a "trusted certificate authority" you won't get the "do you trust my code?" warning window. Personally for me, it's not worth it.

The shift cam texture map was generated using Postscript and the GIMP. I wrote code to output the current shift fork positions, and I put these coordinates into a short Postscript program. I loaded this into GIMP, converted it into a 256x256 pixel image, and saved it as a GIF. I'm rather pleased with how well it matches the shift forks.

Everything is animated using Java3D Alpha objects and RotationInterpolators. The only control the programmer has is over how long the gear takes to make one revolution, so you set the time lengths to have the same ratios as the gear pairs. The rotation angle is proportional to the length of time, so if you change the time length, the current rotation angle changes for the same Alpha. This is why gear positions jump when you change gear ratios.

Shifting is governed with a single Alpha object, and there is a RotationInterpolator for the shift cam and a PositionInterpolator for each shift fork, so everything moves in lockstep.

Closed source sucks!

I FINALLY fixed the problem where closing the applet window would crash the browser. This is because the JMainFrame creates a WindowListener() that ignores the setDefaultCloseOperation() and does an EXIT_ON_CLOSE instead of HIDE_ON_CLOSE as the API documentation specifies. This makes the Java Virtual Machine exit, and the browser crashes when this happens, because it's never supposed to exit. This is a Java3D bug and not a Jython bug. The solution is to simply loop through and remove all the damn WindowListeners. Holy crap, it was painful to find that. I only finally found it because Sun finally open-sourced Java3D.

Wish list:

  • Fix animation to avoid abrupt rotational jumps when shifting.
  • Possibly add output sprocket and clutch.
  • Possibly add foot shift mechanism.
  • Finish cam indexing mechanism.
  • Add display/setting of viewing angles and distance.
  • Add keyboard navigation.