public override void Correct(EpochSatellite epochSatellite) { Time gpsTime = epochSatellite.RecevingTime; IEphemeris sat = epochSatellite.Ephemeris; SatelliteNumber prn = epochSatellite.Prn; //计算太阳位置方法 //XYZ sunPosition = epochSatellite.EpochInfo.DataSouceProvider.UniverseObjectProvider.GetSunPosition(gpsTime); //新的计算太阳位置方法 Time tutc = gpsTime.GpstToUtc(); //查找地球自转信息 Gnsser.Data.ErpItem erpv = null; if (DataSouceProvider.ErpDataService != null) { erpv = DataSouceProvider.ErpDataService.Get(tutc); } if (erpv == null) { erpv = ErpItem.Zero; } XYZ sunPosition = new XYZ(); DataSouceProvider.UniverseObjectProvider.GetSunPosition(gpsTime, erpv, ref sunPosition); //use L1 value IAntenna antenna = DataSouceProvider.AntennaDataSource.Get(prn.ToString(), gpsTime); if (antenna == null) { return; } string AntennaType = antenna.AntennaType; XYZ svPos = sat.XYZ; XYZ receiverPosition = epochSatellite.SiteInfo.EstimatedXyz; if (receiverPosition.Equals(XYZ.Zero)) { return; } bool cycleSlip = epochSatellite.IsUnstable; if (cycleSlip || !PhaseManager.Contains(prn)) //a cycle slip happend { PhaseManager[prn] = new SatVectorPhase(); } double windUpCorrection = GetSatPhaseWindUpCorectValue(prn, gpsTime, svPos, receiverPosition, sunPosition, AntennaType); //double windUpCorrection2 = GetSatPhaseWindUpCorectValue(satelliteType, gpsTime, svPos, receiverPosition, epochSatellite, sunPosition); this.Correction = (windUpCorrection); }
public override void Correct(EpochSatellite epochSatellite) { IEphemeris sat = epochSatellite.Ephemeris; double correction = GetRelativeCorrection(sat) * GnssConst.LIGHT_SPEED; this.Correction = (correction); }
/// <summary> /// 相对论效应改正。 /// 由于卫星速度快,产生相对论效应,使卫星钟变慢。 /// </summary> /// <param name="sat"></param> /// <returns></returns> public static double GetRelativeCorrection(IEphemeris sat) { XYZ pos = sat.XYZ; XYZ speed = sat.XyzDot; return(EphemerisUtil.GetRelativeCorrection(pos, speed)); }
public override bool Revise(ref IEphemeris eph) { //eph.XYZ = EphemerisUtil.CorrectEarthSagnac(eph.XYZ, ReceiverPos); //eph.XyzDot = EphemerisUtil.CorrectEarthSagnac(eph.XyzDot, ReceiverPos); // 卫星坐标的地球自转改正 double len = (eph.XYZ - ReceiverPos).Length; double elapsedTime = len / GnssConst.LIGHT_SPEED; double sag = GnssConst.EARTH_ROTATE_SPEED * elapsedTime; double sx = Math.Cos(sag) * eph.XYZ.X + Math.Sin(sag) * eph.XYZ.Y; double sy = -Math.Sin(sag) * eph.XYZ.X + Math.Cos(sag) * eph.XYZ.Y; eph.XYZ.X = sx; eph.XYZ.Y = sy; sx = Math.Cos(sag) * eph.XyzDot.X + Math.Sin(sag) * eph.XyzDot.Y; sy = -Math.Sin(sag) * eph.XyzDot.X + Math.Cos(sag) * eph.XyzDot.Y; eph.XyzDot.X = sx; eph.XyzDot.Y = sy; return(true); }
public override bool Revise(ref IEphemeris eph) { XYZ dant1 = GetSatAntOff(eph.Prn, eph, eph.Time); eph.XYZ = eph.XYZ + dant1; return(true); }
/// <summary> /// 相对论改正钟差 /// </summary> /// <param name="eph"></param> /// <returns></returns> public override bool Revise(ref IEphemeris eph) { //采用精密钟差服务改正 if (ClockDataSource != null) { if (Failes.Contains(eph.Prn)) { return(true); } var clock = ClockDataSource.Get(eph.Prn, eph.Time); if (clock != null) { if (clock.ClockBias != 0) { eph.ClockBias = clock.ClockBias; } //if (clock.ClockDrift != 0) { eph.ClockDrift = clock.ClockDrift; } //如果钟漂不为 0 ,则赋值。 } else//获取失败 { int i = 0; //下次避免再次计算 Failes.Add(eph.Prn); } } else { log.Debug("没有钟差服务!钟差不会单独改正" + eph); } return(true); }
//// =============== //// LOCAL FUNCTIONS //// =============== //// //// This is the function used to get the position and velocity vectors //// for the major solar system bodies and the moon. It is patterned after //// the solarsystem() function in the original NOVAS-C package. You can //// pass an IDispatch pointer for an ephemeris component, and it will be //// used. If that is NULL the internal solsys3() function is used. //// //// This function must set error info... it is designed to work with //// reflected exceptions from the attached ephemeris //// internal static short solarsystem_nov(ref IEphemeris ephDisp, double tjd, double tdb, Body planet, Origin origin, ref double[] pos, ref double[] vel) { //Dim pl As NOVAS2.Body, org As NOVAS2.Origin //Dim TL As New TraceLogger("", "solarsystem_nov") short rc = 0; //TL.Enabled = True //TL.LogMessage("solarsystem_nov", "Start") //// //// solsys3 takes tdb, ephemeris takes tjd //// //Select Case origin // Case OriginType.nvBarycentric //org = NOVAS2.Origin.SolarSystemBarycentre // Case OriginType.nvHeliocentric //org = NOVAS2.Origin.CentreOfMassOfSun //End Select //Select Case planet // Case PlanetNumber.nvEarth //pl = NOVAS2.Body.Earth // Case PlanetNumber.nvJupiter //pl = NOVAS2.Body.Jupiter // Case PlanetNumber.nvMars //pl = NOVAS2.Body.Mars // Case PlanetNumber.nvMercury //pl = NOVAS2.Body.Mercury // Case PlanetNumber.nvMoon //pl = NOVAS2.Body.Moon // Case PlanetNumber.nvNeptune //pl = NOVAS2.Body.Neptune // Case PlanetNumber.nvPluto //pl = NOVAS2.Body.Pluto // Case PlanetNumber.nvSaturn //pl = NOVAS2.Body.Saturn // Case PlanetNumber.nvSun //pl = NOVAS2.Body.Sun // Case PlanetNumber.nvUranus //pl = NOVAS2.Body.Uranus // Case PlanetNumber.nvVenus //pl = NOVAS2.Body.Venus //End Select //TL.LogMessage("solarsystem_nov", "After planet") if (ephDisp == null) //No ephemeris attached { //rc = solsys3_nov(tdb, planet, origin, pos, vel) throw (new Exceptions.ValueNotSetException("EphemerisCode:SolarSystem_Nov No emphemeris object supplied")); } else { //CHECK TDB BELOW IS CORRECT! //TL.LogMessage("solarsystem_nov", "Before ephemeris_nov") ephemeris_nov(ephDisp, tdb, BodyType.MajorPlanet, planet, "", origin, ref pos, ref vel); //TL.LogMessage("solarsystem_nov", "After ephemeris_nov") } //TL.Enabled = False //TL.Dispose() //TL = Nothing return(rc); }
public IEphemeris Revise(IEphemeris eph) { foreach (var item in EphemerisProcessors) { item.Revise(ref eph); } return(eph); }
public override void Correct(EpochSatellite epochSatellite) { IEphemeris sat = epochSatellite.Ephemeris; XYZ reXyz = epochSatellite.SiteInfo.EstimatedXyz; double correction = GetRelativeCorrection(sat, reXyz); this.Correction = (correction); }
/// <summary> /// 地球自转效应改正。 /// /// </summary> /// <param name="sat"></param> /// <returns></returns> public static double GetRelativeCorrection(IEphemeris sat, XYZ rr) { XYZ rs = sat.XYZ; //double OMGE = 7.2921151467E-5; /* earth angular velocity (IS-GPS) (rad/s) */ double sagnacCorrect = GnssConst.EARTH_ROTATE_SPEED * (rs.X * rr.Y - rs.Y * rr.X) / GnssConst.LIGHT_SPEED; return(sagnacCorrect); }
public Earth() { this.m_BaryPos = new PositionVector(); this.m_HeliPos = new PositionVector(); this.m_BaryVel = new VelocityVector(); this.m_HeliVel = new VelocityVector(); this.m_EarthEph = (IEphemeris) new Ephemeris(); this.m_EarthEph.BodyType = BodyType.Moon; this.m_EarthEph.Number = Body.Earth; this.m_EarthEph.Name = "Earth"; this.m_Valid = false; }
/// <summary> /// 相对论改正钟差 /// </summary> /// <param name="eph"></param> /// <returns></returns> public override bool Revise(ref IEphemeris eph) { //地球自转改正之后,计算相对论改正 XYZ SatXyz = eph.XYZ; XYZ SatSpeed = eph.XyzDot; double relativeTime = GetRelativeCorrection(SatXyz, SatSpeed); eph.ClockBias += relativeTime; eph.RelativeCorrection = relativeTime; return(true); }
public Planet() { this.m_ephdisps = new int[5]; this.m_earthephdisps = new int[5]; this.m_name = (string)null; this.m_bDTValid = false; this.m_ephobj = (IEphemeris) new ASCOM.Astrometry.Kepler.Ephemeris(); this.m_earthephobj = (IEphemeris) new ASCOM.Astrometry.Kepler.Ephemeris(); this.m_earthephobj.BodyType = BodyType.Moon; this.m_earthephobj.Name = "Earth"; this.m_earthephobj.Number = Body.Earth; this.Nov31 = new NOVAS31(); }
public override void Correct(EpochSatellite epochSatellite) { IEphemeris sat = epochSatellite.Ephemeris; if (sat == null) { return; } XYZ svPos = sat.XYZ; XYZ nominalPos = epochSatellite.SiteInfo.EstimatedXyz; double correction = GetSatGravDelayCorrection(svPos, nominalPos); this.Correction = (correction); }
internal static void get_earth_nov(ref IEphemeris pEphDisp, double tjd, ref double tdb, ref double[] peb, ref double[] veb, ref double[] pes, ref double[] ves) { short i, rc; double dummy = 0, secdiff = 0; double ltdb; double[] lpeb = new double[3]; double[] lveb = new double[3]; double[] lpes = new double[3]; double[] lves = new double[3]; Tdb2Tdt(tjd, ref dummy, ref secdiff); ltdb = tjd + secdiff / 86400; try { rc = solarsystem_nov(ref pEphDisp, tjd, ltdb, Body.Earth, Origin.Barycentric, ref lpeb, ref lveb); if (rc != 0) { throw new Exceptions.NOVASFunctionException("EphemerisCode:get_earth_nov Earth eph exception", "solarsystem_nov", rc); } } catch (Exception ex) { get_earth_tjd_last = 0; throw; } try { rc = solarsystem_nov(ref pEphDisp, tjd, ltdb, Body.Earth, Origin.Heliocentric, ref lpes, ref lves); if (rc != 0) { throw new Exceptions.NOVASFunctionException("EphemerisCode:get_earth_nov Earth eph exception", "solarsystem_nov", rc); } } catch (Exception ex) { get_earth_tjd_last = 0; throw; } get_earth_tjd_last = tjd; tdb = ltdb; for (i = 0; i <= 2; i++) { peb[i] = lpeb[i]; veb[i] = lveb[i]; pes[i] = lpes[i]; ves[i] = lves[i]; } }
internal static short solarsystem_nov(ref IEphemeris ephDisp, double tjd, double tdb, Body planet, Origin origin, ref double[] pos, ref double[] vel) { short rc = 0; if ((ephDisp == null)) { throw new Exceptions.ValueNotSetException("EphemerisCode:SolarSystem_Nov No emphemeris object supplied"); } else { ephemeris_nov(ref ephDisp, tdb, BodyType.MajorPlanet, (int)planet, "", origin, ref pos, ref vel); } return(rc); }
public override void Correct(EpochSatellite epochSatellite) { if (AntennaDataSource == null || SatInfoService == null) { return; } Time gpsTime = epochSatellite.RecevingTime; // XYZ sunPosition = epochSatellite.EpochInfo.DataSouceProvider.UniverseObjectProvider.GetSunPosition(gpsTime);// 这个可以每个历元算一次,有待优化。???czs 2014.10.05 //下面是新的计算太阳位置 Time tutc = gpsTime.GpstToUtc(); //查找地球自转信息 Gnsser.Data.ErpItem erpv = null; if (ErpDataService != null) { erpv = ErpDataService.Get(tutc); } if (erpv == null) { erpv = ErpItem.Zero; } XYZ sunPosition = new XYZ(); UniverseObjectProvider.GetSunPosition(gpsTime, erpv, ref sunPosition); IEphemeris sat = epochSatellite.Ephemeris; XYZ svPos = sat.XYZ; XYZ receiverPosition = epochSatellite.SiteInfo.EstimatedXyz; SatelliteNumber prn = epochSatellite.Prn; SatInfoFile periodSatInfoCollection = SatInfoService.SatInfoFile; IAntenna antenna = AntennaDataSource.Get(prn.ToString(), gpsTime); double correction = GetSatPhaseCenterCorectValue(prn, gpsTime, svPos, receiverPosition, sunPosition, periodSatInfoCollection, antenna); this.Correction = (correction);// }
/// <summary> /// 改正 /// </summary> /// <param name="epochSatellite"></param> public override void Correct(EpochSatellite epochSatellite) { Dictionary <RinexSatFrequency, double> correction = new Dictionary <RinexSatFrequency, double>(); IEphemeris sat = epochSatellite.Ephemeris; XYZ satPos = sat.XYZ; XYZ receiverPosition = epochSatellite.SiteInfo.EstimatedXyz; XYZ ray = satPos - receiverPosition; GeoCoord rcvGeoCoord = epochSatellite.SiteInfo.ApproxGeoCoord; int i = 0; List <RinexSatFrequency> frequences = epochSatellite.RinexSatFrequences; foreach (var item in frequences) { XYZ dant1 = GetSatAntOff(epochSatellite.Prn, item, epochSatellite.Ephemeris, epochSatellite.Ephemeris.Time); //Compute vector station-satellite, in ECEF //Rotate vector ray to UEN reference frame //此处修改为 NEU 坐标系。 //NEU rayNeu = CoordTransformer.XyzToNeu(ray, rcvGeoCoord, AngleUnit.Degree); //double rangeCorretion = CoordUtil.GetDirectionLength(dant1, epochSatellite.Polar); //ray = XYZ.RotateZ(ray, lon); //ray = XYZ.RotateY(ray, -lat); //Convert ray to an unitary vector // XYZ xyzNeu = new XYZ(rayNeu.N, rayNeu.E, rayNeu.U); //NEU unit = rayNeu.UnitNeuVector(); //计算沿着射线方向的改正数。Compute corrections = displacement vectors components along ray direction. XYZ unit2 = ray.UnitVector(); double range2 = dant1.Dot(unit2); //double correctForL = dant1.Dot(unit); //double rang = dant1.Dot(unit); if (range2 != 0) { correction.Add(item, range2); } i++; } this.Correction = (correction); }
//// //// Ephemeris() - Wrapper for external ephemeris generator //// //// The ephemeris generator must support a single method: //// //// result(6) = GetPositionAndVelocity(tjd, Type, Number, Name) //// //// tjd Terrestrial Julian Date //// Type Type of body: 0 = major planet, Sun, or Moon //// 1 = minor planet //// Number: For Type = 0: Mercury = 1, ..., Pluto = 9 //// For Type = 1: minor planet number or 0 for unnumbered MP //// Name: For Type = 0: n/a //// For Type = 1: n/a for numbered MPs. For unnumbered MPs, this //// is the MPC PACKED designation. //// result A SAFEARRAY of VARIANT, each element VT_R8 (double). Elements //// 0-2 are the position vector of the body, elements 3.5 are the //// velocity vector of the body. //// internal static void ephemeris_nov(IEphemeris ephDisp, double tjd, BodyType btype, int num, string name, Origin origin, ref double[] pos, ref double[] vel) { int i = 0; double[] posvel = new double[7]; double[] p = new double[3]; double[] v = new double[3]; //Dim bdy As bodystruct //Dim org As NOVAS2Net.Origin //Dim rc As Short //Dim TL As New TraceLogger("", "EphNov") //TL.Enabled = True // TL.LogMessage("EphNov", "Start") //// //// Check inputs //// if (ephDisp == null) { throw (new Exceptions.ValueNotSetException("Ephemeris_nov Ephemeris object not set")); } else { if ((origin != origin.Barycentric) && (origin != origin.Heliocentric)) { throw (new Utilities.Exceptions.InvalidValueException("Ephemeris_nov Origin is neither barycentric or heliocentric")); } //// //// Call the ephemeris for the heliocentric J2000.0 equatorial coordinates BodyType kbtype = default(BodyType); //TL.LogMessage("EphNov", "Before Case Btype") if (btype == BodyType.Comet) { kbtype = BodyType.Comet; } else if (btype == BodyType.MajorPlanet) { kbtype = BodyType.MajorPlanet; } else if (btype == BodyType.MinorPlanet) { kbtype = BodyType.MinorPlanet; } Body knum = default(Body); switch (num) { case 1: knum = Body.Mercury; break; case 2: knum = Body.Venus; break; case 3: knum = Body.Earth; break; case 4: knum = Body.Mars; break; case 5: knum = Body.Jupiter; break; case 6: knum = Body.Saturn; break; case 7: knum = Body.Uranus; break; case 8: knum = Body.Neptune; break; case 9: knum = Body.Pluto; break; } ephDisp.BodyType = kbtype; ephDisp.Number = knum; if (name != "") { ephDisp.Name = name; } //TL.LogMessage("EphNov", "Before ephDisp GetPosAndVel") posvel = ephDisp.GetPositionAndVelocity(tjd); //TL.LogMessage("EphNov", "After ephDisp GetPosAndVel") } if (origin == origin.Barycentric) { double[] sun_pos = new double[4]; double[] sun_vel = new double[4]; //// CHICKEN AND EGG ALERT!!! WE CANNOT CALL OURSELVES FOR //// BARYCENTER CALCULATION -- AS AN APPROXIMATION, WE USE //// OUR INTERNAL SOLSYS3() FUNCTION TO GET THE BARYCENTRIC //// SUN. THIS SHOULD BE "GOOD ENOUGH". IF WE EVER GET //// AN EPHEMERIS GEN THAT HANDLES BARYCENTRIC, WE CAN //// CAN THIS... //TL.LogMessage("EphNov", "Before solsys3") solsys3_nov(tjd, Body.Sun, origin.Barycentric, ref sun_pos, ref sun_vel); //TL.LogMessage("EphNov", "After solsys3") for (i = 0; i <= 2; i++) { posvel[i] += sun_pos[i]; posvel[i + 3] += (int)(sun_vel[i]); } } for (i = 0; i <= 2; i++) { pos[i] = posvel[i]; vel[i] = posvel[i + 3]; } //TL.Enabled = False //TL.Dispose() }
/// <summary> /// 星历矫正 /// </summary> /// <param name="info"></param> /// <returns></returns> public override bool Revise(ref EpochInformation info) { BuildEphemerisReviser(info); foreach (var sat in info) { EmissionEphemerisRolver solver = null; //if (info.Time.Correction == 0 // || info.SiteInfo.EstimatedXyzRms.Length > 100 // || Math.Abs(info.Time.Correction) > 86400) //没有平差,或坐标初值不准确的情况下,直接采用伪距估算卫星发射时刻 { solver = new EmissionEphemerisRolverWithRange(EphemerisService, Context, sat); } //else //坐标初值已经算出,采用精确坐标计算卫星发射时刻 //{ // solver = new EmissionEphemerisRolverWithCoord(service, DataSouceProvider, sat); //} IEphemeris eph = solver.Get(); //第一次获取 if (eph == null) { //采用第二星历服务 if (SecondEphemerisService != null) { solver = new EmissionEphemerisRolverWithRange(SecondEphemerisService, Context, sat); eph = solver.Get();//第2次获取 } if (eph == null) { continue; } } //查看差多少,如果少于1cm,则极速取消,2018.10.06, hmx, czs eph = Revise(eph); //测试校正,差了100多米啊!!! sat.Ephemeris = eph; //第一次赋值 //update and once more //第二次计算 eph = solver.Get(); if (eph == null) { continue; } eph = Revise(eph); if (false)//测试校正,差了0.1m !!! { var diff = eph.XYZ - sat.Ephemeris.XYZ; int i = 0; } sat.Ephemeris = eph; //eph = solver.Get();//第3次计算 //if (eph == null) continue; //eph = Revise(eph); //if (true)//测试校正,差了0.0m !!! //{ // var diff = eph.XYZ - sat.Ephemeris.XYZ; // int i = 0; //} } return(true); }
/// <summary> /// 用于比较排序。 /// </summary> /// <param name="other"></param> /// <returns></returns> public int CompareTo(IEphemeris other) { return((int)this.Time.CompareTo(other.Time)); }
/// <summary> /// 根据太阳计算卫星偏差 /// </summary> /// <param name="prn"></param> /// <param name="eph"></param> /// <param name="emissionTime"></param> /// <returns></returns> private XYZ GetSatAntOff(SatelliteNumber prn, IEphemeris eph, Time emissionTime) { ErpItem erpv = null; if (DataSouceProvider.ErpDataService != null) { erpv = DataSouceProvider.ErpDataService.Get(emissionTime); } if (erpv == null) { erpv = ErpItem.Zero; } XYZ rsun = new XYZ(); //sun position in ecef // rsun = EpochSat.EpochInfo.DataSouceProvider.UniverseObjectProvider.GetSunPosition(emissionTime); this.DataSouceProvider.UniverseObjectProvider.GetSunPosition(emissionTime, erpv, ref rsun); //unit vetcors of satellite fixed coordinates XYZ ez = -1 * eph.XYZ.UnitVector(); XYZ es = (rsun - eph.XYZ).UnitVector(); //outer product of 3D vectors XYZ r = new XYZ(); r.X = ez.Y * es.Z - ez.Z * es.Y; r.Y = ez.Z * es.X - ez.X * es.Z; r.Z = ez.X * es.Y - ez.Y * es.X; XYZ r0 = new XYZ(); r0.X = r.Y * ez.Z - r.Z * ez.Y; r0.Y = r.Z * ez.X - r.X * ez.Z; r0.Z = r.X * ez.Y - r.Y * ez.X; XYZ ex = r0.UnitVector(); XYZ ey = r.UnitVector(); //XYZ ex = new XYZ(); //ex.X = ey.Y * ez.Z - ey.Z * ez.Y; //ex.Y = ey.Z * ez.X - ey.X * ez.Z; //ex.Z = ey.X * ez.Y - ey.Y * ez.X; //use L1 value if (DataSouceProvider.AntennaDataSource == null) { return(new XYZ()); } IAntenna antenna = DataSouceProvider.AntennaDataSource.Get(prn.ToString(), emissionTime); //如果为空,则返回 0 坐标 if (antenna == null) { return(new XYZ()); } // Get antenna eccentricity for frequency "G01" (L1), in // satellite reference system. // NOTE: It is NOT in ECEF, it is in UEN!!! RinexSatFrequency freq = new RinexSatFrequency(prn, 1); // NEU satAnt = antenna.GetAntennaEccentricity(AntennaFrequency.G01); NEU satAnt = antenna.GetPcoValue(freq); XYZ dant = new XYZ(); dant.X = satAnt.E * ex.X + satAnt.N * ey.X + satAnt.U * ez.X; dant.Y = satAnt.E * ex.Y + satAnt.N * ey.Y + satAnt.U * ez.Y; dant.Z = satAnt.E * ex.Z + satAnt.N * ey.Z + satAnt.U * ez.Z; // Unitary vector from satellite to Earth mass center (ECEF) XYZ satToEarthUnit = (-1.0) * eph.XYZ.UnitVector(); // Unitary vector from Earth mass center to Sun (ECEF) XYZ earthToSunUnit = rsun.UnitVector(); // rj = rk x ri: Rotation axis of solar panels (ECEF) XYZ rj = satToEarthUnit.Cross(earthToSunUnit); // Redefine ri: ri = rj x rk (ECEF) earthToSunUnit = rj.Cross(satToEarthUnit); // Let's funcKeyToDouble ri to an unitary vector. (ECEF) earthToSunUnit = earthToSunUnit.UnitVector(); XYZ dant1 = new XYZ(); dant1.X = satAnt.E * rj.X + satAnt.N * earthToSunUnit.X + satAnt.U * satToEarthUnit.X; dant1.Y = satAnt.E * rj.Y + satAnt.N * earthToSunUnit.Y + satAnt.U * satToEarthUnit.Y; dant1.Z = satAnt.E * rj.Z + satAnt.N * earthToSunUnit.Z + satAnt.U * satToEarthUnit.Z; return(dant1); }
internal static void ephemeris_nov(ref IEphemeris ephDisp, double tjd, BodyType btype, int num, string name, Origin origin, ref double[] pos, ref double[] vel) { int i; double[] posvel, p, v; if ((ephDisp == null)) { throw new Exceptions.ValueNotSetException("Ephemeris_nov Ephemeris object not set"); } else { if (((origin != Origin.Barycentric) & (origin != Origin.Heliocentric))) { throw new Utilities.Exceptions.InvalidValueException("Ephemeris_nov Origin is neither barycentric or heliocentric"); } BodyType kbtype; switch (btype) { case BodyType.Comet: kbtype = BodyType.Comet; break; case BodyType.MajorPlanet: kbtype = BodyType.MajorPlanet; break; case BodyType.MinorPlanet: kbtype = BodyType.MinorPlanet; break; default: throw new NotSupportedException(); } Body knum; switch (num) { case 1: knum = Body.Mercury; break; case 2: knum = Body.Venus; break; case 3: knum = Body.Earth; break; case 4: knum = Body.Mars; break; case 5: knum = Body.Jupiter; break; case 6: knum = Body.Saturn; break; case 7: knum = Body.Uranus; break; case 8: knum = Body.Neptune; break; case 9: knum = Body.Pluto; break; default: throw new ArgumentException(); } ephDisp.BodyType = kbtype; ephDisp.Number = knum; if ((name != "")) { ephDisp.Name = name; } posvel = ephDisp.GetPositionAndVelocity(tjd); if ((origin == Origin.Barycentric)) { double[] sun_pos = new double[3], sun_vel = new double[3]; solsys3_nov(tjd, Body.Sun, Origin.Barycentric, ref sun_pos, ref sun_vel); for (i = 0; i <= 2; i++) { posvel[i] += sun_pos[i]; posvel[i + 3] += sun_vel[i]; } } for (i = 0; i <= 2; i++) { pos[i] = posvel[i]; vel[i] = posvel[i + 3]; } } }
public abstract bool Revise(ref IEphemeris eph);
internal static void get_earth_nov(ref IEphemeris pEphDisp, double tjd, ref double tdb, ref double[] peb, ref double[] veb, ref double[] pes, ref double[] ves) { short i = 0; short rc = 0; double dummy = 0; double secdiff = 0; // static double tjd_last = 0.0; VBConversions Note: Static variable moved to class level and renamed get_earth_nov_tjd_last. Local static variables are not supported in C#. double ltdb = 0; double[] lpeb = new double[4]; double[] lveb = new double[4]; double[] lpes = new double[4]; double[] lves = new double[4]; //Dim TL As New TraceLogger("", "get_earth_nov") //TL.Enabled = True //TL.LogMessage("get_earth_nov", "Start") //// //// Compute the TDB Julian date corresponding to 'tjd'. //// //If (Abs(tjd - tjd_last) > 0.000001) Then 'Optimize repeated calls Tdb2Tdt(tjd, dummy, secdiff); //TL.LogMessage("get_earth_nov", "after tbd2tdt") ltdb = tjd + secdiff / 86400.0; //// //// Get position and velocity of the Earth wrt barycenter of //// solar system and wrt center of the sun. These calls reflect //// exceptions thrown by the attached ephemeris generator, so //// we just return the hr ... the ErrorInfo is already set! //// try { //TL.LogMessage("get_earth_nov", "before solsysnov barycentric") rc = solarsystem_nov(ref pEphDisp, tjd, ltdb, Body.Earth, Origin.Barycentric, ref lpeb, ref lveb); //TL.LogMessage("get_earth_nov", "after solsysnov barycentric") if (rc != 0) { throw (new Exceptions.NOVASFunctionException("EphemerisCode:get_earth_nov Earth eph exception", "solarsystem_nov", rc)); } } catch (Exception) { get_earth_nov_tjd_last = 0.0; throw; } try { //TL.LogMessage("get_earth_nov", "before solsysnov heliocentric") rc = solarsystem_nov(ref pEphDisp, tjd, ltdb, Body.Earth, Origin.Heliocentric, ref lpes, ref lves); //TL.LogMessage("get_earth_nov", "after solsysnov heliocentric") if (rc != 0) { throw (new Exceptions.NOVASFunctionException("EphemerisCode:get_earth_nov Earth eph exception", "solarsystem_nov", rc)); } } catch (Exception) { get_earth_nov_tjd_last = 0.0; throw; } get_earth_nov_tjd_last = tjd; //End If tdb = ltdb; for (i = 0; i <= 2; i++) { peb[i] = lpeb[i]; veb[i] = lveb[i]; pes[i] = lpes[i]; ves[i] = lves[i]; } //TL.Enabled = False //TL.Dispose() //TL = Nothing }
/// <summary> /// 改正 /// </summary> /// <param name="epochSatellite"></param> public override void Correct(EpochSatellite epochSatellite) { if (AntennaDataSource == null || SatInfoService == null) { return; } //Time gpsTime = epochSatellite.RecevingTime; Time emmissiontime = epochSatellite.EmissionTime; // XYZ sunPosition = epochSatellite.EpochInfo.DataSouceProvider.UniverseObjectProvider.GetSunPosition(gpsTime);// 这个可以每个历元算一次,有待优化。???czs 2014.10.05 //下面是新的计算太阳位置 //Time tutc = gpsTime.GpstToUtc(); //查找地球自转信息 Gnsser.Data.ErpItem erpv = null; if (ErpDataService != null) { //erpv = ErpDataService.Get(tutc); erpv = ErpDataService.Get(emmissiontime); } if (erpv == null) { erpv = ErpItem.Zero; } XYZ sunPosition = new XYZ(); UniverseObjectProvider.GetSunPosition(emmissiontime, erpv, ref sunPosition); //UniverseObjectProvider.GetSunPosition(gpsTime, erpv, ref sunPosition); IEphemeris sat = epochSatellite.Ephemeris; XYZ svPos = sat.XYZ; XYZ receiverPosition = epochSatellite.SiteInfo.EstimatedXyz; var prn = epochSatellite.Prn; var satType = prn.SatelliteType; SatInfoFile periodSatInfoCollection = SatInfoService.SatInfoFile; IAntenna antenna = AntennaDataSource.Get(prn.ToString(), emmissiontime); if (antenna == null) { if (!noAntSats.Contains(prn)) { log.Warn(prn + " 没有获取到天线信息!"); noAntSats.Add(prn); } return; } List <RinexSatFrequency> frequences = epochSatellite.RinexSatFrequences; Dictionary <RinexSatFrequency, double> correction = new Dictionary <RinexSatFrequency, double>(); GeoCoord rcvGeoCoord = epochSatellite.SiteInfo.ApproxGeoCoord; int i = 0; foreach (var item in frequences) { double rang = GetSatPhaseCenterCorectValue(prn, item, emmissiontime, svPos, receiverPosition, rcvGeoCoord, sunPosition, periodSatInfoCollection, antenna); if (rang != 0 && frequences.Count > i) { correction.Add(frequences[i], rang); } i++; } this.Correction = (correction);// }