Wednesday 21 December 2016

How does a simple Turbo Trainer Work?

My job in the real world is to support the development of Engine Test Facilities for Jaguar LandRover (JLR) in the UK. Specifically I have a team that support and develop software systems for data delivery, although I know a lot about the non-computer systems. I have developed and deliver a training pack for new employees joining the business as Engine Test Bed Operators that covers a wide range of material.

One of the topics is the dynamometers we use, these being a mix of Eddy Current machines and AC motors. During the discussion I mention my turbo trainer as a type of Eddy current dyno, but with permanent magnets rather than electro-magnets.

Wikipedia has a page about what Eddy Currents dynamometers are here: link.

This image shows the principle. Basically the disk passing through the magnetic field causes currents to be induced in the disk. These currents (eddy) generate an opposing force to the direction of motion and hence this resistance is how power is absorbed. The force is function of the velocity (and of course the magnetic strength and resistance of the disk). Basically for a given design doubling the speed means doubling the power dissipated. the resistance dissipated as heat by the currents flowing through the resistance of the metal.

 

I had not really given the exact mode of operation of my turbo trainer a lot of thought but a couple of things coincided recently and I partially disassembled it to fix an issue.

Firstly I was in my garage to re-build my Giant Defy as a turbo (only) bike after it was possibly damaged when I got knocked off in Nov 2015. Secondly, as I was in the garage I partially disassembled my turbo trainer to try and sort out why it was stuck on a quite high load setting - in some respects training at a higher load makes it a little easier when actually riding on the road but at the same time the load can be just too high and make the turbo sessions unpleasant.

I took the cover off and this was the view of the end of the roller:



It is possible to see the disk and a small cooling fan. I think the disk has holes to aid cooling.

The end cover has 6 magnets in a fixed position:



I had assumed that the cable adjuster moved some magnets radially - low load was with the magnets further out and high load with the magnets fully covering the disk. This was clearly not the way this works. I removed the 3 screws and pulled the fan and the disk off the shaft to find  second set of magnets:



These magnets are mounted on an adjustable plate that rotates about 30deg. This rotation moves these magnets into full alignment or out of alignment, this increasing or decreasing the effective magnetic field and hence the eddy currents and hence resistance. This is a really simple and effective design. Here is a schematic:

 

What's also interesting is that this simple set of magnets and metal disk is capable of absorbing around 400W+ (I don't know what my trainer is rated at but I know that I can't get any where near the limit).

Some minor fettling of the assembly and lubrication of the cable adjuster seemed to sort eveything out and I can now easily adjust the load (via magnet positions).

So one better working turbo trainer later I can "train" better.

Sunday 11 December 2016

Strava Data Analysis - A PC Based Visual C# Solution


See latest version here: link

Note - I am keen for people to test the code I have written whilst I continue to develop it. I will release the source code later (when I work out how this can be done), so for now I have built an application for installation.

Thus this post will continue to change and evolve to capture document this application fully

The application looks like this:



Currently it only does one thing - connect to Strava, download all rides between to user definable dates and allow this to be exported as a Tab Separated file. "Ride Data" means the averaged/final data for a ride (description, average speed, duration etc.). (I have development version that can download the second by second GPS data but this needs more work).

So what do you need to do to use this tool?
  • Create your own Strava Application
  • Install this DotNet application and run it
The reason you need to create your own application is you need a "Strava Token" which you receive when you create an application that ties the data to your account. I think it can access other peoples data as well but I don't understand the documentation for this.

Creating your own Strava Application
On Your Account page you will find a link to create an application. You need to enter 4 pieces of information to get an application. Here is my information (that I can change my existing application): 


You need to enter an Application Name, a website (I have used this Blog as a link at the moment), a description and finally an "Authorisation Callback Domain". This is where I failed but some Googling the problem suggested that "localhost" would get you through, which it did. These settings don't support an online solution but I don't want that - I wanted to be able to connect and get my data using a PC offline tool only

With these entries you can actually create an application and you'll get the following tokens/data:



