/// <summary> /// 构建窗口数据。 /// </summary> /// <param name="satData"></param> /// <returns></returns> private TimeNumeralWindowDataManager <SatelliteNumber> BuildWindowData(Dictionary <SatelliteNumber, Dictionary <Time, EpochSatellite> > satData) { var WindowDataManager = new TimeNumeralWindowDataManager <SatelliteNumber>(Int16.MaxValue); foreach (var satDic in satData) { var window = WindowDataManager.GetOrCreate(satDic.Key); foreach (var sat in satDic.Value) { var val = sat.Value[SatObsDataType].CorrectedValue; window.Add(sat.Key, val); } } return(WindowDataManager); }
private BaseDictionary <string, TimePeriod> CalculateConvergeceTimePeriods(ObjectTableStorage epochParamTable) { BaseDictionary <string, TimePeriod> dic = new BaseDictionary <string, TimePeriod>(); string fileKey = epochParamTable.Name; //提取最后的结果作为比较依据 Dictionary <string, double> finalValuesForCompare = new Dictionary <string, double>(); foreach (var paramName in ParamNames) { finalValuesForCompare[paramName] = Geo.Utils.ObjectUtil.GetNumeral(epochParamTable.GetLastValue(paramName)); } bool isAllOk = false; var indexName = epochParamTable.GetIndexColName(); TimeNumeralWindowDataManager windowManager = new TimeNumeralWindowDataManager(SequentialEpochCount); int converedCount = 0; //已经收敛的数量 foreach (var row in epochParamTable.BufferedValues) { var index = (Time)row[indexName]; foreach (var item in row) { var paramName = item.Key; if (ParamNames.Contains(paramName)) { if (dic.Contains(paramName)) { continue; } //存在即收敛!!! var window = windowManager.GetOrCreate(paramName); window.IsSetTheVeryFirstKey = true; var val = Geo.Utils.ObjectUtil.GetNumeral(item.Value); if (!Geo.Utils.DoubleUtil.IsValid(val)) { continue; } window.Add(index, val); if (window.IsFull) { var lastVal = finalValuesForCompare[paramName]; var differ = window.GetMaxDifferReferTo(lastVal); if (Math.Abs(differ.Value) <= MaxDiffer) // 已经收敛 { var convergeEpoch = window.FirstKey; //differ.Key.Tag = window.TheVeryFirstKey; dic[paramName] = new TimePeriod((Time)epochParamTable.FirstIndex, convergeEpoch); converedCount++; } } } } isAllOk = converedCount == ParamNames.Count; if (isAllOk) //所有都收敛了,不用再计算 { break; } } //查找收敛的参数 if (!isAllOk)//表示遍历完成也没有收敛 { var notConvered = Geo.Utils.ListUtil.GetDifferences(ParamNames, dic.Keys); foreach (var paramName in notConvered) { dic[paramName] = new TimePeriod((Time)epochParamTable.FirstIndex, Time.MaxValue); log.Warn(fileKey + " 的 " + paramName + " 没有收敛!"); } } log.Info("计算完成:" + epochParamTable.Name); return(dic); }