Menu

Tree [97922c] default tip /
 History

Read Only access


File Date Author Commit
 .hgtags 2014-01-01 David J. Kessler David J. Kessler [7ebbb7] Added tag v0.3 for changeset 8d9b4c6349d2
 README.rst 2013-11-30 David J. Kessler David J. Kessler [cc24e8] Added README.rst
 kalman.py 2013-11-30 David J. Kessler David J. Kessler [6aed16] Initial commit.
 tcx_vpower.py 2014-01-12 David J. Kessler David J. Kessler [97922c] Revised <Track> detection. Ticket #2.

Read Me

TCX VPower - Add "virtual" power to cycling TCX files

Overview

TCX VPower is a simple Python script to parse Garmin Training Center (TCX) files from cycling activities and add computed "virtual" power to each trackpoint.

This tool is useful for riders without power meters that import TCX files from GPS watches and cycling computers into programs like GoldenCheetah or Garmin Training Center that don't provide their own virtual power calculations. Power computation is similar to the method Strava uses for its virtual power feature.

Accuracy

Cycling power calculations based on anything other than a real power meter are inherently inaccurate. Though the physics behind the calculations is sound, there are many factors that reduce the accuracy. These factors include:

  • Wind speed and direction is not included
  • GPS position data is not perfectly accurate (particularly elevation)
  • CdA (coefficient of drag times frontal area) uses "typical" values that may not be correct for you, your bike, or your riding position
  • Rolling resistance uses "typical" values that may not be accurate for your ride
  • Drivetrain power losses are not modeled

In other words, the individual power calculations at each trackpoint are almost certainly wrong -- sometimes by a lot.

So what good is this thing? Since the errors go both ways (sometimes high, sometimes low), they tend to average out over the course of an entire ride. This assumes, of course, that your ride starts and ends at roughly the same point, that wind doesn't shift dramatically during the ride, and lots of other things remain constant.

But not everyone needs highly accurate power data. The main benefit of a tool like this (and the reason I created it) is that when it comes to tracking your training load, the approximations made by this tool are infinitely better than nothing.

The bottom line is if you need accurate power measurements for your training, get a real power meter. And if you post in your favorite cycling forum about how you figured out you have a 450W FTP by using data from this tool, I'll be first in line to flame you.

Installation

Make sure you have Python 2.7.x installed on your system. Mac OS and most flavors of Linux have everything you need pre-installed for you. Windows users should visit the Python Download Page to download and install the latest production version of Python 2.7.

Download and unzip the tcx_vpower_x_y.zip file (where x_y is the version number). You will get two files: tcx_vpower.py and kalman.py. The script can be executed from any directory, but the easiest thing to do is create an empty directory and put these files in it along with copies of the TCX files you want to convert.

On Mac and Linux, you can optionally make the main script file executable:

$ chmod +x tcx_vpower.py

Usage

Open a command shell and navigate to the directory containing the tcx_vpower.py file. From that directory, you can run the script as follows:

python tcx_vpower.py [-h] [--kalman] [--csv] [--verbose] [--airtemp AIRTEMP]
                     [--airpress AIRPRESS] [--mass MASS] [--cda CDA]
                     tcxfile [tcxfile ...]

positional arguments:
  tcxfile              TCX file to process

optional arguments:
  -h, --help           show this help message and exit
  --kalman             Use Kalman filter on elevation data
  --csv                Write CSV data to stdout
  --verbose            Write debug info to stdout
  --airtemp AIRTEMP    Air temperature in C
  --airpress AIRPRESS  Air pressure in mbar
  --mass MASS          Mass rider + bike in kg
  --cda CDA            Coefficient of Drag * frontal area

All of the parameters except the tcxfile are optional, though some defaults (like mass) are likely to be very wrong. It is recommended that you always use --kalman and --mass parameters. For more accurate results, also supply --airtemp and --airpress parameters.

For each tcxfile specified on the command line, the tool will generate a new file in the same directory with "vpower_" prepended to the name. The original TCX files are not modified by this tool. If your operating system supports it, you can use "wildcards" (like "*.TCX") or list several individual file names to convert multiple files at once.