Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
direction_filter,
get_mock_uss_interactions,
)
from monitoring.uss_qualifier.scenarios.scenario import GenericTestScenario
from monitoring.uss_qualifier.scenarios.scenario import (
DISTANCE_ERROR_TOLERANCE_FRACTION,
GenericTestScenario,
)
from monitoring.uss_qualifier.suites.suite import ExecutionContext


Expand Down Expand Up @@ -81,28 +84,21 @@ def __init__(
Angle.from_degrees(1 * degree_per_km)
)

limit_side_km = self._rid_version.max_diagonal_km / math.sqrt(2)
limit_diagonal_length_ok = self._rid_version.max_diagonal_km * (
1 - DISTANCE_ERROR_TOLERANCE_FRACTION
)

limit_side_km = limit_diagonal_length_ok / math.sqrt(2)
self._limit_rect = LatLngRect.from_point(isa_center).convolve_with_cap(
Angle.from_degrees(limit_side_km * degree_per_km / 2)
)
# Make sure the limit_rect is close to the allowed diagonal limit
assert (
self._rid_version.max_diagonal_km * 0.99
< geo.get_latlngrect_diagonal_km(self._limit_rect)
<= self._rid_version.max_diagonal_km
), (
f"{geo.get_latlngrect_diagonal_km(self._limit_rect)} > {self._rid_version.max_diagonal_km}"

limit_diagonal_length_fail = self._rid_version.max_diagonal_km * (
1 + DISTANCE_ERROR_TOLERANCE_FRACTION
)

# Make the too big rect 1% larger than the allowed diagonal limit
self._too_big_rect = LatLngRect.from_point(isa_center).convolve_with_cap(
Angle.from_degrees(limit_side_km * 1.01 * degree_per_km / 2)
)
assert (
geo.get_latlngrect_diagonal_km(self._too_big_rect)
> self._rid_version.max_diagonal_km
), (
f"{geo.get_latlngrect_diagonal_km(self._too_big_rect)} <= {self._rid_version.max_diagonal_km}"
Angle.from_degrees(limit_diagonal_length_fail * degree_per_km / 2)
)

@property
Expand Down
6 changes: 6 additions & 0 deletions monitoring/uss_qualifier/scenarios/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
QueryType.F3411v22aUSSGetFlightDetails,
]

# Different spherical models have different precisions: implementations may use a different model
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it's not different spherical models, it's just different models for the shape of the Earth. Specifically, the more-accurate ellipsoidal model can be off from our less-accurate spherical model by a little under 0.7%.

# than uss_qualifier. We thus accept an error margin of 0.7% around distance limits and thresholds
# to avoid failing USSes for minor differences in precision whenever the relevant standard is not
# prescriptive in that regard.
DISTANCE_ERROR_TOLERANCE_FRACTION = 0.007


class ScenarioCannotContinueError(Exception):
def __init__(self, msg):
Expand Down
Loading