コード例 #1
0
        private void getSignalForGUI_NMEA(string str)
        {
            PositionInfo.PositionStruct struct2;
            string str5;
            int num8;
            string nmeaMsg = str;
            if (str.Contains("*"))
            {
                nmeaMsg = str.Substring(0, str.Length - 3);
            }
            Hashtable hashtable = this.m_Protocols.ConvertRawToHash_NMEAMsgs(nmeaMsg);
            if (hashtable.ContainsKey("Message ID"))
            {
                string str3 = (string) hashtable["Message ID"];
                struct2 = new PositionInfo.PositionStruct();
                if (!(str3 == "$GPGGA"))
                {
                    if (!(str3 == "$GPGSA"))
                    {
                        switch (str3)
                        {
                            case "$GPRMC":
                                if (this.dataGui.Positions.PositionList.Count > 0)
                                {
                                    struct2 = (PositionInfo.PositionStruct) this.dataGui.Positions.PositionList[this.dataGui.Positions.PositionList.Count - 1];
                                }
                                if (hashtable.ContainsKey("Speed Over Ground"))
                                {
                                    try
                                    {
                                        struct2.Speed = Convert.ToDouble((string) hashtable["Speed Over Ground"]);
                                    }
                                    catch
                                    {
                                        struct2.Speed = 0.0;
                                    }
                                }
                                if (hashtable.ContainsKey("Mode"))
                                {
                                    try
                                    {
                                        byte num10 = 0;
                                        string s = (string) hashtable["Mode"];
                                        if (!byte.TryParse(s, out num10))
                                        {
                                            num10 = byte.Parse(s, NumberStyles.HexNumber);
                                        }
                                        if (num10 == 5)
                                        {
                                            this.NavigationParamrters.FiveHzNavMode = 1;
                                            this.NMEA_navMode = this.NMEA_navMode + " 5Hz";
                                        }
                                        else
                                        {
                                            this.NavigationParamrters.FiveHzNavMode = 0;
                                            this.NMEA_navMode = this.NMEA_navMode + " 1Hz";
                                        }
                                        struct2.NavModeString = this.NMEA_navMode;
                                    }
                                    catch
                                    {
                                    }
                                }
                                break;

                            case "$GPGSV":
                            {
                                int num11 = 0;
                                int num12 = 1;
                                if (hashtable.ContainsKey("Number of Messages"))
                                {
                                    try
                                    {
                                        num11 = Convert.ToInt32((string) hashtable["Number of Messages"]);
                                    }
                                    catch
                                    {
                                        num11 = 0;
                                    }
                                }
                                if (hashtable.ContainsKey("Message Number"))
                                {
                                    try
                                    {
                                        num12 = Convert.ToInt32((string) hashtable["Message Number"]);
                                    }
                                    catch
                                    {
                                        num12 = 0;
                                    }
                                }
                                if ((num11 >= 1) && (num12 == 1))
                                {
                                    for (int j = 0; j < DataForGUI.MAX_PRN; j++)
                                    {
                                        this.dataGui.PRN_Arr_CNO[j] = 0f;
                                        this.dataGui.PRN_Arr_Azimuth[j] = 0f;
                                        this.dataGui.PRN_Arr_Elev[j] = 0f;
                                        this.dataGui.PRN_Arr_State[j] = 0;
                                        this.dataGui.PRN_Arr_ID[j] = 0;
                                    }
                                    for (int k = 0; k < 12; k++)
                                    {
                                        this.dataGui.SignalDataForGUI.CHAN_Arr_CNO[k] = 0f;
                                        this.dataGui.SignalDataForGUI.CHAN_Arr_Azimuth[k] = 0f;
                                        this.dataGui.SignalDataForGUI.CHAN_Arr_Elev[k] = 0f;
                                        this.dataGui.SignalDataForGUI.CHAN_Arr_State[k] = 0;
                                        this.dataGui.SignalDataForGUI.CHAN_Arr_ID[k] = 0;
                                        for (int m = 0; m < 10; m++)
                                        {
                                            this.dataGui.SignalDataForGUI.CHAN_MEAS_CNO[k][m] = 0;
                                        }
                                    }
                                }
                                for (int i = 0; i < 4; i++)
                                {
                                    int index = 0;
                                    string key = "Satellite ID " + ((i + 1)).ToString();
                                    string str9 = "Elevation " + ((i + 1)).ToString();
                                    string str10 = "Azimuth " + ((i + 1)).ToString();
                                    string str8 = "SNR (C/No) " + ((i + 1)).ToString();
                                    if (hashtable.ContainsKey(key) && (((string) hashtable[key]) != ""))
                                    {
                                        byte num18 = Convert.ToByte((string) hashtable[key]);
                                        index = (4 * (num12 - 1)) + i;
                                        if (index >= 12)
                                        {
                                            index = 11;
                                        }
                                        if ((num18 > 0) && (num18 < DataForGUI.MAX_PRN))
                                        {
                                            this.dataGui.PRN_Arr_ID[num18] = num18;
                                            this.dataGui.SignalDataForGUI.CHAN_Arr_ID[index] = this.dataGui.PRN_Arr_ID[num18];
                                            if (hashtable.ContainsKey(str9))
                                            {
                                                if (((string) hashtable[str9]) != "")
                                                {
                                                    this.dataGui.PRN_Arr_Elev[num18] = (float) Convert.ToDouble((string) hashtable[str9]);
                                                }
                                                else
                                                {
                                                    this.dataGui.PRN_Arr_Elev[num18] = 0f;
                                                }
                                                this.dataGui.SignalDataForGUI.CHAN_Arr_Elev[index] = this.dataGui.PRN_Arr_Elev[num18];
                                            }
                                            if (hashtable.ContainsKey(str10))
                                            {
                                                if (((string) hashtable[str10]) != "")
                                                {
                                                    this.dataGui.PRN_Arr_Azimuth[num18] = (float) Convert.ToDouble((string) hashtable[str10]);
                                                }
                                                else
                                                {
                                                    this.dataGui.PRN_Arr_Azimuth[num18] = 0f;
                                                }
                                                this.dataGui.SignalDataForGUI.CHAN_Arr_Azimuth[index] = this.dataGui.PRN_Arr_Azimuth[num18];
                                            }
                                            if (hashtable.ContainsKey(str8))
                                            {
                                                if (((string) hashtable[str8]) != "")
                                                {
                                                    this.dataGui.PRN_Arr_CNO[num18] = (float) Convert.ToDouble((string) hashtable[str8]);
                                                }
                                                else
                                                {
                                                    this.dataGui.PRN_Arr_CNO[num18] = 0f;
                                                }
                                                this.dataGui.SignalDataForGUI.CHAN_Arr_CNO[index] = this.dataGui.PRN_Arr_CNO[num18];
                                                for (int n = 0; n < 10; n++)
                                                {
                                                    this.dataGui.SignalDataForGUI.CHAN_MEAS_CNO[index][n] = (int) this.dataGui.PRN_Arr_CNO[num18];
                                                }
                                            }
                                        }
                                    }
                                }
                                lock (this.LockSignalDataUpdate)
                                {
                                    if (this.SignalDataQ.Count >= this.MAX_SIG_BUFFER)
                                    {
                                        this.SignalDataQ.Dequeue();
                                    }
                                    this.SignalDataQ.Enqueue(this.dataGui.SignalDataForGUI);
                                }
                                if (num11 == num12)
                                {
                                    if (this.DisplayPanelSignal != null)
                                    {
                                        this.DisplayPanelSignal.Invalidate();
                                    }
                                    if (this.DisplayPanelSVs != null)
                                    {
                                        this.DisplayPanelSVs.Invalidate();
                                    }
                                    if (this.DisplayPanelSVTraj != null)
                                    {
                                        this.DisplayPanelSVTraj.Invalidate();
                                    }
                                    if (this.DisplayPanelSatelliteStats != null)
                                    {
                                        this.msgid4Update = true;
                                        this.DisplayPanelSatelliteStats.Invalidate();
                                    }
                                }
                                break;
                            }
                        }
                        return;
                    }
                    if (this.dataGui.Positions.PositionList.Count > 0)
                    {
                        struct2 = (PositionInfo.PositionStruct) this.dataGui.Positions.PositionList[this.dataGui.Positions.PositionList.Count - 1];
                    }
                    str5 = "";
                    int num7 = 0;
                    if (!hashtable.ContainsKey("Mode 2"))
                    {
                        goto Label_0561;
                    }
                    try
                    {
                        num7 = Convert.ToInt32((string) hashtable["Mode 2"]);
                    }
                    catch
                    {
                        num7 = 0;
                    }
                    switch (num7)
                    {
                        case 2:
                            this.NMEA_navMode = "2-D";
                            struct2.NavValid = 0;
                            goto Label_0554;

                        case 3:
                            this.NMEA_navMode = "3-D";
                            struct2.NavValid = 0;
                            goto Label_0554;
                    }
                    this.NMEA_navMode = "No Fix";
                    struct2.NavValid = 1;
                    goto Label_0554;
                }
                long num2 = 0L;
                double num3 = 0.0;
                long result = 0L;
                if (hashtable.ContainsKey("Latitude"))
                {
                    try
                    {
                        num2 = Math.DivRem((long) (Convert.ToDouble((string) hashtable["Latitude"]) * 10000.0), 0xf4240L, out result);
                        num3 = ((double) result) / 600000.0;
                        struct2.Latitude = num2 + num3;
                    }
                    catch
                    {
                        struct2.Latitude = 0.0;
                    }
                }
                if (hashtable.ContainsKey("Latitude N/S") && (((string) hashtable["Latitude N/S"]) == "S"))
                {
                    struct2.Latitude = -struct2.Latitude;
                }
                if (hashtable.ContainsKey("Longitude"))
                {
                    try
                    {
                        num2 = Math.DivRem((long) (Convert.ToDouble((string) hashtable["Longitude"]) * 10000.0), 0xf4240L, out result);
                        num3 = ((double) result) / 600000.0;
                        struct2.Longitude = num2 + num3;
                    }
                    catch
                    {
                        struct2.Longitude = 0.0;
                    }
                }
                if (hashtable.ContainsKey("Longitude E/W") && (((string) hashtable["Longitude E/W"]) == "W"))
                {
                    struct2.Longitude = -struct2.Longitude;
                }
                if (hashtable.ContainsKey("Altitude mean sea level(geoid)"))
                {
                    try
                    {
                        struct2.Altitude = Convert.ToDouble((string) hashtable["Altitude mean sea level(geoid)"]);
                    }
                    catch
                    {
                        struct2.Altitude = 0.0;
                    }
                    if (hashtable.ContainsKey("Geoidal separation 1"))
                    {
                        try
                        {
                            double num5 = Convert.ToDouble((string) hashtable["Geoidal separation 1"]);
                            struct2.Altitude += num5;
                        }
                        catch
                        {
                            struct2.Altitude = 0.0;
                        }
                    }
                }
                if (hashtable.ContainsKey("HDOP"))
                {
                    try
                    {
                        struct2.HDOP = Convert.ToDouble((string) hashtable["HDOP"]);
                    }
                    catch
                    {
                        struct2.HDOP = 0.0;
                    }
                }
                if (hashtable.ContainsKey("Num Svs in use"))
                {
                    try
                    {
                        struct2.SatellitesUsed = Convert.ToUInt32((string) hashtable["Num Svs in use"]);
                    }
                    catch
                    {
                        struct2.SatellitesUsed = 0;
                    }
                }
                if (hashtable.ContainsKey("UTC"))
                {
                    string str4 = (string) hashtable["UTC"];
                    try
                    {
                        struct2.RxTime_Hour = Convert.ToInt32(str4.Substring(0, 2));
                    }
                    catch
                    {
                        struct2.RxTime_Hour = 0;
                    }
                    try
                    {
                        struct2.RxTime_Minute = Convert.ToInt32(str4.Substring(2, 2));
                    }
                    catch
                    {
                        struct2.RxTime_Minute = 0;
                    }
                    try
                    {
                        struct2.RxTime_second = (ushort) (Convert.ToUInt16(str4.Substring(4, 2)) * 0x3e8);
                    }
                    catch
                    {
                        struct2.RxTime_second = 0;
                    }
                }
                byte num6 = 0;
                if (hashtable.ContainsKey("GPS Quality Indicator"))
                {
                    try
                    {
                        num6 = Convert.ToByte((string) hashtable["GPS Quality Indicator"]);
                    }
                    catch
                    {
                        num6 = 0;
                    }
                }
                switch (num6)
                {
                    case 1:
                        this.dataGui._PMODE = num6;
                        struct2.NavValid = 0;
                        break;

                    case 2:
                        this.dataGui._PMODE = num6;
                        struct2.NavValid = 0;
                        break;

                    default:
                        this.dataGui._PMODE = 0;
                        struct2.NavValid = 1;
                        break;
                }
                struct2.NavModeString = this.NMEA_navMode;
                if (this.dataGui.Positions.PositionList.Count >= 0x2710)
                {
                    this.dataGui.Positions.PositionList.RemoveRange(0, this.dataGui.Positions.PositionList.Count / 2);
                }
                this.dataGui.Positions.PositionList.Add(struct2);
                if (this.DisplayPanelLocation != null)
                {
                    this.DisplayPanelLocation.Invalidate();
                }
            }
            return;
            Label_0554:
            struct2.NavModeString = this.NMEA_navMode;
            Label_0561:
            num8 = 1;
            while (num8 < 13)
            {
                str5 = "Satellite Used " + num8.ToString();
                if (hashtable.ContainsKey(str5) && (((string) hashtable[str5]) != ""))
                {
                    byte num9 = Convert.ToByte((string) hashtable[str5]);
                    this.dataGui.PRN_Arr_PRNforSolution[num9] = 1;
                }
                num8++;
            }
        }
