Exemplo n.º 1
0
 public MomentDetail(LogFileManager manager)
 {
     filemanager = manager;
     InitializeComponent();
     chart1.Series[0].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.String;
     ReadCache(0f);
     data = CacheData2[0];
     PlotGraph(data);
     CacheData = CacheData2;
 }
Exemplo n.º 2
0
        public GPSData ReadGPSstatus(float pos)
        {
            GPSData tempdata = new GPSData();
                GPS.Position = Functions.QuantizePosition12bit(pos * GPS.Length);
                Glonass.Position = Functions.QuantizePosition12bit(pos * Glonass.Length);
                Sat.Position = Functions.QuantizePosition8bit(pos * Sat.Length);
                timestream.Position = Functions.QuantizePosition6bit(pos * timestream.Length);

               // UsedStats.Position = Functions.QuantizePosition(pos * UsedStats.Length);
               // VisibleStats.Position = Functions.QuantizePosition(pos * VisibleStats.Length);

                byte[] time = new byte[6];
                timestream.Read(time, 0, 6);
                tempdata.Time = Functions.ReadDateTime(time);

                byte[] stats = new byte[16];
                Sat.Read(stats, 0, 8);

                int visible = 0, used = 0;

                int a = stats[3]; for (int i = 2; i >= 0; --i) { a = a * 256 + stats[i];}
                for (int i = 0; i < 32; ++i)
                {
                    tempdata.GPS[i] = new Satellite();
                    if (a % 2 == 1)
                    {
                        tempdata.GPS[i].Signal_Status = 1;       //visible
                        visible++;
                    }
                    else
                        tempdata.GPS[i].Signal_Status = 0;       //not visible
                    a >>= 1;
                }

                a = stats[7]; for (int i = 2; i >= 0; --i) { a = a * 256 + stats[4 + i];}
                for (int i = 0; i < 32; ++i)
                {
                    if (a % 2 == 1)
                    {
                        tempdata.GPS[i].Signal_Status = 2;       //Used
                        used++;
                    }
                    a >>= 1;
                }

                tempdata.VisibleGPS = visible;
                tempdata.UsedGPS = used;
                visible = 0;
                used = 0;

                a = stats[11]; for (int i = 2; i >= 0; --i) { a = a * 256 + stats[8 + i];}
                for (int i = 0; i < 32; ++i)
                {
                    tempdata.Glonass[i] = new Satellite();
                    if (a % 2 == 1)
                    {
                        tempdata.Glonass[i].Signal_Status = 1;       //visible
                        visible++;
                    }
                    else
                        tempdata.Glonass[i].Signal_Status = 0;       //not visible
                    a >>= 1;
                }

                a = stats[15]; for (int i = 2; i >= 0; --i) { a = a * 256 + stats[12 + i];}
                for (int i = 0; i < 32; ++i)
                {
                    if (a % 2 == 1)
                    {
                        tempdata.Glonass[i].Signal_Status = 2;       //Used
                        used++;
                    }
                    a >>= 1;
                }

                tempdata.VisibleGlonass = visible;
                tempdata.UsedGlonass = used;

                byte[] t = new byte[12];
                GPS.Read(t, 0, 12);
                int index = 0;
                for (int i = 0; i < 32; ++i)
                {
                    if (tempdata.GPS[i].Signal_Status != 0)      //visible
                    {
                        tempdata.GPS[i].SNR = t[index];
                        index++;
                        if (index > 12)
                            break;
                    }
                }

                Glonass.Read(t, 0, 12);
                index = 0;
                for (int i = 0; i < 32; ++i)
                {
                    if (tempdata.Glonass[i].Signal_Status != 0)      //visible
                    {
                        tempdata.Glonass[i].SNR = t[index];
                        index++;
                        if (index > 12)
                            break;
                    }
                }

                return tempdata;
        }
