Simon さんのプロフィールPsiSpaceフォトブログつながり ツール ヘルプ

ブログ


11月24日

Regatta Manager Videos - Update

It has been pointed out to me that Soapbox is still in limited beta.
 
So you can view the Regatta Manager video's on YouTube here and here.
11月22日

Skandia Cowes Week Videos

As I've mentioned before, Microsoft sent a film crew along to Skandia Cowes Week to see the Regatta Manager in action and below are the results. There is a technical and business version of the video.  Thanks again to Tim, Heather, Barbara and Ian at Microsoft who made this happen, and to Bubble Solutions for putting together this great film.  I'll stop now as this is starting to sound like an Oscar acceptance speech...

SiSoft Regatta Manager - Business Edition
SiSoft Regatta Manager - Business Edition

SiSoft Regatta Manager - Technical Edition
SiSoft Regatta Manager - Technical Edition


 

 

 

, , , , , ,

9月1日

Polar diagram generation tool

Since I've had a lot of hits to my blog from google searching for things along the lines of "J/109 polar diagram" and "X-332 polar diagram" I've repurposed a bit of the Regatta Manager to produce a polar diagrams for all the major one design classes with the option to generate one from an IRC rating.

It produces polar diagrams for the following classes:

Laser SB3 Etchells 1720 RSK6 Daring
Dragon Sonar 707 Flying 15 RS Elite
Redwing Solent Sunbeam Squib Swallow Mermaid
Victory XOD J-109 X-332 Sigma 38
Sigma 33 Sunsail 37 Contessa 32

Shout if anyone wants any more defaults added, I'll post a link over the weekend.

8月23日

Wind, Tide and Boat Speed

,
They are the 3 things you need to work out how long it will take to get from point A to point B in a boat.

Getting the first two is quite easy, all you need is your own personal meteorologist and some help from the Proudman Oceanographic Laboratories in Liverpool, the first one can build you a forecast using the wonderful 'SiSoft Weather Maker' the second a library from which you can query tidal speed and direction at specific coordinates.  The third thing isn't quite so simple...

I have mentioned polars previously but I wanted to expand on that and explain what they are and how I use them in more detail.

When a sailor talks about 'polars' they are refering to the graph which describes the behaviour of their boat.  It is refered to as a polar because the type of graph used to show this information is a polar diagram.

On a normal graph a position in graph space is defined by using a set of Cartesian coordinates [x,y] on vertical and horizontal axes.  On a polar diagram a position in space is defined using polar coordinates [Θ,r] on an angluar axis and a radial axis, with the option of a vertical axis [z].

In our case:

Θ = True Wind Angle (TWA)
r = Boat Speed (BS)
z = Velocity Made Good (VMG)

The TWA is the angle of the wind relative to the boat, BS is the speed of the boat through the water, VMG is the component of the boat speed that is in the direction of the destination.

Skandia Cowes Week has around 38 classes which range from very small to very large, for which we need a polar to describe each class.  So as to reduce the amount of work we had to do we only collected 3 polars.  One which represents a displacement hull, one a sportsboat (or planeing) hull as well as one for multihulls and all of them with an IRC handicap rating of 1.0.  Using this we can then scale the polar values to the equivalent rating for each class in the fleet.  This is easy for the large classes as the IRC rating is easily obtained, for the day boats this is less so.  We in fact use another common handicapping method, the Plymouth Yardstick, and becuase there is a one design boat which has both a known PY and IRC rating we can workout the scale factor for the small boats in the fleet.

With this background it becomes easier to see what the curves represent, each is fitted through 5 points, representing a different angle of sail, beating, close reaching, beam reaching, dead reaching and running respectively.  The 5 curves then represent a True Wind Speed (TWS), in this case, 6kts, 10kts, 14kts, 18kts and 25kts.  The horizontal lines are the point at which VMG becomes important, they represent the situation where your destination is either directly into the wind, or directly with the wind, because you physically can't sail directly into the wind, you sail at an angle to it and tack every so often, so as to counteract the perpendicular distance you travel from your target.  So if your destination is 5° from the wind, we assume you are beating and therefore your boat speed will be that at your closest angle to the wind which could be 30°.  Drawing a line from your beating angle to the vertical axis gives us the VMG, which will become important later.

