Beispiel #1
0
        private void Prepare_Freq_Sweep1(SweepParams p)
        {
            p.SweepType = SweepType.Freq_Sweep;

            Init_Sweep_Params(p, this.Handle, RFInvolved.Rf_1, 1);

            p.FrqParam    = new FreqSweepParam();
            p.FrqParam.P1 = this.settings.Tx;

            Auto_CAL_Items Cal_Carrier = RL0_Tables.Cal_Carrier(FuncModule.ISO, RFInvolved.Rf_1);

            //根据隔离度校准表,生成功放1扫描序列
            FreqSweepItem[] items = new FreqSweepItem[Cal_Carrier.Length];

            for (int i = 0; i < items.Length; i++)
            {
                items[i] = new FreqSweepItem();

                items[i].Tx1 = Cal_Carrier.GetItem(i).F0;

                if (App_Configure.Cnfgs.Cal_Use_Table)
                {
                    items[i].P1 = this.settings.Tx + Tx_Tables.iso_tx1.Offset(items[i].Tx1, this.settings.Tx, Tx_Tables.iso_offset1);
                }
                else
                {
                    items[i].P1 = (float)App_Factors.iso_tx1.ValueWithOffset(items[i].Tx1, this.settings.Tx);
                }

                items[i].Rx = Cal_Carrier.GetItem(i).F0;
            }

            //将生成的扫描序列赋值给扫描参数对象
            p.FrqParam.Items1 = items;
        }
        private void IsolationForm_Load(object sender, EventArgs e)
        {
            sweep_params = new SweepParams();
            Prepare_Time_Sweep1(sweep_params);
            pbxFreq.Image = ImagesManage.GetImage("isolation", "freq.gif");

            pltIso.SetLimitEnalbe(true, this.settings.Limit, Color.FromArgb(160, 245, 255));

            UpdateWihtNewSettings();
        }
        private void Prepare_Freq_Sweep2(SweepParams p)
        {
            p.SweepType = SweepType.Freq_Sweep;

            Init_Sweep_Params(p, this.Handle, RFInvolved.Rf_2, 1);

            p.FrqParam        = new FreqSweepParam();
            p.FrqParam.Items2 = NewSweepItems2(this.settings.Freq_Step);

            csv_entries = new CsvReport_IVH_Entry[p.FrqParam.Items2.Length];
        }
Beispiel #4
0
        /// <summary>
        /// 将对象深度拷贝到目标dest
        /// </summary>
        /// <param name="dest"></param>
        public void Clone(SweepParams dest)
        {
            if (dest == null)
            {
                return;
            }

            dest.SweepType  = this.swpType;
            dest.C          = this.c;
            dest.WndHandle  = this.wndHandle;
            dest.RFPriority = this.rfPriority;
            dest.RFInvolved = this.rfInvolved;

            if (this.devInfo != null)
            {
                dest.DevInfo = new DeviceInfo();
                this.devInfo.Clone(dest.DevInfo);
            }

            if (this.tmeParam != null)
            {
                dest.TmeParam = new TimeSweepParam();
                this.tmeParam.Clone(dest.TmeParam);
            }

            if (this.FrqParam != null)
            {
                dest.FrqParam = new FreqSweepParam();
                this.frqParam.Clone(dest.FrqParam);
            }

            if (this.speParam != null)
            {
                dest.SpeParam             = new ScanModel();
                dest.SpeParam.Att         = this.speParam.Att;
                dest.SpeParam.Rbw         = this.speParam.Rbw;
                dest.SpeParam.Vbw         = this.speParam.Vbw;
                dest.speParam.TimeDelay   = this.speParam.TimeDelay;
                dest.SpeParam.Unit        = this.speParam.Unit;
                dest.SpeParam.StartFreq   = this.speParam.StartFreq;
                dest.SpeParam.EndFreq     = this.speParam.EndFreq;
                dest.SpeParam.Continued   = this.speParam.Continued;
                dest.SpeParam.EnableTimer = this.speParam.EnableTimer;
                //针对Deli频谱设置(模式:pim,spe,iso,vswr,har)
                dest.speParam.DeliSpe         = this.speParam.DeliSpe;
                dest.speParam.Deli_isSpectrum = this.speParam.Deli_isSpectrum;
            }
        }
