Skip to content

Commit

Permalink
Improved docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Jan 29, 2024
1 parent 728f807 commit 5624fde
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
15 changes: 10 additions & 5 deletions methodology.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ Source code is available at [src/icao_to_trace.rs](./src/icao_to_trace.rs).
This is performed automatically by the computer program. A leg is defined in this methodology
has a continuous sequence of ADS-B positions in time where the aircraft is flying.

The aircraft at a given segment between two ADS-B positions is considered grounded (not flying) when either:
* both positions are on the ground
* the time between these positions is > 5m and the aircraft is below 10.000 feet
The aircraft at a given segment between two ADS-B positions is considered grounded (not flying) when any of:
1. both positions are on the ground
2. the time between these positions is > 5m and any of the positions is below 10.000 feet
3. the time between these positions is > 10h

The latter condition is used to mitigate the risk that ADS-B receivers sometimes
Condition 1. is the normal case where ADS-B signal was received when the aircraft landed.
Condition 2. is used to mitigate the risk that ADS-B receivers sometimes
do not receive an aircraft's signal when the aircraft is at low altitude.
When this happens for more than 5m, we consider that the aircraft approached and landed.
Condition 3. is used to mitigate situations where the aircraft enters regions
of low ADS-B coverage (e.g. central Africa) while flying and then returns flying
(sometimes days later), which should be intepreted as the aircraft being flying for the whole
time.

Source code is available at [src/legs.rs](./src/legs.rs).

Expand Down
1 change: 1 addition & 0 deletions src/legs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ fn grounded_heuristic(prev_position: &Position, position: &Position) -> bool {
(&prev_position, &position),
(Position::Flying { .. }, Position::Flying { .. })
| (Position::Flying { .. }, Position::Grounded { .. })
| (Position::Grounded { .. }, Position::Flying { .. })
);
let lost_close_to_ground = position.datetime() - prev_position.datetime()
> time::Duration::minutes(5)
Expand Down
15 changes: 6 additions & 9 deletions tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,14 @@ async fn legs(
.collect::<Vec<_>>();
positions.sort_unstable_by_key(|p| p.datetime());

log::info!("Computing legs {}", icao_number);
let legs = flights::legs(positions.into_iter());

// filter by location
Ok(legs)
Ok(flights::legs(positions.into_iter()))
}

/// Verifies that condition 2. of `M-4` is correctly applied.
/// https://globe.adsbexchange.com/?icao=458d90&lat=53.265&lon=8.038&zoom=6.5&showTrace=2023-07-21
#[tokio::test]
async fn multi_day_legs() -> Result<(), Box<dyn Error>> {
async fn ads_b_lost_on_ground() -> Result<(), Box<dyn Error>> {
let legs = legs(date!(2023 - 07 - 21), date!(2023 - 07 - 23), "458d90", None).await?;

// same as ads-b computes: https://globe.adsbexchange.com/?icao=458d90&lat=53.265&lon=8.038&zoom=6.5&showTrace=2023-07-21
assert_eq!(legs.len(), 6);
Ok(())
}
Expand All @@ -93,7 +89,8 @@ async fn case_459257_2023_12_17() -> Result<(), Box<dyn Error>> {
Ok(())
}

/// Case of losing signal for 2 days mid flight.
/// Verifies that condition 3. of `M-4` is correctly applied.
/// Case of losing signal for 2 days mid flight while traveling to central Africa.
/// https://globe.adsbexchange.com/?icao=45dd84&lat=9.613&lon=22.035&zoom=3.8&showTrace=2023-12-08
#[tokio::test]
async fn case_45dd84_2023_12_06() -> Result<(), Box<dyn Error>> {
Expand Down

0 comments on commit 5624fde

Please sign in to comment.