//首先,选择在起始时刻所有满足条件的卫星,
        //查找这些卫星的最大高度角的位置(附近6小时内),选择距离远的,
        //查找其结束点高度角时刻,
        //继续遍历
        public PeriodPrn BuildOnePeriodPrnByCenterTop(Time startTime)
        {
            var endTime = startTime + SearchTimeSpan;

            List <String>    prnsString = GetStartPrns(startTime);
            List <TableCell> maxCells   = new List <TableCell>();

            foreach (var colName in prnsString)
            {
                if (SatElevationTable.MinusNext(colName, startTime) < 0) //方向必须朝上
                {
                    var max = SatElevationTable.GetFirstSlopeApproxTo(colName, CutOffAngle, startTime, false);

                    //   var max = SatElevationTable.GetMaxCell(colName, startTime, endTime);
                    maxCells.Add(max);
                }
            }
            if (maxCells.Count == 0)
            {
                return(null);
            }

            var longest = maxCells.OrderByDescending(m => m.RowNumber).First();

            SatelliteNumber selectedPrn = SatelliteNumber.Parse(longest.ColName);

            var endTimePeriod = (Time)SatElevationTable.GetIndexValue(longest.RowNumber);

            TimePeriod TimePeriod = new Geo.Times.TimePeriod(startTime, endTimePeriod);
            var        PeriodPrn  = new PeriodPrn(TimePeriod, selectedPrn);

            return(PeriodPrn);
        }
        private PeriodPrn BuildOnePeriodPrnByCenterTop2(Time startTime)
        {
            var endTime = startTime + SearchTimeSpan;

            List <String>    prnsString = GetStartPrns(startTime);
            List <TableCell> maxCells   = new List <TableCell>();

            foreach (var item in prnsString)
            {
                if (SatElevationTable.MinusNext(item, startTime) < 0) //方向必须朝上
                {
                    var max = SatElevationTable.GetMaxCell(item, startTime, endTime);
                    maxCells.Add(max);
                }
            }
            var longest = maxCells.FindAll(m => (double)m.Value > CutOffAngle).OrderByDescending(m => m.RowNumber).First();

            SatelliteNumber selectedPrn = SatelliteNumber.Parse(longest.ColName);
            //查找其结尾处,满足条件的时刻或历元
            var       startTime2    = (Time)SatElevationTable.GetIndexValue(longest.RowNumber);
            var       endTime2      = startTime2 + SearchTimeSpan;
            TableCell endCell       = SatElevationTable.GetCellApproxTo(longest.ColName, CutOffAngle, startTime2, endTime2);
            var       endTimePeriod = (Time)SatElevationTable.GetIndexValue(endCell.RowNumber);

            TimePeriod TimePeriod = new Geo.Times.TimePeriod(startTime, endTimePeriod);
            var        PeriodPrn  = new PeriodPrn(TimePeriod, selectedPrn);

            return(PeriodPrn);
        }
Example #3
0
        /// <summary>
        /// 选择
        /// </summary>
        /// <returns></returns>
        public override PeriodPrnManager Select()
        {
            this.DetailResultTable = new ObjectTableStorage("DetailResultTableOf_" + TableSatSelectorType + "_" + PeriodCount + "Count");

            var PeriodPrnManager = new PeriodPrnManager();

            var startTime  = (Time)SatElevationTable.GetIndexValue(0);
            var stepPeriod = TotalPeriodSpan / PeriodCount;

            for (int i = 0; i < PeriodCount; i++)
            {
                var        start      = startTime + TimeSpan.FromSeconds(i * stepPeriod);
                var        end        = start + TimeSpan.FromSeconds(stepPeriod);
                TimePeriod TimePeriod = new TimePeriod(start, end);

                BaseTableSatelliteSelector selector = null;
                switch (TableSatSelectorType)
                {
                case Gnsser.BaseSatSelectionType.MaxElevation:
                    selector = new TableElevationSatSelector(SatElevationTable, TimePeriod, CutOffAngle, false);
                    break;

                case Gnsser.BaseSatSelectionType.MaxCenterElevation:
                    selector = new TableElevationSatSelector(SatElevationTable, TimePeriod, CutOffAngle, true, 1);
                    break;

                case Gnsser.BaseSatSelectionType.MaxTimeSpan:
                    selector = new TableSpanSatSelector(SatElevationTable, TimePeriod, CutOffAngle);
                    break;
                }

                SatelliteNumber prn       = selector.Select();
                var             PeriodPrn = new PeriodPrn(TimePeriod, prn);

                this.AddPeriodPrnToManager(PeriodPrnManager, PeriodPrn);
            }
            return(PeriodPrnManager);
        }
Example #4
0
        /// <summary>
        /// 将选择结果添加到管理器
        /// </summary>
        /// <param name="PeriodPrnManager"></param>
        /// <param name="PeriodPrn"></param>
        protected void AddPeriodPrnToManager(Gnsser.PeriodPrnManager PeriodPrnManager, PeriodPrn PeriodPrn)
        {
            DetailResultTable.NewRow();
            DetailResultTable.AddItem("Period", PeriodPrn.TimePeriod.ToString());
            DetailResultTable.AddItem("Span", PeriodPrn.TimePeriod.TimeSpan.TotalHours.ToString("0.00"));
            DetailResultTable.AddItem("Prn", PeriodPrn.Value);

            var statAngle = SatElevationTable.GetValue <double>(PeriodPrn.TimePeriod.Start, PeriodPrn.Value.ToString());
            var endAngle  = SatElevationTable.GetValue <double>(PeriodPrn.TimePeriod.End, PeriodPrn.Value.ToString());
            var maxAngle  = SatElevationTable.GetMaxValue(PeriodPrn.Value.ToString(), PeriodPrn.TimePeriod.Start, PeriodPrn.TimePeriod.End);

            DetailResultTable.AddItem("StartAngle", statAngle);
            DetailResultTable.AddItem("MaxAngle", maxAngle);
            DetailResultTable.AddItem("EndAngle", endAngle);
            DetailResultTable.EndRow();


            //如果与上次基准星一致,则扩展弧段
            if (IsExpandPeriodWhenSamePrn && PeriodPrnManager.Count > 0 && PeriodPrnManager.Last.Value == PeriodPrn.Value)
            {
                log.Debug("基准星 " + PeriodPrn.Value + "相同,扩展时段 " + PeriodPrnManager.Last.TimePeriod + " 到 " + PeriodPrn.TimePeriod.End);
                PeriodPrnManager.Last.TimePeriod.End = PeriodPrn.TimePeriod.End;
            }
            else
            {
                if (PeriodPrn.Value.SatelliteType == SatelliteType.U)
                {
                    int a = 0;
                }
                if (PeriodPrn.Value != null)
                {
                    PeriodPrnManager.Add(PeriodPrn);
                }
            }
        }