Virtual gear shifting in indoor training

Quite recently Zwift released a “new” trainer with a particularly interesting feature: a single cog gear. The trainer is not new; it’s essentially their Hub Classic. However, instead of shipping it with a regular Shimano cassette, they have replaced it with the “Cog”, a single-cog cassette designed to simplify the process of installing a bike on the trainer and save the users from the complexity of the annoyingly prolific world of bicycle drive trains.

For this to work effectively in an indoor training scenario, you need a way to implement virtual gears that can replace the physical ones you have just removed. And that’s precisely what they’ve done. Zwift provides a basic BLE-enabled remote control called the “Click”, which instructs the Zwift app to tell the trainer to virtually gear up or down (why so many steps?, because that way you NEED to use the Zwift app). They have predefined a set of 24 gear ratios for you to choose from.

That’s very cool, because the gearing is as smooth as it gets and eliminates common issues such as noises, chain skipping and the mechanical problems associated with a traditional drive train. It also reduces wear and tear. However, the downside is that, since this system is integrated into the trainer, you can’t use virtual gearing with other apps until Zwift releases their gearing protocol (don’t hold your breath), and you can’t do virtual gearing in other trainers from other brands.

The math

Way back in time, while working at BKOOL, we faced a challenge with the indoor bike we were developing, which eventually became the Zycle Smart Bike. This experience equipped me with the knowledge to attempt emulation through software in GTBikeV. By shifting the calculations from the trainer to the indoor training app, it becomes compatible with any trainer and can be controlled using a keyboard or gamepad, eliminating the need for extra hardware or firmware updates for your trainer.

The math involved is not very complex:

With cadence, virtual gear ratio and a virtual wheel size we can calculate virtual speed:

speed in meters per second = (cadence RPM / 60 seconds in a minute) x gear ratio x wheel circumference in meters

For a practical example, let’s picture a fellow cyclist called Marco. He maintains an 80 rpm cadence on a bicycle with 700 x 25c wheels (wheel circumference of 2.1m) and he has shifted to his 50×15 (50/15 = 3.33).

virtual speed = 80/60 *  3.33 * 2.1 = 9.3 m/s

This means that Marco is moving at 9.3 m/s, or 33.5 Km/h (20.8 Mph). Note that this is just plain gears math here, no watts involved, no losses, frictions, the environment comes next.

Marco is 1.5 Km into his ascent of Passo di Gavia (not super relevant for calculations, but epic). At this point he is at 1127m elevation, on a sunny day with no wind. After a summer of training, Marco weights shy of 70Kg. His bike, which is not top-of-the-line, adds 9 extra Kg, and he is riding on tubulars. The road at this point is 2.5% grade, has been recently paved and has a rolling resistance of 0.004. With all this information, using the Bike Calculator or the Jim Martin and Andrew Coggan’s formulas we can estimate Marco should be producing about 350w.

Why am I sharing all this information? Well, now that we know Marco should be generating 350w under those conditions, if we are simulating that same conditions at the Passo di Gavia in our training platform, we know the trainer must apply 350w as long as he maintains his 80 rpm cadence. And how do I ask the trainer to target 350w? You guessed it, ERG mode!

So, all I need to do is to recalculate the target power every time any of the simulation parameters change and send the new ERG value to the trainer. Of course this approach has some limitations, primarily based on the trainer’s technology, as some trainers are very sluggish adjusting the target power (think of moving permanent magnets tech vs electromagnet tech). This may not be a significant issue during a regular workout, but is crucial in this “virtual gearing” mode. That’s why it is much, much more efficient to perform this calculation within the trainer itself for faster and more responsive adjustments. However, as we’ve seen, doing it inside the trainer it’s subject to the arbitrary decisions of protocol standardization-averse companies like Zwift.

Alright, let’s keep the good times rolling with our example and see how virtual gear changes work. Imagine our rider, Marco, taking a break from pretending to be a superhero on the bike. He’s decided he’s overcooking it too early in the climb and yearns for a cozier setup. Marco shifts to 48×23 (48/23 = 2.09) and chills out by slowing down his cadence to 75. The result? A new virtual speed:

virtual speed = 75/60 *  2.09 * 2.1 = 5.5 m/s