You will need the "Access Token" to use the application. You can copy and paste from the web page into the application. Don't share your token with others. The Access Token is a 40 character hexadecimal number.

Next you need to get the application. I have put it on my Google Drive and it should be shared with anyone with this link here. Extract it from the .zip file and run setup. All should be OK.

Note that this application uses the DotNet framework so this must be installed. Most Windows PCs will already have this. I am not sure the minimum version required - refining the installer and updates is on the list of things to do!

Once its started you'll need to paste in your Strava Access token in the box and then press the Start Button. 

All being well after a period of time your data should appear in the application. There is currently no progress indicator - so please wait. The longer the data window and the more activities you have to download the longer it takes to get the data - as much as 30 seconds or more. 

Once its complete you can then export the data.

Closing the programme should save your Strava token which will be read next time you run the application.

This is a very short introduction. More details will follow as quickly as I can update this page. Please report all issues via the comments section of this post

Detailed Narrative
Some time ago (2013) I wrote a small tool that downloaded your Strava data using Excel and the wget utility. I documented it here (link) and made it available for download.

However this was thwarted when Strava withdrew support for the API that I was using so my tool stopped working. I gave up looking for alternative solutions at the time as I could download similar data using the great Veloviewer. However this solution was a bit flaky (not sure if it was my browser or what) but it was inconsistent.

I occasionally looked at the Strava Blog and saw that support for external applications was supported but it looked complicated - for example it looked like you needed to call from a web server and use JSON - whatever that is. (see bottom of page for a summary of JSON). However intermittent and continued reading showed that there were also libraries

Language Libraries

The Strava API is implemented using RESTful HTTP JSON patterns. A number of 3rd party language specific libraries exists to wrap this functionality and make usage seemless.

Alongside this were a set of links (replicated below) of all the different libraries implemented by individuals:

 The one that was attractive to me was the .NET library. I have previously written a number of applications in old fashioned C and Delphi, as well as dabbled in VB (the latter because I use Microsoft products a lot at work and have needed to add VBA processing to Excel). I have also played with various versions of Microsoft Visual Studio so was familiar. So I decided to have another go, and chose C# this time (I don't really know why)

