예제 #1
0
 /// <summary>
 /// Create an instance of class CAT all from an instance of class CAT10
 /// </summary>
 /// <param name="message">CAT10 instance from which you want to create a CAT All instance</param>
 /// <param name="First_time_of_day">Parameter that indicates the time 00:00:00 of the day of the message (if the message is from the second day the time will be 86400)</param>
 /// <param name="first_time">Indicates the time of the first message in that file. In this way, if a file lasts 2
 /// days we can identify the messages that are on the second day and host them correctly</param>
 public CATALL(CAT10 message, int First_time_of_day, int first_time)
 {
     this.num = message.num;
     this.CAT = message.CAT;
     this.SAC = message.SAC;
     this.SIC = message.SIC;
     this.Target_Identification = message.TAR;
     this.Target_Address        = message.Target_Address;
     this.Track_number          = message.Track_Number;
     this.Latitude_in_WGS_84    = message.LatitudeWGS_84_map;
     this.Longitude_in_WGS_84   = message.LongitudeWGS_84_map;
     this.Flight_level          = message.Flight_Level;
     if (message.Time_of_day_sec < first_time)
     {
         this.List_Time_Of_Day = message.Time_of_day_sec + 86400 + First_time_of_day;
     }
     else
     {
         this.List_Time_Of_Day = message.Time_of_day_sec + First_time_of_day;
     }
     if (message.TOT == "Ground vehicle")
     {
         type = "car";
     }
     else if (message.TOT == "Aircraft")
     {
         type = "plane";
     }
     else
     {
         type = "undetermined";
     }
     if (message.TYP == "PSR")
     {
         DetectionMode = "SMR";
     }
     if (message.TYP == "Mode S MLAT")
     {
         DetectionMode = "MLAT";
     }
 }
        private void dispatcherTimer_TickCAT10(object sender, EventArgs e)
        {
            checkActual();
            Boolean t = true;

            while (t == true)
            {
                CAT10 cat10 = CAT10s[this.contador];
                this.tiempo = cat10.TimeOfDay.Split(':');
                if (Convert.ToInt32(tiempo[2]) == secact)
                {
                    if (cat10.TYP == "PSR")
                    {
                        addMarkerSMR(Convert.ToDouble(cat10.Xcomponent), Convert.ToDouble(cat10.Ycomponent), cat10.TargetID);
                    }
                    if (cat10.TYP == "Mode S MLAT")
                    {
                        addMarkerMLAT(Convert.ToDouble(cat10.Xcomponent), Convert.ToDouble(cat10.Ycomponent), cat10.TargetID);
                    }
                    this.contador++;
                    if (mapView.Markers.Count >= 200)
                    {
                        mapView.Markers[mapView.Markers.Count - 200].Clear();
                    }
                }
                else
                {
                    t = false;
                    secact++;
                }

                clockUpdate(this.tiempo);
            }
            flightdata.Rows.Clear();
            fillGridFlightsCAT10();
        }
예제 #3
0
 public CAT10_INFOFLIGHT(CAT10 cat10, List <PointLatLng> listaCoordenadas)
 {
     InitializeComponent();
     this.cat10            = cat10;
     this.listaCoordenadas = listaCoordenadas;
 }
