示例#1
0
        /// <summary>
        ///   GNSS时间计算构造函数,
        /// </summary>
        /// <param name="fullBiasBetweenUtcToStartOfGpstNanos">当前时间(UTC)与GPS起始时间之差(StartOfGPST - CurrentUTC),为负数,单位纳秒,第一次观测记录时间。</param>
        public AndroidGnssTimeConverter(long fullBiasBetweenUtcToStartOfGpstNanos, bool IsFromFirstEpoch)
        {
            this.IsFromFirstEpoch    = IsFromFirstEpoch;
            this.FirstFullBias       = fullBiasBetweenUtcToStartOfGpstNanos;
            this.GpsWeekNumber       = (int)Math.Floor(-fullBiasBetweenUtcToStartOfGpstNanos / E9Double / SecondsOfWeek);
            this.GpsWeekNumberNanos  = this.GpsWeekNumber * SecondsOfWeek * E9Long;
            this.GpsWeekStartTimeUtc = Time.StartOfGpsT + GpsWeekNumber * SecondsOfWeek;
            double fullBiasSeconds = -(fullBiasBetweenUtcToStartOfGpstNanos * 1E-9);


            LongPaser LongPaser = new LongPaser(fullBiasBetweenUtcToStartOfGpstNanos);
            var       second    = -1.0 * LongPaser.GetDouble(9);
            var       integ     = -1 * LongPaser.GetHeader(9);
            var       fraction  = -1.0 * LongPaser.GetTail(9) * 1E-9;

            var secTime    = new SecondTime(integ, fraction);
            var newTime    = Time.StartOfGpsT.TickTime + secTime;
            var newGeoTime = new Time(newTime);

            var time = Time.StartOfGpsT + fullBiasSeconds;

            this.FirstEpochOfUtc = time + LeapSecond.Instance.GetLeapSecondBetween(GpsWeekStartTimeUtc.DateTime, time.DateTime);//已经包含跳秒,实质为UTC时间,如果该周内无闰秒的话。
            // local estimate of GPS time = TimeNanos - (FullBiasNanos + BiasNanos)
            this.FirstEpochOfGpst = FirstEpochOfUtc - LeapSecond.Instance.GetLeapSecondFromGpsT(FirstEpochOfUtc.DateTime);

            this.IsEpochValid = true;
            //时间检核
            if (FirstEpochOfUtc < Time.StartOfBdT || FirstEpochOfUtc > Time.UtcNow)
            {
                log.Error("时间可能错误,忽略本历元,可以采用逐历元计算尝试 " + FirstEpochOfUtc);
                this.IsEpochValid = false;
            }
        }
    void OnEnable() {
        s = gameManager.GetComponent<GameManager>();
        SecondTime t = new SecondTime(s.gameRoundTimer);
        time.text = t.formatedTime;

        //< 0.30
        if (t.min == 0 && t.sec < 30) {
            grade.text = "F!";
        } else if (t.min == 0 && t.sec >= 30) { // 0.30 - 1min
            grade.text = "C";
        } else if (t.min == 1 && t.sec < 30) { // < 1.30
            grade.text = "B";
        } else if (t.min == 1 && t.sec >= 30) { // < 2min
            grade.text = "A-";
        } else if (t.min == 2 && t.sec < 30) {
            grade.text = "A";
        } else { //Victory
            grade.text = "A+";
        }
    }
