コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }