## 2013-01-02

### DTF calculation problems near the polar area

As I shortly mentioned in my previous post, the DTF calculation can be weird if there are mark roundings near the polar area. I'll try here to explain how the calculation happens and why it fails near the poles.

For this explanation I must admit I have not tested it manually with the server code so I am not sure that everything is 100% correct. This is more like explanation of the way what I believe happens. There are other experienced SOL'ers who have also tried to explain this in the race chats and you are welcome to correct me in any detail I might have got wrong.

#### DTF calculation when rounding marks

As I explained in my previous post, SOL considers a mark rounded when you cross the line which represents half of the outer angle the mark makes to the route. If we again use the same example of approaching the mark from west and turning north the line would be SE of the mark (135 degrees).

How DTF calculation is affected by this theoretical "rounding line" then. Sometimes in sailing the best route around the mark doesn't go the near it which is the shortest path but boats can choose to round them "wide". SOL tries to anticipate this by calculating what is the boats shortest path to round the mark (cross the rounding detection line) and the shortest path from the rounding point to the next mark.

If the example we have is not near polar area or the distances are short, the boat's DTF is calculated via the mark until the bearing from the boat to the mark is 45 degrees (90 degrees to the rounding line). Only if the boat continues more southeast than that, then the anticipated rounding point comes into play and is used in the calculation. Usually this means that the weather pattern near the mark is such that wide rounding is better or the boat is wide for some reason and the route boat is going to sail can be pretty near the path used for DTF calculation.

#### How this changes near the polar area

If we now think of the rounding line in Cape Horn, the rounding line starts from the mark and continues roughly in the direction 145 degrees SE ending to the South Pole. If you wonder how it ends to the Pole think of a vessel which starts from Cape Horn and continues to the compass course 145. If we ignore the problem of it running into ice or Antarctica it will end up as south as possible which is the South Pole.

So, when the boats are at southern Pacific the DTF calculation tries to find the place where each one is nearest to the rounding line. One end of the line is at Cape Horn and the other is at South Pole. So, when the boats are still really far away from Cape Horn there can easily be a situation where a boat is nearer the pole than the next mark. So the path the DTF calculation uses is first from the boat's position to pole and then from there to the mark after Cape Horn (which is finish in case of Global Challenge leg 3).

As the boat's distance to the South Pole depends how far south it is, in effect this means that before the boats are near Cape Horn (and here near means more than 1000 miles) their DTF is calculated via South Pole and the DTF's the game displays have no real meaning. Partly because of this I have added the distance to next mark as one of the parameters my sollog site displays.

In reality SOL race engine tries to anticipate this problem a bit and the rounding line is limited not to go as far as the poles. The actual point SOL uses in the case of GC Leg 5 is at 83 degrees south and 34 west.

#### Possibility to fix the problems

The method SOL uses has it's obvious problems in the polar area as described above. Also other situation where it doesn't work very well is when the angle of the turn to the next mark is not very big, especially if the two marks are very near each others.

However, the method also has it's benefits. By anticipating the rounding point there very rarely are abrupt changes in the boat's DTF when rounding a mark. The algorithm is also relatively simple for the computer to calculate.

The DTF calculation with it's problems is one of continuing subjects in SOL. Many different improvements have been suggested and some of them can perhaps be taken into use in the future.

However, one essential thing has to be remembered when thinking this calculation. The server runs the DTF calculation after each "hop" (as described in last post) of the boat. This means that this code is run every 15 seconds for each boat racing so too complicated DTF calculation has the danger of slowing the server down.