示例#1
0
        public override void Run()
        {
            List <string> failedPathes = new List <string>();

            this.RunningSolvers       = new System.Collections.Generic.List <IntegralGnssFileSolver>();
            this.PostionReportBuilder = null;

            log.Info("开始初始化,加载资源等。。。");
            DateTime start = DateTime.Now;

            //多时段探测,待做


            if (BaseLineNames == null)
            {
                log.Info("外部没有输入基线,即将选择基线...");
                this.BaseLineNames = BaseLineSelector.GetBaselines(OFilePathes);
            }

            // public List<BaseLineName> GetBaselineNames(string[] obsFilePaths)
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("所选基线:");
            foreach (var item in BaseLineNames)
            {
                sb.AppendLine(item.ToString());
            }
            log.Info(sb.ToString());


            if (BaseLineNames.Count > 1)
            {
                MultiRun(failedPathes, BaseLineNames);
            }
            else
            {
                SingleRun(failedPathes, BaseLineNames[0]);
            }
            this.Complete();
            RunningSolvers.Clear();
            var span = DateTime.Now - start;

            log.Info("计算完毕,耗时:" + span.ToString() + ", " + span.TotalSeconds / OFilePathes.Length + " 秒/个");


            if (failedPathes.Count > 0)
            {
                StringBuilder ssb = new StringBuilder();
                ssb.AppendLine("失败 " + failedPathes.Count + " 个文件(请在日志[Fatal]中查找原因):");
                foreach (var item in failedPathes)
                {
                    ssb.AppendLine(item);
                }
                log.Fatal(ssb.ToString());
            }
        }
示例#2
0
        public override void Run()
        {
            this.RunningSolvers       = new System.Collections.Generic.List <IntegralGnssFileSolver>();
            this.PostionReportBuilder = null;

            log.Info("开始初始化,加载资源等。。。");
            DateTime start = DateTime.Now;

            BuildSolverAndRun(OFilePathes);
            this.Complete();
            RunningSolvers.Clear();
            var span = DateTime.Now - start;

            log.Info("计算完毕,耗时:" + span.ToString() + ", " + span.TotalSeconds / OFilePathes.Length + " 秒/个");
        }
        private void RunSingleSite()
        {
            List <string> failedPathes = new List <string>();

            this.RunningSolvers       = new System.Collections.Generic.List <TStreamer>();
            this.PostionReportBuilder = null;// new PostionReportBuilder(this.Option, RunningSolvers[0].Context);

            log.Info("开始初始化,加载资源等。。。");
            DateTime start = DateTime.Now;

            if (TotalRunnerCount > 1)
            {
                this.InitProcess(TotalRunnerCount);


                if (ParallelConfig.EnableParallel)
                {
                    log.Info("开始并行计算,并行度:" + ParallelConfig.ParallelOptions.MaxDegreeOfParallelism);
                    Parallel.ForEach(OFilePathes, ParallelConfig.ParallelOptions, (path, state) =>
                    {
                        if (!BuildSolverAndRun(path))
                        {
                            failedPathes.Add(path);
                        }

                        if (IsCancel)
                        {
                            state.Break();
                        }
                    });
                }
                else
                {
                    log.Info("开始串行计算。");
                    foreach (var path in OFilePathes)
                    {
                        BuildSolverAndRun(path);

                        if (IsCancel)
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                TStreamer Solver     = null;
                string    singlePath = OFilePathes[0];
//#if !DEBUG
                try
                {
//#endif
                    Solver = BuildSolver(singlePath);
                    this.InitProcess(Solver.Context.ObservationDataSource.ObsInfo.Count);
                    Solver.ResultProduced += Solver_ResultProduced;
                    Solver.Completed      += Solver_Completed;
                    Run(Solver);
//#if !DEBUG
                }
                catch (Exception ex)
                {
                    if (BuildSolverAndRun(singlePath))
                    {
                        failedPathes.Add(singlePath);
                    }

                    var roverMsg = "";
                    if (Solver != null)
                    {
                        roverMsg = Solver.Current + "";
                    }
                    var msg = Solver + singlePath + ", " + roverMsg + ", 计算发生致命错误:" + ex.Message;
                    log.Fatal(msg);
                    if (Setting.GnsserConfig.IsDebug)
                    {
                        ex.Data["GNSSerMsg"] = msg;
                        throw ex;
                    }
                }
//#endif
            }
            this.Complete();
            RunningSolvers.Clear();
            var span = DateTime.Now - start;

            log.Info("计算完毕,耗时:" + span.ToString() + ", " + span.TotalSeconds / TotalRunnerCount + " 秒/个");


            if (failedPathes.Count > 0)
            {
                StringBuilder ssb = new StringBuilder();
                ssb.AppendLine("失败 " + failedPathes.Count + " 个文件(请在日志[Fatal]中查找原因):");
                foreach (var item in failedPathes)
                {
                    ssb.AppendLine(item);
                }
                log.Fatal(ssb.ToString());
                log.Error(ssb.ToString());
            }
        }