예제 #4
0
        public void leer()
        {
            byte[]        fileBytes = File.ReadAllBytes(path);
            List <byte[]> listabyte = new List <byte[]>();
            int           i         = 0;
            int           contador  = fileBytes[2];

            while (i < fileBytes.Length)
            {
                byte[] array = new byte[contador];
                for (int j = 0; j < array.Length; j++)
                {
                    array[j] = fileBytes[i];
                    i++;
                }
                listabyte.Add(array);
                if (i + 2 < fileBytes.Length)
                {
                    contador = fileBytes[i + 2];
                }
            }


            List <string[]> listahex = new List <string[]>();

            for (int x = 0; x < listabyte.Count; x++)
            {
                byte[]   buffer   = listabyte[x];
                string[] arrayhex = new string[buffer.Length];
                for (int y = 0; y < buffer.Length; y++)
                {
                    arrayhex[y] = buffer[y].ToString("X");
                    if (arrayhex[y].Length != 2)
                    {
                        arrayhex[y] = String.Concat("0", arrayhex[y]);
                    }
                }
                listahex.Add(arrayhex);
            }

            for (int q = 0; q < listahex.Count; q++)
            {
                string[] arraystring = listahex[q];
                int      CAT         = int.Parse(arraystring[0], System.Globalization.NumberStyles.HexNumber);

                if (CAT == 10)
                {
                    //try
                    //{
                    CAT10 newcat10 = new CAT10(arraystring);
                    newcat10.Calculate_FSPEC(newcat10.paquete);
                    listaCAT10.Add(newcat10);

                    //}
                    //catch
                    //{
                    //    Console.WriteLine(q);
                    //    Console.ReadKey();
                    //}
                }


                if (CAT == 21)
                {
                    string FSPEC = "";

                    int  j     = 3;
                    bool found = false;

                    while (found == false)
                    {
                        FSPEC = Convert.ToString(Convert.ToInt32(arraystring[j], 16), 2);// Convertir de hex a binario paquete [3]
                        FSPEC = AddZeros(FSPEC);

                        if (Char.ToString(FSPEC[FSPEC.Length - 1]) == "1")
                        {
                            while (Char.ToString(FSPEC[FSPEC.Length - 1]) != "0")
                            {
                                j = j + 1;
                                string parte2 = Convert.ToString(Convert.ToInt32(arraystring[j], 16), 2);
                                parte2 = AddZeros(parte2);

                                FSPEC = String.Concat(FSPEC, parte2);
                            }

                            found = true;
                        }

                        found = true;
                    }

                    int data_position = 1 + 2 + ((FSPEC.Length) / 8);

                    string string1 = Convert.ToString(arraystring[data_position]);
                    string1 = Convert.ToString(Convert.ToInt32(string1, 16), 2);
                    string1 = AddZeros(string1);

                    string string2 = Convert.ToString(arraystring[data_position + 1]);
                    string2 = Convert.ToString(Convert.ToInt32(string2, 16), 2);
                    string2 = AddZeros(string2);

                    data_position = data_position + 2;

                    string DataSourceIdentification = String.Concat(string1, string2);

                    Calculate_DataSourceIdentification(DataSourceIdentification);

                    // ahora que sabemos que version es cada paquete los metemos en su lista correspondiente.

                    if (SAC == 20 && SIC == 219)
                    {
                        CAT21 newcat21 = new CAT21(arraystring);
                        newcat21.Calculate_FSPEC(newcat21.paquete);
                        listaCAT21.Add(newcat21);
                    }

                    if (SAC == 0 && SIC == 107)
                    {
                        CAT21v23 newcat21v23 = new CAT21v23(arraystring);
                        newcat21v23.Calculate_FSPEC(newcat21v23.paquete);
                        listaCAT21v23.Add(newcat21v23);
                    }
                }
            }
        }
        private void searchbut_Click(object sender, RoutedEventArgs e) // botón SEARCH
        {
            if (combobox.SelectedIndex == 0)                           // buscar por número de paquete
            {
                try
                {
                    int package = Convert.ToInt32(searchbox.Text) - 1;

                    if (this.cat == 10)
                    {
                        CAT10 cat10search = f.getCAT10(package);

                        dataCATsearch = f.getTablaCAT10Indv(cat10search, package);

                        gridCAT.ItemsSource = dataCATsearch.DefaultView;
                        gridCAT.Items.Refresh();

                        filldataexpandedCAT10(package);
                    }
                    if (this.cat == 20)
                    {
                        CAT20 cat20search = f.getCAT20(package);

                        dataCATsearch = f.getTablaCAT20Indv(cat20search, package);

                        gridCAT.ItemsSource = dataCATsearch.DefaultView;
                        gridCAT.Items.Refresh();

                        filldataexpandedCAT20(package);
                    }
                    if (this.cat == 21)
                    {
                        CAT21 cat21search = f.getCAT21(package);

                        dataCATsearch = f.getTablaCAT21Indv(cat21search, package);

                        gridCAT.ItemsSource = dataCATsearch.DefaultView;
                        gridCAT.Items.Refresh();

                        filldataexpandedCAT21(package);
                    }
                }
                catch
                {
                    MessageBox.Show("Package not available, check the number");
                }
            }
            if (combobox.SelectedIndex == 1) // buscar por callsign
            {
                try
                {
                    if (this.cat == 10)
                    {
                        dataCATsearch = f.SearchCallsignCAT10(searchbox.Text);

                        gridCAT.ItemsSource = dataCATsearch.DefaultView;
                        gridCAT.Items.Refresh();
                    }
                    if (this.cat == 20)
                    {
                        dataCATsearch = f.SearchCallsignCAT20(searchbox.Text);

                        gridCAT.ItemsSource = dataCATsearch.DefaultView;
                        gridCAT.Items.Refresh();
                    }
                    if (this.cat == 21)
                    {
                        dataCATsearch = f.SearchCallsignCAT21(searchbox.Text);

                        gridCAT.ItemsSource = dataCATsearch.DefaultView;
                        gridCAT.Items.Refresh();
                    }
                }
                catch
                {
                    MessageBox.Show("Package not available, check the callsign");
                }
            }
            if (combobox.SelectedIndex == 2) // buscar por track number
            {
                try
                {
                    if (this.cat == 10)
                    {
                        dataCATsearch = f.SearchTrackNumberCAT10(searchbox.Text);

                        gridCAT.ItemsSource = dataCATsearch.DefaultView;
                        gridCAT.Items.Refresh();
                    }
                    if (this.cat == 20)
                    {
                        dataCATsearch = f.SearchTrackNumberCAT20(searchbox.Text);

                        gridCAT.ItemsSource = dataCATsearch.DefaultView;
                        gridCAT.Items.Refresh();
                    }
                    if (this.cat == 21)
                    {
                        dataCATsearch = f.SearchTrackNumberCAT21(searchbox.Text);

                        gridCAT.ItemsSource = dataCATsearch.DefaultView;
                        gridCAT.Items.Refresh();
                    }
                }
                catch
                {
                    MessageBox.Show("Package not available, check the track number");
                }
            }
        }
        private void filldataexpandedCAT10(int index) //crea la tabla pequeña de CAT10 (solo con los items que existan)
        {
            DataTable expanded = new DataTable();
            CAT10     cat10exp = f.getCAT10(index);

            expanded.Columns.Add(new DataColumn());
            expanded.Columns.Add(new DataColumn());

            expanded.Rows.Add("Package #", index + 1);
            if (cat10exp.DataSourceID != null)
            {
                expanded.Rows.Add("Data Source ID", cat10exp.DataSourceID);
            }
            if (cat10exp.TargetID != null)
            {
                expanded.Rows.Add("Target ID", cat10exp.TargetID);
            }
            if (cat10exp.TrackNumber != null)
            {
                expanded.Rows.Add("Track Number", cat10exp.TrackNumber);
            }
            if (cat10exp.TYP != null)
            {
                expanded.Rows.Add("Data Type", cat10exp.TYP);
            }
            if (cat10exp.TimeOfDay != null)
            {
                expanded.Rows.Add("Time of Day (UTC)", cat10exp.TimeOfDay);
            }
            if (cat10exp.positionWGS != null)
            {
                expanded.Rows.Add("Position in WGS-84\n[Latitude, Longitude]", cat10exp.positionWGS);
            }
            if (cat10exp.positionPolar != null)
            {
                expanded.Rows.Add("Position in Polar\n[Distance, Angle]", cat10exp.positionPolar);
            }
            if (cat10exp.positionCartesian != null)
            {
                expanded.Rows.Add("Position in Cartesian\n[X, Y]", cat10exp.positionCartesian);
            }
            if (cat10exp.velocityPolar != null)
            {
                expanded.Rows.Add("Track Velocity in Polar\n[Ground Speed, Track Angle]", cat10exp.velocityPolar);
            }
            if (cat10exp.velocityCartesian != null)
            {
                expanded.Rows.Add("Track Velocity in Cartesian\n[Vx, Vy]", cat10exp.velocityCartesian);
            }
            if (cat10exp.FlightLevel != null)
            {
                expanded.Rows.Add("Flight Level", cat10exp.FlightLevel);
            }
            if (cat10exp.MessageType != null)
            {
                expanded.Rows.Add("Message Type", cat10exp.MessageType);
            }
            if (cat10exp.DataCharacteristics != null)
            {
                expanded.Rows.Add("Data Characteristics", cat10exp.DataCharacteristics);
            }
            if (cat10exp.TrackStatus != null)
            {
                expanded.Rows.Add("Track Status", cat10exp.TrackStatus);
            }
            if (cat10exp.Mode3ACode != null)
            {
                expanded.Rows.Add("Mode 3/A Code", cat10exp.Mode3ACode);
            }
            if (cat10exp.TargetAddress != null)
            {
                expanded.Rows.Add("Target Address", cat10exp.TargetAddress);
            }
            try
            {
                int cont = 1;
                while (cont <= cat10exp.MBdata.Count())
                {
                    expanded.Rows.Add("Mode S MB Data #" + cont, cat10exp.ModeS[cont + 1]);
                    cont++;
                }
            }
            catch { }
            if (cat10exp.VFI != null)
            {
                expanded.Rows.Add("Vehicle Fleet ID", cat10exp.VFI);
            }
            if (cat10exp.MeasuredHeight != null)
            {
                expanded.Rows.Add("Measured Height", cat10exp.MeasuredHeight);
            }
            if (cat10exp.TargetSize != null)
            {
                expanded.Rows.Add("Target Size\n[Length x Width]", cat10exp.TargetSize);
            }
            if (cat10exp.TargetOrientation_ != null)
            {
                expanded.Rows.Add("Target Orientation", cat10exp.TargetOrientation_);
            }
            if (cat10exp.SystemStatus != null)
            {
                expanded.Rows.Add("System Status", cat10exp.SystemStatus);
            }
            if (cat10exp.MSG != null)
            {
                expanded.Rows.Add("Pre-programmed Message", cat10exp.MSG);
            }
            if (cat10exp.deviation != null)
            {
                expanded.Rows.Add("Standard Deviation of Position\n[X, Y]", cat10exp.deviation);
            }
            if (cat10exp.covariance != null)
            {
                expanded.Rows.Add("Covariance of Deviation", cat10exp.covariance);
            }
            try
            {
                int count = 1;
                while (count <= cat10exp.Presence.Count())
                {
                    expanded.Rows.Add("Presence #" + count.ToString(), cat10exp.Presence[count - 1]);
                    count++;
                }
            }
            catch { }
            if (cat10exp.amplitudePP != null)
            {
                expanded.Rows.Add("Amplitude of Primary Plot", cat10exp.amplitudePP);
            }
            if (cat10exp.acceleration != null)
            {
                expanded.Rows.Add("Calculated Acceleration\n[Ax, Ay]", cat10exp.acceleration);
            }

            dataexpanded.ItemsSource = expanded.DefaultView;
            dataexpanded.Items.Refresh();
        }
        void ClikDataGrid(object sender, RoutedEventArgs e) //al clicar en una celda de la tabla
        {
            //cogemos la celda
            DataGridCell cell = (DataGridCell)sender;
            int          c    = cell.Column.DisplayIndex; //número de columna
            DataGridRow  r2   = DataGridRow.GetRowContainingElement(cell);
            int          fil  = r2.GetIndex();            //número de fila

            if (this.cat == 10)
            {
                //cojo el paquete
                CAT10 paquete = f.getCAT10(fil);

                //expandimos información:
                if (c == 7 && paquete.DataCharacteristics != null) // Target Report - Data Characteristics
                {
                    MessageBox.Show(paquete.DataCharacteristics, "Data Characteristics");
                }
                if (c == 14 && paquete.TrackStatus != null) // Track Status
                {
                    MessageBox.Show(paquete.TrackStatus, "Track Status");
                }
                if (c == 27 && paquete.Presence != null) // Presence
                {
                    MessageBox.Show(paquete.Presence, "Presence");
                }
                if (c == 17 && paquete.ModeS != null) // Mode S MB Data
                {
                    MessageBox.Show(paquete.ModeS, "Mode S MB Data");
                }
                if (c == 23 && paquete.SystemStatus != null) // System Status
                {
                    MessageBox.Show(paquete.SystemStatus, "System Status");
                }

                //mostramos las características de ese paquete a parte:
                filldataexpandedCAT10(fil);
            }
            if (this.cat == 20)
            {
                CAT20 paquete = f.getCAT20(fil);

                //expandimos información:
                if (c == 6 && paquete.getTargetReportDescriptortoString() != null)
                {
                    MessageBox.Show(paquete.getTargetReportDescriptortoString(), "Target Report Descriptor");
                }
                if (c == 10 && paquete.getTrackStatusToString() != null) //Track status
                {
                    MessageBox.Show(paquete.getTrackStatusToString(), "Track Status");
                }
                if (c == 21 && paquete.getPositionAccuracyToString() != null) //Pos Accuracy
                {
                    MessageBox.Show(paquete.getPositionAccuracyToString(), "Position Accuracy");
                }

                //mostramos las características de ese paquete a parte:
                filldataexpandedCAT20(fil);
            }
            if (this.cat == 21)
            {
                CAT21 paquete = f.getCAT21(fil);

                //expandimos información:
                if (c == 5 && paquete.TargetReport != null) //Target Report Descriptor
                {
                    MessageBox.Show(paquete.TargetReport, "Target Report Descriptor");
                }
                if (c == 11 && paquete.OperationalStatus != null) //Operational Status
                {
                    MessageBox.Show(paquete.OperationalStatus, "Operational Status");
                }
                if (c == 48 && paquete.FigureOfMerit != null) //Figure Of Merit
                {
                    MessageBox.Show(paquete.FigureOfMerit, "Figure of Merit");
                }
                if (c == 49 && paquete.ages != null) //Data ages
                {
                    MessageBox.Show(paquete.ages, "Data Ages");
                }
                if (c == 41 && paquete.TrajectoryIntentData != null) //Trajectory Intent Data
                {
                    MessageBox.Show(paquete.TrajectoryIntentData, "Trajectory Intent Data");
                }
                if (c == 32 && paquete.LinkTech != null) //Link Technology
                {
                    MessageBox.Show(paquete.LinkTech, "Link Technology");
                }
                if (c == 26 && paquete.TargetStatus != null) //Target Status
                {
                    MessageBox.Show(paquete.TargetStatus, "Target Status");
                }
                if (c == 21 && paquete.MetReport != null) //Met Report
                {
                    MessageBox.Show(paquete.MetReport, "Met Report");
                }
                if (c == 30 && paquete.QualityIndicators != null) //Quality Indicators
                {
                    MessageBox.Show(paquete.QualityIndicators, "Quality Indicators");
                }
                if (c == 28 && paquete.ModeS != null) //Mode S
                {
                    MessageBox.Show(paquete.ModeS, "Mode S");
                }
                if (c == 18 && paquete.MOPS != null) //MOPS version
                {
                    MessageBox.Show(paquete.MOPS, "MOPS Version");
                }

                //mostramos las características de ese paquete a parte:
                filldataexpandedCAT21(fil);
            }
        }
예제 #8
0
 public CAT10_TARGET(CAT10 cat10)
 {
     InitializeComponent();
     this.cat10 = cat10;
 }
 public MoreInfoOfPacketCAT10(CAT10 packet)
 {
     InitializeComponent();
     this.selectedPacket = packet;
 }
예제 #10
0
 public CAT10_TRACKSTATUS(CAT10 cat10)
 {
     InitializeComponent();
     this.cat10 = cat10;
 }
예제 #11
0
 public AircraftInformation(CAT10 cat10)
 {
     InitializeComponent();
     this.cat10 = cat10;
 }