Exemplo n.º 1
0
        /// <summary>
        /// Lens慢速线性扫描
        /// </summary>
        /// <param name="Service"></param>
        /// <param name="opts"></param>
        private static void Step3(SystemServiceClient Service, Options opts)
        {
            var cycle = 0;

            Service.__SSC_Powermeter_SetRange(opts.PowerMeterCaption, SSC_PMRangeEnum.AUTO);

            Thread.Sleep(500);

            Service.__SSC_LogInfo("开始执行线性扫描....");

            while (true)
            {
                // PowerMeterAutoRange(Service, PM_CAPTION);

                var pBeforeAlign = Service.__SSC_Powermeter_Read(opts.PowerMeterCaption);

                if (opts.UseHillClimbInLensAlign)
                {
                    Service.__SSC_DoHillClimb(opts.ProfileNameLineScanLens);
                }
                else
                {
                    Service.__SSC_DoProfileND(opts.ProfileNameLineScanLens);
                }

                Thread.Sleep(500);

                var pAfterAlign = Service.__SSC_Powermeter_Read(opts.PowerMeterCaption);
                Service.__SSC_LogInfo($"光功率:{pAfterAlign:F2}dBm");

                var powerDiff = pAfterAlign - pBeforeAlign;
                Service.__SSC_LogInfo($"Power Diff: {powerDiff:F2}dB, {pAfterAlign:F2}dBm/{pBeforeAlign:F2}dBm");

                //if (power > 0 && (powerDiff > -0.2 && powerDiff < 0.2))
                if (powerDiff > opts.PowerThreLineScanN && powerDiff < opts.PowerThreLineScanP)
                {
                    break;
                }
                if (pAfterAlign >= opts.PowerThreTerminate)
                {
                    break;
                }

                cycle++;

                if (cycle > 10)
                {
                    throw new Exception("慢速扫描执行失败,无法找到稳定光功率。");
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 执行爬山算法微调
        /// </summary>
        /// <param name="Apas"></param>
        /// <param name="opts"></param>
        private static void Step5(SystemServiceClient Apas, Options opts)
        {
            Apas.__SSC_LogInfo("开始执行最终位置优化...");

            try
            {
                Apas.__SSC_Powermeter_SetRange(opts.PowerMeterCaption, SSC_PMRangeEnum.AUTO);
                if (opts.UseHillClimbInFinalFineTune)
                {
                    Apas.__SSC_DoHillClimb(opts.ProfileNameFinalFineTune);
                }
                else
                {
                    Apas.__SSC_DoProfileND(opts.ProfileNameFinalFineTune);
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Receptacle和准直Lens同时调整。
        /// </summary>
        /// <param name="Apas"></param>
        private static void Step4(SystemServiceClient Apas, Options opts)
        {
            var cycle = 0;

            Apas.__SSC_LogInfo("开始Rept和准直Lens双边调整...");

            Apas.__SSC_Powermeter_SetRange(opts.PowerMeterCaption, SSC_PMRangeEnum.AUTO);

            while (true)
            {
                var pBeforeAlign = Apas.__SSC_Powermeter_Read(opts.PowerMeterCaption);

                #region 调整Receptacle

                if (opts.UseProfileNdInReceptLensDualScan == false)
                {
                    Apas.__SSC_Powermeter_SetRange(opts.PowerMeterCaption, SSC_PMRangeEnum.RANGE4);
                    Apas.__SSC_DoFastND(opts.ProfileNameDualLineScanRecept);
                }
                else
                {
                    Apas.__SSC_Powermeter_SetRange(opts.PowerMeterCaption, SSC_PMRangeEnum.AUTO);
                    Apas.__SSC_DoProfileND(opts.ProfileNameDualLineScanRecept);
                }

                #endregion

                Thread.Sleep(200);

                #region 调整Lens

                Apas.__SSC_Powermeter_SetRange(opts.PowerMeterCaption, SSC_PMRangeEnum.AUTO);
                if (opts.UseHillClimbInLensAlign)
                {
                    Apas.__SSC_DoHillClimb(opts.ProfileNameDualLineScanLens);
                }
                else
                {
                    Apas.__SSC_DoProfileND(opts.ProfileNameDualLineScanLens);
                }
                #endregion

                Thread.Sleep(500);

                var pAfterAlign = Apas.__SSC_Powermeter_Read(opts.PowerMeterCaption);
                var pDiff       = pAfterAlign - pBeforeAlign;

                Apas.__SSC_LogInfo($"Power Diff: {pDiff:F2}dB, {pAfterAlign:F2}dBm, {pBeforeAlign:F2}dBm");

                //if (power > 3.5 && (powerDiff > -0.2 && powerDiff < 0.2))
                if (pDiff > opts.PowerThreDualLineScanN && pDiff < opts.PowerThreDualLineScanP)
                {
                    break;
                }
                if (pAfterAlign >= opts.PowerThreTerminate)
                {
                    break;
                }
                if (pDiff < -0.3)
                {
                    break;               // 如果耦合功率开始变小超过-0.3dBm,则停止扫描
                }
                cycle++;

                if (cycle > 10)
                {
                    var msg = "无法调整稳定功率位置。";
                    Apas.__SSC_LogError(msg);
                    throw new Exception(msg);
                }
            }
        }