Cast for two

Friday, January 31, 2014

Adding virtual power to TCX for the Tacx Blue Motion Cycling Trainer

I recently bought a cycle trainer for indoor training: Tacx Blue Motion T2600 for 185€ at fiets.be, a local cycling store. Using my Garmin 800, i could record my heartrate, cadence and speed while riding a workout. Since I have no power meter on my bike, I was barred from a feature that higher and more expensive trainers offer. But in the documentation of the trainer, I found a graph showing a linear relation between speed and power. So if I just could add this to the recorded file before submitting it to Strava, I would have trainer for less than 200€ with power measurement. This is the graph:

From that graph we can derive that riding at 60 km/h in position 5 (the middle blue line) a power of 500 Watt is developed. Hence power = speed / 60 * 500 = speed / 6 * 50 . Remark that speed must be in Km/h dimensions to obtain the power in Watt. There's even an interactive graph at website of Tacx. The Garmin 800 measures speed by counting the number of revolution of the wheel in a time unit and multiplying this by the circumference of the wheels. I converted the .fit file, I obtained from the Garmin device, in TCX (a XML file) using Garmin Training Center (Free software available for Windows and Mac). This file basically contains a list of trackpoints (1 trackpoint every second). One trackpoint looks like this:
        <Trackpoint>
            <Time>2014-01-29T20:38:59Z</Time>
            <AltitudeMeters>157.4000244</AltitudeMeters>
            <DistanceMeters>14850.7099609</DistanceMeters>
            <HeartRateBpm xsi:type="HeartRateInBeatsPerMinute_t">
              <Value>139</Value>
            </HeartRateBpm>
            <Cadence>92</Cadence>
            <Extensions>
              <TPX xmlns="http://www.garmin.com/xmlschemas/ActivityExtension/v2" CadenceSensor="Bike">
                <Speed>8.4530001</Speed>
              </TPX>
            </Extensions>
          </Trackpoint>
At this time, the speed was 8.4530001 meter per second. To convert this to km/h, we have to divide by thousand and multiply by 3600 (the number of seconds in an hour). So speed_in_kmperh = speed /1000.0 * 60 *60 = 30.43080036 km/h. The power developed at that moment was : 30.43080036/6.0*50.0 = 253.590003 Watts. We convert to integer : 253 Watt. To add this to the TCX file, we add a line <Watts>253</Watts> as follows:
        <Trackpoint>
            <Time>2014-01-29T20:38:59Z</Time>
            <AltitudeMeters>157.4000244</AltitudeMeters>
            <DistanceMeters>14850.7099609</DistanceMeters>
            <HeartRateBpm xsi:type="HeartRateInBeatsPerMinute_t">
              <Value>139</Value>
            </HeartRateBpm>
            <Cadence>92</Cadence>
            <Extensions>
              <TPX xmlns="http://www.garmin.com/xmlschemas/ActivityExtension/v2" CadenceSensor="Bike">
                <Speed>8.4530001</Speed>
                <Watts>253</Watts>
              </TPX>
            </Extensions>
          </Trackpoint>
The next step was to automate the calculation of the power and adding it to the TCX file. I wrote the following Python script to do that:
prompt> python vpower.py > vpower_29-01-14\ 20-53-27.tcx
I uploaded the resulting TCX file to Strava and obtained this:
Of course, the power in this workout is based on the fact that I left the lever om my trainer on position 5 during the whole workout. If you change the position of the lever during the workout, this approach will give wrong results.

Is this approach of "virtual power" accurate ? Not as accurate as power meters on the bike but usable I would argue. The concept of "virtual power" is also supported by Trainer Road Software. Later, I found an interactive graph of the speed power relation for Tacx Blue Motion on the website of Tacx. From that graph, I could obtain more precise datapoints : at 60 km/h power is 407 Watt. So next time I use my script, I will use power = speed_in_kmperh / 60.0 * 407.0 as power formula.

3 comments:

Unknown said...

like your engineering approach to sports!

davidof said...
This comment has been removed by the author.
davidof said...

You may also be interested in my application:

wattzap

it supports the Blue Motion and other trainers incl the full Tacx range and lets you ride Real Life Videos as well.