Lastly, if the wind speed lies between two defined curves, we take the upper and lower bound and linearly interpolate between the values, with all of this data it is possible to work out VMG and boatspeed for a given wind angle and wind speed for any boat in the fleet.

To get your boat speed you need to know the angle you are sailing to the wind, so you need to know your 'Course To Steer' (CTS) which is the heading you follow so that when tides are accounted for you'll end up at your destination.  Unfortunately to work out the CTS you need to know your boat speed, and so as you can see we have a dilemma.

We get around this by looping over the function to calculate your CTS until the change in CTS is within a defined threshold, with the initial boat speed obtained by using an angle to the wind equal to the bearing of your destination. 

Once you have the CTS and the corresponding boat speed for that CTS you can work out how long it will take to get to your destination. This is all well and good if the distance to that destination is quite short, but sometimes you will be working out the ETA for a destination that is several tens of miles away, and both the wind and tide will change from the values you originally used as you progress spatially and temporally to your destination.

To overcome this issue we can do one of 2 things; divide the trip into a defined number of segments and calculate the ETA for each segment, which still has the disadvantage of becoming more inaccurate over longer distances, or repeatedly calculate the distance traveled in a defined time interval, using new wind and tide data, until the distance between your current position and your destination is within a defined threshold.

The second method has the added advantage of allowing for the scenario where given the wind, tide and boat speed, the actual direction traveled is back to your start point.  When this occurs an assumption that one is kedged can be made, so the algorithm will add a time increment until either the wind picks up enough that you can continue against the foul tide, or the tidal stream changes to become more favorable.

And that is how you get predicted finish times that are accurate to ±5 seconds over 4 hours.

8月14日

Where have all my klocs gone...?

, ,

I’ve never thought counting the number of lines of code in a project was a terribly accurate metric. It gives no view on the quality or efficiency of code and can lead to a mentality of more is better when it most certainly isn’t. Line counts are however good for the soul if you are very small development team and can act as an indication of project size and complexity. What can be a good metric, however, is a version on version comparison of line count.

So, Regatta Manager Suite v2.0 is approximately 70,000 lines of code, 11,000 of those are Jenny’s with the Weather Maker, Race Administrator and Rounding Actuals tools. The remaining 60,000 lines making up the core assemblies and the Course Setter. I’d not actually done a line count last year but had guessed (very wrongly) that it was around 30,000 lines. That code was actually 110,000 lines of code. 65,000 of those were in the Course Setter.

Using WPF reduced the line count for the Course Setter by half. The rest of the reduction in code is accounted for by a huge amount of refactoring of the core and clients; I moved from the data application block to using ADO.NET DataSets, and cleaned up a whole host of repeated, bloated and frankly crap code written either during the early hours of the morning or under huge pressure and always with a caffeine saturated blood stream.

I’m always looking for ways to promote WPF and the rest of the .NET Framework v3.0 to other developers and here is another one. It can seriously reduce the amount of code you have to manage on your user interface.

All I have to do now is port all my thrown together XAML from Beta 2 to RC1/RTM.

Lucky me.

8月11日

It’s over!

, , ,

It’s all over (until next year?), and I am back at home in Newbury and have my email back up and running. I am still in need of a great amount of sleep which I hope I can catch up on before Monday.

Anyway, ‘what happened?’ you are all asking.  Well for starters here is a screenshot of the final application with live data showing from last week for you all to gawp at.

