New Zealand Orienteering Rankings Explanation

The formulas used for the ranking system are based on the quality of ranked
runners who are running in a race. This ranking list will be the offical 
list of the NZOF and no doubt be used by the selectors. It will be updated 
and published regularly in the New Zealand Orienteering magazine.

Some comments:
 - Overseas World Cup events for elites have been added and will continue
   to be added if there are two New Zealanders competing.
 
 - It is possible that ANZ challenge events when in Australia could also be
   added in.

 - The time period for the rankings will be reviewed at each publishing of
   the list depending on how many major events have taken place.

 - Only major events and world cup events will be included. 
   Events like relays and events which do not carry badge status will not
   be included.
  
 - The points can be viewed as the average number of minutes you are 
   behind the top ranked runner for a classic event.

 - You have to have at least 2 ranking events (non-elites) or 4 rankings 
   events (elites) within the time period.

 - Your average ranking points must be less than the Estimated winning time
   for you to be ranked.

 - A DNF/DSQ will cause a big jump in your ranking points as you are given
   the equivalent of the estimated winning time. (eg M21E = 80)
   It is better to finish when you are having a bad race.

Rankings are calculated in a number of steps:

1. CALCULATE RANKING POINTS FOR EACH EVENT

Then when a new ranking list is generated:
2. CALCULATE AVERAGE RANKING POINTS FOR PERSON PER CLASS 
3. SET LOWEST TO ZERO 

1. CALCULATE RANKING POINTS FOR EACH EVENT

Set New Zealand Clubs List:
 nzclubs=",A,AU,C,CM,CU,D,DOC,EG,H,HB,HV,KH,LSO,M,MOC,NW,NZL,OU,P,PAPO,PP,R,RK,S,SA,SOC,T,TOPS,VD,VUW,W,WACO,WAI,WH,WHO,"

Read in Estimated Winning Times for Classic Events:
(This table also determines which classes are ranked. M12 and W12, B and C classes are not ranked)
 Ewts["M14A"]  = 35;
 Ewts["M16A"]  = 50;
 Ewts["M18A"]  = 60;
 Ewts["M20A"]  = 70;
 Ewts["M21AL"] = 70;
 Ewts["M21A"]  = 70;
 Ewts["M21E"]  = 105;
 Ewts["M35A"]  = 70;
 Ewts["M40A"]  = 65;
 Ewts["M45A"]  = 60;
 Ewts["M50A"]  = 55;
 Ewts["M55A"]  = 50;
 Ewts["M60A"]  = 45;
 Ewts["M65A"]  = 45;
 Ewts["M70A"]  = 45;
 Ewts["M75A"]  = 45;
 Ewts["M80A"]  = 45;
 Ewts["M85A"]  = 45;
 Ewts["W14A"]  = 35;
 Ewts["W16A"]  = 45;
 Ewts["W18A"]  = 55;
 Ewts["W20A"]  = 60;
 Ewts["W21AL"] = 60;
 Ewts["W21A"]  = 60;
 Ewts["W21E"]  = 75;
 Ewts["W35A"]  = 60;
 Ewts["W40A"]  = 60;
 Ewts["W45A"]  = 55;
 Ewts["W50A"]  = 50;
 Ewts["W55A"]  = 45;
 Ewts["W60A"]  = 40;
 Ewts["W65A"]  = 40;
 Ewts["W70A"]  = 40;
 Ewts["W75A"]  = 40;
 Ewts["W80A"]  = 40;
 Ewts["W85A"]  = 40;

Read average rankings points file and find all ranked runners in a class.

If class = M21A set class to M21AL
If class = W21A set class to W21AL

Process A classes only 

Read each record in event and store in array for processing.

Process each class and print the rankings for each class.

Each class is processed in the following way:

Find the 3 lowest ranked runners (rank1, rank2, rank3) running in this event 
for each class where each person in a class is checked against the average 
ranking points file.
The time must be a valid time and the club field for each person must be a 
New Zealand club.
Set Time1, Time2, Time3 to be the finishing times (in seconds) for the first 3 
finishers.

         if 3 ranked runners running then 
           Pm = (rank1 + rank2 + rank3)/3
           Tmsecs = (time1 + time2 + time3)/3
         else if only 2 ranked runners then
           Pm = (rank1 + rank2)/2;
           Tmsecs = (time1 + time2)/2
         else if only 1 ranked runner then
           Pm = rank1
           Tmsecs = time1
         else 
          SET TOTALLY ARBITRARY FACTOR 0.7 OF EWT TO GET PEOPLE REGISTERING ON
          RANKING SYSTEM WHEN NO RANKING PEOPLE RUNNING.
          This is a bit of a fiddle for New Zealand conditions where there are
          not enough people running, there is not enough crossover of runners
          between North and South Islands and every year a lot of younger
          runners move up a class. I'm not totally happy with it.
           Pm = Ewts[class]*0.7

         Set Points system to be equivalent to digital minutes so that points
         can be viewed as approximately on average the number of minutes you 
         are behind the top ranked person:

         Tm = Tmsecs/60; 

There has to be at least one finisher in each class.

Get estimated winning time for each class:

 Ewt = Ewts[class]

If there is no estimated winning time for class then class is ignored. 
(eg M12, W12, B and C classes ignored for rankings) 

Now the nice stuff:

 Kk = (Ewt + Pm)/Tm;

 Tb = Tm - (Pm/Kk);

 for every competitor in class {
  if person's club is a New Zealand Club then 
    if DNF or DSQ then (Set points to estimated winning time)
      points = Ewt; 
    else {
     Set yourtime to be finishing time in seconds.
     
     points=(yourtime-Tb)*Kk; 
    }
 }
These points are then appended to the ranking points file.

2. CALCULATE AVERAGE RANKING POINTS FOR PERSON PER CLASS

From the file of ranking points, create a file of average ranking points for
each person per class. There has to be at least 2 (non-elites) or 4 (elites) 
or more ranked events for a person in each class before an average is 
calculated.

Search ranking points file for all ranking points that are within a certain
time period.

Set Number of counting events to be equal to 2 (non-elites) or 4 (elites);

If the average ranking points for a person is greater than the estimated 
winning time, then set the ranking points to the estimated winning time.

3. SET LOWEST TO ZERO 

From the file of average ranking points, find the lowest ranking point for 
each class. This may be negative. Subtract this value from all ranking 
points for the class. This will mean that the highest ranked person in a 
class will have a ranking of 0.
  
   ranking points = ranking points - lowest ranking points for class

Ranking points are then sorted on class and descending points.