improve BDS 50 and 60 inference
This commit is contained in:
parent
1f15a953e3
commit
93fc536926
@ -60,25 +60,34 @@ def is50or60(msg, spd_ref, trk_ref, alt_ref):
|
|||||||
vy = v * np.cos(np.radians(angle))
|
vy = v * np.cos(np.radians(angle))
|
||||||
return vx, vy
|
return vx, vy
|
||||||
|
|
||||||
|
# message must be both BDS 50 and 60 before processing
|
||||||
if not (bds50.is50(msg) and bds60.is60(msg)):
|
if not (bds50.is50(msg) and bds60.is60(msg)):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
h50 = bds50.trk50(msg)
|
# --- assuming BDS60 ---
|
||||||
v50 = bds50.gs50(msg)
|
|
||||||
|
|
||||||
if h50 is None or v50 is None:
|
|
||||||
return "BDS50,BDS60"
|
|
||||||
|
|
||||||
h60 = bds60.hdg60(msg)
|
h60 = bds60.hdg60(msg)
|
||||||
m60 = bds60.mach60(msg)
|
m60 = bds60.mach60(msg)
|
||||||
i60 = bds60.ias60(msg)
|
i60 = bds60.ias60(msg)
|
||||||
|
|
||||||
|
# additional check now knowing the altitude
|
||||||
|
if (m60 is not None) and (i60 is not None):
|
||||||
|
ias_ = aero.mach2cas(m60, alt_ref * aero.ft) / aero.kts
|
||||||
|
if abs(i60 - ias_) > 20:
|
||||||
|
return "BDS50"
|
||||||
|
|
||||||
if h60 is None or (m60 is None and i60 is None):
|
if h60 is None or (m60 is None and i60 is None):
|
||||||
return "BDS50,BDS60"
|
return "BDS50,BDS60"
|
||||||
|
|
||||||
m60 = np.nan if m60 is None else m60
|
m60 = np.nan if m60 is None else m60
|
||||||
i60 = np.nan if i60 is None else i60
|
i60 = np.nan if i60 is None else i60
|
||||||
|
|
||||||
|
# --- assuming BDS50 ---
|
||||||
|
h50 = bds50.trk50(msg)
|
||||||
|
v50 = bds50.gs50(msg)
|
||||||
|
|
||||||
|
if h50 is None or v50 is None:
|
||||||
|
return "BDS50,BDS60"
|
||||||
|
|
||||||
XY5 = vxy(v50 * aero.kts, h50)
|
XY5 = vxy(v50 * aero.kts, h50)
|
||||||
XY6m = vxy(aero.mach2tas(m60, alt_ref * aero.ft), h60)
|
XY6m = vxy(aero.mach2tas(m60, alt_ref * aero.ft), h60)
|
||||||
XY6i = vxy(aero.cas2tas(i60 * aero.kts, alt_ref * aero.ft), h60)
|
XY6i = vxy(aero.cas2tas(i60 * aero.kts, alt_ref * aero.ft), h60)
|
||||||
@ -98,6 +107,7 @@ def is50or60(msg, spd_ref, trk_ref, alt_ref):
|
|||||||
try:
|
try:
|
||||||
dist = np.linalg.norm(X - Mu, axis=1)
|
dist = np.linalg.norm(X - Mu, axis=1)
|
||||||
BDS = allbds[np.nanargmin(dist)]
|
BDS = allbds[np.nanargmin(dist)]
|
||||||
|
print(dist, BDS)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return "BDS50,BDS60"
|
return "BDS50,BDS60"
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ def is50(msg):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
roll = roll50(msg)
|
roll = roll50(msg)
|
||||||
if (roll is not None) and abs(roll) > 60:
|
if (roll is not None) and abs(roll) > 50:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
gs = gs50(msg)
|
gs = gs50(msg)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
|
|
||||||
from pyModeS import common
|
from pyModeS import common
|
||||||
|
from pyModeS.extra import aero
|
||||||
|
|
||||||
|
|
||||||
def is60(msg):
|
def is60(msg):
|
||||||
@ -54,6 +55,13 @@ def is60(msg):
|
|||||||
if vr_ins is not None and abs(vr_ins) > 6000:
|
if vr_ins is not None and abs(vr_ins) > 6000:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# additional check knowing altitude
|
||||||
|
if (mach is not None) and (ias is not None) and (common.df(msg) == 20):
|
||||||
|
alt = common.altcode(msg)
|
||||||
|
ias_ = aero.mach2cas(mach, alt * aero.ft) / aero.kts
|
||||||
|
if abs(ias - ias_) > 20:
|
||||||
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ def bds_info(BDS, m):
|
|||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
info = None
|
info = []
|
||||||
|
|
||||||
return info
|
return info
|
||||||
|
|
||||||
@ -87,5 +87,5 @@ def commb_decode_all(df, n=None):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
commb_decode_all(df=20, n=100)
|
commb_decode_all(df=20, n=500)
|
||||||
commb_decode_all(df=21, n=100)
|
commb_decode_all(df=21, n=500)
|
||||||
|
@ -17,8 +17,8 @@ def test_bds_infer():
|
|||||||
|
|
||||||
def test_bds_is50or60():
|
def test_bds_is50or60():
|
||||||
assert bds.is50or60("A0001838201584F23468207CDFA5", 0, 0, 0) == None
|
assert bds.is50or60("A0001838201584F23468207CDFA5", 0, 0, 0) == None
|
||||||
assert bds.is50or60("A0000000FFDA9517000464000000", 182, 237, 1250) == "BDS50"
|
assert bds.is50or60("A8001EBCFFFB23286004A73F6A5B", 320, 250, 14000) == "BDS50"
|
||||||
assert bds.is50or60("A0000000919A5927E23444000000", 413, 54, 18700) == "BDS60"
|
assert bds.is50or60("A8001EBCFE1B29287FDCA807BCFC", 320, 250, 14000) == "BDS50"
|
||||||
|
|
||||||
|
|
||||||
def test_surface_position():
|
def test_surface_position():
|
||||||
|
Loading…
Reference in New Issue
Block a user