コード例 #2
0
        private void getMsg41DataFromHash(Hashtable msgH)
        {
            ushort navValid = 0xffff;
            PositionInfo.PositionStruct struct2 = new PositionInfo.PositionStruct();
            if (msgH.ContainsKey("Nav Valid"))
            {
                struct2.NavValid = Convert.ToUInt16((string) msgH["Nav Valid"]);
                navValid = struct2.NavValid;
            }
            if (msgH.ContainsKey("TOW"))
            {
                struct2.TOW = Convert.ToDouble((string) msgH["TOW"]);
                if ((this.dataPlot != null) && (navValid == 0))
                {
                    this.dataPlot.InsertTow_nvplot(struct2.TOW / 1000.0);
                }
            }
            if (msgH.ContainsKey("Latitude"))
            {
                struct2.Latitude = Convert.ToDouble((string) msgH["Latitude"]) / 10000000.0;
                if ((this.dataPlot != null) && (navValid == 0))
                {
                    this.dataPlot.InsertLat(struct2.Latitude);
                }
            }
            if (msgH.ContainsKey("Longitude"))
            {
                struct2.Longitude = Convert.ToDouble((string) msgH["Longitude"]) / 10000000.0;
                if ((this.dataPlot != null) && (navValid == 0))
                {
                    this.dataPlot.InsertLon(struct2.Longitude);
                }
            }
            if (msgH.ContainsKey("Altitude from Ellipsoid"))
            {
                struct2.Altitude = Convert.ToDouble((string) msgH["Altitude from Ellipsoid"]) / 100.0;
                if ((this.dataPlot != null) && (navValid == 0))
                {
                    this.dataPlot.InsertAlt(struct2.Altitude);
                    this.dataPlot.UpdateIdx_nvplot();
                }
            }
            if (msgH.ContainsKey("HDOP"))
            {
                struct2.HDOP = Convert.ToDouble((string) msgH["HDOP"]) / 5.0;
            }
            if (msgH.ContainsKey("Satellite ID List"))
            {
                struct2.SatellitesUsed = Convert.ToUInt32((string) msgH["Satellite ID List"]);
            }
            if (msgH.ContainsKey("UTC Hour"))
            {
                struct2.RxTime_Hour = Convert.ToInt32((string) msgH["UTC Hour"]);
            }
            if (msgH.ContainsKey("UTC Minute"))
            {
                struct2.RxTime_Minute = Convert.ToInt32((string) msgH["UTC Minute"]);
            }
            if (msgH.ContainsKey("UTC Second"))
            {
                struct2.RxTime_second = Convert.ToUInt16((string) msgH["UTC Second"]);
            }
            if (msgH.ContainsKey("Speed Over Ground (SOG)"))
            {
                struct2.Speed = Convert.ToDouble((string) msgH["Speed Over Ground (SOG)"]) / 100.0;
            }
            if (msgH.ContainsKey("Course Over Ground (COG True)"))
            {
                struct2.Heading = Convert.ToDouble((string) msgH["Course Over Ground (COG True)"]) / 100.0;
            }
            if (msgH.ContainsKey("Extended Week Number"))
            {
                struct2.ExtWeek = Convert.ToUInt16((string) msgH["Extended Week Number"]);
            }
            if (msgH.ContainsKey("Number of SVs in Fix"))
            {
                this.m_NavData.NumSVsInFix = Convert.ToInt32((string) msgH["Number of SVs in Fix"]);
            }
            string str = "Mode: ";
            byte num2 = 0;
            if (msgH.ContainsKey("NAV Type"))
            {
                struct2.NavType = Convert.ToUInt16((string) msgH["NAV Type"]);
                num2 = (byte) (struct2.NavType & 7);
                switch (num2)
                {
                    case 1:
                        str = str + "1-SV KF";
                        break;

                    case 2:
                        str = str + "2-SVs KF";
                        break;

                    case 3:
                        str = str + "3-SVs KF";
                        break;

                    case 4:
                        str = str + "> 4-SVs KF";
                        break;

                    case 5:
                        str = str + "2-D LSQ";
                        break;

                    case 6:
                        str = str + "3-D LSQ";
                        break;

                    case 7:
                        str = str + "DR";
                        break;

                    default:
                        str = str + "No Fix";
                        break;
                }
                byte num3 = (byte) (struct2.NavType & 8);
                if (num3 == 8)
                {
                    str = str + " + TP";
                }
                byte num4 = (byte) (struct2.NavType & 0x80);
                if (num4 == 0x80)
                {
                    str = str + " + Dgps";
                }
            }
            struct2.NavModeString = str;
            if (!this.AutoReplyCtrl.AutoReplyParams.AutoReply)
            {
                PositionErrorCalc calc = new PositionErrorCalc();
                if (num2 == 0)
                {
                    this.RxCtrl.ResetCtrl.ResetPositionAvailable = false;
                }
                else if (this.RxCtrl.ResetCtrl == null)
                {
                    this.m_NavData.TTFFSiRFLive = 0.0;
                }
                else
                {
                    if (!this.RxCtrl.ResetCtrl.ResetPositionAvailable)
                    {
                        this.m_NavData.TTFFSiRFLive = ((double) (DateTime.Now.Ticks - this.RxCtrl.ResetCtrl.StartResetTime)) / 10000000.0;
                        if (this.m_NavData.TTFFSiRFLive > 1.0)
                        {
                            this.m_NavData.TTFFSiRFLive -= clsGlobal.SiRFLive_TTFF_OFFSET;
                        }
                        this.m_NavData.TTFFReport = this.m_NavData.TTFFSiRFLive;
                    }
                    if (this.m_NavData.ValidatePosition)
                    {
                        double num5 = Convert.ToDouble(this.m_NavData.RefLat);
                        double num6 = Convert.ToDouble(this.m_NavData.RefLon);
                        double num7 = Convert.ToDouble(this.m_NavData.RefAlt);
                        calc.GetPositionErrorsInMeter(struct2.Latitude, struct2.Longitude, struct2.Altitude, num5, num6, num7);
                        this.m_NavData.Nav2DPositionError = calc.HorizontalError;
                        this.m_NavData.Nav3DPositionError = calc.Position3DError;
                        this.m_NavData.NavVerticalPositionError = calc.VerticalErrorInMeter;
                    }
                    else
                    {
                        this.m_NavData.Nav2DPositionError = -9999.0;
                        this.m_NavData.Nav3DPositionError = -9999.0;
                        this.m_NavData.NavVerticalPositionError = -9999.0;
                        this.m_NavData.TTFFSiRFLive = -9999.0;
                    }
                    this.m_NavData.MeasLat = struct2.Latitude;
                    this.m_NavData.MeasLon = struct2.Longitude;
                    this.m_NavData.MeasAlt = struct2.Altitude;
                    this.m_NavData.TOW = struct2.TOW;
                    if (!this.RxCtrl.ResetCtrl.ResetPositionAvailable)
                    {
                        this.m_NavData.FirstFixMeasLat = this.m_NavData.MeasLat;
                        this.m_NavData.FirstFixMeasLon = this.m_NavData.MeasLon;
                        this.m_NavData.FirstFixMeasAlt = this.m_NavData.MeasAlt;
                        this.m_NavData.FirstFix2DPositionError = this.m_NavData.Nav2DPositionError;
                        this.m_NavData.FirstFix3DPositionError = this.m_NavData.Nav3DPositionError;
                        this.m_NavData.FirstFixVerticalPositionError = this.m_NavData.NavVerticalPositionError;
                        this.m_NavData.FirstFixTOW = this.m_NavData.TOW;
                        this.RxCtrl.ResetCtrl.ResetPositionAvailable = true;
                    }
                }
            }
            if (msgH.ContainsKey("Nav Valid"))
            {
                try
                {
                    if ((Convert.ToUInt16((string) msgH["Nav Valid"]) & 0x100) == 0x100)
                    {
                        this.ABPModeIndicator = true;
                        struct2.NavModeString = struct2.NavModeString + " ABP";
                    }
                    else
                    {
                        this.ABPModeIndicator = false;
                    }
                }
                catch
                {
                }
            }
            if (this.dataGui.Positions.PositionList.Count >= 0x2710)
            {
                this.dataGui.Positions.PositionList.RemoveRange(0, this.dataGui.Positions.PositionList.Count / 2);
            }
            this.dataGui.Positions.PositionList.Add(struct2);
            if (this.DisplayPanelLocation != null)
            {
                this.DisplayPanelLocation.Invalidate();
            }
        }
