private static double TestPeakIL(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var testData = testDataCollection.GetTestData(testType, "Swept", "SweptPDL"); if (testData == null) { throw new MeasuringException("没有计算IL所需测试数据"); } var data = testData.GetDataList(temp, port); if (data.Count < 1) { throw new MeasuringException("没有计算IL所需测试数据"); } var list = GetSettingData(data.ToList(), pSetting, 0); if (list.Count < 1) { return(double.MinValue); } var il = list.Max(); if (il == double.MinValue) { return(double.MinValue); } il = Math.Round(Math.Abs(il), 3); return(il); }
private static double TestCWLAccuracy(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var testData = testDataCollection.GetTestData(testType, "Swept", "SweptPDL"); if (testData == null) { throw new MeasuringException("没有计算CWL所需测试数据"); } var list = testData.GetDataList(temp, port); if (list.Count < 1) { throw new MeasuringException("没有计算CWL所需测试数据"); } var items = MeasuringManager.GetItemSettings(pSetting); var type = GetSettingType(items); var cw = GetSettingCenterWaveLength(items); var db = GetSettingDB(items); var wl = GetCenterWaveLength(list.ToList(), type, cw, db, bwSetting); if (cw < 1 || wl == double.MinValue) { return(double.MinValue); } return(Math.Round(Math.Abs(wl - cw), 3)); }
private static double TestPolarizationDependentLoss(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var testData = testDataCollection.GetTestData(testType, "Swept", "SweptPDL"); if (testData == null) { throw new MeasuringException("没有计算PDL所需测试数据"); } var data = testData.GetData(temp, port).Values.ToList(); if (data.Count < 1) { throw new MeasuringException("没有计算PDL所需测试数据"); } var list = GetSettingData(data, pSetting, 3); if (list.Count < 1) { return(double.MinValue); } var pdl = list.Max(); if (pdl == double.MinValue) { return(double.MinValue); } pdl = Math.Round(Math.Abs(pdl), 3); return(pdl); }
private static double TestPointIL(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var pointTestData = testDataCollection.GetTestData(testType, "Point", "PointPDL"); if (pointTestData == null) { throw new MeasuringException("没有计算IL所需测试数据"); } var wl = pSetting.CastTo(double.MinValue); if (wl == double.MinValue) { throw new MeasuringException("波长设置错误"); } var item = pointTestData.GetDataItem(temp, port, wl); if (item == null) { throw new MeasuringException("没有计算IL所需测试数据"); } var value = item == null ? double.MinValue : Math.Round(Math.Abs(item.IL), 3); return(value); }
private static double TestReturnLoss(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var testData = testDataCollection.GetTestData(testType, "Swept", "SweptPDL"); if (testData == null) { throw new MeasuringException("没有计算RL所需测试数据"); } var data = testData.GetData(temp, port).Values.ToList(); if (data.Count < 1) { throw new MeasuringException("没有计算RL所需测试数据"); } var list = GetSettingData(data, pSetting, 2); if (list.Count < 1) { return(double.MinValue); } var rl = list.Max(); if (rl == double.MinValue) { return(double.MinValue); } rl = Math.Round(Math.Abs(rl) + Windows.IniProfile <BusinessLogic.Setting.SystemSetting> .Instance.Profile.RetrunLosssCompensation, 3); return(rl); }
private static double TestIsolation(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var testData = testDataCollection.GetTestData(testType, "Swept", "SweptPDL"); if (testData == null) { throw new MeasuringException("没有计算ISO所需测试数据"); } var data = testData.GetDataList(temp, port); if (data.Count < 1) { throw new MeasuringException("没有计算ISO所需测试数据"); } var list = GetSettingData(data.ToList(), pSetting, 1); if (list.Count < 1) { return(double.MinValue); } var iso = list.Max(); if (iso == double.MinValue) { return(double.MinValue); } var minIL = data.Select(q => GetPointItemValue(q, 0)).Max(); iso = Math.Round(Math.Abs(iso - minIL), 3); return(iso); }
private static double TestRipple(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var testData = testDataCollection.GetTestData(testType, "Swept", "SweptPDL"); if (testData == null) { throw new MeasuringException("没有计算Ripple所需测试数据"); } var data = testData.GetDataList(temp, port); if (data.Count < 1) { throw new MeasuringException("没有计算Ripple所需测试数据"); } var list = GetSettingData(data.ToList(), pSetting, 0); if (list.Count < 1) { return(double.MinValue); } var maxIL = list.Max(); var minIL = list.Min(); if (maxIL == double.MinValue || minIL == double.MinValue) { return(double.MinValue); } return(Math.Round((maxIL - minIL), 3)); }
private static double TestPointRL(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var rlTestData = testDataCollection.GetTestData(testType, "Point"); if (rlTestData == null) { throw new MeasuringException("没有计算RL所需测试数据"); } var wl = pSetting.CastTo(double.MaxValue); if (wl == double.MinValue) { throw new MeasuringException("波长设置错误"); } var item = rlTestData.GetDataItem(temp, port, wl); var refR = referenceData.GetReference(2, 1, wl); if (item == null || refR == null) { throw new MeasuringException("没有计算RL所需测试数据"); } var value = double.MinValue; //回损结果 var valueR = item.IL; //读取回损 var valueS = refR.IL; //系统回损 var AbsS = Math.Abs(valueS); //系统回损绝对值 if (Math.Abs(valueR) > AbsS) { //RL读取值小于系统值时候, if (AbsS >= 60D) { value = 60d; } else if (AbsS >= 58D) { value = 58d; } else { value = Math.Round(AbsS, 1); } } else { var cR = MeasuringManager.Convert_dBm2mW(valueR + Windows.IniProfile <BusinessLogic.Setting.SystemSetting> .Instance.Profile.RetrunLosssCompensation); var cS = MeasuringManager.Convert_dBm2mW(valueS + Windows.IniProfile <BusinessLogic.Setting.SystemSetting> .Instance.Profile.RetrunLosssCompensation); var rl = MeasuringManager.Convert_mW2dBm(cR - cS); value = Math.Round( Math.Min(Math.Abs(rl), AbsS), 1); } return(value); }
private static double TestPointUniformity(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var pointTestData = testDataCollection.GetTestData(testType, "Point", "PointPDL"); if (pointTestData == null) { throw new MeasuringException("没有计算Uniformity所需测试数据"); } var wl = pSetting.CastTo(double.MaxValue); if (wl == double.MinValue) { throw new MeasuringException("波长设置错误"); } var testData = pointTestData.GetTestData(); if (!testData.ContainsKey(temp)) { throw new MeasuringException("没有计算Uniformity所需测试数据"); } var data = testData[temp]; var setting = TestPortSetting.Get(port); var powers = new List <double>(); foreach (var item in data) { var ch = item.Key; if (ch < 1 || !item.Value.ContainsKey(wl)) { continue; } var chSetting = TestPortSetting.Get(ch); if (chSetting.DataID != setting.DataID) { continue; } var testItem = item.Value[wl]; if (testItem.IL == double.MinValue) { continue; } powers.Add(testItem.IL); } var value = powers.Count < 1 ? double.MinValue : Math.Round(powers.Max() - powers.Min(), 3); return(value); }
private static double TestTotalIsolation(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var testData = testDataCollection.GetTestData(testType, "Swept", "SweptPDL"); if (testData == null) { throw new MeasuringException("没有计算ISO所需测试数据"); } var tdata = testData.GetTestData(); if (!tdata.ContainsKey(temp)) { throw new MeasuringException("没有计算ISO所需测试数据"); } var data = tdata[temp]; if (data.Count < 1) { throw new MeasuringException("没有计算ISO所需测试数据"); } var totaliso = double.MaxValue; foreach (var portData in data) { if (portData.Key == port) { continue; } var pdata = portData.Value.Values.ToList(); var list = GetSettingData(pdata, pSetting, 1); if (list.Count < 1) { continue; } var iso = list.Max(); if (iso == double.MinValue) { continue; } var minIL = pdata.Select(q => GetPointItemValue(q, 0)).Max(); iso = Math.Round(Math.Abs(iso - minIL), 3); totaliso = Math.Min(totaliso, iso); } if (totaliso == double.MaxValue) { return(double.MinValue); } return(totaliso); }
private static double TestPointTDL(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var pointTestData = testDataCollection.GetTestData(testType, "Point", "PointPDL"); if (pointTestData == null) { throw new MeasuringException("没有计算TDL所需测试数据"); } var testData = pointTestData.GetTestData(); if (!testData.ContainsKey(temp)) { throw new MeasuringException("没有计算TDL所需测试数据"); } var wl = pSetting.CastTo(double.MaxValue); if (wl == double.MinValue) { throw new MeasuringException("波长设置错误"); } var max = double.MinValue; var min = double.MaxValue; foreach (var data in testData.Values) { if (!data.ContainsKey(port)) { throw new MeasuringException("没有计算TDL所需测试数据"); } var item = data[port]; if (!item.ContainsKey(wl)) { continue; } var testItem = item[wl]; if (testItem.Power == double.MinValue || testItem.IL == double.MinValue) { continue; } max = Math.Max(max, testItem.Power); min = Math.Min(min, testItem.Power); } var value = max == double.MinValue || min == double.MinValue ? double.MinValue : Math.Round(max - min, 3); return(value); }
private static double TestChannelUniformity(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var testData = testDataCollection.GetTestData(testType, "Swept", "SweptPDL"); if (testData == null) { throw new MeasuringException("没有计算Uniformity所需测试数据"); } var list = new List <double>(); var parallels = MeasuringManager.GetParallelSettings(pSetting); foreach (var parallel in parallels) { var items = MeasuringManager.GetItemSettings(parallel); var sport = GetSetingPort(items); var data = testData.GetData(temp, sport).Values.ToList(); if (data.Count < 1) { throw new MeasuringException("没有计算Uniformity所需测试数据"); } var tempData = GetRangeData(data, items, 0); if (tempData.Count < 1) { throw new MeasuringException("没有计算Uniformity所需测试数据"); } list.Add(tempData.Min()); } if (list.Count < 1) { throw new MeasuringException("没有计算Uniformity所需测试数据"); } var max = list.Max(); var min = list.Min(); if (max == double.MinValue || min == double.MinValue) { return(double.MinValue); } return(Math.Abs(Math.Round(max - min, 3))); }
private static double TestBandwidth(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var testData = testDataCollection.GetTestData(testType, "Swept", "SweptPDL"); if (testData == null) { throw new MeasuringException("没有计算Bandwidth所需测试数据"); } var list = testData.GetDataList(temp, port); if (list.Count < 1) { throw new MeasuringException("没有计算Bandwidth所需测试数据"); } var items = MeasuringManager.GetItemSettings(pSetting); var type = GetSettingType(items); var cw = GetSettingCenterWaveLength(items); var db = GetSettingDB(items); var wl = GetBandwidth(list.ToList(), type, cw, db, bwSetting); return(wl); }
private static double TestPointWDL(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var pointTestData = testDataCollection.GetTestData(testType, "Point", "PointPDL"); if (pointTestData == null) { throw new MeasuringException("没有计算WDL所需测试数据"); } var testData = pointTestData.GetTestData(); if (!testData.ContainsKey(temp)) { throw new MeasuringException("没有计算WDL所需测试数据"); } if (!testData[temp].ContainsKey(port)) { throw new MeasuringException("没有计算WDL所需测试数据"); } var data = testData[temp][port]; var max = double.MinValue; var min = double.MaxValue; foreach (var item in data) { var testItem = item.Value; if (testItem.IL == double.MinValue) { continue; } max = Math.Max(max, testItem.IL); min = Math.Min(min, testItem.IL); } var value = max == double.MinValue || min == double.MinValue ? double.MinValue : Math.Round(max - min, 3); return(value); }
private static double TestChipUniformity(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var testData = testDataCollection.GetTestData(testType, "Swept", "SweptPDL"); if (testData == null) { throw new MeasuringException("没有计算Uniformity所需测试数据"); } if (uniformity == null) { if (System.IO.File.Exists(uniformityFile)) { var data = System.IO.File.ReadAllText(uniformityFile); try { uniformity = data.FromJsonString <Dictionary <string, List <double> > >(); } catch { } } if (uniformity == null) { uniformity = new Dictionary <string, List <double> >(); } } if (!uniformity.ContainsKey(pSetting)) { uniformity[pSetting] = new List <double>(); } var list = uniformity[pSetting]; if (list.Count >= Windows.IniProfile <BusinessLogic.Setting.SystemSetting> .Instance.Profile.ChipCount) { list.RemoveAt(0); } var parallels = MeasuringManager.GetParallelSettings(pSetting); foreach (var parallel in parallels) { var items = MeasuringManager.GetItemSettings(parallel); var sport = GetSetingPort(items); var data = testData.GetData(temp, sport).Values.ToList(); if (data.Count < 1) { throw new MeasuringException("没有计算Uniformity所需测试数据"); } var tempData = GetRangeData(data, items, 0); if (tempData.Count < 1) { throw new MeasuringException("没有计算Uniformity所需测试数据"); } list.Add(tempData.Min()); } if (list.Count < 1) { throw new MeasuringException("没有计算Uniformity所需测试数据"); } try { System.IO.File.WriteAllText(uniformityFile, uniformity.ToJsonString()); } catch { } var max = list.Max(); var min = list.Min(); if (max == double.MinValue || min == double.MinValue) { return(double.MinValue); } return(Math.Abs(Math.Round(max - min, 3))); }
private static double TestPointEL(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var pointTestData = testDataCollection.GetTestData(testType, "Point", "PointPDL"); if (pointTestData == null) { throw new MeasuringException("没有计算EL所需测试数据"); } var wl = pSetting.CastTo(double.MaxValue); if (wl == double.MinValue) { throw new MeasuringException("波长设置错误"); } var testData = pointTestData.GetTestData(); if (!testData.ContainsKey(temp)) { throw new MeasuringException("没有计算EL所需测试数据"); } var data = testData[temp]; var allPower = 0D; var inPower = 0D; var count = 0; var setting = TestPortSetting.Get(port); foreach (var item in data) { var ch = item.Key; if (ch < 1 || !item.Value.ContainsKey(wl)) { continue; } var chSetting = TestPortSetting.Get(ch); if (chSetting.DataID != setting.DataID) { continue; } var testItem = item.Value[wl]; if (testItem.Power == double.MinValue) { continue; } var refpower = referenceData.GetReference(1, ch % TestPortSetting.DataDivide, wl); allPower += MeasuringManager.Convert_dBm2mW(testItem.Power); inPower += refpower.Power; count++; } allPower = MeasuringManager.Convert_mW2dBm(allPower) + Windows.IniProfile <BusinessLogic.Setting.SystemSetting> .Instance.Profile.ExtraLosssCompensation; inPower = inPower / count; var value = inPower == double.MinValue ? double.MinValue : Math.Abs(Math.Round(allPower - inPower, 3)); return(value); }
private static double TestPointCR(ReferenceData referenceData, TestDataCollection testDataCollection, string testType, string temp, int port, string pSetting) { var pointTestData = testDataCollection.GetTestData(testType, "Point", "PointPDL"); if (pointTestData == null) { throw new MeasuringException("没有计算CR所需测试数据"); } /* * var wl = pSetting.CastTo(double.MinValue); * if (wl == double.MinValue) * throw new MeasuringException("波长设置错误"); * * var item = pointTestData.GetDataItem(temp, port, wl); * if (item == null) * { * throw new MeasuringException("没有计算CR所需测试数据"); * } * var refpower = referenceData.GetReference(1, port, wl); * var power = item.Power + Windows.IniProfile<BusinessLogic.Setting.SystemSetting>.Instance.Profile.ExtraLosssCompensation; * var cr = MeasuringManager.Convert_dBm2mW(power - refpower.Power); * cr = Math.Round(cr * 100D, 2); */ var wl = pSetting.CastTo(double.MaxValue); if (wl == double.MinValue) { throw new MeasuringException("波长设置错误"); } var testData = pointTestData.GetTestData(); if (!testData.ContainsKey(temp)) { throw new MeasuringException("没有计算CL所需测试数据"); } var data = testData[temp]; var inPower = 0D; var allPower = 0D; var setting = TestPortSetting.Get(port); foreach (var item in data) { var ch = item.Key; if (ch < 1 || !item.Value.ContainsKey(wl)) { continue; } var chSetting = TestPortSetting.Get(ch); if (chSetting.DataID != setting.DataID) { continue; } var testItem = item.Value[wl]; if (testItem.Power == double.MinValue) { continue; } var power = MeasuringManager.Convert_dBm2mW(testItem.IL); if (port == ch) { inPower = power; } allPower += power; } var cr = allPower == 0D ? 0D : inPower / allPower; cr = Math.Round(cr * 100D, 2); return(cr); }