Пример #1
0
        private void Looper_Looping(Geo.Times.Time time)
        {
            TableObject.NewRow();
            TableObject.AddItem("Epoch", time);
            string prefix   = "";
            int    satCount = Prns.Count;

            foreach (var prn in Prns)
            {
                var eph = EphemerisService.Get(prn, time);
                if (eph == null)
                {
                    continue;
                }
                var satXyz = eph.XYZ;
                var polar  = CoordTransformer.XyzToGeoPolar(satXyz, siteXyz, AngleUnit.Degree);
                if (cutOff > polar.Elevation)
                {
                    continue;
                }
                prefix = prn.ToString() + "_";
                TableObject.AddItem(prefix + "Elevation", polar.Elevation);
                TableObject.AddItem(prefix + "Azimuth", polar.Azimuth);
            }
        }
Пример #2
0
        /// <summary>
        /// 预处理
        /// </summary>
        /// <param name="epoch"></param>
        public override void PreProcess(EpochInformation epoch)
        {
            epoch.RemoveIonoFreeUnavailable();

            //预处理
            var tobeDeletes = new List <SatelliteNumber>();

            foreach (var sat in epoch)
            {
                if (!IsValid(sat) || !SatelliteTypes.Contains(sat.Prn.SatelliteType))
                {
                    tobeDeletes.Add(sat.Prn);
                }
            }
            epoch.Remove(tobeDeletes);
            tobeDeletes.Clear();


            foreach (var sat in epoch)
            {
                if (!IsValid(sat) || !SatelliteTypes.Contains(sat.Prn.SatelliteType))
                {
                    continue;
                }
                var prn = sat.Prn;

                var eph = EphemerisService.Get(sat.Prn, sat.ReceiverTime);
                if (eph == null)
                {
                    tobeDeletes.Add(sat.Prn);
                    continue;
                }
                sat.Ephemeris = eph;
                if (sat.GeoElevation < AngleCut)
                {
                    tobeDeletes.Add(sat.Prn);
                    continue;
                }

                //C1 改为 P1
                DcbRangeCorrector.Correct(sat);
                //周跳探测
                //sat.IsUnstable = Detector.Detect(sat);
            }

            epoch.Remove(tobeDeletes);
            tobeDeletes.Clear();
        }
Пример #3
0
        /// <summary>
        /// 计算
        /// </summary>
        public override IEphemeris Get()
        {
            SatelliteNumber prn          = EpochSat.Prn;
            Time            recevingTime = EpochSat.RecevingTime;//utc?? ,接收时刻时间,含钟差改正

            if (EpochSat.Time.Correction != 0)
            {
                int i = 0;
                int j = 0;
            }
            var transTime = EpochSat.GetTransitTime();

            Time emissionTime = recevingTime - transTime;
            var  eph          = EphemerisService.Get(prn, emissionTime);

            return(eph);
        }