Exemplo n.º 3
0
        public void PlotGraph(GPSData data)
        {
            VisibleGLONASS = VisibleGPS = UsedGLONASS = UsedGPS = 0;

            int counter = 0;
            for (int i = 0; i < 32; i++)
            {
                if (data.GPS[i].Signal_Status == 1)
                {
                    try
                    {
                        chart1.Series[0].Points[counter].SetValueXY(i.ToString() + "(" + data.GPS[i].SNR.ToString() + ")", data.GPS[i].SNR);
                        chart1.Series[0].Points[counter].Color = Color.Blue;
                    }
                    catch
                    {
                        chart1.Series[0].Points.AddXY(i.ToString() + "(" + data.GPS[i].SNR.ToString() + ")", data.GPS[i].SNR);
                        chart1.Series[0].Points[chart1.Series[0].Points.Count-1].Color = Color.Blue;
                    }
                    VisibleGPS++;
                    counter++;
                }
                if (data.GPS[i].Signal_Status == 2)
                {
                    try
                    {
                        chart1.Series[0].Points[counter].SetValueXY(i.ToString() + "(" + data.GPS[i].SNR.ToString() + ")", data.GPS[i].SNR);
                        chart1.Series[0].Points[counter].Color = Color.Green;
                    }
                    catch
                    {
                        chart1.Series[0].Points.AddXY(i.ToString() + "(" + data.GPS[i].SNR.ToString() + ")", data.GPS[i].SNR);
                        chart1.Series[0].Points[chart1.Series[0].Points.Count-1].Color = Color.Green;
                    }
                    VisibleGPS++;
                    UsedGPS++;
                    counter++;
                }
            }
            //removing previous unneccesary datas
            if (counter < chart1.Series[0].Points.Count && counter != 0)
            {
                for (int i = chart1.Series[0].Points.Count-1; i >= counter; i--)
                    chart1.Series[0].Points.RemoveAt(i);
            }
            counter = 0;
            for (int i = 0; i < 32; i++)
            {
                if (data.Glonass[i].Signal_Status == 1)
                {
                    try
                    {
                        chart2.Series[0].Points[counter].SetValueXY(i.ToString() + "(" + data.Glonass[i].SNR.ToString() + ")", data.Glonass[i].SNR);
                        chart2.Series[0].Points[counter].Color = Color.Blue;
                    }
                    catch
                    {
                        chart2.Series[0].Points.AddXY(i.ToString() + "(" + data.Glonass[i].SNR.ToString() + ")", data.Glonass[i].SNR);
                        chart2.Series[0].Points[chart1.Series[0].Points.Count - 1].Color = Color.Blue;
                    }
                    VisibleGLONASS++;
                    counter++;
                }
                if (data.Glonass[i].Signal_Status == 2)
                {
                    try
                    {
                        chart2.Series[0].Points[counter].SetValueXY(i.ToString() + "(" + data.Glonass[i].SNR.ToString() + ")", data.Glonass[i].SNR);
                        chart2.Series[0].Points[counter].Color = Color.Green;
                    }
                    catch
                    {
                        chart2.Series[0].Points.AddXY(i.ToString() + "(" + data.Glonass[i].SNR.ToString() + ")", data.Glonass[i].SNR);
                        chart2.Series[0].Points[chart1.Series[0].Points.Count - 1].Color = Color.Green;
                    }
                    VisibleGLONASS++;
                    UsedGLONASS++;
                    counter++;
                }
            }
            //removing previous unneccesary datas
            if (counter < chart2.Series[0].Points.Count && counter != 0)
            {
                for (int i = chart2.Series[0].Points.Count - 1; i >= counter; i--)
                    chart2.Series[0].Points.RemoveAt(i);
            }
            updateLabels(data.Time,VisibleGPS,UsedGPS,VisibleGLONASS,UsedGLONASS);
        }
Exemplo n.º 4
0
 public void UpdateData(double xpos, DateTime time)
 {
     position = (float)xpos;
     data = filemanager.ReadGPSstatus(position);
     ReadCache(position);
     updateLabels(time,0,0,0,0);
     PlotGraph(data);
     CacheData = CacheData2;
 }