示例#3
0
        /// <summary>
        /// 增加参数到存储表
        /// </summary>
        /// <param name="epoch"></param>
        /// <param name="result"></param>
        private void AddEpochParam(ISiteSatObsInfo epoch, SimpleGnssResult result)
        {
            var fileName = ResultFileNameBuilder.BuildEpochParamFileName(epoch.Name);



            var table = TableTextManager.GetOrCreate(fileName);

            table.NewRow();
            table.AddItem("Epoch", epoch.ReceiverTime);//ToShortTimeString());

            if (result is SingleSiteGnssResult ||
                result is IWithEstimatedBaselines ||
                result is SingleSitePeriodInfoGnssResult ||
                result is IWithEstimatedBaseline)
            {
                XYZ appXyz = new XYZ();
                XYZ estXyz = new XYZ();
                if (result is SingleSiteGnssResult)
                {
                    var singleSiteResult = result as SingleSiteGnssResult;
                    appXyz = singleSiteResult.ApproxXyz;
                    estXyz = singleSiteResult.EstimatedXyz;
                }
                if (result is SingleSitePeriodInfoGnssResult)
                {
                    var period = result as SingleSitePeriodInfoGnssResult;
                    appXyz = period.MaterialObj[0].SiteInfo.ApproxXyz;
                }
                if (result is IWithEstimatedBaseline)
                {
                    var info     = result as IWithEstimatedBaseline;
                    var baseLine = info.GetEstimatedBaseline();
                    estXyz = baseLine.EstimatedXyzOfRov;
                    appXyz = baseLine.ApproxXyzOfRov;
                }
                if (result is IWithEstimatedBaselines)
                {
                    var info     = result as IWithEstimatedBaselines;
                    var baseLine = info.GetEstimatedBaselines().First;
                    estXyz = baseLine.EstimatedXyzOfRov;
                    appXyz = baseLine.ApproxXyzOfRov;
                }


                var dxyz = ((BaseGnssResult)result).XyzCorrection; // XYZ.Parse(result.Adjustment.Estimated);

                if (dxyz != null)                                  //&& epoch.ReceiverTime.SecondsOfDay % 30 == 0
                {
                    ENU enu = null;
                    if (this.Option.IsUpdateEstimatePostition)
                    {
                        dxyz = estXyz - appXyz;

                        enu = CoordTransformer.XyzToEnu(estXyz, appXyz);
                    }
                    else
                    {
                        enu = CoordTransformer.LocaXyzToEnu(dxyz, appXyz);
                    }

                    table.AddItem(Gnsser.ParamNames.De, enu.E);
                    table.AddItem(Gnsser.ParamNames.Dn, enu.N);
                    table.AddItem(Gnsser.ParamNames.Du, enu.U);

                    if (this.Option.IsUpdateEstimatePostition || this.Option.PositionType == PositionType.动态定位)
                    {
                        table.AddItem("EstX", estXyz.X);
                        table.AddItem("EstY", estXyz.Y);
                        table.AddItem("EstZ", estXyz.Z);
                    }
                }
            }

            #region 添加钟结果改正
            if (result is ClockEstimationResult)
            {
                var           mEpochInfo = epoch as MultiSiteEpochInfo;
                List <string> paranames  = result.ResultMatrix.ParamNames;
                int           CountOfSat = epoch.EnabledSatCount * 2;
                foreach (var item in epoch.EnabledPrns)
                {
                    double qq = result.ResultMatrix.Corrected.CorrectedValue[paranames.IndexOf(item + "_" + ParamNames.SatClkErrDistance)];
                    table.AddItem(item.ToString(), qq);
                    int    count = 0;
                    double time  = 0;
                    Time   EmissionSatClockTime = new Time();// Time.Default;
                    //Time EmissionSatClockTime1 = Time.Default;
                    foreach (var item2 in mEpochInfo)
                    {
                        foreach (var item3 in item2)
                        {
                            if (item3.Prn == item)
                            {
                                count++;
                                time += item3.Ephemeris.ClockBias - ((Ephemeris)item3.Ephemeris).RelativeCorrection;
                                //EmissionSatClockTime.TickTime.SecondTicks += item3.EmissionTime.TickTime.SecondTicks;

                                EmissionSatClockTime.TickTime += item3.EmissionTime.TickTime;
                                break;
                            }
                        }
                    }
                    double aa    = qq / 0.3 + time * 1e9 / count;
                    double time1 = (EmissionSatClockTime.TickTime.SecondTicks + EmissionSatClockTime.TickTime.Fraction) / count;
                    EmissionSatClockTime.TickTime = SecondTime.FromSecond(time1);
                    table.AddItem(item + "EmissionSatClockTime", EmissionSatClockTime.ToString());
                    table.AddItem(item + "_Corrected", aa);
                }
            }
            #endregion

            //table.AddItem((IVector)result.Adjustment.Estimated);
            foreach (var name in result.ParamNames)
            {
                //if (item.Length == 6 && item.Substring(3, 3) == "_λN")
                //{
                //    table.AddItem(item.Substring(0, 3), result.Adjustment.Estimated[item]);
                //}
                //else
                {
                    table.AddItem(name, result.ResultMatrix.Estimated[name]);
                }
            }
            if (epoch.UnstablePrns.Count > 0 || epoch.RemovedPrns.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                if (epoch.UnstablePrns.Count > 0)
                {
                    sb.Append(String.Format(new EnumerableFormatProvider(), "{0}", epoch.UnstablePrns));
                }

                if (epoch.RemovedPrns.Count > 0)
                {
                    sb.Append(";" + String.Format(new EnumerableFormatProvider(), "{0}", epoch.RemovedPrns));
                }

                table.AddItem("CsOrRemoved", sb.ToString());
            }

            table.AddItem(ParamNames.ResultType, result.ResultMatrix.ResultType);
            table.AddItem(ParamNames.StdDev, result.ResultMatrix.StdDev);

            table.EndRow();
        }