Beispiel #5
0
        /// <summary>
        /// 准备扫描参数
        /// </summary>
        /// <param name="sweeps"></param>
        internal void Prepare(SweepParams usr_sweeps)
        {
            usr_sweeps.Clone(exe_params);

            //设置功放消息的目标窗体句柄
            RFSignal.SetWndHandle(exe_params.WndHandle);

            //建立频谱分析对象
            if (exe_params.DevInfo.Spectrum == SpectrumType.SPECAT2)
            {
                ISpectrumObj = new SpectrumLib.Spectrums.SpeCat2(exe_params.WndHandle, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
            }

            else
            {
                ISpectrumObj = new SpectrumLib.Spectrums.BirdSh(exe_params.WndHandle, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
            }
        }
        /// <summary>
        /// 初始化扫描参数,仅填入公共部分
        /// </summary>
        /// <param name="p"></param>
        /// <param name="wndh"></param>
        /// <param name="rf"></param>
        /// <param name="count"></param>
        private void Init_Sweep_Params(SweepParams p, IntPtr wndh, RFInvolved rf, int count)
        {
            p.C         = count;
            p.WndHandle = wndh;

            p.DevInfo          = new DeviceInfo();
            p.DevInfo.RF_Addr1 = App_Configure.Cnfgs.ComAddr1;
            p.DevInfo.RF_Addr2 = App_Configure.Cnfgs.ComAddr2;
            p.DevInfo.Spectrum = App_Configure.Cnfgs.Spectrum;
            p.RFInvolved       = rf;

            p.SpeParam           = new SpectrumLib.Models.ScanModel();
            p.SpeParam.Att       = settings.Att_Spc;
            p.SpeParam.Rbw       = settings.Rbw_Spc;
            p.SpeParam.Unit      = SpectrumLib.Defines.CommonDef.EFreqUnit.MHz;
            p.SpeParam.Continued = false;
            p.SpeParam.DeliSpe   = SpectrumLib.Defines.CommonDef.SpectrumType.Deli_ISOLATION;
        }
Beispiel #7
0
        /// <summary>
        /// 启动自动校准
        /// </summary>
        /// <param name="RF_Num">功放编号</param>
        private void AutoCAL(RFInvolved RF_Num)
        {
            SweepParams sp = new SweepParams();

            sp.WndHandle = this.Handle;
            sp.SweepType = SweepType.Freq_Sweep;
            sp.FrqParam  = new FreqSweepParam();

            if (RF_Num == RFInvolved.Rf_1)
            {
                sp.RFInvolved      = RFInvolved.Rf_1;
                sp.FrqParam.P1     = this.settings.Tx;
                sp.FrqParam.Items1 = GetItemList(listCurrentCAL_1);
            }
            if (RF_Num == RFInvolved.Rf_2)
            {
                sp.RFInvolved      = RFInvolved.Rf_2;
                sp.FrqParam.P2     = this.settings.Tx;
                sp.FrqParam.Items2 = GetItemList(listCurrentCAL_2);
            }

            //设备参数
            sp.DevInfo          = new DeviceInfo();
            sp.DevInfo.RF_Addr1 = App_Configure.Cnfgs.ComAddr1;
            sp.DevInfo.RF_Addr2 = App_Configure.Cnfgs.ComAddr2;
            sp.DevInfo.Spectrum = App_Configure.Cnfgs.Spectrum;
            sp.C = 1;

            //频谱参数
            sp.SpeParam           = new SpectrumLib.Models.ScanModel();
            sp.SpeParam.Att       = this.settings.Att_Spc;
            sp.SpeParam.Rbw       = this.settings.Rbw_Spc;
            sp.SpeParam.Unit      = SpectrumLib.Defines.CommonDef.EFreqUnit.MHz;
            sp.SpeParam.Continued = false;
            sp.SpeParam.DeliSpe   = SpectrumLib.Defines.CommonDef.SpectrumType.Deli_VSWR;

            SweepObj.InitSweep();
            SweepObj.Prepare(sp);
            SweepObj.StartSweep();
        }
Beispiel #8
0
        /// <summary>
        /// 建立实例变量
        /// </summary>
        internal void InitSweep()
        {
            ctrl = new SweepCtrl();

            exe_params = new SweepParams();

            power1_Handle = new ManualResetEvent(false);

            power2_Handle = new ManualResetEvent(false);

            thrd_Handle = new ManualResetEvent(false);

            sweepValue = new SweepResult();

            rfStatus_1 = new PowerStatus();

            rfStatus_2 = new PowerStatus();

            rfErrors_1 = new RFErrors();

            rfErrors_2 = new RFErrors();
        }
        private void Prepare_Time_Sweep2(SweepParams p)
        {
            p.SweepType = SweepType.Time_Sweep;

            Init_Sweep_Params(p, this.Handle, RFInvolved.Rf_2, 1);

            p.TmeParam = new TimeSweepParam();

            if (App_Configure.Cnfgs.Cal_Use_Table)
            {
                p.TmeParam.P2 = this.settings.Tx + Tx_Tables.iso_tx2.Offset(this.settings.F, this.settings.Tx, Tx_Tables.iso_offset2);
            }
            else
            {
                p.TmeParam.P2 = (float)App_Factors.iso_tx2.ValueWithOffset(this.settings.F, this.settings.Tx);
            }

            p.TmeParam.F2 = this.settings.F;
            p.TmeParam.Rx = this.settings.F;
            p.TmeParam.N  = this.settings.Time_Points;

            csv_entries = new CsvReport_IVH_Entry[p.TmeParam.N];
        }
        private void Prepare_Time_Sweep1(SweepParams p)
        {
            p.SweepType = SweepType.Time_Sweep;

            Init_Sweep_Params(p, this.Handle, RFInvolved.Rf_1, 1);

            p.TmeParam = new TimeSweepParam();

            if (App_Configure.Cnfgs.Cal_Use_Table)
            {
                p.TmeParam.P1 = this.settings.Tx + Tx_Tables.iso_tx1.Offset(this.settings.F, this.settings.Tx, Tx_Tables.iso_offset1);
                //Log.WriteLog("Tx_Tables.iso_tx1.Offset=" + Tx_Tables.iso_offset1.ToString(), Log.EFunctionType.ISOLATION);
            }
            else
            {
                p.TmeParam.P1 = (float)App_Factors.iso_tx1.ValueWithOffset(this.settings.F, this.settings.Tx);
            }

            p.TmeParam.F1 = this.settings.F;
            p.TmeParam.Rx = this.settings.F;
            p.TmeParam.N  = this.settings.Time_Points;

            csv_entries = new CsvReport_IVH_Entry[p.TmeParam.N];
        }
        /// <summary>
        /// 使用扫描参数对象,启动隔离度分析
        /// </summary>
        /// <param name="sweepParams"></param>
        private void StartSweep()
        {
            bool power_too_large = false;

            if ((!Sweeping) && (!csv_playbacking))
            {
                Sweeping            = true;
                MarkVisible         = false;
                AutoscaleEnable     = false;
                PointsDone          = 0;
                csv_points_playback = 0;

                pbxStart.Image     = ImagesManage.GetImage("isolation", "start.gif");
                pbxMark.Image      = ImagesManage.GetImage("isolation", "mark_in.gif");
                pbxAutoscale.Image = ImagesManage.GetImage("isolation", "autoscale_in.gif");

                pltIso.Clear();

                pltIso.SetYStartStop(this.settings.Min_Iso, this.settings.Max_Iso);

                sweep_params = new SweepParams();

                //准备扫描参数,并启动扫描
                if (sweep_or_time == SweepType.Freq_Sweep)
                {
                    pltIso.SetMarkText(Sweep_MarkText);

                    if (rf_involved == RFInvolved.Rf_1)
                    {
                        pbxCarrier1.Image = ImagesManage.GetImage("isolation", "carrier1.gif");
                        pbxCarrier2.Image = ImagesManage.GetImage("isolation", "carrier2_in.gif");
                        pbxFreq.Image     = ImagesManage.GetImage("isolation", "freq_in.gif");

                        if (!IsoSettingForm.bEnableCAL_RF1)
                        {
                            MessageBox.Show(this, "Please calibrate carrier 1!");
                            pbxStart.Image = ImagesManage.GetImage("isolation", "start_in.gif");
                            Sweeping       = false;
                            return;
                        }

                        pltIso.SetXStartStop(App_Settings.sgn_1.Min_Freq, App_Settings.sgn_1.Max_Freq);

                        if (this.settings.Tx > App_Settings.sgn_1.Max_Power || this.settings.Tx < App_Settings.sgn_1.Min_Power)
                        {
                            power_too_large = true;
                        }

                        Prepare_Freq_Sweep1(sweep_params);

                        //for (int i = 0; i < sweep_params.FrqParam.Items1.Length; i++)
                        //if (sweep_params.FrqParam.Items1[i].P1 > App_Settings.sgn_1.Max_Power)
                        //{
                        //    power_too_large = true;
                        //    break;
                        //}
                    }
                    else
                    {
                        if (!IsoSettingForm.bEnableCAL_RF2)
                        {
                            MessageBox.Show(this, "Please calibrate carrier 2!");
                            pbxStart.Image = ImagesManage.GetImage("isolation", "start_in.gif");
                            Sweeping       = false;
                            return;
                        }

                        pbxCarrier2.Image = ImagesManage.GetImage("isolation", "carrier2.gif");
                        pbxCarrier1.Image = ImagesManage.GetImage("isolation", "carrier1_in.gif");
                        pbxFreq.Image     = ImagesManage.GetImage("isolation", "freq_in.gif");
                        pltIso.SetXStartStop(App_Settings.sgn_2.Min_Freq, App_Settings.sgn_2.Max_Freq);

                        if (this.settings.Tx > App_Settings.sgn_2.Max_Power || this.settings.Tx < App_Settings.sgn_2.Min_Power)
                        {
                            power_too_large = true;
                        }

                        Prepare_Freq_Sweep2(sweep_params);

                        //for (int i = 0; i < sweep_params.FrqParam.Items2.Length; i++)
                        //if (sweep_params.FrqParam.Items2[i].P2 > App_Settings.sgn_2.Max_Power)
                        //{
                        //    power_too_large = true;
                        //    break;
                        //}
                    }
                }
                else
                {
                    pltIso.SetMarkText(Fixed_MarkText);

                    pbxFreq.Image     = ImagesManage.GetImage("isolation", "freq.gif");
                    pbxCarrier1.Image = ImagesManage.GetImage("isolation", "carrier1_in.gif");
                    pbxCarrier2.Image = ImagesManage.GetImage("isolation", "carrier2_in.gif");

                    //pltIso.SetXStartStop(0, (this.settings.Time_Points - 1));
                    pltIso.SetXStartStop(0, (this.settings.Time_Points));

                    if ((this.settings.F >= App_Settings.sgn_1.Min_Freq) &&
                        (this.settings.F <= App_Settings.sgn_1.Max_Freq))
                    {
                        if (!IsoSettingForm.bEnableCAL_RF1)
                        {
                            MessageBox.Show(this, "Please calibrate carrier 1!");
                            pbxStart.Image = ImagesManage.GetImage("isolation", "start_in.gif");
                            Sweeping       = false;
                            return;
                        }

                        rf_involved = RFInvolved.Rf_1;
                    }
                    else
                    {
                        if (!IsoSettingForm.bEnableCAL_RF2)
                        {
                            MessageBox.Show(this, "Please calibrate carrier 2!");
                            pbxStart.Image = ImagesManage.GetImage("isolation", "start_in.gif");
                            Sweeping       = false;
                            return;
                        }

                        rf_involved = RFInvolved.Rf_2;
                    }

                    if (rf_involved == RFInvolved.Rf_1)
                    {
                        if (this.settings.Tx > App_Settings.sgn_1.Max_Power || this.settings.Tx < App_Settings.sgn_1.Min_Power)
                        {
                            power_too_large = true;
                        }

                        Prepare_Time_Sweep1(sweep_params);

                        //if (sweep_params.TmeParam.P1 > App_Settings.sgn_1.Max_Power)
                        //    power_too_large = true;
                    }
                    else
                    {
                        if (this.settings.Tx > App_Settings.sgn_2.Max_Power || this.settings.Tx < App_Settings.sgn_2.Min_Power)
                        {
                            power_too_large = true;
                        }

                        Prepare_Time_Sweep2(sweep_params);

                        //if (sweep_params.TmeParam.P2 > App_Settings.sgn_2.Max_Power)
                        //    power_too_large = true;
                    }
                }

                if (power_too_large)
                {
                    Sweeping = false;

                    MessageBox.Show(this, "The carrier power setup is out of its range!");
                }
                else
                {
                    SweepObj.InitSweep();

                    SweepObj.Prepare(sweep_params);

                    SweepObj.StartSweep();
                }
            }
        }
Beispiel #12
0
        /// <summary>
        /// 窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TestForm_Load(object sender, EventArgs e)
        {
            _handle = this.Handle;

            //频谱类型
            type = App_Configure.Cnfgs.Spectrum;
            switch (type)
            {
            case 0:
                ISpectrumObj = new SpectrumLib.Spectrums.SpeCat2(this.Handle, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
                break;

            case 1:
                ISpectrumObj = new SpectrumLib.Spectrums.BirdSh(this.Handle, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
                break;

            case 2:
                ISpectrumObj = new SpectrumLib.Spectrums.Deli(this.Handle, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
                break;

            case 3:
                ISpectrumObj = new SpectrumLib.Spectrums.FanShuang(this.Handle, MessageID.SPECTRUEME_SUCCED, MessageID.SPECTRUM_ERROR);
                break;
            }

            ISpectrumObj.EnableLog();

            //绑定RBW
            Bind(comboBoxRbw);

            if (type == 0)
            {
                comboBoxVbw.Enabled = false;
                comboBoxVbw.Visible = false;
                label19.Visible     = false;
            }
            else if (type == 1)
            {
                //绑定VBW
                Bind(comboBoxVbw);
            }
            else
            {
                comboBoxVbw.Enabled = false;
                comboBoxVbw.Visible = false;
                label19.Visible     = false;
            }

            //绑定Fun
            BindFun();

            //扫描对象
            exe_params           = new SweepParams();
            exe_params.SweepType = SweepType.Time_Sweep;
            exe_params.WndHandle = this.Handle;
            exe_params.DevInfo   = new DeviceInfo();
            exe_params.TmeParam  = new TimeSweepParam();
            exe_params.WndHandle = _handle;
            power1_Handle        = new ManualResetEvent(false);
            power2_Handle        = new ManualResetEvent(false);
            //建立射频功放层
            RFSignal.SetWndHandle(exe_params.WndHandle);

            btnRF1_On.Enabled  = true;
            btnRF1_Off.Enabled = false;

            btnRF2_On.Enabled  = true;
            btnRF2_Off.Enabled = false;

            btnSpe_On.Enabled  = true;
            btnSpe_Off.Enabled = false;

            //范围
            numericUpDownFreq1.Minimum = (decimal)App_Settings.sgn_1.Min_Freq;
            numericUpDownFreq1.Maximum = (decimal)App_Settings.sgn_1.Max_Freq;
            numericUpDownFreq2.Minimum = (decimal)App_Settings.sgn_2.Min_Freq;
            numericUpDownFreq2.Maximum = (decimal)App_Settings.sgn_2.Max_Freq;
            numericUpDownRF1.Minimum   = (decimal)App_Settings.sgn_1.Min_Power;
            numericUpDownRF1.Maximum   = (decimal)App_Settings.sgn_1.Max_Power;
            numericUpDownRF2.Minimum   = (decimal)App_Settings.sgn_2.Min_Power;
            numericUpDownRF2.Maximum   = (decimal)App_Settings.sgn_2.Max_Power;

            //初值
            numericUpDownFreq1.Value = (decimal)App_Settings.sgn_1.Min_Freq;
            numericUpDownFreq2.Value = (decimal)App_Settings.sgn_2.Min_Freq;
            numericUpDownRF1.Value   = (decimal)App_Settings.sgn_1.Min_Power;
            numericUpDownRF2.Value   = (decimal)App_Settings.sgn_2.Min_Power;
            numericUpDownSpe.Value   = (decimal)App_Settings.sgn_1.Min_Freq;

            if (App_Configure.Cnfgs.Cal_Use_Table)
            {
                btnOffset.Enabled = false;
                chkTable.Checked  = true;
                rad_frd.Enabled   = true;
                rad_rev.Enabled   = true;
            }
            else
            {
                btnOffset.Enabled = true;
                chkTable.Checked  = false;
                rad_frd.Enabled   = false;
                rad_rev.Enabled   = false;
            }
        }
Beispiel #13
0
        /// <summary>
        /// 使用扫描参数对象,启动隔离度分析
        /// </summary>
        /// <param name="sweepParams"></param>
        private bool StartSweep()
        {
            bool power_too_large = false;

            if (!Sweeping)
            {
                Sweeping = true;

                PointsDone = 0;

                sweep_params = new SweepParams();

                //准备扫描参数,并启动扫描
                pbrCAL.Minimum = 0;

                if (rf_involved == RFInvolved.Rf_1)
                {
                    Prepare_Freq_Sweep1(sweep_params);

                    pbrCAL.Maximum = sweep_params.FrqParam.Items1.Length;

                    for (int i = 0; i < sweep_params.FrqParam.Items1.Length; i++)
                    {
                        if (sweep_params.FrqParam.Items1[i].P1 > App_Settings.sgn_1.Max_Power)
                        {
                            power_too_large = true;
                            break;
                        }
                    }
                }
                else
                {
                    Prepare_Freq_Sweep2(sweep_params);

                    pbrCAL.Maximum = sweep_params.FrqParam.Items2.Length;

                    for (int i = 0; i < sweep_params.FrqParam.Items2.Length; i++)
                    {
                        if (sweep_params.FrqParam.Items2[i].P2 > App_Settings.sgn_2.Max_Power)
                        {
                            power_too_large = true;
                            break;
                        }
                    }
                }

                if (power_too_large)
                {
                    Sweeping = false;

                    MessageBox.Show(this, "The carrier power setup is out of its range!");

                    this.Close();
                }
                else
                {
                    SweepObj.InitSweep();
                    SweepObj.Prepare(sweep_params);
                    SweepObj.StartSweep();
                }
            }

            return(power_too_large);
        }