Пример #4
0
        public override IEphemeris Get()
        {
            SatelliteNumber prn           = EpochSat.Prn;
            Ephemeris       eph           = null;
            XYZ             receiverPos   = EpochSat.SiteInfo.EstimatedXyz;
            Time            receivingTime = EpochSat.RecevingTime;
            //2.1 坐标迭代法求解
            double transitTime  = 0.075;//传输时间初始值,GEO卫星应该更长,但此处并不影响。
            Time   transmitTime = receivingTime - transitTime;

            eph = EphemerisService.Get(prn, transmitTime);
            if (eph == null)
            {
                throw new NullReferenceException("没有找到 " + prn + " " + transmitTime + " 的星历");
            }


            double differ = Double.MaxValue;//亚纳秒级别则退出
            double DELTA  = 1e-10;
            double tmp    = transitTime;

            //  int count = 0;//测试,统计计算了多少次
            for (int i = 0; differ > DELTA && i < 5; i++) //一般循环一次,可满足精度
            {
                //由于第一次的时间求得的卫星坐标可能会很差(几十米即可带来较大时间误差),因此继续利用通过观测值求得的时间
                tmp          = transitTime;
                transitTime  = (eph.XYZ - receiverPos).Length / GnssConst.LIGHT_SPEED;
                transmitTime = receivingTime - transitTime;

                differ = Math.Abs(transitTime - tmp);

                eph = EphemerisService.Get(prn, transmitTime);
                //  count++;
            }

            //  System.IO.File.AppendAllText(@"D:\count.txt", count + "\t" + differ.ToString("E") + "\r\n");

            return(eph);
        }
        public override IEphemeris Get()
        {
            //实质为计算发射时刻的系统时间, 只比较秒数
            SatelliteNumber prn           = EpochSat.Prn;
            Ephemeris       eph           = null;
            XYZ             receiverPos   = EpochSat.SiteInfo.EstimatedXyz;
            Time            receivingTime = EpochSat.RecevingTime;

            //2.需要接收机钟差
            if (EpochSat.Time.Correction != 0 && EpochSat.FrequenceA.DopplerShift != null)
            {
                //2.2 多普勒频移法
                eph = EphemerisService.Get(prn, receivingTime);
                double distance = (eph.XYZ - receiverPos).Length;
                double deltaT   = distance / GnssConst.LIGHT_SPEED;

                //这里的距离差是接收时刻与发射时刻的位移差,所以应该减去。
                distance -= EpochSat.AverageDopplorSpeed * deltaT;
                deltaT    = distance / GnssConst.LIGHT_SPEED;
                Time transmitTime = receivingTime - deltaT;
                eph = EphemerisService.Get(prn, transmitTime);
            }
            return(eph);
        }
        /// <summary>
        /// 数据刚刚进入,立即执行,最优先的执行,初探
        /// </summary>
        /// <param name="current"></param>
        public override void RawRevise(RinexEpochObservation current)
        {
            //时段过滤
            if (Option.IsEnableTimePeriod)
            {
                if (!Option.TimePeriod.Contains(current.ReceiverTime))
                {
                    current.Clear(); return;
                }
            }

            //采样率时间赋值
            if (this.CurrentIndex == 0 || this.CurrentIndex == -1)
            {
                this.CurrentIndex = 1;
                InitSeconds       = current.ReceiverTime.DateTime.TimeOfDay.TotalSeconds;
                if (Option.IsEnableInterval && Option.Interval > 1 && InitSeconds % 5 != 0) // 若非0, 5秒整数倍的采样间隔,则强制采用10秒整数倍间隔
                {
                    InitSeconds = 0;
                }
            }

            //采样间隔过滤
            if (Option.IsEnableInterval)
            {
                //首先考虑采样率大于1s
                var diff = Math.Round(current.ReceiverTime.DateTime.TimeOfDay.TotalSeconds - InitSeconds) % Option.Interval;
                if (diff > 0.5 && Option.Interval > 1)//相差0.5s,认为是同一个历元
                {
                    current.Clear();
                    return;
                }

                //采样率太小,直接过滤
                if (current.ReceiverTime - PrevOkEpoch < Option.Interval)
                {
                    current.Clear();
                    return;
                }

                //10s 以上的整数必须为10倍的整数秒,如 30s采样率,只能出现 00 和 30 秒
                if (Option.Interval >= 10 && Option.Interval <= 30 && current.ReceiverTime.Seconds % Option.Interval > 1)
                {
                    current.Clear();
                    return;
                }
            }


            //移除其它系统
            if (Option.IsEnableSatelliteTypes)
            {
                current.RemoveOther(Option.SatelliteTypes);
            }


            //观测类型过滤凭借第一字母判断,此处过滤可以加快速度,避免多余计算
            if (Option.IsEnableObsTypes)
            {
                current.RemoveOthers(Option.ObsTypes);
            }

            //删除观测频率
            if (Option.IsEnableRemoveIndicatedFrequence)
            {
                current.RemoveFrequences(Option.FrequenceNumToBeRemoved);
                // log.Info("除频率:" + Geo.Utils.StringUtil.ToString(Option.FrequenceNumToBeRemoved));
            }

            //移除不能组成电离层组合的卫星
            if (Option.IsRemoveIonoFreeUnavaliable)
            {
                List <RinexSatObsData> list = new List <RinexSatObsData>();
                foreach (var sat in current)
                {
                    if (!sat.IsIonoFreeCombinationAvaliable)
                    {
                        list.Add(sat);
                    }
                }
                foreach (var item in list)
                {
                    current.Remove(item.Prn);
                }
            }

            //移除卫星中对于双频无电离层组合多余的观测值
            if (Option.IsRemoveRedundantObsForIonoFree)
            {
                foreach (var sat in current)
                {
                    sat.RemoveRedundantObsForIonoFree();
                }
            }


            //观测码数量不足的移除
            if (ObsCodesToBeRemove != null && ObsCodesToBeRemove.Count > 0)
            {
                foreach (var sat in current)
                {
                    if (!ObsCodesToBeRemove.ContainsKey(sat.Prn.SatelliteType))
                    {
                        continue;
                    }

                    var codes = this.ObsCodesToBeRemove[sat.Prn.SatelliteType];

                    foreach (var item in codes)
                    {
                        sat.Remove(item);
                    }
                }
            }

            //移除指定卫星
            if (Option.IsEnableRemoveSats && Option.SatsToBeRemoved != null && Option.SatsToBeRemoved.Count > 0)
            {
                current.Remove(Option.SatsToBeRemoved);
            }

            //卫星高度角过滤
            if (Option.SatCutOffAngle.Enabled && !XYZ.IsZeroOrEmpty(OldHeader.ApproxXyz))
            {
                //如果星历范围不包括,则不做更改
                if (EphemerisService.TimePeriod.Contains(current.ReceiverTime))
                {
                    List <RinexSatObsData> list = new List <RinexSatObsData>();
                    foreach (var item in current)
                    {
                        var   eph   = EphemerisService.Get(item.Prn, current.ReceiverTime);
                        Polar polar = null;
                        if (eph != null)
                        {
                            polar = CoordTransformer.XyzToGeoPolar(eph.XYZ, OldHeader.ApproxXyz);
                        }
                        //移除了没有星历的卫星
                        if (polar == null || polar.Elevation < Option.SatCutOffAngle.Value)
                        {
                            list.Add(item);
                        }
                    }
                    foreach (var item in list)
                    {
                        current.Remove(item.Prn);
                    }
                }
            }
            //删除指定数据为空的卫星
            if (Option.IsDeleteVacantSat)
            {
                List <SatelliteNumber> tobeDeletes = new List <SatelliteNumber>();
                foreach (var sat in current)
                {
                    foreach (var item in Option.NotVacantCodeList)
                    {
                        if (sat.TryGetValue(item) == 0)
                        {
                            tobeDeletes.Add(sat.Prn);
                        }
                    }
                }
                current.Remove(tobeDeletes);
            }

            base.RawRevise(current);

            //小时段过滤
            if (Option.IsEnableMinEpochCount)
            {
                SmallObsPeriodRemover.Revise(ref current);
            }
        }
