/// <summary> /// 获取指定时刻的卫星位置,考虑了地球自转改正置。 /// </summary> /// <param name="gpsTime"></param> /// <param name="ephemeris"></param> /// <returns></returns> public static XYZ GetSatPosWithEarthRotateCorrection(Time gpsTime, Ephemeris ephemeris) { var dt = (ephemeris.Time - gpsTime); //相距参考时刻的秒数。 #region 方案1:顾及地球自转效应 //correction for earth rotation double sinL = Math.Sin(RotateVelocityOfEarth * dt); double cosL = Math.Cos(RotateVelocityOfEarth * dt); double newX = cosL * ephemeris.XYZ.X - sinL * ephemeris.XYZ.Y; double newY = sinL * ephemeris.XYZ.X + cosL * ephemeris.XYZ.Y; double newZ = ephemeris.XYZ.Z; XYZ newXyz = new XYZ(newX, newY, newZ); #endregion return(newXyz); }
/// <summary> /// 星历相减 /// </summary> /// <param name="first"></param> /// <param name="second"></param> /// <returns></returns> public static Ephemeris operator -(Ephemeris first, Ephemeris second) { if (first.Prn != second.Prn || first.Time != second.Time) { new Log(typeof(Ephemeris)).Error("不是同一卫星,不可相加," + first + ", " + second); return(first); } Ephemeris ephemeris = new Ephemeris(first.Prn, first.Time); ephemeris.XYZ = first.XYZ - second.XYZ; if (first.Rms != null && second.Rms != null) { // ephemeris.Rms = XYZ.RmsPlus(first.Rms, second.Rms); } ephemeris.XyzDot = first.XyzDot - second.XyzDot; ephemeris.ClockBias = first.ClockBias - second.ClockBias; ephemeris.ClockBiasRms = Utils.DoubleUtil.RmsPlus(first.ClockBiasRms, first.ClockBiasRms); ephemeris.ClockDrift = first.ClockDrift - second.ClockDrift; return(ephemeris); }
/// <summary> /// 用于比较排序。 /// </summary> /// <param name="other"></param> /// <returns></returns> public int CompareTo(Ephemeris other) { return((int)this.Time.CompareTo(other.Time)); }