FAI-CIVL / FAI-Airscore

AirScore - online paragliding / hanggliding GAP-based scoring software.
https://airscore.cc/
GNU General Public License v3.0
13 stars 17 forks source link

Turnpoint tolerance GAP2016 #227

Closed philderbeast closed 3 years ago

philderbeast commented 3 years ago

I imported the *.fsdb for 2018 XC Dalmatian Paragliding Open and converted it to airScore. I expected turnpoint tolerances for GAP2016 but see the latest tolerances. Can we please retain the tolerances matching the formula or tolerances written to the XML (see below). This will help reduce manual workload when testing.

From the GAP rules, it looks like the default here should be 0.5% tolerance and 0 minimum or alternately 0.01% tolerance and 5m minimum but from looking at its source code I suspect FS defaults to 5m for the minimum whatever the tolerance.

tolerance = 0.5% | 0.01% minTolerance = 0 | 5m

Later versions of FS do write attributes for these values but no such attributes exist in this *.fsdb and in that case tolerances must be inferred from the formula name alone, from //FsScoreFormula/@id.

//FsScoreFormula/@turnpoint_radius_tolerance was added 19 May 2018 with https://github.com/FAI-CIVL/FS/commit/16de3d2953856beba3048013390541bb6e0d48c3

//FsScoreFormula/@turnpoint_radius_minimum_absolute_tolerance was added 19 Oct 2019 with https://github.com/FAI-CIVL/FS/commit/32e539f4945f56cf78d8ed9b291d49c41b33e5cb

<FsCompetition id="12859" name="2018 XC Dalmatian Paragliding Open"
  location="Hrvace, Croatia" from="2018-05-24" to="2018-05-27"
  utc_offset="2" discipline="pg" ftv_factor="0">
  <FsScoreFormula id="GAP2016" min_dist="1" nom_dist="25" nom_time="1" nom_launch="0.96"
  nom_goal="0.2" day_quality_override="0" bonus_gr="4" jump_the_gun_factor="0" jump_the_gun_max="0"
  normalize_1000_before_day_quality="0" time_points_if_not_in_goal="0" use_1000_points_for_max_day_quality="0"
  use_arrival_position_points="0" use_arrival_time_points="0" use_departure_points="0"
  use_difficulty_for_distance_points="0" use_distance_points="1" use_distance_squared_for_LC="1"
  use_leading_points="1" use_semi_circle_control_zone_for_goal_line="1" use_time_points="1"
  scoring_altitude="qnh" leading_time_ballance="0" final_glide_decelerator="none"
  no_final_glide_decelerator_reason="" min_time_span_for_valid_task="60" score_back_time="5"
  use_proportional_leading_weight_if_nobody_in_goal="1" double_leading_weight="0" qnh_setting="1013.25" />

Screen Shot 2020-12-25 at 3 51 55 PM

philderbeast commented 3 years ago

I imported again but this time didn't convert to airScore. Note the turnpoint tolerance.

Screen Shot 2020-12-26 at 6 39 13 AM

kuaka commented 3 years ago

the turnpoint tolerances from the 2 screenshots look identical to me. Perhaps that is your point?

Is this issue resolved by the closure of #228 or is it something different?

philderbeast commented 3 years ago

The turnpoint tolerances are not those of GAP2016, the version used by this comp. I first saw this with a comp converted as airScore internal. Importing again I can see the problem is there for the external comp too, prior to the conversion.

philderbeast commented 3 years ago

Is this issue resolved by the closure of #228

I pulled the latest commits including the fix for #228 but the problem persists.

kuaka commented 3 years ago

ok I will try to paraphrase the issue to see if I understand:

when importing a FSDB file that does not include turnpoint tollerance key/values, airScore is defaulting to tolerances that are different to the defaults (defined in the rules) for the formula being used.

is that the issue?

philderbeast commented 3 years ago

Can we please retain the tolerances matching the formula or tolerances written to the XML.

Digging deeper into the FS sources because the GAP rules are not as clear to me on this, it appears that before the minimum absolute tolerance could be set in FS and written as an attribute when the `*.fsdb was saved, it was hard-coded to 5m.

// minimum tolerance is 5m (a bit more than IGC file position resolution)
double tp_radius_g = (double)Math.Max(tp.Radius * (1 + this._tp_radius_error_margin), tp.Radius + 5); 
double tp_radius_s = (double)Math.Min(tp.Radius * (1 - this._tp_radius_error_margin), tp.Radius - 5);

The same code after the addition of the setting for minimum absolute tolerance as seen in later versions of FS.

// minimum tolerance is 5m (a bit more than IGC file position resolution)
double tp_radius_g = (double)Math.Max(tp.Radius * (1 + this._tp_radius_error_margin),
                            tp.Radius + this._tp_radius_min_abs_error_margin);
double tp_radius_s = (double)Math.Min(tp.Radius * (1 - this._tp_radius_error_margin),
                            tp.Radius - this._tp_radius_min_abs_error_margin);

This comp's *.fsdb has neither tolerance attribute on the FsScoreFormula element so in this case we need to infer these values from the formula. This is GAP2016 so we should have a tolerance of 0.005 and a minimum absolute of 5m.

philderbeast commented 3 years ago

when importing a FSDB file that does not include turnpoint tollerance key/values, airScore is defaulting to tolerances that are different to the defaults (defined in the rules) for the formula being used.

That's it in a nutshell.

kuaka commented 3 years ago

ok I have committed a fix. tested with the competition in question. please check and close if ok.

philderbeast commented 3 years ago

ok I have committed a fix. tested with the competition in question. please check and close if ok.

That's fixed it, thanks.