Airport vehicles and ground stations must behave as such

A feed's ZVEH type held for any contact, so a test transponder at 77 m/s
drew as a car driving at airliner speed and a drone at 762 m as a car in
the air; a GRND station reporting 11,880 m drew as a mast in the sky.
ZVEH now holds only for a contact reported on the ground (or with no
altitude) at up to 40 m/s; anything else is classed as an aircraft. A
GRND station stands on the ground whatever height it reports.
This commit is contained in:
Sameh Khamis committed 2026-11-17 19:13:04 -08:00
1 parent 783d45c148
commit d9b187bf9a
3 files changed
+55 -8

No files matched your search

+19 -2
View File
@@ -92,11 +92,11 @@ export class FlightRecords {
originCountry: origin_country,
longitude: lon,
latitude: lat,
baroAltitudeM: baro_alt,
baroAltitudeM: reportedBaroAlt,
onGround: on_ground,
speedMps: velocity,
courseDeg: true_track,
ellipsoidAltitudeM: geo_alt,
ellipsoidAltitudeM: reportedGeoAlt,
category,
verticalRateMps: vertical_rate,
} = observation;
@@ -126,15 +126,30 @@ export class FlightRecords {
const feedType = cleanType(observation.typeCode);
// A surface category keeps only a feed's ground type: a C1 contact whose
// feed names an airliner type stays a vehicle.
// A feed's ground type holds only for a contact that behaves as one: an
// airport vehicle reported airborne, or faster than a vehicle drives (a
// test transponder, a drone), is classed as any other aircraft.
const driving =
!(Number.isFinite(velocity) && velocity > VEHICLE_MAX_SPEED_MPS) &&
(on_ground === true ||
(!Number.isFinite(reportedBaroAlt) &&
!Number.isFinite(reportedGeoAlt)));
const keepFeedType =
Boolean(feedType) &&
(feedType !== 'ZVEH' || driving) &&
(!groundCategory(category) || GROUND_FEED_TYPES.has(feedType));
// A ground station is fixed: it stands on the ground whatever height its
// reports carry, as if they carried none.
const station = keepFeedType && feedType === 'GRND';
const baro_alt = station ? null : reportedBaroAlt;
const geo_alt = station ? null : reportedGeoAlt;
const typeLookedUp = airframe?.typeLookedUp === true;
const typeCode = typeLookedUp
? airframe.typeCode
: ((keepFeedType ? feedType : null) ?? airframe?.typeCode ?? null);
const onGround =
on_ground === true ||
station ||
(!Number.isFinite(baro_alt) &&
!Number.isFinite(geo_alt) &&
groundModel(typeCode));
@@ -485,6 +500,8 @@ function cleanType(value) {
/** The types a feed gives airport vehicles (ZVEH) and ground stations (GRND). */
const GROUND_FEED_TYPES = new Set(['ZVEH', 'GRND']);
/** The fastest an airport vehicle drives, m/s (144 km/h); faster, it is no vehicle. */
const VEHICLE_MAX_SPEED_MPS = 40;
/** Per loaded fleet model set: whether a type, category and callsign rule draw a ground model. */
const groundModelCaches = new WeakMap();
+35 -5
View File
@@ -283,6 +283,7 @@ test('a ground vehicle or station with no altitude stands on the ground; an airc
observation({
id: 'v1',
typeCode: 'ZVEH',
speedMps: 8,
callsign: 'FIRE 2',
...noAltitude,
}),
@@ -306,17 +307,44 @@ test('a ground vehicle or station with no altitude stands on the ground; an airc
assert.equal(plane.onGround, false);
assert.equal(plane.altitude, 10000);
assert.equal(plane.typeCode, 'A320');
// A vehicle reporting an altitude is placed by it.
// An "airport vehicle" reported airborne is no vehicle (a drone, a test
// transponder): it is placed by its altitude and classed as an aircraft.
const reported = store.receive(
observation({ id: 'v2', typeCode: 'ZVEH', baroAltitudeM: 12 }),
observation({ id: 'v2', typeCode: 'ZVEH', baroAltitudeM: 762 }),
view(),
).meta;
assert.equal(reported.onGround, false);
assert.equal(reported.typeCode, null);
assert.notEqual(reported.klass, 'vehicle');
// Nor is one on the ground faster than a vehicle drives.
const fast = store.receive(
observation({
id: 'v4',
typeCode: 'ZVEH',
onGround: true,
speedMps: 77,
...noAltitude,
}),
view(),
).meta;
assert.notEqual(fast.klass, 'vehicle');
// A ground station stands on the ground whatever height it reports.
const high = store.receive(
observation({ id: 'm2', typeCode: 'GRND', baroAltitudeM: 11880 }),
view(),
).meta;
assert.equal(high.onGround, true);
assert.equal(high.klass, 'station');
assert.equal(high.altitude, 0);
assert.ok(
!(high.renderAltitudeM > 1000),
`drawn at ${high.renderAltitudeM} m`,
);
// Before the model set loads, the feed's ground types already count: an
// airport vehicle is never drawn as an aircraft first.
const early = records();
const unloaded = early.receive(
observation({ id: 'v3', typeCode: 'ZVEH', ...noAltitude }),
observation({ id: 'v3', typeCode: 'ZVEH', speedMps: 8, ...noAltitude }),
view(),
).meta;
assert.equal(unloaded.onGround, true);
@@ -335,9 +363,11 @@ test('airport vehicles and ground stations take their class from the first fix',
const klass = (fields) =>
store.receive(observation({ callsign: '', ...fields }), view()).meta
.klass;
assert.equal(klass({ id: 'v1', typeCode: 'ZVEH' }), 'vehicle');
// An airport vehicle reports itself on the ground, at a vehicle's speed.
const driving = { onGround: true, speedMps: 8 };
assert.equal(klass({ id: 'v1', typeCode: 'ZVEH', ...driving }), 'vehicle');
assert.equal(
klass({ id: 'v2', typeCode: 'ZVEH', callsign: 'FIRE 2' }),
klass({ id: 'v2', typeCode: 'ZVEH', callsign: 'FIRE 2', ...driving }),
'vehicle',
);
assert.equal(klass({ id: 'v3', category: 'C1' }), 'vehicle');