So now, Marco’s virtual speed is down to about 20 km/h (or a leisurely 12.5 mph), and he’s still on the same stretch of the road with the same simulation settings. We crunch the numbers once again with our trusty power calculator, and it tells us Marco’s dishing out around 160 watts—a much more relaxing power level for his legs. So we send an ERG target of 160w to the trainer, and Marco feels the relief… as quickly as the trainer can respond.

This is basically what’s going on inside the trainer when you’re playing around with virtual gearing—probably several times per second. Doing it inside has the advantage of not having to wait for the new parameters to be sent because they’re all comfortably stored in the trainer’s memory, including the gear ratio, which the app captured when the user gave the ‘Click’ remote or ‘Play’ shifting button a tap

But wait… what about the real gears in the bike?

I’m glad you ask that (I know I made you do it by reading the question, but I’m glad anyway). In theory it shouldn’t matter what real world gears you’ve got going on. In fact, you can even change your gears mid-ride, and it won’t throw a virtual wrench into the works. Why is that? Well, because the trainer has been instructed to set ERG mode! As you might have noticed during your workout sessions, if you decide to play around with your real-world gears, the trainer just nods calmly and adjusts itself to the new speed of your bike’s hub (if it’s a direct drive) or the roller (if you’re wheelin’ it). There might be a brief moment of confusion as it recalibrates, but then it gets right back to delivering the wattage you asked for

The moral of the story here is, don’t go fiddling with your real gears while you’re in the midst of virtual gearing. The universe won’t implode if you do, but it’s not going to be the smoothest ride either. Also, make sure your real-world gears are in the combo that makes your chain as straight as a ruler. Now, I get it, you might have as many chainring combinations as there are chainrings in your collection. So, when it comes to picking the perfect real-world gearing combo, the answer, once again, is, ‘It depends’. It depends on your trainer’s abilities and your preferred cadence style.

If your trainer doesn’t like slow speeds, if it’s a bit grumpy about dishing out high wattage at low RPMs, then opt for the largest chainring you’ve got. Conversely, if your trainer can’t deliver low watts at high speeds, you won’t see much rest even if you gear down to the lowest virtual gear ratio, if you use a massive 58-tooth chainring. So, find a happy compromise, taking into account your average cadence. If you’re a speed spinner, loving that 90 RPM or above, you might want to roll with a smaller chainring. On the flip side, if you’re a pedal-pushing powerhouse who thrives on slow, torque-heavy cranks, then go big with a larger chainring

And humour me here again. For your deity of choice’s sake, once you’ve chosen your real world gearing, don’t change it during your virtual gearing ride!

Automatic shifting and more

Now, this old-school tech opens up some doors to some pretty fancy stuff. Chances are this doesn’t work as well as it looks, and that’s why we don’t see it on all the indoor bikes that have been using this virtual gearing concepts for quite while now.

Take automatic gearing, for instance. It’s a bit like automatic cars that magically know when to shift gears to keep the engine humming in its sweet spot. With your indoor ride, you could set a cadence range that you find most comfortable. If your legs are turning too slow and your cadence drops below your lower limit, this virtual gearing could cleverly downshift to help you get back to your ideal cadence. On the flip side, if your legs are spinning like a Formula 1 race car because the resistance in your trainer feels too easy – a downhill maybe, the virtual gearing could nudge up, so you can crank out more watts without pedaling like mad.

And then there’s the world of non-sequential gearing – think of it like skipping up or down as many gears as you’d like in one fell swoop. For this nifty trick, within GTBike V, I’ve reprogrammed the shifter button on the Zwift Play controller. Instead of just clicking it, you can give it a good, long press, and it’ll happily skip you through 5 gears at once. Now that’s the kind of gear change that’ll keep you groovin’ on your virtual ride.

How to try this?

I have implemented virtual gearing in GTBike V version 0.7.4 beta and you can try it for free, because the mod is free. It should work with any trainer capable of ERG mode. Although it’s still in beta you can check it out. And don’t worry if you don’t have a Zwift Play Controller, it also responds to keys 7 and 9 in the numeric key pad of your keyboard.

1 thought on “Virtual gear shifting in indoor training

  1. Pingback: New version 0.7.4.0 – Virtual gearing, virtual cornering and localization – GTBike V

Comments are closed.