public override int GetPosition(string logTime, string message) { if ((message == null) || (message.Length == 0)) { return 1; } if ((base._commWindow.AutoReplyCtrl.PositionRequestCtrl.LocMethod == 4) && ((base._commWindow.AutoReplyCtrl.AidingFlag & 2) == 2)) { return 1; } if (!base._resetCtrl.ResetPositionAvailable) { base._rxNavData.TTFFSiRFLive = ((double) (DateTime.Now.Ticks - base._resetCtrl.StartResetTime)) / 10000000.0; if (base._rxNavData.TTFFSiRFLive > 1.0) { base._rxNavData.TTFFSiRFLive -= clsGlobal.SiRFLive_TTFF_OFFSET; } } byte[] comByte = HelperFunctions.HexToByte(message); Hashtable hashtable = base.m_Protocols.ConvertRawToHash(comByte, "OSP"); double lat = 0.0; double lon = 0.0; double alt = 0.0; byte num4 = 0; PositionErrorCalc calc = new PositionErrorCalc(); ushort num5 = 0; if (hashtable.ContainsKey("POSITION_ERROR_STATUS")) { num5 = Convert.ToUInt16((string) hashtable["POSITION_ERROR_STATUS"]); } if (num5 != 0) { base._resetCtrl.ResetPositionAvailable = false; return 1; } if (hashtable.ContainsKey("MEAS_LAT")) { lat = (Convert.ToInt32((string) hashtable["MEAS_LAT"]) * 180.0) / 4294967296; } if (hashtable.ContainsKey("MEAS_LONG")) { lon = (Convert.ToInt32((string) hashtable["MEAS_LONG"]) * 360.0) / 4294967296; } if (hashtable.ContainsKey("OTHER SECTIONS")) { num4 = (byte) (2 & Convert.ToByte((string) hashtable["OTHER SECTIONS"])); if (num4 == 2) { if (hashtable.ContainsKey("HEIGHT")) { alt = (Convert.ToDouble((string) hashtable["HEIGHT"]) * 0.1) - 500.0; } } else { alt = -9999.0; } } if (hashtable.ContainsKey("MEAS_GPS_SECONDS")) { base._rxNavData.TOW = Convert.ToDouble((string) hashtable["MEAS_GPS_SECONDS"]); } if (base._rxNavData.ValidatePosition) { double num6 = Convert.ToDouble(base._rxNavData.RefLat); double num7 = Convert.ToDouble(base._rxNavData.RefLon); double num8 = Convert.ToDouble(base._rxNavData.RefAlt); calc.GetPositionErrorsInMeter(lat, lon, alt, num6, num7, num8); base._rxNavData.Nav2DPositionError = calc.HorizontalError; if (num4 == 2) { base._rxNavData.Nav3DPositionError = calc.Position3DError; base._rxNavData.NavVerticalPositionError = calc.VerticalErrorInMeter; } else { base._rxNavData.Nav3DPositionError = -9999.0; base._rxNavData.NavVerticalPositionError = -9999.0; } } else { base._rxNavData.Nav2DPositionError = -9999.0; base._rxNavData.Nav3DPositionError = -9999.0; base._rxNavData.NavVerticalPositionError = -9999.0; } base._rxNavData.MeasLat = lat; base._rxNavData.MeasLon = lon; base._rxNavData.MeasAlt = alt; int num9 = 4; if ((comByte[num9 + 0x16] & 8) == 8) { ushort num10 = (ushort) ((comByte[num9 + 0x29] * 0x100) + comByte[num9 + 0x2a]); ushort num11 = (ushort) (num10 >> 15); ushort num12 = (ushort) ((num10 >> 11) & 15); ushort num13 = (ushort) (num10 & 0x7ff); if (num11 != 0) { base._commWindow.LastAidingSessionReportedClockDrift = (-0.005 * (1.0 + (((double) num13) / 2048.0))) * (((int) 1) << num12); } else { base._commWindow.LastAidingSessionReportedClockDrift = (0.005 * (1.0 + (((double) num13) / 2048.0))) * (((int) 1) << num12); } } if (!base._resetCtrl.ResetPositionAvailable) { base._rxNavData.TTFFReport = base._rxNavData.TTFFSiRFLive; base._rxNavData.FirstFixMeasLat = base._rxNavData.MeasLat; base._rxNavData.FirstFixMeasLon = base._rxNavData.MeasLon; base._rxNavData.FirstFixMeasAlt = base._rxNavData.MeasAlt; base._rxNavData.FirstFix2DPositionError = base._rxNavData.Nav2DPositionError; base._rxNavData.FirstFix3DPositionError = base._rxNavData.Nav3DPositionError; base._rxNavData.FirstFixVerticalPositionError = base._rxNavData.NavVerticalPositionError; base._rxNavData.FirstFixTOW = base._rxNavData.TOW; base._resetCtrl.ResetPositionAvailable = true; } return 0; }
private void getOSPPosition(string line) { string[] strArray = line.Split(new char[] { ',' }); int num = 0; int num2 = 0; this.comm.RxCtrl.RxNavData.Nav2DPositionError = -9999.0; this.comm.RxCtrl.RxNavData.Nav3DPositionError = -9999.0; this.comm.RxCtrl.RxNavData.NavVerticalPositionError = -9999.0; try { Convert.ToInt32(strArray[2]); num = Convert.ToInt32(strArray[3]); num2 = Convert.ToInt32(strArray[4]); } catch { } if (num == 0) { this.comm.RxCtrl.ResetCtrl.ResetPositionAvailable = false; } else if (num2 == 0) { double lat = 0.0; double lon = 0.0; int num5 = 0; double alt = 0.0; int num7 = 0; int num8 = 0; try { Convert.ToInt32(strArray[5]); Convert.ToInt32(strArray[6]); Convert.ToInt32(strArray[7]); Convert.ToInt32(strArray[8]); double num1 = Convert.ToDouble(strArray[9]) / 1000.0; lat = (Convert.ToDouble(strArray[10]) * 180.0) / 4294967296; lon = (Convert.ToDouble(strArray[11]) * 360.0) / 4294967296; num5 = Convert.ToInt32(strArray[12]); double num14 = (Convert.ToDouble(strArray[13]) * 180.0) / 256.0; alt = (Convert.ToDouble(strArray[0x10]) * 0.1) - 500.0; Convert.ToDouble(strArray[0x12]); double num15 = (Convert.ToDouble(strArray[0x13]) * 360.0) / 65536.0; Convert.ToDouble(strArray[20]); Convert.ToDouble(strArray[0x15]); Convert.ToDouble(strArray[0x16]); Convert.ToDouble(strArray[0x17]); Convert.ToDouble(strArray[0x18]); Convert.ToInt32(strArray[0x19]); Convert.ToUInt16(strArray[0x1a]); Convert.ToDouble(strArray[0x1c]); Convert.ToInt32(strArray[0x1d]); num7 = Convert.ToInt32(strArray[30]); int[] numArray = new int[num7]; int[] numArray2 = new int[num7]; int[] numArray3 = new int[num7]; num8 = num5 & 2; int index = 0; int num10 = 0x1f; while (index < num7) { numArray[index] = Convert.ToInt32(strArray[num10++]); numArray2[index] = Convert.ToInt32(strArray[num10++]); numArray3[index] = Convert.ToInt32(strArray[num10++]); index++; } if (num8 != 2) { alt = -9999.0; } } catch { } PositionErrorCalc calc = new PositionErrorCalc(); double num11 = Convert.ToDouble(this.comm.RxCtrl.RxNavData.RefLat); double num12 = Convert.ToDouble(this.comm.RxCtrl.RxNavData.RefLon); double num13 = Convert.ToDouble(this.comm.RxCtrl.RxNavData.RefAlt); calc.GetPositionErrorsInMeter(lat, lon, alt, num11, num12, num13); this.comm.RxCtrl.RxNavData.Nav2DPositionError = calc.HorizontalError; if (num8 == 2) { this.comm.RxCtrl.RxNavData.Nav3DPositionError = calc.Position3DError; this.comm.RxCtrl.RxNavData.NavVerticalPositionError = calc.VerticalErrorInMeter; } else { this.comm.RxCtrl.RxNavData.Nav3DPositionError = -9999.0; this.comm.RxCtrl.RxNavData.NavVerticalPositionError = -9999.0; } this.comm.RxCtrl.RxNavData.MeasLat = lat; this.comm.RxCtrl.RxNavData.MeasLon = lon; this.comm.RxCtrl.RxNavData.MeasAlt = alt; this.comm.RxCtrl.ResetCtrl.ResetPositionAvailable = true; } }
public string PostionErrorCalc(string latStr, string lonStr, string altStr, string refLatStr, string refLonStr, string refAltStr) { string str; try { PositionErrorCalc calc = new PositionErrorCalc(); double lat = Convert.ToDouble(latStr) / 10000000.0; double lon = Convert.ToDouble(lonStr) / 10000000.0; double alt = Convert.ToDouble(altStr) / 100.0; double num4 = Convert.ToDouble(refLatStr); double num5 = Convert.ToDouble(refLonStr); double num6 = Convert.ToDouble(refAltStr); calc.GetPositionErrorsInMeter(lat, lon, alt, num4, num5, num6); str = string.Format(clsGlobal.MyCulture, "{0:F6},{1:F6}", new object[] { calc.HorizontalError, calc.VerticalErrorInMeter }); } catch (Exception exception) { throw exception; } return str; }
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(); } }
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; }
public void Summary_LSM(string dir, double refLat, double refLon, double refAlt, int latIdx, int lonIdx, int altIdx, int ttffIdx, int startCNoIdx) { frmResetTestReportPlots plots = new frmResetTestReportPlots(); new ZedGraphControl(); Hashtable hashtable = new Hashtable(); PositionErrorCalc calc = new PositionErrorCalc(); int num = 12; int index = (startCNoIdx + num) + 1; double sample = 0.0; string path = dir + @"\summary_reset.xml"; StreamWriter f = new StreamWriter(path); try { FileInfo[] files = new DirectoryInfo(dir).GetFiles("*.csv"); if (files.Length != 0) { foreach (FileInfo info2 in files) { Header1DataClass class2; PerEnvReport report; ReportElements elements; StreamReader reader = info2.OpenText(); string name = info2.Name; string pattern = @"_(com|COM|tcp|TCP|i2c|I2C)\d+_reset(?<testName>\w+)_(?<cno>-?\d+\.*\d?)"; Regex regex = new Regex(pattern, RegexOptions.Compiled); bool flag = regex.IsMatch(name); string key = "Unknown"; string str5 = "Unknown"; if (flag) { key = regex.Match(name).Result("${cno}"); str5 = regex.Match(name).Result("${testName}"); } string str6 = string.Empty; string input = reader.ReadLine(); if (input != null) { pattern = @"SW Version:\s*(?<swVer>.*)"; Regex regex2 = new Regex(pattern, RegexOptions.Compiled); if (regex2.IsMatch(input)) { str6 = regex2.Match(input).Result("${swVer}"); } else { str6 = "SW Version: Not detected"; } } else { str6 = "SW Version: Not detected"; } if (hashtable.Contains(str6)) { class2 = (Header1DataClass) hashtable[str6]; } else { Header1DataClass class3 = new Header1DataClass(); hashtable.Add(str6, class3); class2 = (Header1DataClass) hashtable[str6]; } if (class2.Header2DataHash.Contains(str5)) { report = (PerEnvReport) class2.Header2DataHash[str5]; } else { PerEnvReport report2 = new PerEnvReport(); class2.Header2DataHash.Add(str5, report2); report = (PerEnvReport) class2.Header2DataHash[str5]; } if (report.PerSiteData.Contains(key)) { elements = (ReportElements) report.PerSiteData[key]; } else { ReportElements elements2 = new ReportElements(); report.PerSiteData.Add(key, elements2); elements = (ReportElements) report.PerSiteData[key]; } input = reader.ReadLine(); string str8 = "N/A"; Hashtable hashtable2 = new Hashtable(); int num4 = 0; if (input != null) { string[] strArray = input.Split(new char[] { '=' }); if (strArray.Length > 1) { str8 = strArray[1]; if (this.perRxSetupData.ContainsKey(str8)) { goto Label_0310; } if (strArray.Length > 1) { hashtable2.Add(strArray[0], strArray[1]); } while ((input = reader.ReadLine()) != null) { if (input == "End Summary") { break; } if (input != string.Empty) { strArray = input.Split(new char[] { '=' }); if (strArray.Length > 1) { hashtable2.Add(strArray[0], strArray[1]); } num4++; } } this.perRxSetupData.Add(str8, hashtable2); } } goto Label_031C; Label_0302: if (input == "End Summary") { goto Label_031C; } Label_0310: if ((input = reader.ReadLine()) != null) { goto Label_0302; } Label_031C: input = reader.ReadLine(); for (input = reader.ReadLine(); input != null; input = reader.ReadLine()) { string[] strArray2 = input.Split(new char[] { ',' }); double num5 = -9999.0; if (strArray2.Length >= 5) { double num6 = Convert.ToDouble(strArray2[ttffIdx]); double horizontalError = -9999.0; double num8 = Convert.ToDouble(this._limitVal); string[] strArray3 = this._hrErrLimit.Split(new char[] { ',' }); int num9 = -1; try { num9 = Convert.ToInt32(strArray2[index]); } catch { } if ((num9 >= 0) && (num9 <= 3)) { elements.NumberOfSVInFix++; } if (strArray3.Length > 0) { Convert.ToDouble(strArray3[strArray3.Length - 1]); } else { Convert.ToDouble(strArray3[0]); } if (num6 <= 0.0) { elements.NumberOfMisses++; } else if (num6 >= num8) { elements.NumberOfMisses++; } double num10 = Convert.ToDouble(strArray2[altIdx]); if (num10 != -9999.0) { num5 = Math.Abs((double) (num10 - refAlt)); } calc.GetPositionErrorsInMeter(Convert.ToDouble(strArray2[latIdx]), Convert.ToDouble(strArray2[lonIdx]), Convert.ToDouble(strArray2[altIdx]), refLat, refLon, refAlt); horizontalError = calc.HorizontalError; try { elements.TTFFSamples.InsertSample(num6); elements.Position2DErrorSamples.InsertSample(horizontalError); elements.VerticalErrorSamples.InsertSample(num5); report.PerEnvSamples.TTFFSamples.InsertSample(num6); report.PerEnvSamples.Position2DErrorSamples.InsertSample(horizontalError); report.PerEnvSamples.VerticalErrorSamples.InsertSample(num5); class2.ReportDataSamples.TTFFSamples.InsertSample(num6); class2.ReportDataSamples.Position2DErrorSamples.InsertSample(horizontalError); class2.ReportDataSamples.VerticalErrorSamples.InsertSample(num5); for (int i = 0; i < num; i++) { if (startCNoIdx != -1) { sample = Convert.ToDouble(strArray2[startCNoIdx + i]); } else { sample = -9999.0; } if (sample != 0.0) { elements.CNOSamples.InsertSample(sample); report.PerEnvSamples.CNOSamples.InsertSample(sample); class2.ReportDataSamples.CNOSamples.InsertSample(sample); } } } catch (FormatException exception) { exception.ToString(); } } } reader.Close(); } f.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); f.WriteLine("<reset>"); int styleCt = 0; List<string> il = new List<string>(); foreach (string str9 in hashtable.Keys) { Header1DataClass class4 = (Header1DataClass) hashtable[str9]; f.WriteLine("\t<swVersion name=\"{0}\">", str9); foreach (string str10 in class4.Header2DataHash.Keys) { plots.PaneTitle = str9 + "\r\n" + str10; plots.CreateCharts(); GraphPane myPane = plots.AddPane("TTFF Resets", "Secs"); GraphPane pane2 = plots.AddPane("2-D Error", "Meters"); GraphPane pane3 = plots.AddPane("Verical Error", "Meters"); PerEnvReport report3 = (PerEnvReport) class4.Header2DataHash[str10]; styleCt++; string item = str10 + styleCt.ToString() + ".jpg"; string str12 = "Style" + styleCt.ToString(); il.Add(item); f.WriteLine("\t\t<environment name=\"{0}\" plotImage=\"{1}\" showpicturestyle=\"{2}\">", str10, item, str12); ArrayList list2 = new ArrayList(); foreach (string str13 in report3.PerSiteData.Keys) { list2.Add(str13); } list2.Sort(); int num13 = 0; foreach (string str14 in list2) { ReportElements elements3 = (ReportElements) report3.PerSiteData[str14]; f.WriteLine("\t\t\t<site number=\"{0}\">", str14); this.printResetSummary(f, elements3.TTFFSamples.Samples, elements3.NumberOfMisses, elements3.NumberOfSVInFix); this.printSampleData(f, elements3.TTFFSamples, this._percentile, this._ttffLimit, Convert.ToDouble(this._timeoutVal), "TTFF", "sec"); plots.AddCurve(myPane, elements3.TTFFSamples, elements3.TTFFSamples.Samples, str14); this.printSampleData(f, elements3.Position2DErrorSamples, this._percentile, this._hrErrLimit, -9999.0, "2-D Error", "m"); plots.AddCurve(pane2, elements3.Position2DErrorSamples, elements3.Position2DErrorSamples.Samples, str14); this.printSampleData(f, elements3.VerticalErrorSamples, this._percentile, this._hrErrLimit, -9999.0, "Vertical Error", "m"); plots.AddCurve(pane3, elements3.VerticalErrorSamples, elements3.VerticalErrorSamples.Samples, str14); this.printSampleData(f, elements3.CNOSamples, this._percentile, "", -9999.0, "CNO", "dbHz"); f.WriteLine("\t\t\t</site>"); num13++; } plots.RefreshGraph(); plots.SaveGraphToFile(dir, item); plots.PaneTitle = string.Empty; f.WriteLine("\t\t</environment>"); } f.WriteLine("\t</swVersion>"); } this.modifyResetReportCSS(dir, styleCt); this.printTestSetup(f); this.printImageList(f, il); f.WriteLine("</reset>"); f.Close(); hashtable.Clear(); this.perRxSetupData.Clear(); string outputFile = dir + @"\summary_reset.html"; this.GenerateHTMLReport(path, outputFile, ConfigurationManager.AppSettings["InstalledDirectory"] + @"\scripts\resetReport.xsl"); } } catch (Exception exception2) { this.perRxSetupData.Clear(); hashtable.Clear(); f.Close(); MessageBox.Show(exception2.Message, "ERROR"); } }
private void plotChart() { GraphPane graphPane = this.zedGraphControl1.GraphPane; graphPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45f); int num = 0; if (this.IsRealTime) { if (this.comm.dataPlot != null) { num = this.comm.dataPlot.GetNumSample_nvplot(); } } else { num = this._length; } if (num >= 1) { double[] x = new double[num]; double[] y = new double[num]; PositionErrorCalc calc = new PositionErrorCalc(); for (uint i = 0; i < num; i++) { if (this.IsRealTime) { if (this.comm.dataPlot != null) { if (this.navAccuracyComboBox.SelectedIndex == 1) { x[i] = i + 1; } else { x[i] = this.comm.dataPlot.tows_nvplot[i]; } calc.GetPositionErrorsInMeter(this.comm.dataPlot.Lat_nvplot[i], this.comm.dataPlot.Lon_nvplot[i], this.comm.dataPlot.Alt_nvplot[i], this.comm.dataPlot.RefLat, this.comm.dataPlot.RefLon, this.comm.dataPlot.RefAlt); } } else { x[i] = this._tows[i]; calc.GetPositionErrorsInMeter(this._lat[i], this._lon[i], this._alt[i], this.comm_forFile.RxCtrl.RxNavData.RefLat, this.comm_forFile.RxCtrl.RxNavData.RefLon, this.comm_forFile.RxCtrl.RxNavData.RefAlt); } y[i] = calc.HorizontalError; } LineItem item = graphPane.AddCurve("", x, y, Color.Blue, SymbolType.Diamond); item.Symbol.Size = 3f; item.Symbol.Fill = new Fill(Color.Red); graphPane.Title.Text = "Nav Accuracy vs Time Plot"; graphPane.XAxis.Title.Text = "TOW"; graphPane.YAxis.Title.Text = "Horizontal Error (m)"; graphPane.XAxis.Scale.FormatAuto = true; if (this.navAccuracyComboBox.SelectedIndex == 1) { graphPane.Title.Text = "Nav Accuracy in Test Sequence"; graphPane.XAxis.Title.Text = "Sequence"; } graphPane.XAxis.Scale.MaxAuto = true; graphPane.XAxis.Scale.MajorStepAuto = true; graphPane.YAxis.MajorGrid.IsVisible = true; graphPane.YAxis.MinorGrid.IsVisible = true; graphPane.YAxis.Scale.MaxAuto = true; graphPane.YAxis.Scale.MinAuto = true; graphPane.YAxis.Scale.FontSpec.FontColor = Color.Blue; graphPane.XAxis.Scale.FontSpec.Size = 8f; this.zedGraphControl1.AxisChange(); base.Invoke((MethodInvoker)delegate { this.zedGraphControl1.Refresh(); this.zedGraphControl1.Update(); }); } }
public override int GetPositionFromMeasurement(string logTime, string message) { int num = 0; PositionErrorCalc calc = new PositionErrorCalc(); if ((message.Length == 0) || (message == null)) { return 1; } byte num2 = Convert.ToByte(message.Replace(" ", "").Substring(0x10, 2)); double lat = Convert.ToDouble(base._rxNavData.RefLat); double lon = Convert.ToDouble(base._rxNavData.RefLon); double num5 = Convert.ToDouble(base._rxNavData.RefAlt); int estHorrErr = (int) base._commWindow.AutoReplyCtrl.ApproxPositionCtrl.EstHorrErr; if (num2 != 0) { num = 1; base._rxNavData.Nav2DPositionError = -9999.0; base._rxNavData.Nav3DPositionError = -9999.0; base._rxNavData.NavVerticalPositionError = -9999.0; base._rxNavData.TTFFSiRFLive = -9999.0; base._commWindow.WriteApp("### Need more time ###"); return num; } base._rxNavData.TTFFSiRFLive = ((double) (DateTime.Now.Ticks - base._resetCtrl.StartResetTime)) / 10000000.0; if (base._rxNavData.TTFFSiRFLive > 1.0) { base._rxNavData.TTFFSiRFLive -= clsGlobal.SiRFLive_TTFF_OFFSET; } NavLibInterface interface2 = new NavLibInterface(); interface2.MeasRespMsg = message; interface2.EphClkMsg = base._commWindow.AutoReplyCtrl.EphDataMsgBackup; interface2.SetUncertValues(0, 0); interface2.SetAPRValues(lat, lon, (int) num5, estHorrErr); if (!interface2.GetPositionValues()) { base._commWindow.WriteApp("### Error get position in NavLib ###"); return num; } double num7 = interface2.Ai3ResultValues.lat * 4.1909515857696533E-08; double num8 = interface2.Ai3ResultValues.lon * 8.3819031715393066E-08; double alt = (interface2.Ai3ResultValues.height * 0.1) - 500.0; base._rxNavData.MeasLat = num7; base._rxNavData.MeasLon = num8; base._rxNavData.MeasAlt = alt; base._rxNavData.TOW = interface2.Ai3ResultValues.TOW; if (base._rxNavData.ValidatePosition) { calc.GetPositionErrorsInMeter(num7, num8, alt, lat, lon, num5); base._rxNavData.Nav2DPositionError = calc.HorizontalError; base._rxNavData.Nav3DPositionError = calc.Position3DError; base._rxNavData.NavVerticalPositionError = calc.VerticalErrorInMeter; } else { base._rxNavData.Nav2DPositionError = -9999.0; base._rxNavData.Nav3DPositionError = -9999.0; base._rxNavData.NavVerticalPositionError = -9999.0; } if (!base._resetCtrl.ResetPositionAvailable) { base._rxNavData.TTFFReport = base._rxNavData.TTFFSiRFLive; base._rxNavData.FirstFixMeasLat = base._rxNavData.MeasLat; base._rxNavData.FirstFixMeasLon = base._rxNavData.MeasLon; base._rxNavData.FirstFixMeasAlt = base._rxNavData.MeasAlt; base._rxNavData.FirstFix2DPositionError = base._rxNavData.Nav2DPositionError; base._rxNavData.FirstFix3DPositionError = base._rxNavData.Nav3DPositionError; base._rxNavData.FirstFixVerticalPositionError = base._rxNavData.NavVerticalPositionError; base._rxNavData.FirstFixTOW = base._rxNavData.TOW; base._resetCtrl.ResetPositionAvailable = true; } return 0; }
private int decodeAi3PosResp(string logTime, string message) { int num = 0; if ((message == null) || (message.Length == 0)) { return 1; } if (!base._resetCtrl.ResetPositionAvailable) { base._rxNavData.TTFFSiRFLive = ((double) (DateTime.Now.Ticks - base._resetCtrl.StartResetTime)) / 10000000.0; if (base._rxNavData.TTFFSiRFLive > 1.0) { base._rxNavData.TTFFSiRFLive--; } string str = message.Replace(" ", ""); byte[] input = HelperFunctions.HexToByte(str.Substring(0x10, str.Length - 0x18)); byte[] output = new byte[0xe1a]; this._F_AI3.decmprss(input, (uint) input.Length, output, 0xe10); if (base._commWindow.AutoReplyCtrl.PositionRequestCtrl.LocMethod == 0) { byte[] destinationArray = new byte[170]; Array.Copy(output, 0x4e, destinationArray, 0, 170); string str3 = "45 02" + HelperFunctions.ByteToHex(destinationArray); StringBuilder builder = new StringBuilder(); builder.Append("A0A2"); int num2 = 0xac; builder.Append(num2.ToString("X").PadLeft(4, '0')); builder.Append(GetChecksum(str3)); builder.Append("B0B3"); return this.GetPositionFromMeasurement(logTime, builder.ToString()); } if (output[1] == 0) { int nIdx = 15; int index = nIdx + 4; int num6 = index + 4; double lat = (base.ImportINT32(output, 11) * 180.0) / 4294967296; double lon = (base.ImportINT32(output, nIdx) * 360.0) / 4294967296; double alt = -9999.0; if ((output[index] & 2) == 2) { alt = (base.ImportINT16(output, num6) * 0.1) - 500.0; } num = 0; PositionErrorCalc calc = new PositionErrorCalc(); if (base._rxNavData.ValidatePosition) { double num10 = Convert.ToDouble(base._rxNavData.RefLat); double num11 = Convert.ToDouble(base._rxNavData.RefLon); double num12 = Convert.ToDouble(base._rxNavData.RefAlt); calc.GetPositionErrorsInMeter(lat, lon, alt, num10, num11, num12); base._rxNavData.Nav2DPositionError = calc.HorizontalError; if (alt != -9999.0) { base._rxNavData.Nav3DPositionError = calc.Position3DError; base._rxNavData.NavVerticalPositionError = calc.VerticalErrorInMeter; } else { base._rxNavData.Nav3DPositionError = -9999.0; base._rxNavData.NavVerticalPositionError = -9999.0; } } base._rxNavData.MeasLat = lat; base._rxNavData.MeasLon = lon; base._rxNavData.MeasAlt = alt; base._resetCtrl.ResetPositionAvailable = true; return num; } num = 1; base._rxNavData.Nav2DPositionError = -9999.0; base._rxNavData.Nav3DPositionError = -9999.0; base._rxNavData.MeasLat = -9999.0; base._rxNavData.MeasLon = -9999.0; base._rxNavData.MeasLat = -9999.0; base._resetCtrl.ResetPositionAvailable = false; } return num; }
public override void SSBP2PAccuracy() { try { if (base._resetCtrl.ResetPositionAvailable) { double num = base._commWindow.m_NavData.TOW / 1000.0; string key = string.Format(clsGlobal.MyCulture, "{0:F1}", new object[] { num }); if ((key != string.Empty) && base._commWindow.NavTruthDataHash.ContainsKey(key)) { ReferenceData data = (ReferenceData) base._commWindow.NavTruthDataHash[key]; PositionErrorCalc calc = new PositionErrorCalc(); calc.GetPositionErrorsInMeter(base._commWindow.m_NavData.MeasLat, base._commWindow.m_NavData.MeasLon, base._commWindow.m_NavData.MeasAlt, data.DegreeLatitude, data.DegreeLongitude, data.MeterAltitude); double horizontalError = calc.HorizontalError; double num1 = calc.Position3DError; double verticalErrorInMeter = calc.VerticalErrorInMeter; string str = string.Format(clsGlobal.MyCulture, "{0},0,N/A,{1:F1},{2:F1},{3:F1},{4:F2},{5:F2},{6:F6},{7:F6},{8:F6},{9:F6},{10:F6},{11:F6},{12},{13},{14},{15},{16},{17}{18},{19},{20}", new object[] { num, base._commWindow.m_NavData.TTFFReport, base._commWindow.m_NavData.TTFFSiRFLive, base._commWindow.m_NavData.TTFFReset, base._commWindow.m_NavData.TTFFAided, base._commWindow.m_NavData.TTFFFirstNav, horizontalError, verticalErrorInMeter, base._commWindow.m_NavData.MeasLat, base._commWindow.m_NavData.MeasLon, base._commWindow.m_NavData.MeasAlt, data.DegreeLatitude, data.DegreeLongitude, data.MeterAltitude, base._commWindow.m_NavData.TimeErr, base._commWindow.m_NavData.TimeUncer, base._commWindow.m_NavData.FreqErr, base._commWindow.m_NavData.FreqUncer, base._commWindow.m_NavData.AvgCNo, base._commWindow.m_NavData.NumSVsInFix, base._commWindow.m_NavData.TOW }); base.LogWrite(clsGlobal.P2PAccuracy, str); } } } catch { } }
public override int DecodePostionFromSSB(string logtime, string message) { if ((message.Length == 0) || base._resetCtrl.ResetPositionAvailable) { return 1; } Hashtable hashtable = base.m_Protocols.ConvertRawToHash(HelperFunctions.HexToByte(message), "SSB"); double lat = 0.0; double lon = 0.0; double alt = 0.0; PositionErrorCalc calc = new PositionErrorCalc(); if (hashtable.ContainsKey("NAV Type") && (((byte) (Convert.ToUInt16((string) hashtable["NAV Type"]) & 7)) == 0)) { base._resetCtrl.ResetPositionAvailable = false; return 1; } if (hashtable.ContainsKey("Latitude")) { lat = Convert.ToDouble((string) hashtable["Latitude"]) / 10000000.0; } if (hashtable.ContainsKey("Longitude")) { lon = Convert.ToDouble((string) hashtable["Longitude"]) / 10000000.0; } if (hashtable.ContainsKey("Altitude from Ellipsoid")) { alt = Convert.ToDouble((string) hashtable["Altitude from Ellipsoid"]) / 100.0; } if (base._rxNavData.ValidatePosition) { double refLat = base._rxNavData.RefLat; double refLon = base._rxNavData.RefLon; double refAlt = base._rxNavData.RefAlt; calc.GetPositionErrorsInMeter(lat, lon, alt, refLat, refLon, refAlt); base._rxNavData.Nav2DPositionError = calc.HorizontalError; base._rxNavData.Nav3DPositionError = calc.Position3DError; base._rxNavData.NavVerticalPositionError = calc.VerticalErrorInMeter; } else { base._rxNavData.Nav2DPositionError = -9999.0; base._rxNavData.Nav3DPositionError = -9999.0; base._rxNavData.NavVerticalPositionError = -9999.0; } base._rxNavData.MeasLat = lat; base._rxNavData.MeasLon = lon; base._rxNavData.MeasAlt = alt; base._resetCtrl.ResetPositionAvailable = true; return 0; }