Пример #7
0
        /// <summary>
        /// 指定时段内,可以看见的卫星。
        /// </summary>
        /// <returns></returns>
        public List <VisibilityOfSat> GetPeriodSatAppearTimes()
        {
            this.LonLats.Clear();
            List <VisibilityOfSat> sats  = new List <VisibilityOfSat>();
            List <StationSatInfo>  infos = new List <StationSatInfo>();
            List <SatelliteNumber> prns  = new List <SatelliteNumber>();

            //  EphemerisService.EphemerisDataSource.GetEphemerisInfos(
            foreach (SatelliteNumber rec in EphemerisService.Prns)//卫星一颗一颗的算
            {
                if (prns.Contains(rec))
                {
                    continue;
                }
                prns.Add(rec);

                VisibilityOfSat satA = new VisibilityOfSat()
                {
                    PRN = rec, VisibleTimes = new List <BufferedTimePeriod>()
                };
                sats.Add(satA);
                Polar lastP = null;

                DateTime f = DateTime.MinValue;
                for (int i = 0; i < Count; i++)
                {
                    DateTime            time  = From + TimeSpan.FromMinutes(i * SpanMinutes);
                    Time                g     = new Time(time);
                    Geo.Coordinates.XYZ xyz   = EphemerisService.Get(rec, g).XYZ;
                    GeoCoord            coord = CoordTransformer.XyzToGeoCoord(xyz);
                    Polar               p     = CoordTransformer.XyzToGeoPolar(xyz, StationPos);

                    if (lastP == null)
                    {
                        lastP = p; continue;
                    }

                    if (p.Elevation >= EleAngle)
                    {
                        if (f.Equals(DateTime.MinValue) || lastP.Elevation < EleAngle)
                        {
                            f     = time;
                            lastP = p;
                            continue;
                        }
                    }
                    if (p.Elevation < EleAngle || i == Count - 1)                       //当前小于指定高度角
                    {
                        if (!f.Equals(DateTime.MinValue) && lastP.Elevation > EleAngle) //且上一个时刻是大于的,则终端出现了。
                        {
                            BufferedTimePeriod s = new BufferedTimePeriod(f, time);
                            satA.VisibleTimes.Add(s);
                            this.LonLats.Add(new Vector(coord.Lon, coord.Lat)
                            {
                                Tag = rec.PRN.ToString()
                            });
                        }
                    }
                    lastP = p;
                }
            }
            sats.Sort();

            return(sats);
        }