public double[] getSIC_SAC(string[] paquete) { Metodos Met = new Metodos(); int longitud = Met.Longitud_Paquete(paquete); string[] paquete0 = new string[longitud]; for (int i = 0; i < longitud; i++) { paquete0[i] = Met.Poner_Zeros_Delante(paquete[i]); string bitscat = Convert.ToString(Convert.ToInt32(paquete0[0], 16), 2); double CAT = Convert.ToInt32(bitscat, 2); if (CAT != 21) { i = i + 1; } } List <string> FSPEC = new List <string>(Met.FSPEC(paquete0)); // Posicion del vector paquete0 donde empieza la info despues del FSPEC int contador = Convert.ToInt32(FSPEC[FSPEC.Count - 1]) + 1; FSPEC.RemoveAt(FSPEC.Count - 1); double[] SIC_SAC = new double[2]; if (FSPEC[0] == "1") { // Item I021/010 : Data Source Identification string SAC_Bin = Met.Octeto_A_Bin(paquete0[contador]); string SIC_Bin = Met.Octeto_A_Bin(paquete0[contador + 1]); double SAC = (Convert.ToInt32(SAC_Bin, 2)); double SIC = (Convert.ToInt32(SIC_Bin, 2)); //decodificamos , solo utilizaremos estos dos SIC_SAC[0] = SIC; SIC_SAC[1] = SAC; } return(SIC_SAC); }
public void Decode10(string[] paquete) { Metodos M = new Metodos(); int longitud = M.Longitud_Paquete(paquete); string[] paquete0 = new string[longitud]; for (int i = 0; i < longitud; i++) { paquete0[i] = M.Poner_Zeros_Delante(paquete[i]); string bitscat = Convert.ToString(Convert.ToInt32(paquete0[0], 16), 2); double CAT = Convert.ToInt32(bitscat, 2); if (CAT != 10) { i = i + 1; } } List <string> FSPEC = new List <string>(M.FSPEC(paquete0)); // Posicion del vector paquete0 donde empieza la info despues del FSPEC int contador = Convert.ToInt32(FSPEC[FSPEC.Count - 1]) + 1; FSPEC.RemoveAt(FSPEC.Count - 1); if (FSPEC[0] == "1") { // Item I010/010: Data source ID string SAC_Bin = M.Octeto_A_Bin(paquete0[contador]); string SIC_Bin = M.Octeto_A_Bin(paquete0[contador + 1]); double SAC = Convert.ToInt32(SAC_Bin, 2); double SIC = Convert.ToInt32(SIC_Bin, 2); Data_Source_ID[0] = Convert.ToInt32(SIC); Data_Source_ID[1] = Convert.ToInt32(SAC); contador += 2; } if (FSPEC[1] == "1") { // Item I010/000: Message Type string MessType_Bin = M.Octeto_A_Bin(paquete0[contador]); Int32 MessType = Convert.ToInt32(MessType_Bin, 2); if (MessType == 1) { Message_Type = "Target Report"; } if (MessType == 2) { Message_Type = "Start of Update Cycle"; } if (MessType == 3) { Message_Type = "Periodic Status Message"; } if (MessType == 4) { Message_Type = "Event-triggered Status Message"; } contador += 1; } if (FSPEC[2] == "1") { // Item I010/020: Target Report Descriptor string TargetReport_Bin = M.Octeto_A_Bin(paquete0[contador]); char[] Target_Bits = TargetReport_Bin.ToCharArray(); string TYP_Bin = Target_Bits[0].ToString() + Target_Bits[1].ToString() + Target_Bits[2].ToString(); Int32 TYP = Convert.ToInt32(TYP_Bin, 2); // TYP if (TYP == 0) { Target_Rep_Descript[0] = "SSR Multilateration"; } if (TYP == 1) { Target_Rep_Descript[0] = "Mode S Multilateration"; } if (TYP == 2) { Target_Rep_Descript[0] = "ADS-B"; } if (TYP == 3) { Target_Rep_Descript[0] = "PSR"; } if (TYP == 4) { Target_Rep_Descript[0] = "Magnetic Loop System"; } if (TYP == 5) { Target_Rep_Descript[0] = "HF Multilateration"; } if (TYP == 6) { Target_Rep_Descript[0] = "Not defined"; } if (TYP == 7) { Target_Rep_Descript[0] = "Other types"; } //DCR if (Target_Bits[3].ToString() == "1") { Target_Rep_Descript[1] = "Differential Correction (ADS-B)"; } if (Target_Bits[3].ToString() == "0") { Target_Rep_Descript[1] = "No Differential Correction (ADS-B)"; } //CHN if (Target_Bits[4].ToString() == "1") { Target_Rep_Descript[2] = "Chain 2"; } if (Target_Bits[4].ToString() == "0") { Target_Rep_Descript[2] = "Chain 1"; } //GBS if (Target_Bits[5].ToString() == "1") { Target_Rep_Descript[3] = "Transponder Ground bit set"; } if (Target_Bits[5].ToString() == "0") { Target_Rep_Descript[3] = "Transponder Ground bit not set"; } //CRT if (Target_Bits[6].ToString() == "1") { Target_Rep_Descript[4] = "Corrupted reply in multilateration"; } if (Target_Bits[6].ToString() == "0") { Target_Rep_Descript[4] = "No Corrupted replies in multilateration"; } if (Target_Bits[7].ToString() == "1") { contador += 1; // First extent string TargetReport_Bin1 = M.Octeto_A_Bin(paquete0[contador]); char[] Target_Bits1 = TargetReport_Bin1.ToCharArray(); //SIM if (Target_Bits1[0].ToString() == "1") { Target_Rep_Descript[5] = "Simulated Target Report"; } if (Target_Bits1[0].ToString() == "0") { Target_Rep_Descript[5] = "Actual Target Report"; } //TST if (Target_Bits1[1].ToString() == "1") { Target_Rep_Descript[6] = "Test Target"; } if (Target_Bits1[1].ToString() == "0") { Target_Rep_Descript[6] = "Default"; } //RAB if (Target_Bits1[2].ToString() == "1") { Target_Rep_Descript[7] = "Report from field monitor(fixed transponder)"; } if (Target_Bits1[2].ToString() == "0") { Target_Rep_Descript[7] = "Report from target transponder"; } string LOP_Bin = Target_Bits1[3].ToString() + Target_Bits1[4].ToString(); Int32 LOP = Convert.ToInt32(LOP_Bin, 2); //LOP if (LOP == 0) { Target_Rep_Descript[8] = "Undetermined"; } if (LOP == 1) { Target_Rep_Descript[8] = "Loop Start"; } if (LOP == 2) { Target_Rep_Descript[8] = "Loop Finish"; } string TOT_Bin = Target_Bits1[5].ToString() + Target_Bits1[6].ToString(); Int32 TOT = Convert.ToInt32(TOT_Bin, 2); //TOT if (TOT == 0) { Target_Rep_Descript[9] = "Undetermined"; } if (TOT == 1) { Target_Rep_Descript[9] = "Aircraft"; } if (TOT == 2) { Target_Rep_Descript[9] = "Ground Vehicle"; } if (TOT == 3) { Target_Rep_Descript[9] = "Helicopter"; } if (Target_Bits1[7].ToString() == "1") { contador += 1; // Second Extent string TargetReport_Bin2 = M.Octeto_A_Bin(paquete0[contador]); char[] Target_Bits2 = TargetReport_Bin2.ToCharArray(); //SPI if (Target_Bits2[0].ToString() == "1") { Target_Rep_Descript[10] = "Special Position Identification"; } if (Target_Bits2[0].ToString() == "0") { Target_Rep_Descript[10] = "Abcense of SPI"; } // los siguientes 6 bits deberian ser 0s string Spare_Bin = Target_Bits2[1].ToString() + Target_Bits2[2].ToString() + Target_Bits2[3].ToString() + Target_Bits2[4].ToString() + Target_Bits2[5].ToString() + Target_Bits2[6].ToString(); Int32 Spare = Convert.ToInt32(Spare_Bin, 2); } if (Target_Bits1[7].ToString() == "0") { contador += 1; } } if (Target_Bits[7].ToString() == "0") { contador += 1; } } if (FSPEC[3] == "1") { // Item I010/140: Time of Day string ToD1 = M.Octeto_A_Bin(paquete0[contador]); string ToD2 = M.Octeto_A_Bin(paquete0[contador + 1]); string ToD3 = M.Octeto_A_Bin(paquete0[contador + 2]); string ToD = ToD1 + ToD2 + ToD3; Time_Day = Convert.ToInt32(ToD, 2) / 128.0; contador += 3; } if (FSPEC[4] == "1") { // Item I010/041: Position WGS-84 string position1 = M.Octeto_A_Bin(paquete0[contador]); string position2 = M.Octeto_A_Bin(paquete0[contador + 1]); string position3 = M.Octeto_A_Bin(paquete0[contador + 2]); string position4 = M.Octeto_A_Bin(paquete0[contador + 3]); string position5 = M.Octeto_A_Bin(paquete0[contador + 4]); string position6 = M.Octeto_A_Bin(paquete0[contador + 5]); string position7 = M.Octeto_A_Bin(paquete0[contador + 6]); string position8 = M.Octeto_A_Bin(paquete0[contador + 7]); string lat_bin = position1 + position2 + position3 + position4; string lon_bin = position5 + position6 + position7 + position8; Pos_WGS84[0] = Math.Round(M.ComplementoA2(lat_bin) * (180 / Math.Pow(2, 31)), 5); Pos_WGS84[1] = Math.Round(M.ComplementoA2(lon_bin) * (180 / Math.Pow(2, 31)), 5); contador += 8; } if (FSPEC[5] == "1") { // Item I010/040: Position Polar string PolarR1 = M.Octeto_A_Bin(paquete0[contador]); string PolarR2 = M.Octeto_A_Bin(paquete0[contador + 1]); string PolarT1 = M.Octeto_A_Bin(paquete0[contador + 2]); string PolarT2 = M.Octeto_A_Bin(paquete0[contador + 3]); string PolarR = PolarR1 + PolarR2; string PolarT = PolarT1 + PolarT2; Pos_PolarCoord[0] = Convert.ToInt32(PolarR, 2); Pos_PolarCoord[1] = Math.Round(Convert.ToInt32(PolarT, 2) * (360.0 / Math.Pow(2, 16)), 5); contador += 4; } if (FSPEC[6] == "1") { // Item I010/042: Position Cartesian string Cartx1 = M.Octeto_A_Bin(paquete0[contador]); string Cartx2 = M.Octeto_A_Bin(paquete0[contador + 1]); string Carty1 = M.Octeto_A_Bin(paquete0[contador + 2]); string Carty2 = M.Octeto_A_Bin(paquete0[contador + 3]); string CartX = Cartx1 + Cartx2; string CartY = Carty1 + Carty2; Pos_Cartesian[0] = Convert.ToInt32(M.ComplementoA2(CartX)); Pos_Cartesian[1] = Convert.ToInt32(M.ComplementoA2(CartY)); contador += 4; } if (FSPEC.Count > 7) { if (FSPEC[7] == "1") { // Item I010/200: Track Velocity Polar string polar_vel1 = M.Octeto_A_Bin(paquete0[contador]); string polar_vel2 = M.Octeto_A_Bin(paquete0[contador + 1]); string polar_vel3 = M.Octeto_A_Bin(paquete0[contador + 2]); string polar_vel4 = M.Octeto_A_Bin(paquete0[contador + 3]); string track_gs = polar_vel1 + polar_vel2; string track_ta = polar_vel3 + polar_vel4; Track_Vel_Cartesian[0] = Convert.ToInt32(track_gs, 2) * Math.Pow(2, -14); Track_Vel_Cartesian[1] = Convert.ToInt32(track_ta, 2) * (360.0 / Math.Pow(2, 16)); contador += 4; } if (FSPEC[8] == "1") { // Item I010/202: Track Velocity Cartesian string track_vel1 = M.Octeto_A_Bin(paquete0[contador]); string track_vel2 = M.Octeto_A_Bin(paquete0[contador + 1]); string track_vel3 = M.Octeto_A_Bin(paquete0[contador + 2]); string track_vel4 = M.Octeto_A_Bin(paquete0[contador + 3]); string track_vx = track_vel1 + track_vel2; string track_vy = track_vel3 + track_vel4; Track_Vel_Cartesian[0] = Math.Round(M.ComplementoA2(track_vx) * 0.25, 5); Track_Vel_Cartesian[1] = Math.Round(M.ComplementoA2(track_vy) * 0.25, 5); contador += 4; } if (FSPEC[9] == "1") { // Item I010/161: Track Number string TN_1 = M.Octeto_A_Bin(paquete0[contador]); string TN_2 = M.Octeto_A_Bin(paquete0[contador + 1]); string TN = TN_1.Remove(0, 3) + TN_2; Track_Num = Convert.ToInt32(TN, 2); contador += 2; } if (FSPEC[10] == "1") { // Item I010/170: Track Status string Status_Bin = M.Octeto_A_Bin(paquete0[contador]); char[] Status = Status_Bin.ToCharArray(); //CNF if (Status[0].ToString() == "1") { Track_Status[0] = "Track in initalisation phase"; } if (Status[0].ToString() == "0") { Track_Status[0] = "Confirmed Track"; } //TRE if (Status[1].ToString() == "1") { Track_Status[1] = "Last Report for a Track"; } if (Status[1].ToString() == "0") { Track_Status[1] = "Default"; } string CST_bin = Status[2].ToString() + Status[3].ToString(); Int32 CST = Convert.ToInt32(CST_bin, 2); //CST if (CST == 0) { Track_Status[2] = "No Extrapolation"; } if (CST == 1) { Track_Status[2] = "Predictable extrapolation due to sensor refresh period"; } if (CST == 2) { Track_Status[2] = "Predictable extrapolation in masked area"; } if (CST == 3) { Track_Status[2] = "Extrapolation due to unpredictable absence of detection"; } //MAH if (Status[4].ToString() == "1") { Track_Status[3] = "Horizontal manouvre"; } if (Status[4].ToString() == "0") { Track_Status[3] = "Default"; } //TCC if (Status[5].ToString() == "1") { Track_Status[4] = "Horizontal manouvre"; } if (Status[5].ToString() == "0") { Track_Status[4] = "Default"; } //STH if (Status[6].ToString() == "1") { Track_Status[5] = "Smoothed Position"; } if (Status[6].ToString() == "0") { Track_Status[5] = "Measured Position"; } if (Status[7].ToString() == "1") { contador += 1; string Status_Bin1 = M.Octeto_A_Bin(paquete0[contador]); char[] Status1 = Status_Bin1.ToCharArray(); string TOM_bin = Status1[0].ToString() + Status1[1].ToString(); Int32 TOM = Convert.ToInt32(TOM_bin, 2); //TOM if (TOM == 0) { Track_Status[6] = "Unknown Type of Movement"; } if (TOM == 1) { Track_Status[6] = "Taking-off"; } if (TOM == 2) { Track_Status[6] = "Landing"; } if (TOM == 3) { Track_Status[6] = "Other Types of Movements"; } string DOU_bin = Status1[2].ToString() + Status1[3].ToString() + Status1[4].ToString(); Int32 DOU = Convert.ToInt32(DOU_bin, 2); //DOU if (DOU == 0) { Track_Status[7] = "No doubt"; } if (DOU == 1) { Track_Status[7] = "Doubtful correlation"; } if (DOU == 2) { Track_Status[7] = "Doubtful correlation in clutter"; } if (DOU == 3) { Track_Status[7] = "Loss of accuracy"; } if (DOU == 4) { Track_Status[7] = "Loss of accuracy in clutter"; } if (DOU == 5) { Track_Status[7] = "Unstable track"; } if (DOU == 6) { Track_Status[7] = "Previously Cosated"; } contador += 1; string MRS_bin = Status1[5].ToString() + Status1[6].ToString(); Int32 MRS = Convert.ToInt32(MRS_bin, 2); //MRS if (MRS == 0) { Track_Status[8] = "Merge or split indication undetermined"; } if (MRS == 1) { Track_Status[8] = "Track merged by association to plot"; } if (MRS == 2) { Track_Status[8] = "Track merged by non-association to plot"; } if (MRS == 3) { Track_Status[8] = "Split track"; } if (Status1[7].ToString() == "1") { contador += 1; string Status_Bin2 = M.Octeto_A_Bin(paquete0[contador]); char[] Status2 = Status_Bin2.ToCharArray(); //GHO if (Status2[0].ToString() == "1") { Track_Status[9] = "Ghost Track"; } if (Status2[0].ToString() == "0") { Track_Status[9] = "Default"; } } if (Status1[7].ToString() == "0") { contador += 1; } } if (Status[7].ToString() == "0") { contador += 1; } } if (FSPEC[11] == "1") { // Item I010/060: Mode-3/A in Octal string Mode3A_Bin1 = M.Octeto_A_Bin(paquete0[contador]); string Mode3A_Bin2 = M.Octeto_A_Bin(paquete0[contador + 1]); string Mode3A_Bin = Mode3A_Bin1 + Mode3A_Bin2; char[] Mode3A_v = Mode3A_Bin.ToCharArray(); // V if (Mode3A_v[0].ToString() == "0") { Mode3A_Code[0] = "Code validated"; } if (Mode3A_v[0].ToString() == "1") { Mode3A_Code[0] = "Code not validated"; } // G if (Mode3A_v[1].ToString() == "0") { Mode3A_Code[1] = "Default"; } if (Mode3A_v[1].ToString() == "1") { Mode3A_Code[1] = "Garbled Code"; } // L if (Mode3A_v[2].ToString() == "0") { Mode3A_Code[2] = "Mode-3/A code derived from the reply of the transponder"; } if (Mode3A_v[2].ToString() == "0") { Mode3A_Code[2] = "Mode-3/A code not extracted during the last scan"; } string Mode3A = Mode3A_v[4].ToString() + Mode3A_v[5].ToString() + Mode3A_v[6].ToString() + Mode3A_v[7].ToString() + Mode3A_v[8].ToString() + Mode3A_v[9].ToString() + Mode3A_v[10].ToString() + Mode3A_v[11].ToString() + Mode3A_v[12].ToString() + Mode3A_v[13].ToString() + Mode3A_v[14].ToString() + Mode3A_v[15].ToString(); Mode3A_Code[3] = M.Convert_Binary_to_Octal(Mode3A); contador += 2; } if (FSPEC[12] == "1") { // Item I010/220: Target Address Target_Add = Convert.ToString(paquete0[contador]) + Convert.ToString(paquete0[contador + 1]) + Convert.ToString(paquete0[contador + 2]); contador += 3; } if (FSPEC[13] == "1") { // Item I010/245: Target Identification string TI_Bin1 = M.Octeto_A_Bin(paquete0[contador]); string TI_Bin2 = M.Octeto_A_Bin(paquete0[contador + 1]); string TI_Bin3 = M.Octeto_A_Bin(paquete0[contador + 2]); string TI_Bin4 = M.Octeto_A_Bin(paquete0[contador + 3]); string TI_Bin5 = M.Octeto_A_Bin(paquete0[contador + 4]); string TI_Bin6 = M.Octeto_A_Bin(paquete0[contador + 5]); string TI_Bin7 = M.Octeto_A_Bin(paquete0[contador + 6]); string TI_Bin = TI_Bin1 + TI_Bin2 + TI_Bin3 + TI_Bin4 + TI_Bin5 + TI_Bin6 + TI_Bin7; char[] TI_v = TI_Bin.ToCharArray(); Int32 sti = Convert.ToInt32(TI_v[0].ToString() + TI_v[1].ToString(), 2); // STI if (sti == 0) { STI = "Callsign or registration downlinked from transponder"; } if (sti == 1) { STI = "Callsign not downlinked from transponder"; } if (sti == 2) { STI = "Registration not downlinked from transponder"; } for (int i = 8; i < TI_v.Length; i++) { Target_ID += TI_v[i].ToString(); } Target_ID = M.Compare_bits(Target_ID); contador += 7; } if (FSPEC.Count > 14) { if (FSPEC[14] == "1") { // Item I010/250: Mode S MB Data string REP = M.Octeto_A_Bin(paquete0[contador]); string SMB2 = M.Octeto_A_Bin(paquete0[contador + 1]); string SMB3 = M.Octeto_A_Bin(paquete0[contador + 2]); string SMB4 = M.Octeto_A_Bin(paquete0[contador + 3]); string SMB5 = M.Octeto_A_Bin(paquete0[contador + 4]); string SMB6 = M.Octeto_A_Bin(paquete0[contador + 5]); string SMB7 = M.Octeto_A_Bin(paquete0[contador + 6]); string SMB8 = M.Octeto_A_Bin(paquete0[contador + 7]); string BDS = M.Octeto_A_Bin(paquete0[contador + 8]); char[] BDS_bin = BDS.ToCharArray(); Mode_SMB[0] = REP; //MB Mode_SMB[1] = (Convert.ToInt32(SMB2 + SMB3 + SMB4 + SMB5 + SMB6 + SMB7 + SMB8, 2)).ToString(); // BDS 1 Mode_SMB[2] = BDS_bin[0].ToString() + BDS_bin[1].ToString() + BDS_bin[2].ToString() + BDS_bin[3].ToString(); // BDS 2 Mode_SMB[3] = BDS_bin[4].ToString() + BDS_bin[5].ToString() + BDS_bin[6].ToString() + BDS_bin[7].ToString(); contador += 9; } if (FSPEC[15] == "1") { // Item I010/300: Vehicle Fleet ID string fleetID = M.Octeto_A_Bin(paquete0[contador]); int VFI = Convert.ToInt32(fleetID, 2); if (VFI == 0) { Fleet_ID = "Unknown"; } if (VFI == 1) { Fleet_ID = "ATC Equipment maintainance"; } if (VFI == 2) { Fleet_ID = "Airport maintainance"; } if (VFI == 3) { Fleet_ID = "Fire"; } if (VFI == 4) { Fleet_ID = "Bird scarer"; } if (VFI == 5) { Fleet_ID = "Snow plough"; } if (VFI == 6) { Fleet_ID = "Runway sweeper"; } if (VFI == 7) { Fleet_ID = "Emergency"; } if (VFI == 8) { Fleet_ID = "Police"; } if (VFI == 9) { Fleet_ID = "Bus"; } if (VFI == 10) { Fleet_ID = "Tug (push/tow)"; } if (VFI == 11) { Fleet_ID = "Grass cutter"; } if (VFI == 12) { Fleet_ID = "Fuel"; } if (VFI == 13) { Fleet_ID = "Baggage"; } if (VFI == 14) { Fleet_ID = "Catering"; } if (VFI == 15) { Fleet_ID = "Aircraft maintainance"; } if (VFI == 16) { Fleet_ID = "Flyco (follow me)"; } contador += 1; } if (FSPEC[16] == "1") { // Item I010/090: Flight Level string FL1 = M.Octeto_A_Bin(paquete0[contador]); string FL2 = M.Octeto_A_Bin(paquete0[contador + 1]); string FL_ = FL1 + FL2; char[] FL_bin = FL_.ToCharArray(); //V if (FL_bin[0].ToString() == "0") { FL[0] = "Code Validated"; } if (FL_bin[0].ToString() == "1") { FL[0] = "Code Not Validated"; } //G if (FL_bin[1].ToString() == "0") { FL[1] = "Default"; } if (FL_bin[1].ToString() == "1") { FL[1] = "Garbled Code"; } string FL3 = FL_bin[2].ToString(); for (int i = 3; i < FL_bin.Length; i++) { FL3 += FL_bin[i].ToString(); } FL[2] = (M.ComplementoA2(FL3) * 0.25).ToString(); contador += 2; } if (FSPEC[17] == "1") { // Item I010/091: Measured Height string height1 = M.Octeto_A_Bin(paquete0[contador]); string height2 = M.Octeto_A_Bin(paquete0[contador + 1]); string height = height1 + height2; Height = Math.Round(Convert.ToInt32(height) * 6.25, 3); contador += 2; } if (FSPEC[18] == "1") { // Item I010/270: Target Size and Orientation string length = M.Octeto_A_Bin(paquete0[contador]); char[] length_v = length.ToCharArray(); string length_bin = new string(length_v, 0, 6); Target_Size_Heading[0] = Convert.ToInt32(length_bin, 2); if (length_v[7].ToString() == "1") { string length1 = M.Octeto_A_Bin(paquete0[contador + 1]); char[] length1_v = length1.ToCharArray(); string lenght1_bin = new string(length1_v, 0, 6); Target_Size_Heading[1] = Math.Round(Convert.ToInt32(lenght1_bin, 2) * (360.0 / 128.0), 3); if (length1_v[7].ToString() == "1") { string length2 = M.Octeto_A_Bin(paquete0[contador + 2]); char[] length2_v = length2.ToCharArray(); string lenght2_bin = new string(length2_v, 0, 6); Target_Size_Heading[2] = Convert.ToInt32(lenght2_bin, 2); contador += 3; } if (length1_v[7].ToString() == "0") { contador += 2; } } if (length_v[7].ToString() == "0") { contador += 1; } } if (FSPEC[19] == "1") { // Item I010/550: System Status string stat = M.Octeto_A_Bin(paquete0[contador]); char[] stat_v = stat.ToCharArray(); int NOGO = Convert.ToInt32(stat_v[0].ToString() + stat_v[1].ToString(), 2); // NOGO if (NOGO == 0) { Sys_Status[0] = "Operational"; } if (NOGO == 1) { Sys_Status[0] = "Degraded"; } if (NOGO == 2) { Sys_Status[0] = "NOGO"; } // OVL if (stat_v[2].ToString() == "0") { Sys_Status[1] = "No overload"; } if (stat_v[2].ToString() == "1") { Sys_Status[1] = "Overload"; } // TSV if (stat_v[3].ToString() == "0") { Sys_Status[2] = "Valid"; } if (stat_v[3].ToString() == "1") { Sys_Status[2] = "Invalid"; } // DIV if (stat_v[4].ToString() == "0") { Sys_Status[3] = "Normal Operation"; } if (stat_v[4].ToString() == "1") { Sys_Status[3] = "Diversity degraded"; } // TTF if (stat_v[5].ToString() == "0") { Sys_Status[4] = "Test Target Operative"; } if (stat_v[5].ToString() == "1") { Sys_Status[4] = "Test Target Failure"; } contador += 1; } if (FSPEC[20] == "1") { // Item I010/310: Pre-programmed Message string messg = M.Octeto_A_Bin(paquete0[contador]); char[] messg_v = messg.ToCharArray(); // TRB if (messg_v[0].ToString() == "0") { Pre_Prog_Message[0] = "Default"; } if (messg_v[0].ToString() == "1") { Pre_Prog_Message[0] = "In Trouble"; } string MSGbin = new string(messg_v, 1, 7); int MSG = Convert.ToInt32(MSGbin, 2); // MSG if (MSG == 1) { Pre_Prog_Message[1] = "Towing Aircraft"; } if (MSG == 2) { Pre_Prog_Message[1] = "'Follow Me' operation"; } if (MSG == 3) { Pre_Prog_Message[1] = "Runway Check"; } if (MSG == 4) { Pre_Prog_Message[1] = "Emergency Operation"; } if (MSG == 5) { Pre_Prog_Message[1] = "Work in progress"; } contador += 1; } if (FSPEC.Count > 21) { if (FSPEC[21] == "1") { // Item I010/500: Standard Deviation of Position string SDx = M.Octeto_A_Bin(paquete0[contador]); string SDy = M.Octeto_A_Bin(paquete0[contador + 1]); string SDxy1 = M.Octeto_A_Bin(paquete0[contador + 2]); string SDxy2 = M.Octeto_A_Bin(paquete0[contador + 3]); StndrdDev_Position[0] = Math.Round(Convert.ToInt32(SDx, 2) * 0.25, 3); StndrdDev_Position[1] = Math.Round(Convert.ToInt32(SDy, 2) * 0.25, 3); string SDxy = SDxy1 + SDxy2; StndrdDev_Position[2] = Math.Round(Convert.ToInt32(SDxy, 2) * 0.25, 3); contador += 4; } if (FSPEC[22] == "1") { // Item I010/280: Presence string REP = M.Octeto_A_Bin(paquete0[contador]); string DRHO = M.Octeto_A_Bin(paquete0[contador + 1]); string DTHETA = M.Octeto_A_Bin(paquete0[contador + 2]); Presence[0] = Convert.ToInt32(REP, 2); Presence[1] = Convert.ToInt32(DRHO, 2); Presence[2] = Math.Round(Convert.ToInt32(DTHETA, 2) * 0.15, 3); contador += 3; } if (FSPEC[23] == "1") { // Item I010/131: Amplitude of Primary Plot string amplitude = M.Octeto_A_Bin(paquete0[contador]); Amplitude = Convert.ToInt32(amplitude, 2); contador += 1; } if (FSPEC[24] == "1") { // Item I010/210: Calculated Acceleration string Ax = M.Octeto_A_Bin(paquete0[contador]); string Ay = M.Octeto_A_Bin(paquete0[contador + 1]); Acceleration[0] = Math.Round(M.ComplementoA2(Ax) * 0.25, 3); Acceleration[1] = Math.Round(M.ComplementoA2(Ay) * 0.25, 3); contador += 2; } } else { } } else { } } else { } }
public void Decode21_23(string[] paquete) { Metodos Met = new Metodos(); int longitud = Met.Longitud_Paquete(paquete); string[] paquete0 = new string[longitud]; for (int i = 0; i < longitud; i++) { paquete0[i] = Met.Poner_Zeros_Delante(paquete[i]); string bitscat = Convert.ToString(Convert.ToInt32(paquete0[0], 16), 2); double CAT = Convert.ToInt32(bitscat, 2); if (CAT != 21) { i = i + 1; } } List <string> FSPEC = new List <string>(Met.FSPEC(paquete0)); // Posicion del vector paquete0 donde empieza la info despues del FSPEC int contador = Convert.ToInt32(FSPEC[FSPEC.Count - 1]) + 1; FSPEC.RemoveAt(FSPEC.Count - 1); // definicion de cada data item segun ADS-B Reports UAP if (FSPEC[0] == "1") { // Item I021/010 : Data Source Identification string SAC_Bin = Met.Octeto_A_Bin(paquete0[contador]); string SIC_Bin = Met.Octeto_A_Bin(paquete0[contador + 1]); double SAC = (Convert.ToInt32(SAC_Bin, 2)); double SIC = (Convert.ToInt32(SIC_Bin, 2)); //decodificamos , solo utilizaremos estos dos Data_Source_ID_SIC = SIC; Data_Source_ID_SAC = SAC; contador = contador + 2; } if (FSPEC[1] == "1") { // I021/040 : Target Report Descriptor string TargetReport_Bin = Met.Octeto_A_Bin(paquete0[contador]); if (TargetReport_Bin[0].ToString() == "0") { Target_Report_Desc[0] = "No differential correction (ADS-B)"; } if (TargetReport_Bin[0].ToString() == "1") { Target_Report_Desc[0] = "Differential correction (ADS-B)"; } if (TargetReport_Bin[1].ToString() == "0") { Target_Report_Desc[1] = "Ground Bit not set"; } if (TargetReport_Bin[1].ToString() == "1") { Target_Report_Desc[1] = "Ground Bit set"; } if (TargetReport_Bin[2].ToString() == "0") { Target_Report_Desc[2] = "Actual target report"; } if (TargetReport_Bin[2].ToString() == "1") { Target_Report_Desc[2] = "Simulated target report"; } if (TargetReport_Bin[3].ToString() == "0") { Target_Report_Desc[3] = "Default"; } if (TargetReport_Bin[3].ToString() == "1") { Target_Report_Desc[3] = "Test Target"; } if (TargetReport_Bin[4].ToString() == "0") { Target_Report_Desc[4] = "Report from target transponder"; } if (TargetReport_Bin[4].ToString() == "1") { Target_Report_Desc[4] = "Report from field monitor (fixed transponder)"; } if (TargetReport_Bin[5].ToString() == "0") { Target_Report_Desc[5] = "Equipement not capable to provide Selected Altitude"; } if (TargetReport_Bin[5].ToString() == "1") { Target_Report_Desc[5] = "Equipement capable to provide Selected Altitude"; } if (TargetReport_Bin[6].ToString() == "0") { Target_Report_Desc[6] = "Absence of SPI"; } if (TargetReport_Bin[6].ToString() == "1") { Target_Report_Desc[6] = "Special Position Identification"; } string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string ARC_Bin = octeto2[0].ToString() + octeto2[1].ToString() + octeto2[2].ToString(); Int32 ARC = Convert.ToInt32(ARC_Bin, 2); if (ARC == 0) { Target_Report_Desc[7] = "Non unique address"; } if (ARC == 1) { Target_Report_Desc[7] = "24-Bit ICAO address"; } if (ARC == 2) { Target_Report_Desc[7] = "Surface vehicle address"; } if (ARC == 3) { Target_Report_Desc[7] = "Anonymous address"; } if (ARC == 4 || ARC == 5 || ARC == 6 || ARC == 7) { Target_Report_Desc[7] = "Reserved for future use"; } string bits2 = octeto2[3].ToString() + octeto2[4].ToString(); Int32 bb = Convert.ToInt32(bits2, 2); if (bb == 0) { Target_Report_Desc[8] = "Unknown"; } if (bb == 1) { Target_Report_Desc[8] = "25 ft"; } if (bb == 2) { Target_Report_Desc[8] = "100 ft"; } contador = contador + 2; } if (FSPEC[2] == "1") { //Data Item I021/030, Time of Day string TODbits = Met.Octeto_A_Bin(paquete0[contador]) + Met.Octeto_A_Bin(paquete0[contador + 1]) + Met.Octeto_A_Bin(paquete0[contador + 2]); Time_of_Day = Math.Round(Convert.ToInt32(TODbits, 2) * (1.0 / 128.0), 3); contador = contador + 3; } if (FSPEC[3] == "1") { // I021/130: Position in WGS-84 Co-ordinates string octeto1 = Met.Octeto_A_Bin(paquete0[contador]); string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string octeto3 = Met.Octeto_A_Bin(paquete0[contador + 2]); string octeto_total = octeto1 + octeto2 + octeto3; Lat_WGS_84 = Met.ComplementoA2(octeto_total) * (180.0 / Math.Pow(2, 23)); string octeto4 = Met.Octeto_A_Bin(paquete0[contador + 3]); string octeto5 = Met.Octeto_A_Bin(paquete0[contador + 4]); string octeto6 = Met.Octeto_A_Bin(paquete0[contador + 5]); string octeto_total1 = octeto4 + octeto5 + octeto6; Lon_WGS_84 = Met.ComplementoA2(octeto_total1) * (180.0 / Math.Pow(2, 23)); contador = contador + 6; } if (FSPEC[4] == "1") { // I021/080 Target Address Target_Address = Convert.ToString(paquete0[contador]) + Convert.ToString(paquete0[contador + 1]) + Convert.ToString(paquete0[contador + 2]); contador = contador + 3; } if (FSPEC[5] == "1") { //I021/140: Geometric Altitude string octeto1 = Met.Octeto_A_Bin(paquete0[contador]); string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string octeto_total = octeto1 + octeto2; GA = Math.Round(Met.ComplementoA2(octeto_total) * 6.25, 3); contador = contador + 2; } if (FSPEC[6] == "1") { //Data Item I021/090, Figure of Merit string octeto1 = Met.Octeto_A_Bin(paquete0[contador]); string acbits = octeto1[0].ToString() + octeto1[1].ToString(); if (acbits == "00") { Fig_of_Merit[0] = "Unknown"; } if (acbits == "01") { Fig_of_Merit[0] = "ACAS not operational"; } if (acbits == "10") { Fig_of_Merit[0] = "ACAS operational"; } if (acbits == "11") { Fig_of_Merit[0] = "invalid"; } string mnbits = octeto1[2].ToString() + octeto1[3].ToString(); if (mnbits == "00") { Fig_of_Merit[1] = "Unknown"; } if (mnbits == "01") { Fig_of_Merit[1] = "Multiple navigational aids not operating"; } if (mnbits == "10") { Fig_of_Merit[1] = "Multiple navigational aids operating"; } if (mnbits == "11") { Fig_of_Merit[1] = "invalid"; } string dcbits = octeto1[4].ToString() + octeto1[5].ToString(); if (mnbits == "00") { Fig_of_Merit[2] = "Unknown"; } if (mnbits == "01") { Fig_of_Merit[2] = "Differential correction"; } if (mnbits == "10") { Fig_of_Merit[2] = "No Differential correction"; } if (mnbits == "11") { Fig_of_Merit[2] = "invalid"; } string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string pabits = octeto2[4].ToString() + octeto2[5].ToString() + octeto2[6].ToString() + octeto2[7].ToString(); Fig_of_Merit[3] = pabits; contador = contador + 2; } if (FSPEC.Count > 7) { if (FSPEC[7] == "1") { //Data Item I021/210, Link Technology Indicator string octeto = Met.Octeto_A_Bin(paquete0[contador]); if (octeto[3].ToString() == "0") { Link_Tech[0] = "Unknown"; } if (octeto[3].ToString() == "1") { Link_Tech[0] = "Aircraft Equiped with CDTI"; } if (octeto[4].ToString() == "0") { Link_Tech[1] = "Not Used"; } if (octeto[4].ToString() == "1") { Link_Tech[1] = "Used"; } if (octeto[5].ToString() == "0") { Link_Tech[2] = "Not Used"; } if (octeto[5].ToString() == "1") { Link_Tech[2] = "Used"; } if (octeto[6].ToString() == "0") { Link_Tech[3] = "Not Used"; } if (octeto[6].ToString() == "1") { Link_Tech[3] = "Used"; } if (octeto[7].ToString() == "0") { Link_Tech[4] = "Not Used"; } if (octeto[7].ToString() == "1") { Link_Tech[4] = "Used"; } contador = contador + 1; } if (FSPEC[8] == "1") { // I021/230 Roll Angle string octeto1 = Met.Octeto_A_Bin(paquete0[contador]); string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string octeto_total = octeto1.ToString() + octeto2.ToString(); Roll = Met.ComplementoA2(octeto_total) * 0.01; contador = contador + 2; } if (FSPEC[9] == "1") { //I021/145: Flight Level string octeto1 = Met.Octeto_A_Bin(paquete0[contador]); string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string octeto_total = octeto1.ToString() + octeto2.ToString(); FL = Math.Round(Met.ComplementoA2(octeto_total) * 0.25, 3); contador = contador + 2; } if (FSPEC[10] == "1") { // I021/150: Air Speed string octeto1 = Met.Octeto_A_Bin(paquete0[contador]); string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string octeto_total = octeto1 + octeto2; double num1 = 0.001; if (Convert.ToInt32(octeto_total[0].ToString()) == 0) { double ias = Met.ComplementoA2(octeto_total.Remove(0, 1)) * (Math.Pow(2, -14)); // IAS Air_Speed[0] = Math.Round(ias, 3);// NM/s } else { double Mach = Met.ComplementoA2(octeto_total.Remove(0, 1)) * num1; // Mach Num Air_Speed[1] = Math.Round(Mach, 3); } contador = contador + 2; } if (FSPEC[11] == "1") { //I021/151 True Airspeed string octeto1 = Met.Octeto_A_Bin(paquete0[contador]); string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string octeto_total = octeto1 + octeto2; True_Airspeed = Met.ComplementoA2(octeto_total);// knots contador = contador + 2; } if (FSPEC[12] == "1") { //I021/152: Magnetic Heading string octeto1 = Met.Octeto_A_Bin(paquete0[contador]); string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string octeto_total = octeto1.ToString() + octeto2.ToString(); MH = Math.Round(Met.ComplementoA2(octeto_total) * (360.0 / Math.Pow(2, 16)), 3); contador = contador + 2; } if (FSPEC[13] == "1") { // I021/155: Barometric Vertical Rate string totalbits = Met.Octeto_A_Bin(paquete0[contador]) + Met.Octeto_A_Bin(paquete0[contador + 1]); BVR = Math.Round(Met.ComplementoA2(totalbits) * 6.25, 3); contador = contador + 2; } if (FSPEC.Count > 14) { if (FSPEC[14] == "1") { //021/157: Geometric Vertical Rate string totalbits = Met.Octeto_A_Bin(paquete0[contador]) + Met.Octeto_A_Bin(paquete0[contador + 1]); GVR = Math.Round(Met.ComplementoA2(totalbits) * 6.25, 3); contador = contador + 2; } if (FSPEC[15] == "1") { //I021/160: Airborne Ground Vector string GSbits = Met.Octeto_A_Bin(paquete0[contador]) + Met.Octeto_A_Bin(paquete0[contador + 1]); GS = Math.Round(Met.ComplementoA2(GSbits) * 0.22, 3); string TAbits = Met.Octeto_A_Bin(paquete0[contador + 2]) + Met.Octeto_A_Bin(paquete0[contador + 3]); TA = Math.Round(Met.ComplementoA2(TAbits) * (360.0 / Math.Pow(2, 16)), 3); contador = contador + 4; } if (FSPEC[16] == "1") { //Data Item I021/165, Rate Of Turn string octeto1 = Met.Octeto_A_Bin(paquete0[contador]); string value = octeto1[0].ToString() + octeto1[1].ToString(); if (value == "00") { Rate_of_Turn[0] = "Not available"; } if (value == "01") { Rate_of_Turn[0] = "Left"; } if (value == "10") { Rate_of_Turn[0] = "Right"; } if (value == "11") { Rate_of_Turn[0] = "Straight"; } if (octeto1[7].ToString() == "0") { contador = contador + 1; } if (octeto1[7].ToString() == "1") { string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string rotbits = octeto2.Remove(7); Rate_of_Turn[1] = (Met.ComplementoA2(rotbits) * (1.0 / 4.0)).ToString(); contador = contador + 1; } } if (FSPEC[17] == "1") { //I021/170 Target Identification (found in table 3.8 annex 10 ICAO) see 3.1.2.9 string octetototal = Met.Octeto_A_Bin(paquete0[contador]) + Met.Octeto_A_Bin(paquete0[contador + 1]) + Met.Octeto_A_Bin(paquete0[contador + 2]) + Met.Octeto_A_Bin(paquete0[contador + 3]) + Met.Octeto_A_Bin(paquete0[contador + 4]) + Met.Octeto_A_Bin(paquete0[contador + 5]); Target_ID = Met.Compare_bits(octetototal); contador = contador + 6; } if (FSPEC[18] == "1") { //Data Item I021/095, Velocity Accuracy string octeto1 = Met.Octeto_A_Bin(paquete0[contador]); Velocity_Acc = Met.ComplementoA2(octeto1); contador = contador + 1; } if (FSPEC[19] == "1") { //Data Item I021/032, Time of Day Accuracy string octeto1 = Met.Octeto_A_Bin(paquete0[contador]); ToD_Acc = Met.ComplementoA2(octeto1) * (1.0 / 256.0); contador = contador + 1; } if (FSPEC[20] == "1") { //I021/200: Target Status string octeto = Met.Octeto_A_Bin(paquete0[contador]); // ICF if (Convert.ToInt32(octeto[0].ToString(), 2) == 0) { Target_Status[0] = "No intent change active"; } else { Target_Status[0] = "Intent change flag raised "; } // LNAV if (Convert.ToInt32(octeto[1].ToString(), 2) == 0) { Target_Status[1] = "LNAV Mode engaged"; } else { Target_Status[1] = "LNAV Mode not engaged "; } string octetoPS = octeto[3].ToString() + octeto[4].ToString() + octeto[5].ToString(); // PS int PS = Convert.ToInt32(octetoPS, 2); if (PS == 0) { Target_Status[2] = "No emergency / not reported"; } if (PS == 1) { Target_Status[2] = "General emergency"; } if (PS == 2) { Target_Status[2] = "Lifeguard / medical emergency"; } if (PS == 3) { Target_Status[2] = "Minimum fuel"; } if (PS == 4) { Target_Status[2] = "No communications"; } if (PS == 5) { Target_Status[2] = "Unlawful interference"; } if (PS == 6) { Target_Status[2] = "Downed aircraft"; } string octetoSS = octeto[6].ToString() + octeto[7].ToString(); //SS int SS = Convert.ToInt32(octetoSS, 2); if (SS == 0) { Target_Status[3] = "No condition reported"; } if (SS == 1) { Target_Status[3] = "Permanent Alert (Emergency condition)"; } if (SS == 2) { Target_Status[3] = "Temporary Alert (change in Mode 3/A Code other than emergency"; } if (SS == 3) { Target_Status[3] = "SPI set"; } contador = contador + 1; } if (FSPEC.Count > 21) { if (FSPEC[21] == "1") { // I021/020 Emitter Category string octeto = Met.Octeto_A_Bin(paquete0[contador]); int value = Convert.ToInt32(octeto, 2); if (value == 1) { ECAT = "light aircraft <= 7000 kg"; } if (value == 2) { ECAT = "reserved"; } if (value == 3) { ECAT = "7000 kg < medium aircraft < 136000 kg"; } if (value == 4) { ECAT = "reserved"; } if (value == 5) { ECAT = "136000 kg <= heavy aircraft"; } if (value == 6) { ECAT = "highly manoeuvrable (5g acceleration capability) and high speed (>400knots cruise)"; } if (value == 7) { ECAT = "reserved"; } if (value == 8) { ECAT = "reserved"; } if (value == 9) { ECAT = "reserved"; } if (value == 10) { ECAT = "rotocraft"; } if (value == 11) { ECAT = "glider / sailplane"; } if (value == 12) { ECAT = "lighter-than-air"; } if (value == 13) { ECAT = "unmanned aerial vehicle"; } if (value == 14) { ECAT = "space / transatmospheric vehicle"; } if (value == 15) { ECAT = "ultralight / handglider / paraglider"; } if (value == 16) { ECAT = "parachutist / skydiver"; } if (value == 17) { ECAT = "reserved"; } if (value == 18) { ECAT = "reserved"; } if (value == 19) { ECAT = "reserved"; } if (value == 20) { ECAT = "surface emergency vehicle"; } if (value == 21) { ECAT = "surface service vehicle"; } if (value == 22) { ECAT = "fixed ground or tethered obstruction"; } if (value == 23) { ECAT = "reserved"; } if (value == 24) { ECAT = "reserved"; } contador = contador + 1; } if (FSPEC[22] == "1") { // I021/220 Met Information string octeto = Met.Octeto_A_Bin(paquete0[contador]); // Wind Speed in knots if (octeto[0].ToString() == "0") { Met_Report[0] = "No Wind Speed reported"; } else { string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string octeto3 = Met.Octeto_A_Bin(paquete0[contador + 2]); string windspeedbits = octeto2 + octeto3; Met_Report[0] = Convert.ToString(Met.ComplementoA2(windspeedbits)); contador = contador + 2; } // Wind Direction in degrees if (octeto[1].ToString() == "0") { Met_Report[1] = "No Wind Speed reported"; } else { string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string octeto3 = Met.Octeto_A_Bin(paquete0[contador + 2]); string windspeedbits = octeto2 + octeto3; Met_Report[1] = Convert.ToString(Met.ComplementoA2(windspeedbits)); contador = contador + 2; } // Temperature in Celsius if (octeto[2].ToString() == "0") { Met_Report[2] = "No Temperature reported"; } else { string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string octeto3 = Met.Octeto_A_Bin(paquete0[contador + 2]); string windspeedbits = octeto2 + octeto3; Met_Report[2] = Convert.ToString(Math.Round((Met.ComplementoA2(windspeedbits) * 0.25), 2)); contador = contador + 2; } // Turbulence if (octeto[3].ToString() == "0") { Met_Report[3] = "No Turbulence reported"; } else { string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); Met_Report[3] = Convert.ToString(Convert.ToInt32(Met.ComplementoA2(octeto2)), 2); contador = contador + 1; } contador = contador + 1; } if (FSPEC[23] == "1") { //021/146 Intermediate State Selected Altitude string octeto = Met.Octeto_A_Bin(paquete0[contador]); string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string total = octeto + octeto2; if (total[0].ToString() == "0") { SAS = "No source information provided"; } else { SAS = "Source information provided"; } string sourcebits = total[1].ToString() + total[2].ToString(); if (sourcebits == "00") { Source = "Unknown"; } if (sourcebits == "01") { Source = "Aircraft Altitude (Holding Altitude"; } if (sourcebits == "10") { Source = "MCP/FCU Selected Altitude"; } if (sourcebits == "11") { Source = "FMS Selected Altitude"; } string altitudebits = total.Remove(0, 2); Interm_Selec_Alt = Math.Round(Met.ComplementoA2(altitudebits) * 25.0, 3); contador = contador + 2; } if (FSPEC[24] == "1") { //I021/148 Final State Selected Altitude string octeto = Met.Octeto_A_Bin(paquete0[contador]); string octeto2 = Met.Octeto_A_Bin(paquete0[contador + 1]); string total = octeto + octeto2; if (total[0].ToString() == "0") { MV = "Not active or unknown"; } else { MV = "Active"; } if (total[1].ToString() == "0") { AH = "Not active or unknown"; } else { AH = "Active"; } if (total[2].ToString() == "0") { AM = "Not active or unknown"; } else { AM = "Active"; } string altitudebits = total.Remove(0, 2); FSSA = Math.Round(Met.ComplementoA2(altitudebits) * 25.0, 3); contador = contador + 2; } if (FSPEC[25] == "1") { //I021/110 Trajectory Intent string octeto = Met.Octeto_A_Bin(paquete0[contador]); if (octeto[0].ToString() == "0") { Trajectory_Intent[0] = "Abscence of Subfield #1"; } else { contador = contador + 1; string octeto1 = Met.Octeto_A_Bin(paquete0[contador]); // NVB if (octeto1[1].ToString() == "0") { Trajectory_Intent[1] = "Trajectory Intent Data is valid"; } else { Trajectory_Intent[1] = "Trajectory Intent Data is not valid"; } // NAV if (octeto1[0].ToString() == "1") { Trajectory_Intent[2] = "Trajectory Intent Data is not available for this aircraft"; } else { contador = contador + 1; string octeto2 = Met.Octeto_A_Bin(paquete0[contador]); //REP Trajectory_Intent[3] = Convert.ToInt32(octeto2, 2).ToString(); contador = contador + 1; string octeto3 = Met.Octeto_A_Bin(paquete0[contador]); //TCA if (octeto3[0].ToString() == "0") { Trajectory_Intent[4] = "TCP number available"; } else { Trajectory_Intent[4] = "TCP number not available"; } // NC if (octeto3[1].ToString() == "0") { Trajectory_Intent[5] = "TCP compliance"; } else { Trajectory_Intent[5] = "TCP non-compliance"; } // TCP num Trajectory_Intent[6] = Convert.ToInt32(octeto3.Remove(0, 1), 2).ToString(); string octetoaltitude = Met.Octeto_A_Bin(paquete0[contador + 1]) + Met.Octeto_A_Bin(paquete0[contador + 2]); // Alt in ft Trajectory_Intent[9] = Math.Round(Convert.ToInt32(octetoaltitude, 2) * 10.0, 3).ToString(); string octetolatitude = Met.Octeto_A_Bin(paquete0[contador + 3]) + Met.Octeto_A_Bin(paquete0[contador + 4]) + Met.Octeto_A_Bin(paquete0[contador + 5]); // Lat TID in degrees Trajectory_Intent[7] = Math.Round(Convert.ToInt32(octetolatitude, 2) * (180.0 / Math.Pow(2, 23)), 3).ToString(); string octetolong = Met.Octeto_A_Bin(paquete0[contador + 6]) + Met.Octeto_A_Bin(paquete0[contador + 7]) + Met.Octeto_A_Bin(paquete0[contador + 8]); // Lon TID in degrees Trajectory_Intent[8] = Math.Round(Convert.ToInt32(octetolong, 2) * (180.0 / Math.Pow(2, 23)), 3).ToString(); string octeto11 = Met.Octeto_A_Bin(paquete0[contador + 9]); string pointtyopebits = octeto11[0].ToString() + octeto11[1].ToString() + octeto11[2].ToString() + octeto11[3].ToString(); // Point Type int value = Convert.ToInt32(pointtyopebits, 2); if (value == 0) { Trajectory_Intent[10] = "Unknown"; } if (value == 1) { Trajectory_Intent[10] = "Fly by waypoint (LT)"; } if (value == 2) { Trajectory_Intent[10] = "Fly over waypoint (LT)"; } if (value == 3) { Trajectory_Intent[10] = "Hold pattern (LT)"; } if (value == 4) { Trajectory_Intent[10] = "Procedure hold(LT)"; } if (value == 5) { Trajectory_Intent[10] = "Procedure turn (LT)"; } if (value == 6) { Trajectory_Intent[10] = "RF leg (LT)"; } if (value == 7) { Trajectory_Intent[10] = "Top of climb (VT)"; } if (value == 8) { Trajectory_Intent[10] = "Top of descent (VT)"; } if (value == 9) { Trajectory_Intent[10] = "Start of level (VT)"; } if (value == 10) { Trajectory_Intent[10] = "Cross-over altitude (VT)"; } if (value == 11) { Trajectory_Intent[10] = "Transition altitude (VT)"; } string TDbits = octeto11[4].ToString() + octeto11[5].ToString(); // TD if (TDbits == "00") { Trajectory_Intent[11] = "N/A"; } if (TDbits == "01") { Trajectory_Intent[11] = "Turn right"; } if (TDbits == "10") { Trajectory_Intent[11] = "Turn left"; } if (TDbits == "11") { Trajectory_Intent[11] = "No turn"; } // TRA if (octeto11[6].ToString() == "0") { Trajectory_Intent[12] = "TTR not available"; } if (octeto11[6].ToString() == "1") { Trajectory_Intent[12] = "TTR available"; } // TOA if (octeto11[7].ToString() == "0") { Trajectory_Intent[13] = "TOV available"; } if (octeto11[7].ToString() == "1") { Trajectory_Intent[13] = "TOV not available"; } string TOVbits = Met.Octeto_A_Bin(paquete0[contador + 10]) + Met.Octeto_A_Bin(paquete0[contador + 11]) + Met.Octeto_A_Bin(paquete0[contador + 12]); // TOV in seconds Trajectory_Intent[14] = Convert.ToInt32(TOVbits, 2).ToString(); string TTRbits = Met.Octeto_A_Bin(paquete0[contador + 13]) + Met.Octeto_A_Bin(paquete0[contador + 14]); // TTR in Nm Trajectory_Intent[15] = Math.Round(Convert.ToInt32(TTRbits, 2) * 0.01, 3).ToString(); } } } } else { } } else { } } else { } }