コード例 #3
0
ファイル: frmFilePlots.cs プロジェクト: facchinm/SiRFLive
 private void getMsg41DataFromHash(Hashtable msgH)
 {
     ushort navValid = 0xffff;
     PositionInfo.PositionStruct struct2 = new PositionInfo.PositionStruct();
     if (msgH.ContainsKey("Nav Valid"))
     {
         struct2.NavValid = Convert.ToUInt16((string) msgH["Nav Valid"]);
         navValid = struct2.NavValid;
     }
     if (msgH.ContainsKey("TOW"))
     {
         struct2.TOW = Convert.ToDouble((string) msgH["TOW"]);
         if (navValid == 0)
         {
             this.dataPlot.InsertTow_nvplot(struct2.TOW / 1000.0);
         }
     }
     if (msgH.ContainsKey("Latitude"))
     {
         struct2.Latitude = Convert.ToDouble((string) msgH["Latitude"]) / 10000000.0;
         if (navValid == 0)
         {
             this.dataPlot.InsertLat(struct2.Latitude);
         }
     }
     if (msgH.ContainsKey("Longitude"))
     {
         struct2.Longitude = Convert.ToDouble((string) msgH["Longitude"]) / 10000000.0;
         if (navValid == 0)
         {
             this.dataPlot.InsertLon(struct2.Longitude);
         }
     }
     if (msgH.ContainsKey("Altitude from Ellipsoid"))
     {
         struct2.Altitude = Convert.ToDouble((string) msgH["Altitude from Ellipsoid"]) / 100.0;
         if (navValid == 0)
         {
             this.dataPlot.InsertAlt(struct2.Altitude);
             this.dataPlot.UpdateIdx_nvplot();
         }
     }
 }
