示例#1
0
文件: Orbit.cs 项目: mfkiwl/GeoFun
        /// <summary>
        /// 计算卫星位置
        /// </summary>
        /// <param name="oEpo"></param>
        public void GetSatPos(ref OEpoch oEpo)
        {
            if (oEpo is null || oEpo.SatNum == 0)
            {
                return;
            }

            double pRange = 0d;

            foreach (var sat in oEpo.AllSat.Values)
            {
                if (!sat.SatPRN.StartsWith("G"))
                {
                    continue;
                }
                pRange = sat["P2"];
                if (pRange == 0d)
                {
                    pRange = sat["P1"];
                }
                if (pRange == 0d)
                {
                    pRange = sat["C1"];
                }
                if (pRange == 0d)
                {
                    continue;
                }

                GPST t0 = new GPST(oEpo.Epoch);
                t0.AddSeconds(-pRange / Common.C0);
                double[] satPos = GetSatPos(t0, sat.SatPRN);
                sat.SatCoor = satPos;
            }
        }
示例#2
0
        /// <summary>
        /// 每几个历元输出一张图
        /// </summary>
        /// <param name="epoNum"></param>
        public void WriteTECMap(string outFolder, int epoNum = 10)
        {
            List <int> startIndex = new List <int>();

            GPST startTime = Stations.Min(s => s.StartTime);

            for (int i = 0; i < Stations.Count; i++)
            {
                OStation sta   = Stations[i];
                int      index = (int)Math.Floor(sta.StartTime.TotalSeconds - startTime.TotalSeconds + 0.1d);
                startIndex.Add(index);
            }

            GPST curStartTime = new GPST(startTime);
            GPST curEndTime   = new GPST(startTime);

            curEndTime.AddSeconds(epoNum * Interval);
            double          p4 = 0d;
            int             start = 0, end = epoNum;
            List <string[]> data = new List <string[]>();

            do
            {
                data = new List <string[]>();
                for (int i = 0; i < Stations.Count; i++)
                {
                    var sta = Stations[i];
                    if (startIndex[i] >= end)
                    {
                        continue;
                    }
                    if (startIndex[i] + sta.EpochNum <= start)
                    {
                        continue;
                    }

                    int epoNum1 = startIndex[i] < start ? start - startIndex[i] : 0;
                    int epoNum2 = end - startIndex[i];
                    for (int j = epoNum1; j < epoNum2; j++)
                    {
                        foreach (var sat in sta.Epoches[j].AllSat.Values)
                        {
                            p4 = sat["SP4"];
                            if (Math.Abs(p4) < 1e-10)
                            {
                                continue;
                            }

                            data.Add(new string[]
                            {
                                (sat.IPP[1] * Angle.R2D).ToString("#.##########"),
                                (sat.IPP[0] * Angle.R2D).ToString("#.##########"),
                                p4.ToString("f4")
                            });
                        }
                    }
                }

                // 写入文件
                //if (data.Count > 0)
                {
                    string fileName = string.Format("{0}{1:0#}{2:0#}{3:0#}{4:0#}{5:##.#}.{6}{7:0#}{8:0#}{9:0#}{10:0#}{11:##.#}.tec",
                                                    curStartTime.CommonT.Year,
                                                    curStartTime.CommonT.Month,
                                                    curStartTime.CommonT.Day,
                                                    curStartTime.CommonT.Hour,
                                                    curStartTime.CommonT.Minute,
                                                    curStartTime.CommonT.Second,
                                                    curEndTime.CommonT.Year,
                                                    curEndTime.CommonT.Month,
                                                    curEndTime.CommonT.Day,
                                                    curEndTime.CommonT.Hour,
                                                    curEndTime.CommonT.Minute,
                                                    curEndTime.CommonT.Second
                                                    );

                    string filePath = Path.Combine(outFolder, fileName);
                    FileHelper.WriteLines(filePath, data, ',');

                    curStartTime.AddSeconds(epoNum * Interval);
                    curEndTime.AddSeconds(epoNum * Interval);
                }

                start += epoNum;
                end   += epoNum;
            }while (data.Count > 0);
        }