It looks pretty funky doesn't it, well other than the blue gel effect anyway.  As far as how it worked other than a few user errors we had a pretty faultless week, we had to put a bit more validation in to the Weather Maker so that it doesn’t allow you to put the bearing and wind speed in the wrong way around; because the boat speed calculations interpolate linearly past the maximum polar ring (25kts) putting in 110knots and 18 instead of the other way around results in about 90kts of boat speed, so whilst not stopping you doing it in future, it now asks you if you’re sure.

There were also a couple of issues with the predictions for class 0, mostly because the IRC handicap rating doesn’t allow for the type of boat and despite their size ABN Amro, Maximus and Full Pelt sail like sports boats in the right conditions, whereas the rest of the IRC 0 fleet are displacement boats.

 

The graph on the right represents the X-332 class, which is a displacement boat, (the different arcs being different wind speeds (2,4, and 6kts)) and the one on the left the J-109 class, a sportsboat, (the first arc being 6kts wind speed). As you can see there is a marked difference between the two from 90 onwards, which represents how the boats behave as they get futher away from the wind.  Sportsboats take off as they start to reach, whilst displacement boats are at their most efficient running before the wind. Now this is fine when you have two classes which each fit one of these diagrams, but when you have a class which contains both it becomes difficult to predict when the class will get home. On top of that ABN Amro has a canting keel, meaning she can sail in much higher winds with the same sail area without the corresponding increase in leeway. Amazingly however, discounting class 0 and the multihulls (again another really difficult class to predict for) we were pretty much spot on with our estimates. I haven’t checked all of the data yet, but I know we had at least 2 predictions that differed from the actuals by less than 5 seconds. Over 2 hours and 10-20 miles that ain’t half bad.

Linz has insisted that I immortalise the following story on my blog, and whilst equal parts name dropping and total embarrassment I have given in. Throughout the week we must have had 20 or so people ranging from media to friends of staff, from the Skandia Geelong week organisers to the small time Waymouth Regtta people come in and look at the Regatta Manager, sometimes I was there, others not. Needless to say by the end of the week I pretty much had the spiel down to a concise 5-10 min talk and was starting to relax whilst doing them. So much so that when a member of staff came in with what appeared to be his family I merrily went on about how wonderful it all was and everything was good. It was only after they left and Linz came over and said “You do realise that was David Gower don’t you?” that I started to feel like a prat.

Microsoft PR Event

I alluded in an earlier post to a PR event that Microsoft organised, they sent a film crew along to video the whole Regatta Manager Suite working, paying special attention to the Course Setter which makes use of the Windows Presentation Foundation aspect of the .Net Framework version 3.0. It was a fantastic 3 days actually, we had good wind, and it was the Royal Yacht Squadron’s triumvirate days and everyone went out of the way to accommodate the film crew. A special thanks to John Grandy the RYS Principle Race Officer, and to all the course setters on those days, as well as Chris Tibbs and Richard Saloman and his team for the intrusion on their time.

In terms of where and when the final product will be shown, I am not quite sure yet, but with the imminent release of Windows Vista hopefully it will feature along with that.

And Finally...

A lot of people have expressed an interest in how the Regatta Manager works, and whilst I am not about to reveal trade secrets I am planning on putting together a post explaining some of the concepts behind how we get such good predictions given the large variables we have to deal with.

8月3日

So, we are finally here...

Tomorrow evening I am driving down to Southampton to catch the 2100 Red Funnel ferry to East Cowes. Which will signal the start of the final leg of another knackering journey; it has been equal parts marriage-threatening stress and fantastic fun learning and using this exciting new technology.

I owe so much to so many people; Stuart for not lynching me when I over ran the deadline, Andrew and Ged from ngresults for their help with infrastructure, the WPF community for their quick responses, endless samples and the knowledge that I wasn’t the only one struggling, and to Tim Sneath and Barbara Jenkins at Microsoft and Michelle and Peta from CCC for organising the PR event that I’ll talk about later. Thank you all.

4月9日

What exactly am I doing?

A couple of people have asked what it is exactly that I am working on.
 
