MPower Echelon2 Import with Aerodynamic Drag Calculations
Dec 24, 2020
I added Schwinn AC Performance Plus support via MPower Echelon2 Console CSV import to my Track My Indoor Workout application. Things were hunky-dory except that the velocities were too fast for high power outputs. This resulted in inflated average speeds, and on two occasions when I was on slightly miscalibrated bikes (which read higher power) I managed to take down some Strava KOMs (King of the Mountain awards) in the Jerry Baker Memorial Velodrome - where I interpolated the GPS coordinates.
This was very alarming, because the last thing I wanted to do was to interfere with the real track cyclists of that velodrome (or anywhere else). Any of the app users could also unintentionally take down a KOM on a miscalibrated bike. What makes the problem worse is that even though I specify "VirtualRide" as the sport type in my TCX Strava upload, it seems to go through as a regular Ride.
- As an immediate crisis avoidance measure, I relocated the GPS location from Marymoor Park to the Hoover High School’s running track in Fresno, California. The running track doesn’t have any cycling segments, so no user could take down any KOMs/QOMs anymore; the app wouldn’t interfere with real riders whatsoever. The move wasn’t too hard, because that running track is also North-South oriented. Although both are 400m tracks, they are very different: an athletic running track has 100m-long straights and 100m-long turns, whereas a velodrome has longer turns and shorter straights so the turns can be graded lower and the radius can be bigger, resulting in less centripetal force on the riders. A high school track that hosts an American football field also has a different shape than an athletic track, although all of them are still 400m long. Fortunately I already faced this when I developed for the velodrome and I have a factor in place for the different shapes; I just needed to fine-tune that for the Hoover track over 5–6 uploads.
- As a longer-term solution, I needed to change how I compute velocity from a power reading. What I did so far was to look at the average power and the total distance, calculate the ratio of that, and proportion it per power. This resulted in a linear power-to-speed equation which worked OK when looking at the whole ride, but resulted in excessive speeds for high power outputs. That not only resulted in unwanted KOMs, but Strava also automatically flagged two of my workouts which were on slightly miscalibrated bikes (with higher power readings). I knew that if I used a physically realistic equation, it would gradually tone down the speeds for higher outputs because the aerodynamic drag is proportional to the square of the velocity (
), and the required power grows with the cube of the velocity ( ).
I came across this webpage by Steve Gribble which gave a nice foundation for more realistic equations. The formula is not simply reversible. There’s a closed formula to compute the forces for a specific velocity, so we use a successive approximation method to hone in on a velocity belonging to a power value. We set low and high velocity bounds and start from an approximate velocity point. In an iteration we compute the power for the current velocity point and adjust the low and high bounds based on the offset of the power from the given power value. We exit the iteration if we get close enough to the given power (by an epsilon) or we exceed 100 iterations.
Since we only need a speed reading with two fractional digits of precision, the epsilon can be fairly large: currently 0.001. The bound adjustment is halving domain distances so the iteration converges in