There were several steps required (not necessarily in this order:
  • Get Visual Studio
  • Get the Stravadotnet packages
  • Create a Strava Application
  • Read some documentation
  • Try the examples
  • Understand a bit better using Visual Studio
  • Get the examples to work
  • Try various things
  • Work on an example
  • Test and trial the example
  • Get a working piece of code
  • Share with the world
JSON (JavaScript Object Notation is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999.

Sunday 30 October 2016

Possibly Some Form Again - Just in time for the Winter Wind Down

There is no way that I would say I was a fast or strong cyclist. I don't set the MAMIL leader boards that are Strava on fire and when I do I am astounded. I would best describe myself as a reliable cyclist - I can go out and reasonably easily turn out 50-70 miles every Sunday without feeling too tired

Last year I had a strong run through the year and 2 weeks in the French Alps, and a 5hr Ride London meant I was strong all the way until the point that I got knocked off. I was off the bike for over a month and although I was riding again 5 weeks later it was no where near at the same pace. In fact it probably took until 6 months later in May/June 2016 that I was anywhere near where I had been in November 2015.

I was fit enough for 2 weeks in French Alps and Pyrenees and felt OK for a while after that. However there were no rides that, when I'd got home, I felt that it had been great, and there some that I barely made home at any sort of pace at all - I got to 60 miles and it was like a switch going off

In October the shoulder I injured when I got knocked up flared up. I could not lie down and I had had to abort a ride after only 9 miles and ring my wife to come and get me - the first time ever.

This meant another 2 weeks or so off the bike and by now the days had shortened so I had also stopped riding to work - I am still nervous about the dark after the accident.

As a result I had even started riding my turbo trainer 1-2 times per week in the evenings to keep some level of fitness. I hate it to be honest, but its a chance to get a level of high intensity riding in some form of controlled manner. I got up to 45 minute sessions with some semblance of intervals.


I am not sure it is enough yet to make a difference. One of the end results is that, despite just wearing shorts and short sleeved jersey, its like I have had a shower whilst riding as I end up so sweaty!

As an example I rode Saturday 29 Oct and my average HR was 150bpm - it was not that high in the Pyrenees! Its rides like this that make me wonder what I need to do restore a level of consistent fitness.

However today (30 Oct) I rode to the Marina at Barton-under-Needwood where my wife picked me up before we went to the National Hill Climb Championships 2016 up Bank Road, Matlock. I had ridden to the Marina before and estimated 2.5hrs ride time. However once I'd left home having banked on 2.5hrs, I did the sums again and reckoned that at my usual recent pace (16mph) I'd be late meeting my wife so I had to up the pace. What surprised me was that I was able to hold this speed pretty well all the way. Apart from almost grinding to a halt up the last two inclines (no way were they hills) in the last 3-4 miles I felt really good and it was reminiscent of fitness back in August 2015.

I averaged 17.8mph which is by no means great in comparison but this was a solo ride of 44 miles and for me a big improvement - just in time for the weather to be closing in and my mileage to start to plummet over the Winter!

Here's the Veloviewer data: 







National Hill Climb Championships 2016 - Bank Road, Matlock

We went to the National Hill Climb Championships this year at Bank Road, Matlock.

Its hard work - a few people had clearly given it their all and were sick or needing a level of medical attention at the top.

I won't write a tedious summary, but here are some photos (just a random selection) and a short video.





















Saturday 15 October 2016

VeloViewer 2016 Info Graphic

Its back - the great VeloViewer Info Graphic for 2016 - even though 2016 is not yet over!

Here's mine:


Sunday 4 September 2016

Watching the 2016 Tour de France - Stage 7

We were on holiday in the Pyrenees when the TdF 2016 was passing through - this was a complete coincidence and not planned but we decided to take advantage and go and watch part of Stage 7 - L'Isle-Jourdain / Lac de Payolle:





Given we needed to drive 500+ miles the next day the preferred location of watching somewhere on the climb of Col d'Aspin was ruled out. This was given how many people would be in the same area and the fact that the most direct route was over the Tourmalet. Instead we went the top of the other climb - a paltry Cat 4 at Côte de Capvern. This was about an hours drive away on normal roads - i.e. not over a high mountain pass.

We checked the time tabled route and planned to get to the route about 60-90 minutes before the Caravan. We duly arrive in the village but it was not actually clear where the route was and there was no signage. However all along the side of a road were French families with the picnics, barbeques, verre de vin so we guessed we were OK. We went for a short walk and a few minutes down the road it was clear that we were in the right place - signage, even more people and a general party atmosphere.

We had to wait a couple of hours for the Caravan to arrive. There were quite frequent isntances where "official" cats came through but as it got closer the atmosphere did get quite tense and people were standing up and waiting. There were messages about staying to the side of the road and we were not quite sure why - but once the caravan came through we could see why - it really races past - 20-25mph as a guess and a constant throwing out of the "souvenirs". The Caravan was fantastic - about 15-20 minutes of really creative floats

The Caravan












Heres the souvenirs we managed to grab:



We also got a bottle of Vittel water, but missed out on a Polka Dot T Shirt

About an hour later the race itself came round. We were about 250m from the top of a Cat 4 climb so Iwas hoping that the riders would be a little slower - they were but not a lot!. There was a break away group of about 20 or 30 riders followed by some team cars. I didn't recognise any big names in this group

The Race - The Breakaway Group











Then the Peleton came through in a fairly team order, at least at the front.

The Race - The Peleton


Team Sky were really the lead team with a few Movistar riders at the front


Froome was the 2nd to last Sky Rider in the picture above

Team BMC -Porte 2nd here I think

Trek Segrefrado

Most of the Tinkoff Team

You can see how close the riders get

And at the end of the Course the Broom Wagon!


Within 5 minutes most of the people had dispersed, the official banners and railings at the top were being removed and within 30 minutes there would have been no trace that the race had been through!

It was a great experience - the worlds greatest cycle race and you can watch for free and be close enough to touch the riders.