コード例 #4
0
ファイル: HelperFunctions.cs プロジェクト: facchinm/SiRFLive
 public ArrayList ReadIMUFile(string filePath, double startTow, double endTow)
 {
     ArrayList list = new ArrayList();
     try
     {
         StreamReader reader = new FileInfo(filePath).OpenText();
         double num = 0.0;
         int num2 = 0;
         int num3 = 0;
         bool flag = false;
         string str = string.Empty;
         string input = reader.ReadLine();
         while (input != null)
         {
             if (!flag && input.Contains("SW Version"))
             {
                 string pattern = "SW Version*(?<swVer>.*)";
                 Regex regex = new Regex(pattern, RegexOptions.Compiled);
                 if (regex.IsMatch(input))
                 {
                     str = regex.Match(input).Result("${swVer}");
                     flag = true;
                 }
             }
             string[] strArray = input.Split(new char[] { ',' });
             if (strArray.Length <= 20)
             {
                 goto Label_0302;
             }
             if (strArray[0] == "28")
             {
                 num3 = Convert.ToInt16(strArray[0x13]);
                 if (num2 < num3)
                 {
                     num2 = num3;
                     num = (uint) Convert.ToDouble(strArray[4]);
                 }
             }
             if (!(strArray[0] == "41") || (Convert.ToInt16(strArray[2]) <= 0))
             {
                 goto Label_0302;
             }
             PositionInfo.PositionStruct struct2 = new PositionInfo.PositionStruct();
             struct2.NavType = Convert.ToUInt16(strArray[2]);
             int num4 = 8;
             struct2.TOW = (uint) (Convert.ToDouble(strArray[num4 / 2]) / 1000.0);
             if (startTow > 0.0)
             {
                 if (struct2.TOW >= startTow)
                 {
                     if ((endTow > 0.0) && (struct2.TOW > endTow))
                     {
                         return list;
                     }
                     goto Label_0190;
                 }
                 input = reader.ReadLine();
                 continue;
             }
             if ((endTow > 0.0) && (struct2.TOW > endTow))
             {
                 return list;
             }
         Label_0190:
             struct2.RxTime_Hour = Convert.ToInt32(strArray[num4++]);
             struct2.RxTime_Minute = Convert.ToInt32(strArray[num4++]);
             struct2.RxTime_second = (ushort) (Convert.ToDouble(strArray[num4++]) / 1000.0);
             struct2.SatellitesUsed = Convert.ToUInt32(strArray[num4++]);
             struct2.Latitude = Convert.ToDouble(strArray[num4++]) / 10000000.0;
             struct2.Longitude = Convert.ToDouble(strArray[num4++]) / 10000000.0;
             struct2.Altitude = Convert.ToDouble(strArray[num4++]) / 100.0;
             struct2.Speed = Convert.ToDouble(strArray[num4 + 2]) / 100.0;
             struct2.Heading = Convert.ToDouble(strArray[num4 + 3]) / 100.0;
             struct2.NumSVInFix = Convert.ToUInt16(strArray[num4 + 0x12]);
             struct2.HDOP = Convert.ToDouble(strArray[num4 + 0x13]) / 5.0;
             if (struct2.TOW == num)
             {
                 struct2.MaxCN0 = num2;
             }
             else
             {
                 struct2.MaxCN0 = 0.0;
             }
             num2 = 0;
             num3 = 0;
             struct2.SW_Version = str;
             list.Add(struct2);
         Label_0302:
             input = reader.ReadLine();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
     return list;
 }
コード例 #5
0
ファイル: Report.cs プロジェクト: facchinm/SiRFLive
 public void PointToPointErrorCalculation(string dataFile, string refFile, double startPoint, double endPoint)
 {
     ArrayList list = this._helperFunctions.ReadIMUFile(dataFile, startPoint, endPoint);
     ArrayList list2 = this._helperFunctions.ReadIMUFile(refFile, startPoint, endPoint);
     Stats stats = new Stats();
     Stats stats2 = new Stats();
     Stats stats3 = new Stats();
     Stats stats4 = new Stats();
     Stats stats5 = new Stats();
     Stats stats6 = new Stats();
     Stats stats7 = new Stats();
     Stats stats8 = new Stats();
     PositionErrorCalc calc = new PositionErrorCalc();
     List<string> list3 = new List<string>();
     string item = string.Empty;
     List<double> positionDataList = new List<double>(8);
     for (int i = 0; i < 8; i++)
     {
         positionDataList.Add(0.0);
     }
     PositionInfo.PositionStruct struct2 = new PositionInfo.PositionStruct();
     PositionInfo.PositionStruct struct3 = new PositionInfo.PositionStruct();
     int num2 = 0;
     int num3 = 0;
     double tOW = 0.0;
     double num5 = 0.0;
     double sample = 0.0;
     double num7 = 0.0;
     double num8 = 0.0;
     double num9 = 0.0;
     double num10 = 0.0;
     double num11 = 0.0;
     double num12 = 0.0;
     int num13 = 0;
     int num14 = 0;
     int num15 = 0;
     int num16 = 0;
     int num17 = 0;
     int num18 = 0;
     int num19 = 0;
     int num20 = 0;
     int num21 = 0;
     string str2 = "Not detected";
     if ((list.Count > 0) && (list2.Count > 0))
     {
         for (num2 = 0; (num2 < list.Count) && (num3 < list2.Count); num2++)
         {
             struct2 = (PositionInfo.PositionStruct) list[num2];
             struct3 = (PositionInfo.PositionStruct) list2[num3];
             if (struct2.SW_Version != string.Empty)
             {
                 str2 = struct2.SW_Version.TrimStart(new char[] { ':' });
             }
             if (struct2.NavType > 0)
             {
                 tOW = struct2.TOW;
                 num5 = struct3.TOW;
                 while (tOW > num5)
                 {
                     num3++;
                     if (num3 >= list2.Count)
                     {
                         break;
                     }
                     struct3 = (PositionInfo.PositionStruct) list2[num3];
                     num5 = struct3.TOW;
                 }
                 if (num8 == 0.0)
                 {
                     num8 = tOW;
                 }
                 num9 = tOW;
                 if (tOW == num5)
                 {
                     positionDataList[0] = struct2.Latitude;
                     positionDataList[1] = struct2.Longitude;
                     positionDataList[2] = struct2.Altitude;
                     positionDataList[3] = struct2.Heading;
                     positionDataList[4] = struct3.Latitude;
                     positionDataList[5] = struct3.Longitude;
                     positionDataList[6] = struct3.Altitude;
                     positionDataList[7] = struct3.Heading;
                     calc.GetPositionErrorsInMeter(positionDataList);
                     sample = calc.HorizontalError;
                     stats.InsertSample(sample);
                     num7 = Math.Abs(calc.VerticalErrorInMeter);
                     stats2.InsertSample(num7);
                     num11 = Math.Abs(calc.AlongTrackErrorInMeter);
                     stats7.InsertSample(num11);
                     num12 = Math.Abs(calc.XTrackErrorInMeter);
                     stats8.InsertSample(num12);
                     num10 = Math.Abs((double) (struct2.Heading - struct3.Heading));
                     if (num10 > 180.0)
                     {
                         num10 = 360.0 - num10;
                     }
                     stats6.InsertSample(num10);
                     stats3.InsertSample(struct2.HDOP);
                     stats4.InsertSample((double) struct2.NumSVInFix);
                     stats5.InsertSample(struct2.MaxCN0);
                     if (sample > 50.0)
                     {
                         num13++;
                         num19++;
                         if (num13 == 4)
                         {
                             num16++;
                         }
                     }
                     else
                     {
                         num13 = 0;
                     }
                     if (sample > 25.0)
                     {
                         num14++;
                         num20++;
                         if (num14 == 4)
                         {
                             num17++;
                         }
                     }
                     else
                     {
                         num14 = 0;
                     }
                     if (sample > 10.0)
                     {
                         num15++;
                         num21++;
                         if (num15 == 4)
                         {
                             num18++;
                         }
                     }
                     else
                     {
                         num15 = 0;
                     }
                     item = string.Format("{0},{1}, {2:F6},{3:F6},{4:F6},{5:F6},{6:F6},{7:F6},{8:F6}, {9:F6}, {10:F2}, {11:F2}, {12:F2}, {13:F2},{14:F2},{15:F2},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25}, {26},{27}", new object[] {
                         tOW, num5, struct2.Latitude, struct2.Longitude, struct2.Altitude, struct3.Latitude, struct3.Longitude, struct3.Altitude, struct2.Heading, struct3.Heading, sample, num7, num12, num11, struct2.HDOP, struct2.NumSVInFix,
                         struct2.MaxCN0, struct2.NavType, num19, num16, num20, num17, num21, num18, num13, num14, num15, num10
                      });
                     list3.Add(item);
                     num3++;
                 }
             }
         }
         if (stats.Samples > 0)
         {
             double percentile = stats.GetPercentile((double) 50.0, -9999.0);
             double num23 = stats.GetPercentile((double) 68.0, -9999.0);
             double num24 = stats.GetPercentile((double) 95.0, -9999.0);
             double num25 = stats.Stats_Max((double) -9999.0);
             stats.Stats_Min((double) -9999.0);
             stats.Stats_Mean((double) -9999.0);
             double num26 = stats2.GetPercentile((double) 50.0, -9999.0);
             double num27 = stats2.GetPercentile((double) 68.0, -9999.0);
             double num28 = stats2.GetPercentile((double) 95.0, -9999.0);
             double num29 = stats2.Stats_Max((double) -9999.0);
             stats2.Stats_Min((double) -9999.0);
             stats2.Stats_Mean((double) -9999.0);
             double num30 = stats8.GetPercentile((double) 50.0, -9999.0);
             double num31 = stats8.GetPercentile((double) 68.0, -9999.0);
             double num32 = stats8.GetPercentile((double) 95.0, -9999.0);
             double num33 = stats8.Stats_Max((double) -9999.0);
             stats8.Stats_Min((double) -9999.0);
             stats8.Stats_Mean((double) -9999.0);
             double num34 = stats7.GetPercentile((double) 50.0, -9999.0);
             double num35 = stats7.GetPercentile((double) 68.0, -9999.0);
             double num36 = stats7.GetPercentile((double) 95.0, -9999.0);
             double num37 = stats7.Stats_Max((double) -9999.0);
             stats7.Stats_Min((double) -9999.0);
             stats7.Stats_Mean((double) -9999.0);
             int samples = stats.Samples;
             double num39 = stats3.Stats_Mean((double) -9999.0);
             double num40 = stats4.Stats_Mean((double) -9999.0);
             double num41 = (((double) samples) / ((num9 - num8) + 1.0)) * 100.0;
             double num42 = stats5.Stats_Mean((double) -9999.0);
             double num43 = stats6.Stats_Max((double) -9999.0);
             stats6.Stats_Min((double) -9999.0);
             stats6.Stats_Mean((double) -9999.0);
             double num44 = stats6.GetPercentile((double) 50.0, -9999.0);
             double num45 = stats6.GetPercentile((double) 68.0, -9999.0);
             double num46 = stats6.GetPercentile((double) 95.0, -9999.0);
             string path = dataFile.Replace(".gps", "_PointToPointAccuracy.csv");
             FileInfo info = new FileInfo(dataFile);
             StreamWriter writer = new StreamWriter(path);
             FileInfo info2 = new FileInfo(refFile);
             writer.WriteLine("IMU file path= {0}", info2.Name);
             writer.WriteLine("Data file path= {0}", info.Name);
             writer.WriteLine("SW Version= {0}", str2);
             writer.WriteLine("MaxCN0 Ave|dBHz= {0:F1}", num42);
             writer.WriteLine("Samples= {0:}", samples);
             writer.WriteLine("Tracking Availability= {0:F1}%", num41);
             writer.WriteLine("HDOP Ave= {0:F1}", num39);
             writer.WriteLine("Satellite Number Ave= {0:F1}", num40);
             writer.WriteLine("Horizontal Error 50% CEP|m= {0:F1}", percentile);
             writer.WriteLine("Horizontal Error 68% CEP|m= {0:F1}", num23);
             writer.WriteLine("Horizontal Error 95% CEP|m= {0:F1}", num24);
             writer.WriteLine("Horizontal Error Max|m= {0:F1}", num25);
             writer.WriteLine("Altitude Error 50% CEP|m= {0:F1}", num26);
             writer.WriteLine("Altitude Error 68% CEP|m= {0:F1}", num27);
             writer.WriteLine("Altitude Error 95% CEP|m= {0:F1}", num28);
             writer.WriteLine("Altitude Error Max|m= {0:F1}", num29);
             writer.WriteLine("Cross Track Error 50% CEP|m= {0:F1}", num30);
             writer.WriteLine("Cross Track Error 68% CEP|m= {0:F1}", num31);
             writer.WriteLine("Cross Track Error 95% CEP|m= {0:F1}", num32);
             writer.WriteLine("Cross Track Error Max|m= {0:F1}", num33);
             writer.WriteLine("Along Track Error 50% CEP|m= {0:F1}", num34);
             writer.WriteLine("Along Track Error 68% CEP|m= {0:F1}", num35);
             writer.WriteLine("Along Track Error 95% CEP|m= {0:F1}", num36);
             writer.WriteLine("Along Track Error Max|m= {0:F1}", num37);
             writer.WriteLine("Exceed50mCount= {0}", num19);
             writer.WriteLine("Exceed50m3sNotPullInCount= {0}", num16);
             writer.WriteLine("Exceed25mCount= {0}", num20);
             writer.WriteLine("Exceed25m3sNotPullInCount= {0}", num17);
             writer.WriteLine("Exceed10mCount= {0}", num21);
             writer.WriteLine("Exceed10m3sNotPullInCount= {0}", num18);
             writer.WriteLine("Heading Error 50% CEP|m= {0:F1}", num44);
             writer.WriteLine("Heading Error 68% CEP|m= {0:F1}", num45);
             writer.WriteLine("Heading Error 95% CEP|m= {0:F1}", num46);
             writer.WriteLine("Heading Error Max|m= {0:F1}", num43);
             writer.WriteLine("End Summary");
             writer.WriteLine("Tow,RefTow,Latitude,Longitude,Altitude,RefLatitude,RefLongitude,RefAltitude,Heading,RefHeading,HzError,AltError,CrossTrackError,AlongTrackError,HDOP,NumSVInFix,MaxCN0,NavType,Exceed50mCount,Exceed50m3sNotPullInCount,Exceed25mCount,Exceed25m3sNotPullInCount,Exceed10mCount,Exceed10m3sNotPullInCount,PullInTime50m,PullInTime25m,ullInTime10m,headingError");
             foreach (string str4 in list3)
             {
                 writer.WriteLine(str4);
             }
             writer.Close();
         }
         list.Clear();
         list2.Clear();
     }
     stats.Dispose();
     stats = null;
     stats2.Dispose();
     stats2 = null;
     stats3.Dispose();
     stats3 = null;
     stats4.Dispose();
     stats4 = null;
     stats5.Dispose();
     stats5 = null;
     stats8.Dispose();
     stats8 = null;
     stats7.Dispose();
     stats7 = null;
     stats6.Dispose();
     stats6 = null;
     calc = null;
     list3.Clear();
     list3 = null;
 }