Well at the Skandia Cowes Week 2004 wrap up party my Father-in-law talked about his plan for a completely automated course setting process, something that I'd also been thinking about for a couple of years too.  It had been pie in the sky, and to be honest was, with any sort of reasonable budget, still so when we were discussing it.  To give you an idea as to why we wanted to do this I'll give a brief overview of how things work on a typical race day during Cowes Week.
 
There are over 1000 boats and over 8000 sailors, split amongst 38 classes divided into two groups based on size.  Starting at 11:00 there is a class starting every 5 mins for a minimum of 3 hours.  For each class a course has to be designed selecting from 100+ buoys; this course is based on the size of the boats in the class, the weather and tidal conditions, the time and course length preferences of the class, and avoiding any conflicts with other classes that might be sailing around the same mark at the same time, and especially making sure classes don't go around buoys in different directions. 
 
Can you imagine the chaos if 30-40 15ft day boats were going around a mark at the same time as the big boat classes which are 60ft+ is length?  Now imagine what would happen if they were going in opposite directions...
 
...Now imagine that the system for preventing this relied on 5 dog leads, a large chart of the solent and some screws to represent the buoys...
 
So I (with a great deal of help from my wife) spent evenings, weekends and holidays for 12 months writing a computerised replacement to this system, and other than a few issues in the first couple of days of Skandia Cowes Week 2005, it worked.  My proudest moment of the entire week was when I realised that the prediction algorithm my wife and I had spent a solid week of 10 hour days perfecting was consistently accurate to within 30seconds over 5+ hours of sailing...
 
...You can't do that with a bit of string ;)
 
(Jenny has just reminded me that on occasions where the weather predictions were spot on we had predictions to within a second)
4月4日

Before and After

Well,
 
I've been working on the new CourseSetter UI for the last couple of weeks, and I've actually got something I'm willing to show off!
 
The original UI was written using the Managed DirectX extensions and made extensive use of the Sample Framework for dialogs, meshes and interaction.  This made getting a good UX really hard as I had to handle the layout and drawing of all the controls I needed myself.  This was, however, a neccessary headache as the resources required to use Windows Forms at 2560x1600 were too high.  Screen real estate was an issue too, so I couldn't go with a windowed application, the intended audience being used to charts up to 2 meters wide.  So MDX it was.
 
For v2.0 there are a lot of changes to the UI, mostly brought about by a new course design concept, which concentrates on creating a set of template courses, which are applied to classes later.  Doing this was going to involve tearing out all of the existing dialogs and interaction and adding new ones; It was the realisation of this coinciding with the release of the February CTP of WinFX (and more importantly the announcement of the upcoming March CTP of Expression Interactive Designer) that prompted the ditching of MDX in favour of rebuilding the UI, from scratch, with the Windows Presentation Foundation.
 
48 Hours later and I was in a position that took me 3 months to get to last year.  The chart as a mesh was dropped in favour of a collection of filled paths (still rendered in hardware though), interaction is so much easier with WPFs new eventing model that I am making the most of.  The best thing? Well that has got to be the databinding,  I'd designed the datalayer with very simple mapping, one table one class, and CRUD stored procedures for each table whilst making use of the Data Application Block to go back and forth between the database.  I've dumped that in favour of ADO.NET and DataSets, and have created a subclassed ObserveableCollection<T> for each business object.  All this means that there is no business logic whatsoever in the UI and no massaging of data in code either, it's all done declaratively.
 
One of the other things I like are the INotifyPropertyChanged and INotifyCollectionChanged interfaces, I didn't have time to implement dirtying of collections last year, and was doing a retrieve of the entire dataset when anything changed (BAD!), so this should make the application alot more performant.
 
So with all that done I can concentrate on adding new functionality to make v2.0 more than just a makeover!
 
(As you can see from the before and after photos below there is still quite a bit to add, but that really should not take all that long to do! Oh and it may be an Apple screen, but it *IS* running on a PC, I promise!)
 
I've added a wider angle photo as now two people have asked if that is the top of a vodka bottle!!!