private static void DecodeAzimuthAndDistance(ref GeoCordSystemDegMinSecUtilities.LatLongClass NewPosition, double Distance, double Azimuth) { GeoCordSystemDegMinSecUtilities.LatLongClass ResultPosition = new GeoCordSystemDegMinSecUtilities.LatLongClass(); ////////////////////////////////////////////////////////////////////////////////// // // Here loop through the defined radars and determine the source of the data. // Once the source is determined calculate the extact position of the target // by taking the position of the radar and applying the range and bearing. // Display time of reception // Extract the cu // rrent SIC/SAC so the correct radar can be applied // ASTERIX.SIC_SAC_Time SIC_SAC_TIME = (ASTERIX.SIC_SAC_Time)CAT01.I001DataItems[CAT01.ItemIDToIndex("010")].value; foreach (SystemAdaptationDataSet.Radar RDS in SystemAdaptationDataSet.RadarDataSet) { // If the current SIC/SAC code matched the code of one of the defined radars // then go ahead and calculate the Lat/Long position. if (RDS.SIC == SIC_SAC_TIME.SIC.ToString() && RDS.SAC == SIC_SAC_TIME.SAC.ToString()) { ResultPosition = GeoCordSystemDegMinSecUtilities.CalculateNewPosition(RDS.RadarPosition, Distance, Azimuth); } } NewPosition.SetPosition(ResultPosition.GetLatLongDecimal()); }
private static void DecodeAzimuthAndDistance(ref GeoCordSystemDegMinSecUtilities.LatLongClass NewPosition, out double Distance, out double Azimuth, Bit_Ops BO) { double Distance_Loc = 0.0; double Azimuth_Loc = 0.0; GeoCordSystemDegMinSecUtilities.LatLongClass ResultPosition = new GeoCordSystemDegMinSecUtilities.LatLongClass(); /////////////////////////////////////////////////////////////////////////////////////// // Decode Distance /////////////////////////////////////////////////////////////////////////////////////// if (BO.DWord[Bit_Ops.Bit16] == true) { Distance_Loc = RHO_1; } if (BO.DWord[Bit_Ops.Bit17] == true) { Distance_Loc = Distance_Loc + RHO_2; } if (BO.DWord[Bit_Ops.Bit18] == true) { Distance_Loc = Distance_Loc + RHO_3; } if (BO.DWord[Bit_Ops.Bit19] == true) { Distance_Loc = Distance_Loc + RHO_4; } if (BO.DWord[Bit_Ops.Bit20] == true) { Distance_Loc = Distance_Loc + RHO_5; } if (BO.DWord[Bit_Ops.Bit21] == true) { Distance_Loc = Distance_Loc + RHO_6; } if (BO.DWord[Bit_Ops.Bit22] == true) { Distance_Loc = Distance_Loc + RHO_7; } if (BO.DWord[Bit_Ops.Bit23] == true) { Distance_Loc = Distance_Loc + RHO_8; } if (BO.DWord[Bit_Ops.Bit24] == true) { Distance_Loc = Distance_Loc + RHO_9; } if (BO.DWord[Bit_Ops.Bit25] == true) { Distance_Loc = Distance_Loc + RHO_10; } if (BO.DWord[Bit_Ops.Bit26] == true) { Distance_Loc = Distance_Loc + RHO_11; } if (BO.DWord[Bit_Ops.Bit27] == true) { Distance_Loc = Distance_Loc + RHO_12; } if (BO.DWord[Bit_Ops.Bit28] == true) { Distance_Loc = Distance_Loc + RHO_13; } if (BO.DWord[Bit_Ops.Bit29] == true) { Distance_Loc = Distance_Loc + RHO_14; } if (BO.DWord[Bit_Ops.Bit30] == true) { Distance_Loc = Distance_Loc + RHO_15; } if (BO.DWord[Bit_Ops.Bit31] == true) { Distance_Loc = Distance_Loc + RHO_16; } /////////////////////////////////////////////////////////////////////////////////////// // Decode Azimuth /////////////////////////////////////////////////////////////////////////////////////// if (BO.DWord[Bit_Ops.Bit0] == true) { Azimuth_Loc = THETA_1; } if (BO.DWord[Bit_Ops.Bit1] == true) { Azimuth_Loc = Azimuth_Loc + THETA_2; } if (BO.DWord[Bit_Ops.Bit2] == true) { Azimuth_Loc = Azimuth_Loc + THETA_3; } if (BO.DWord[Bit_Ops.Bit3] == true) { Azimuth_Loc = Azimuth_Loc + THETA_4; } if (BO.DWord[Bit_Ops.Bit4] == true) { Azimuth_Loc = Azimuth_Loc + THETA_5; } if (BO.DWord[Bit_Ops.Bit5] == true) { Azimuth_Loc = Azimuth_Loc + THETA_6; } if (BO.DWord[Bit_Ops.Bit6] == true) { Azimuth_Loc = Azimuth_Loc + THETA_7; } if (BO.DWord[Bit_Ops.Bit7] == true) { Azimuth_Loc = Azimuth_Loc + THETA_8; } if (BO.DWord[Bit_Ops.Bit8] == true) { Azimuth_Loc = Azimuth_Loc + THETA_9; } if (BO.DWord[Bit_Ops.Bit9] == true) { Azimuth_Loc = Azimuth_Loc + THETA_10; } if (BO.DWord[Bit_Ops.Bit10] == true) { Azimuth_Loc = Azimuth_Loc + THETA_11; } if (BO.DWord[Bit_Ops.Bit11] == true) { Azimuth_Loc = Azimuth_Loc + THETA_12; } if (BO.DWord[Bit_Ops.Bit12] == true) { Azimuth_Loc = Azimuth_Loc + THETA_13; } if (BO.DWord[Bit_Ops.Bit13] == true) { Azimuth_Loc = Azimuth_Loc + THETA_14; } if (BO.DWord[Bit_Ops.Bit14] == true) { Azimuth_Loc = Azimuth_Loc + THETA_15; } if (BO.DWord[Bit_Ops.Bit15] == true) { Azimuth_Loc = Azimuth_Loc + THETA_16; } Azimuth = Azimuth_Loc; Distance = Distance_Loc; ////////////////////////////////////////////////////////////////////////////////// // // Here loop through the defined radars and determine the source of the data. // Once the source is determined calculate the extact position of the target // by taking the position of the radar and applying the range and bearing. // Display time of reception // // Extract the current SIC/SAC so the correct radar can be applied // ASTERIX.SIC_SAC_Time SIC_SAC_TIME = (ASTERIX.SIC_SAC_Time)CAT01.I001DataItems[CAT01.ItemIDToIndex("010")].value; foreach (SystemAdaptationDataSet.Radar RDS in SystemAdaptationDataSet.RadarDataSet) { // If the current SIC/SAC code matched the code of one of the defined radars // then go ahead and calculate the Lat/Long position. if (RDS.SIC == SIC_SAC_TIME.SIC.ToString() && RDS.SAC == SIC_SAC_TIME.SAC.ToString()) { ResultPosition = GeoCordSystemDegMinSecUtilities.CalculateNewPosition(RDS.RadarPosition, Distance_Loc, Azimuth_Loc); } } NewPosition.SetPosition(ResultPosition.GetLatLongDecimal()); }
private void comboBoxSSRCode_SelectedIndexChanged(object sender, EventArgs e) { this.listBoxDataBySSRCode.Items.Clear(); if (SSR_Code_Lookup.Length > 0) { // On load determine what SSR codes are present end populate the combo box if (MainASTERIXDataStorage.CAT01Message.Count > 0) { foreach (MainASTERIXDataStorage.CAT01Data Msg in MainASTERIXDataStorage.CAT01Message) { CAT01I070Types.CAT01070Mode3UserData MyData = (CAT01I070Types.CAT01070Mode3UserData)Msg.CAT01DataItems[CAT01.ItemIDToIndex("070")].value; if (MyData.Mode3A_Code == this.comboBoxSSRCode.Items[this.comboBoxSSRCode.SelectedIndex].ToString()) { ASTERIX.SIC_SAC_Time SIC_SAC_TIME = (ASTERIX.SIC_SAC_Time)Msg.CAT01DataItems[CAT01.ItemIDToIndex("010")].value; // Display time string Time = SIC_SAC_TIME.TimeofReception.Hour.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Minute.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Second.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Millisecond.ToString().PadLeft(3, '0'); this.listBoxDataBySSRCode.Items.Add("Rcvd Time: " + Time); CAT01I040Types.CAT01I040MeasuredPosInPolarCoordinates PositionData = (CAT01I040Types.CAT01I040MeasuredPosInPolarCoordinates)Msg.CAT01DataItems[CAT01.ItemIDToIndex("040")].value; this.listBoxDataBySSRCode.Items.Add("\tDistance:\t" + PositionData.Measured_Distance); this.listBoxDataBySSRCode.Items.Add("\tAzimuth:\t" + PositionData.Measured_Azimuth.ToString()); string Lat, Lon; PositionData.LatLong.GetDegMinSecStringFormat(out Lat, out Lon); this.listBoxDataBySSRCode.Items.Add("\tLat/Long:\t" + Lat + "/" + Lon); // Display Data CAT01I090Types.CAT01I090FlightLevelUserData FL_Data = (CAT01I090Types.CAT01I090FlightLevelUserData)Msg.CAT01DataItems[CAT01.ItemIDToIndex("090")].value; this.listBoxDataBySSRCode.Items.Add("\tMode Validated:\t" + FL_Data.Code_Validated.ToString()); this.listBoxDataBySSRCode.Items.Add("\tMode Garbled:\t" + FL_Data.Code_Garbled.ToString()); this.listBoxDataBySSRCode.Items.Add("\tFL:\t" + FL_Data.FlightLevel.ToString()); this.listBoxDataBySSRCode.Items.Add(" "); } } } else if (MainASTERIXDataStorage.CAT48Message.Count > 0) { foreach (MainASTERIXDataStorage.CAT48Data Msg in MainASTERIXDataStorage.CAT48Message) { CAT48I070Types.CAT48I070Mode3UserData MyData = (CAT48I070Types.CAT48I070Mode3UserData)Msg.CAT48DataItems[CAT48.ItemIDToIndex("070")].value; if (MyData.Mode3A_Code == this.comboBoxSSRCode.Items[this.comboBoxSSRCode.SelectedIndex].ToString()) { ASTERIX.SIC_SAC_Time SIC_SAC_TIME = (ASTERIX.SIC_SAC_Time)Msg.CAT48DataItems[CAT48.ItemIDToIndex("010")].value; // Display time string Time = SIC_SAC_TIME.TimeofReception.Hour.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Minute.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Second.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Millisecond.ToString().PadLeft(3, '0'); this.listBoxDataBySSRCode.Items.Add("Rcvd Time: " + Time); // Display Data CAT48I240Types.CAT48I240ACID_Data ACID_String = (CAT48I240Types.CAT48I240ACID_Data)Msg.CAT48DataItems[CAT48.ItemIDToIndex("240")].value; if (ACID_String != null) { this.listBoxDataBySSRCode.Items.Add("\t" + "Callsign:" + ACID_String.ACID); } else { this.listBoxDataBySSRCode.Items.Add("\t" + "Callsign: N/A"); } CAT48I040Types.CAT48I040MeasuredPosInPolarCoordinates PositionData = (CAT48I040Types.CAT48I040MeasuredPosInPolarCoordinates)Msg.CAT48DataItems[CAT48.ItemIDToIndex("040")].value; this.listBoxDataBySSRCode.Items.Add("\tDistance:\t" + PositionData.Measured_Distance); this.listBoxDataBySSRCode.Items.Add("\tAzimuth:\t" + PositionData.Measured_Azimuth.ToString()); string Lat, Lon; PositionData.LatLong.GetDegMinSecStringFormat(out Lat, out Lon); this.listBoxDataBySSRCode.Items.Add("\tLat/Long:\t" + Lat + "/" + Lon); CAT48I090Types.CAT48I090FlightLevelUserData FL_Data = (CAT48I090Types.CAT48I090FlightLevelUserData)Msg.CAT48DataItems[CAT48.ItemIDToIndex("090")].value; this.listBoxDataBySSRCode.Items.Add("\tMode Validated:\t" + FL_Data.Code_Validated.ToString()); this.listBoxDataBySSRCode.Items.Add("\tMode Garbled:\t" + FL_Data.Code_Garbled.ToString()); this.listBoxDataBySSRCode.Items.Add("\tFL:\t" + FL_Data.FlightLevel.ToString()); this.listBoxDataBySSRCode.Items.Add(" "); } } } else if (MainASTERIXDataStorage.CAT62Message.Count > 0) { foreach (MainASTERIXDataStorage.CAT62Data Msg in MainASTERIXDataStorage.CAT62Message) { CAT62I060Types.CAT62060Mode3UserData MyData = (CAT62I060Types.CAT62060Mode3UserData)Msg.CAT62DataItems[CAT62.ItemIDToIndex("060")].value; if (MyData.Mode3A_Code == this.comboBoxSSRCode.Items[this.comboBoxSSRCode.SelectedIndex].ToString()) { ASTERIX.SIC_SAC_Time SIC_SAC_TIME = (ASTERIX.SIC_SAC_Time)Msg.CAT62DataItems[CAT62.ItemIDToIndex("010")].value; // TIME string Time = SIC_SAC_TIME.TimeofReception.Hour.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Minute.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Second.ToString().PadLeft(2, '0') + ":" + SIC_SAC_TIME.TimeofReception.Millisecond.ToString().PadLeft(3, '0'); this.listBoxDataBySSRCode.Items.Add("Rcvd Time: " + Time); // TRACK NUMBER int TrackNumber = (int)Msg.CAT62DataItems[CAT62.ItemIDToIndex("040")].value; this.listBoxDataBySSRCode.Items.Add("\t" + "TRACK#:" + TrackNumber.ToString()); // CALLSIGN CAT62I380Types.CAT62I380Data CAT62I380Data = (CAT62I380Types.CAT62I380Data)Msg.CAT62DataItems[CAT62.ItemIDToIndex("380")].value; if (CAT62I380Data != null) { this.listBoxDataBySSRCode.Items.Add("\t" + "Callsign:" + CAT62I380Data.ACID.ACID_String); } // POSITION GeoCordSystemDegMinSecUtilities.LatLongClass LatLongData = (GeoCordSystemDegMinSecUtilities.LatLongClass)Msg.CAT62DataItems[CAT62.ItemIDToIndex("105")].value; string Lat, Lon; LatLongData.GetDegMinSecStringFormat(out Lat, out Lon); this.listBoxDataBySSRCode.Items.Add("\tLat/Long:\t" + Lat + "/" + Lon); // FLIGHT LEVEL double FlightLevel = (double)Msg.CAT62DataItems[CAT62.ItemIDToIndex("136")].value; if (Msg.CAT62DataItems[CAT62.ItemIDToIndex("136")].value != null) { this.listBoxDataBySSRCode.Items.Add("\tFL:\t" + FlightLevel.ToString()); } else { this.listBoxDataBySSRCode.Items.Add("\tFL:\t" + "N/A"); } this.listBoxDataBySSRCode.Items.Add(" "); } } } } else { this.listBoxDataBySSRCode.Items.Add("No data was acquired !!!"); } }