vendredi 8 mai 2015

Using Data to 'win' Sailboat races

I've been sailing for quite a few years on the great lakes, doing various buoys and port to port regattas. I decided last year to use the skills I developed at work and bring that to the boat to have an edge on others, so in early 2014, I started developing a system that allowed us to have a clear edge on the competition by using data publicly available, some creative ways of gathering the data and the good tools to analyse it.

We did out best ever Mackinac race that year, and I'm pretty sure it'll be hard to reproduce.

Preparation


I started gathering and observing weather data for that race 7 days ahead, collecting the data ahead of time allows you to see how the foretasted results evolves. If you see that for 7 days in a row, the wind speed and direction are the same for the day of your race, you can assume that the model is pretty stable and results are solid. If you see huge variations from day to day, it's likely that big perturbations are in the area, and the models have a hard time predicting what will happen.

3 Days before the race, I knew what the strategy will be : I wanted to be the leftmost boat of the fleet. I sent a couple of emails to everybody everyday refining our route and strategy but the overall plan did not change. Why? Because fronts were coming from the west and I wanted our boat to be the first catching it while everyone else will be stuck in high pressure system on the east side.

That's a very short story to let you know how I prepared for the race, but what about the other systems I told about in the first chapter? Read next.

Capabilities of our boat

 Our boat was able to:
  • Gather weather forecast from various models as soon as they were published by the NOAA
  • Selectively get a portion of our area of interest to reduce the time it takes to download things
  • Sends Tweets (text and images)
  • Post on Facebook (configured by following our twitter account)
  • Re-estimate the best route with every weather forecast we had
  • Know the position of all the other boats at any time
To do that I created a system made of two parts: A server that was running at home waiting for my commands, an POP/SMTP client used on the boat to send receive messages.

The mode of operation was pretty simple, if I wanted to know the weather forecast, I was sending an email to my server with a specific title like when my server receives the request, it downloads all the necessary files from the NOAA servers, stack them hour per hour, and truncate them to only use the desired area. Thus files sent back to me where around 44kB only and downloadable in a read.

There are systems commercially available for that but the only provide you with GFS models, ours could grab any model, thus we had a better overview of the weather ahead of us.

We could also send tweets like this one :
For that I needed to take a picture, resize it to a very small image to weight no more than 20kB and sent another type of email to my server. Then the server took care of publishing out tweet.

For the positions of the other boats it was also pretty straight forward. But required some hacks, our positions are relayed to the public using the website Yellowbick. They have a pretty nice webpage and JavaScript client that displays boats on a map. 

However we didn't wanted to download the whole page all the time with our cheap satellite connection, this was just impossible. So the server was doing it for us, send an email every time new positions are available, and I used my custom made software to display course, speed, heading... of all our competitors, this was our little spy:


We're also using the forecast and a software that performs optimal routing using dynamic programming. The inputs it needs are: The predicted performance of your boat, the weather forecast and a GPS point to go to. Then what it does it try for many different increment of headings to find the route that takes you the closer to your destination in the shortest amount of time. And provides you with very good information about where to be on the race course:


All of that was running during our race, and it allowed us to finish in second place. Now what second? We didn't win? No because we were a bit too slow at the beginning, but we'll fix that this year with some other data and visualization tools.

Conclusion


We'll use all these tools again next year, we'll improve on our satellite communication to have a more reliable connection, and we'll also train hard to stay on target all the time. The WiFi transponder and App described a year ago will be very useful!

Aucun commentaire:

Enregistrer un commentaire