public void computeSVState(tSVD_SVState st, short svid, RinexEph eph, tGPSTime gTime) { double num50 = 0.0; double ntcld = 0.0; double num52 = 0.0; double num53 = 0.0; double num54 = 0.0; double num55 = 0.0; double num56 = 0.0; tSVD_EphemerisConsts constptr = new tSVD_EphemerisConsts(); st.svid = (byte) svid; double num59 = ((SECONDS_IN_WEEK * (gTime.week - eph.weekNo)) + gTime.time) - eph.toe; if ((eph.status & EPHSTATUS_EPH_AVAIL) != 0) { if (eph.age == 0) { st.dataAvail = 1; } else if ((eph.age & EPH_AGE_CGEE_INDICATOR) != 0) { st.dataAvail = 6; } else { st.dataAvail = 5; } } else if ((eph.status & EPHSTATUS_ALM_AVAIL) != 0) { if ((num59 < 302400.0) && (num59 > -302400.0)) { st.dataAvail = 4; } else { st.dataAvail = 2; } } else { st.dataAvail = 0; return; } this.setEphemerisConstants(ref constptr, svid, ref eph, ref gTime); num59 = ((SECONDS_IN_WEEK * (gTime.week - eph.weekNo)) + gTime.time) - eph.toe; double a = eph.m0 + (constptr.ntcn * num59); double num14 = Math.Sin(a); double num25 = Math.Cos(a); double num15 = num14 * num14; double num16 = num15 * num14; double num17 = num16 * num14; double num18 = num17 * num14; double num19 = num18 * num14; double num20 = num19 * num14; double num23 = constptr.ntck * (((((((constptr.ntcs1 * num14) + ((constptr.ntcs2 * num14) * num25)) + (constptr.ntcs3 * num16)) + ((constptr.ntcs4 * num16) * num25)) + (constptr.ntcs5 * num18)) + ((constptr.ntcs6 * num18) * num25)) + (constptr.ntcs7 * num20)); double num28 = (((((num25 + (constptr.ntcc2 * num15)) + ((constptr.ntcc3 * num15) * num25)) + (constptr.ntcc4 * num17)) + ((constptr.ntcc5 * num17) * num25)) + (constptr.ntcc6 * num19)) + ((constptr.ntcc7 * num19) * num25); double num21 = (num23 * constptr.ntccw) + (num28 * constptr.ntcsw); double num26 = (num28 * constptr.ntccw) - (num23 * constptr.ntcsw); double num12 = (2.0 * num21) * num26; double num24 = (num26 * num26) - (num21 * num21); double num45 = (eph.Cus * num12) + (eph.Cuc * num24); double num13 = num45; double num48 = 1.0 - ((num13 * num13) / 2.0); double num22 = (num21 * num48) + (num26 * num13); double num27 = (num26 * num48) - (num21 * num13); double num = 1.0 + (eph.ecc * num28); double num8 = constptr.ntcrx / num; double num10 = (eph.Crs * num12) + (eph.Crc * num24); double num37 = num8 + num10; double num39 = num37 * num27; num50 = num37 * num22; num52 = (eph.Cis * num12) + (eph.Cic * num24); double num29 = (eph.i0 + num52) + (eph.idot * num59); ntcld = constptr.ntcld; double d = (eph.omega0 + (ntcld * num59)) - constptr.ntcl2; num53 = Math.Cos(d); num55 = Math.Sin(d); num54 = Math.Sin(num29); num56 = Math.Cos(num29); st.pos[0] = (num39 * num53) - ((num50 * num56) * num55); st.pos[1] = (num39 * num55) + ((num50 * num56) * num53); st.pos[2] = num50 * num54; double num5 = ((constptr.ntcn * num) * num) / constptr.ntck2; double num44 = (eph.Cus * num24) - (eph.Cuc * num12); double num3 = 2.0 * num5; double num42 = num5 + (num3 * num44); double num11 = (eph.Crs * num24) - (eph.Crc * num12); double num57 = ((constptr.sqrta_2 * eph.ecc) * constptr.ntcn) / constptr.ntck; double num38 = (num57 * num23) + (num3 * num11); double num40 = (num38 * num27) - (num50 * num42); double num41 = (num38 * num22) + (num39 * num42); double num32 = (eph.Cis * num24) - (eph.Cic * num12); double num30 = (num3 * num32) + eph.idot; double num33 = num40 - ((num50 * ntcld) * num56); double num35 = ((num41 * num56) - (st.pos[2] * num30)) + (num39 * ntcld); st.vel[0] = (num33 * num53) - (num35 * num55); st.vel[1] = (num33 * num55) + (num35 * num53); st.vel[2] = (num41 * num54) + ((num50 * num30) * num56); double num2 = num3 * num3; double num6 = (-(((num3 * eph.ecc) * constptr.ntcn) * num23) / constptr.ntck2) * num; double num9 = (((num57 * num5) * num28) + ((2.0 * num6) * num11)) - (num2 * num10); double num43 = (num6 + ((2.0 * num6) * num44)) - (num2 * num45); double num46 = (((num9 * num27) - ((num38 * num42) * num22)) - (num41 * num42)) - (num43 * num50); double num47 = (((num9 * num22) + ((num38 * num42) * num27)) + (num40 * num42)) + (num43 * num39); double num31 = ((2.0 * num6) * num32) - (num2 * num52); double num34 = (num46 - ((num41 * ntcld) * num56)) + (((num50 * num30) * ntcld) * num54); double num36 = ((((num47 * num56) - ((num41 * num30) * num54)) - (st.vel[2] * num30)) - (st.pos[2] * num31)) + (num40 * ntcld); st.acc[0] = (float) (((-ntcld * st.vel[1]) + (num34 * num53)) - (num36 * num55)); st.acc[1] = (float) (((ntcld * st.vel[0]) + (num34 * num55)) + (num36 * num53)); st.acc[2] = (float) ((((num47 * num54) + (((2.0 * num41) * num30) * num56)) + ((num50 * num31) * num56)) - ((num30 * num30) * st.pos[2])); st.jrk[0] = (float) ((((-3.0 * NLERTE) * NLERTE) * ((float) st.vel[0])) + ((2.0 * NLERTE) * st.acc[1])); st.jrk[1] = (float) ((((-3.0 * NLERTE) * NLERTE) * st.vel[1]) - ((2.0 * NLERTE) * st.acc[0])); st.jrk[2] = (float) (((-4.0 * NLERTE) * NLERTE) * st.vel[2]); double num49 = constptr.ntecos / (1.0 + (eph.ecc * num28)); st.tcr = (float) ((num49 * constptr.ntck) * num23); st.rcd = (float) ((num49 * constptr.ntcn) * (eph.ecc + num28)); st.slw = 0; st.tow = (int) eph.toe; st.wno = (short) eph.weekNo; st.cct = (int) eph.toc; st.tgd = eph.tgd; st.iode = (byte) (((byte) eph.iode) & 0xff); st.af0 = eph.af0; st.af1 = eph.af1; st.af2 = eph.af2; st.gct = gTime.time; st.gcw = (short) gTime.week; if (st.dataAvail == 5) { st.posVar = g_posVar[eph.age]; st.clkVar = g_svClkVar[eph.age]; st.ephAge = eph.age; } else if (st.dataAvail == 6) { if (eph.age == 1) { st.posVar = g_posVar[3]; } else if (eph.age == 2) { st.posVar = g_posVar[4]; } else if (eph.age == 3) { st.posVar = g_posVar[6]; } else { st.posVar = g_posVar[eph.age]; } st.clkVar = g_svClkVar[eph.age]; st.ephAge = eph.age; } else { st.posVar = 0f; st.clkVar = 0f; st.ephAge = 0; } double num58 = ((SECONDS_PER_WEEK * (st.gcw - st.wno)) + st.gct) - st.cct; st.clockBias = ((st.af0 + (num58 * (st.af1 + (num58 * st.af2)))) + st.tcr) - st.tgd; st.clockDrift = (st.af1 + ((2.0 * st.af2) * num58)) + st.rcd; }
public bool ReadEphWriteToArrayList() { try { RinexEph eph = new RinexEph(); int startIndex = 0; int num2 = 0x16; int length = 0x13; int num4 = num2; int num5 = num4 + length; int num6 = num5 + length; string str = this.m_streamreader.ReadLine(); if (str == null) { return true; } eph.svid = byte.Parse(str.Substring(startIndex, 2).Trim()); string str2 = str.Substring(2, 3).Trim(); this.Year = Convert.ToInt32(str2); if (this.Year < 80) { this.Year += 0x7d0; } else if ((this.Year >= 80) && (this.Year <= 0x63)) { this.Year += 0x76c; } else { return false; } string str3 = str.Substring(5, 3).Trim(); this.Month = Convert.ToInt32(str3); string str4 = str.Substring(8, 3).Trim(); this.Day = Convert.ToInt32(str4); this.Hour = int.Parse(str.Substring(11, 3).Trim()); this.Minute = int.Parse(str.Substring(14, 3).Trim()); string str7 = str.Substring(0x11, 5); this.Second = (int) double.Parse(str7.Trim()); eph.af0 = double.Parse(str.Substring(num2, length).ToString().Replace('D', 'e').Trim()); eph.af1 = double.Parse(str.Substring(num5, length).ToString().Replace('D', 'e').Trim()); eph.af2 = double.Parse(str.Substring(num6, length).ToString().Replace('D', 'e').Trim()); string str11 = this.m_streamreader.ReadLine(); eph.iode = double.Parse(str11.Substring(startIndex, num2).ToString().Replace('D', 'e').Trim()); eph.Crs = double.Parse(str11.Substring(num4, length).ToString().Replace('D', 'e').Trim()); string str14 = str11.Substring(num5, length).ToString().Replace('D', 'e'); eph.deltan = double.Parse(str14.Trim()) / 3.1415926535897931; string str15 = str11.Substring(num6, length).ToString().Replace('D', 'e'); eph.m0 = double.Parse(str15.Trim()) / 3.1415926535897931; string str16 = this.m_streamreader.ReadLine(); eph.Cuc = double.Parse(str16.Substring(startIndex, num2).ToString().Replace('D', 'e').Trim()); eph.ecc = double.Parse(str16.Substring(num4, length).ToString().Replace('D', 'e').Trim()); eph.Cus = double.Parse(str16.Substring(num5, length).ToString().Replace('D', 'e').Trim()); eph.sqrta = double.Parse(str16.Substring(num6, length).ToString().Replace('D', 'e').Trim()); string str21 = this.m_streamreader.ReadLine(); double num7 = double.Parse(str21.Substring(startIndex, num2).ToString().Replace('D', 'e').Trim()); eph.toe = num7; eph.toc = eph.toe; eph.Cic = double.Parse(str21.Substring(num4, length).ToString().Replace('D', 'e').Trim()); string str24 = str21.Substring(num5, length).ToString().Replace('D', 'e'); eph.omega0 = double.Parse(str24.Trim()) / 3.1415926535897931; eph.Cis = double.Parse(str21.Substring(num6, length).ToString().Replace('D', 'e').Trim()); string str26 = this.m_streamreader.ReadLine(); string str27 = str26.Substring(startIndex, num2).ToString().Replace('D', 'e'); eph.i0 = double.Parse(str27.Trim()) / 3.1415926535897931; eph.Crc = double.Parse(str26.Substring(num4, length).ToString().Replace('D', 'e').Trim()); string str29 = str26.Substring(num5, length).ToString().Replace('D', 'e'); eph.omega = double.Parse(str29.Trim()) / 3.1415926535897931; string str30 = str26.Substring(num6, length).ToString().Replace('D', 'e'); eph.omegaDot = double.Parse(str30.Trim()) / 3.1415926535897931; string str31 = this.m_streamreader.ReadLine(); string str32 = str31.Substring(startIndex, num2).ToString().Replace('D', 'e'); eph.idot = double.Parse(str32.Trim()) / 3.1415926535897931; double num8 = double.Parse(str31.Substring(num5, length).ToString().Replace('D', 'e').Trim()); eph.weekNo = num8; string str34 = this.m_streamreader.ReadLine(); double num9 = double.Parse(str34.Substring(startIndex, num2).ToString().Replace('D', 'e').Trim()); eph.accuracy = num9; if ((num9 >= 0.0) && (num9 <= 2.4)) { eph.ura_ind = 0; } else if ((num9 > 2.4) && (num9 <= 3.4)) { eph.ura_ind = 1; } else if ((num9 > 3.4) && (num9 <= 4.85)) { eph.ura_ind = 2; } else if ((num9 > 4.85) && (num9 <= 6.85)) { eph.ura_ind = 3; } else if ((num9 > 6.85) && (num9 <= 9.65)) { eph.ura_ind = 4; } else if ((num9 > 9.65) && (num9 <= 13.65)) { eph.ura_ind = 5; } else if ((num9 > 13.65) && (num9 <= 24.0)) { eph.ura_ind = 6; } else if ((num9 > 24.0) && (num9 <= 48.0)) { eph.accuracy = 7.0; } else if ((num9 > 48.0) && (num9 <= 96.0)) { eph.ura_ind = 8; } else if ((num9 > 96.0) && (num9 <= 192.0)) { eph.ura_ind = 9; } else if ((num9 > 192.0) && (num9 <= 384.0)) { eph.ura_ind = 10; } else if ((num9 > 384.0) && (num9 <= 768.0)) { eph.ura_ind = 11; } else if ((num9 > 768.0) && (num9 <= 1536.0)) { eph.ura_ind = 12; } else if ((num9 > 1536.0) && (num9 <= 3072.0)) { eph.ura_ind = 13; } else if ((num9 > 3072.0) && (num9 <= 6144.0)) { eph.ura_ind = 14; } else { eph.ura_ind = 15; } if (((uint) double.Parse(str34.Substring(num4, length).ToString().Replace('D', 'e').Trim())) == 0) { eph.status = 1; } else { eph.status = 0; } eph.tgd = double.Parse(str34.Substring(num5, length).ToString().Replace('D', 'e').Trim()); double num11 = double.Parse(str34.Substring(num6, length).ToString().Replace('D', 'e').Trim()); eph.iodc = num11; double num12 = double.Parse(this.m_streamreader.ReadLine().Substring(num4, length).ToString().Replace('D', 'e').Trim()); eph.fitint = (sbyte) num12; this.rinexArray.Add(eph); } catch (Exception exception) { string message = exception.Message; return true; } return false; }
private void setEphemerisConstants(ref tSVD_EphemerisConsts constptr, short svid, ref RinexEph eph, ref tGPSTime gTime) { constptr.sqrta_2 = eph.sqrta * eph.sqrta; if (constptr.sqrta_2 != 0.0) { constptr.ntcn = (NLSQMU / (constptr.sqrta_2 * eph.sqrta)) + eph.deltan; } else { constptr.ntcn = eph.deltan; } double num = eph.ecc * eph.ecc; double num2 = num * eph.ecc; double num3 = num2 * eph.ecc; double num4 = num3 * eph.ecc; double num5 = num4 * eph.ecc; constptr.ntcs1 = ((1.0 + (3.0 * num)) + (5.0 * num3)) + (7.0 * num5); constptr.ntcs2 = ((2.0 * eph.ecc) + (4.0 * num2)) + (6.0 * num4); constptr.ntcs3 = -(((4.5 * num) + (28.3333333333333 * num3)) + (96.8333333333333 * num5)); constptr.ntcs4 = -((10.6666666666667 * num2) + (52.0 * num4)); constptr.ntcs5 = (26.0416666666667 * num3) + (247.975 * num5); constptr.ntcs6 = 64.8 * num4; constptr.ntcs7 = -163.401388888889 * num5; constptr.ntcc2 = -(((2.0 * eph.ecc) + (8.0 * num2)) + (18.0 * num4)); constptr.ntcc3 = -(((4.5 * num) + (12.5 * num3)) + (24.5 * num5)); constptr.ntcc4 = (10.6666666666667 * num2) + (78.0 * num4); constptr.ntcc5 = (26.0416666666667 * num3) + (151.083333333333 * num5); constptr.ntcc6 = -constptr.ntcs6; constptr.ntcc7 = constptr.ntcs7; constptr.ntc1e2 = 1.0 - num; constptr.ntcrx = constptr.sqrta_2 * constptr.ntc1e2; constptr.ntck = Math.Sqrt(constptr.ntc1e2); constptr.ntck2 = constptr.ntck * constptr.ntc1e2; constptr.ntcsw = Math.Sin(eph.omega); constptr.ntccw = Math.Cos(eph.omega); constptr.ntcl = eph.omega0 - (eph.omegaDot * eph.toe); constptr.ntcld = eph.omegaDot - NLERTE; constptr.ntcl2 = NLERTE * eph.toe; constptr.ntecos = (-NLRF * eph.ecc) * eph.sqrta; }
public bool ReadEphWriteToArrayList() { try { RinexEph eph = new RinexEph(); int startIndex = 0; int num2 = 0x16; int length = 0x13; int num4 = num2; int num5 = num4 + length; int num6 = num5 + length; string str = this.m_streamreader.ReadLine(); if (str == null) { return(true); } eph.svid = byte.Parse(str.Substring(startIndex, 2).Trim()); string str2 = str.Substring(2, 3).Trim(); this.Year = Convert.ToInt32(str2); if (this.Year < 80) { this.Year += 0x7d0; } else if ((this.Year >= 80) && (this.Year <= 0x63)) { this.Year += 0x76c; } else { return(false); } string str3 = str.Substring(5, 3).Trim(); this.Month = Convert.ToInt32(str3); string str4 = str.Substring(8, 3).Trim(); this.Day = Convert.ToInt32(str4); this.Hour = int.Parse(str.Substring(11, 3).Trim()); this.Minute = int.Parse(str.Substring(14, 3).Trim()); string str7 = str.Substring(0x11, 5); this.Second = (int)double.Parse(str7.Trim()); eph.af0 = double.Parse(str.Substring(num2, length).ToString().Replace('D', 'e').Trim()); eph.af1 = double.Parse(str.Substring(num5, length).ToString().Replace('D', 'e').Trim()); eph.af2 = double.Parse(str.Substring(num6, length).ToString().Replace('D', 'e').Trim()); string str11 = this.m_streamreader.ReadLine(); eph.iode = double.Parse(str11.Substring(startIndex, num2).ToString().Replace('D', 'e').Trim()); eph.Crs = double.Parse(str11.Substring(num4, length).ToString().Replace('D', 'e').Trim()); string str14 = str11.Substring(num5, length).ToString().Replace('D', 'e'); eph.deltan = double.Parse(str14.Trim()) / 3.1415926535897931; string str15 = str11.Substring(num6, length).ToString().Replace('D', 'e'); eph.m0 = double.Parse(str15.Trim()) / 3.1415926535897931; string str16 = this.m_streamreader.ReadLine(); eph.Cuc = double.Parse(str16.Substring(startIndex, num2).ToString().Replace('D', 'e').Trim()); eph.ecc = double.Parse(str16.Substring(num4, length).ToString().Replace('D', 'e').Trim()); eph.Cus = double.Parse(str16.Substring(num5, length).ToString().Replace('D', 'e').Trim()); eph.sqrta = double.Parse(str16.Substring(num6, length).ToString().Replace('D', 'e').Trim()); string str21 = this.m_streamreader.ReadLine(); double num7 = double.Parse(str21.Substring(startIndex, num2).ToString().Replace('D', 'e').Trim()); eph.toe = num7; eph.toc = eph.toe; eph.Cic = double.Parse(str21.Substring(num4, length).ToString().Replace('D', 'e').Trim()); string str24 = str21.Substring(num5, length).ToString().Replace('D', 'e'); eph.omega0 = double.Parse(str24.Trim()) / 3.1415926535897931; eph.Cis = double.Parse(str21.Substring(num6, length).ToString().Replace('D', 'e').Trim()); string str26 = this.m_streamreader.ReadLine(); string str27 = str26.Substring(startIndex, num2).ToString().Replace('D', 'e'); eph.i0 = double.Parse(str27.Trim()) / 3.1415926535897931; eph.Crc = double.Parse(str26.Substring(num4, length).ToString().Replace('D', 'e').Trim()); string str29 = str26.Substring(num5, length).ToString().Replace('D', 'e'); eph.omega = double.Parse(str29.Trim()) / 3.1415926535897931; string str30 = str26.Substring(num6, length).ToString().Replace('D', 'e'); eph.omegaDot = double.Parse(str30.Trim()) / 3.1415926535897931; string str31 = this.m_streamreader.ReadLine(); string str32 = str31.Substring(startIndex, num2).ToString().Replace('D', 'e'); eph.idot = double.Parse(str32.Trim()) / 3.1415926535897931; double num8 = double.Parse(str31.Substring(num5, length).ToString().Replace('D', 'e').Trim()); eph.weekNo = num8; string str34 = this.m_streamreader.ReadLine(); double num9 = double.Parse(str34.Substring(startIndex, num2).ToString().Replace('D', 'e').Trim()); eph.accuracy = num9; if ((num9 >= 0.0) && (num9 <= 2.4)) { eph.ura_ind = 0; } else if ((num9 > 2.4) && (num9 <= 3.4)) { eph.ura_ind = 1; } else if ((num9 > 3.4) && (num9 <= 4.85)) { eph.ura_ind = 2; } else if ((num9 > 4.85) && (num9 <= 6.85)) { eph.ura_ind = 3; } else if ((num9 > 6.85) && (num9 <= 9.65)) { eph.ura_ind = 4; } else if ((num9 > 9.65) && (num9 <= 13.65)) { eph.ura_ind = 5; } else if ((num9 > 13.65) && (num9 <= 24.0)) { eph.ura_ind = 6; } else if ((num9 > 24.0) && (num9 <= 48.0)) { eph.accuracy = 7.0; } else if ((num9 > 48.0) && (num9 <= 96.0)) { eph.ura_ind = 8; } else if ((num9 > 96.0) && (num9 <= 192.0)) { eph.ura_ind = 9; } else if ((num9 > 192.0) && (num9 <= 384.0)) { eph.ura_ind = 10; } else if ((num9 > 384.0) && (num9 <= 768.0)) { eph.ura_ind = 11; } else if ((num9 > 768.0) && (num9 <= 1536.0)) { eph.ura_ind = 12; } else if ((num9 > 1536.0) && (num9 <= 3072.0)) { eph.ura_ind = 13; } else if ((num9 > 3072.0) && (num9 <= 6144.0)) { eph.ura_ind = 14; } else { eph.ura_ind = 15; } if (((uint)double.Parse(str34.Substring(num4, length).ToString().Replace('D', 'e').Trim())) == 0) { eph.status = 1; } else { eph.status = 0; } eph.tgd = double.Parse(str34.Substring(num5, length).ToString().Replace('D', 'e').Trim()); double num11 = double.Parse(str34.Substring(num6, length).ToString().Replace('D', 'e').Trim()); eph.iodc = num11; double num12 = double.Parse(this.m_streamreader.ReadLine().Substring(num4, length).ToString().Replace('D', 'e').Trim()); eph.fitint = (sbyte)num12; this.rinexArray.Add(eph); } catch (Exception exception) { string message = exception.Message; return(true); } return(false); }