Beispiel #1
0
 /// <summary>
 /// 获取校准频率列表
 /// </summary>
 /// <param name="RF_Num">功放编号</param>
 private void GetCalFreqList(RFInvolved RF_Num)
 {
     jcPimSoftware.VswrForm.CalibrationObj CalObj = new VswrForm.CalibrationObj();
     if (RF_Num == RFInvolved.Rf_1)
     {
         List <RL0_TableItem> listCAL = RL0_Tables.Items(FuncModule.VSW, RFInvolved.Rf_1);
         for (int i = 0; i < listCAL.Count; i++)
         {
             CalObj.Freq = listCAL[i].F;
             CalObj.RL0  = listCAL[i].RL;
             listCurrentCAL_1.Add(CalObj);
         }
         progressBar1.Maximum = listCurrentCAL_1.Count;
         progressBar1.Step    = 1;
     }
     if (RF_Num == RFInvolved.Rf_2)
     {
         List <RL0_TableItem> listCAL = RL0_Tables.Items(FuncModule.VSW, RFInvolved.Rf_2);
         for (int i = 0; i < listCAL.Count; i++)
         {
             CalObj.Freq = listCAL[i].F;
             CalObj.RL0  = listCAL[i].RL;
             listCurrentCAL_2.Add(CalObj);
         }
         progressBar1.Maximum = listCurrentCAL_2.Count;
         progressBar1.Step    = 1;
     }
 }
Beispiel #2
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;
        }
        /// <summary>
        /// 获取功放输出功率、频率,频谱分析的场强值,并应用补偿数据
        /// 处理数据,并更新界面
        /// </summary>
        private void SweepProcesing2()
        {
            float          tx_out   = 0.0f;
            float          rx_value = 0.0f;
            Auto_CAL_Items Cal_Carrier;

            //获取功放状态、分析数据、异常信息
            SweepObj.CloneReference(ref ps1, ref ps2, ref sr, ref rfr_errors1, ref rfr_errors2);

            //处理扫频
            if (sweep_or_time == SweepType.Freq_Sweep)
            {
                //功放1扫频
                if (rf_involved == RFInvolved.Rf_1)
                {
                    sweep_points[0].X = ps1.Status2.Freq;

                    Cal_Carrier = RL0_Tables.Cal_Carrier(FuncModule.ISO, RFInvolved.Rf_1);
                    cal_item    = Cal_Carrier.GetItem(ps1.Status2.Freq);

                    if (App_Configure.Cnfgs.Cal_Use_Table)
                    {
                        tx_out   = ps1.Status2.OutP + Tx_Tables.iso_tx1_disp.Offset(ps1.Status2.Freq, ps1.Status2.OutP, Tx_Tables.har_offset1_disp);
                        rx_value = sr.dBmValue + Rx_Tables.Offset(ps1.Status2.Freq, FuncModule.ISO);
                    }
                    else
                    {
                        tx_out   = (float)App_Factors.iso_tx1_disp.ValueWithOffset(ps1.Status2.Freq, ps1.Status2.OutP);
                        rx_value = (float)App_Factors.iso_rx1.ValueWithOffset(ps1.Status2.Freq, sr.dBmValue);
                    }

                    sweep_points[0].Y = (tx_out - rx_value) -
                                        (cal_item.Tx0 - cal_item.Rx0) + cal_item.RL0; // -this.settings.Offset;

                    lblF.Text  = "F:" + sweep_points[0].X.ToString("0.0") + "MHz";
                    lblTx.Text = "Tx:" + tx_out.ToString("0.0") + "dBm";

                    //功放2扫频
                }
                else
                {
                    sweep_points[0].X = ps2.Status2.Freq;

                    Cal_Carrier = RL0_Tables.Cal_Carrier(FuncModule.ISO, RFInvolved.Rf_2);
                    cal_item    = Cal_Carrier.GetItem(ps2.Status2.Freq);

                    if (App_Configure.Cnfgs.Cal_Use_Table)
                    {
                        tx_out   = ps2.Status2.OutP + Tx_Tables.iso_tx2_disp.Offset(ps2.Status2.Freq, ps2.Status2.OutP, Tx_Tables.iso_offset2_disp);
                        rx_value = sr.dBmValue + Rx_Tables.Offset(ps2.Status2.Freq, FuncModule.ISO);
                    }
                    else
                    {
                        tx_out   = (float)App_Factors.iso_tx2_disp.ValueWithOffset(ps2.Status2.Freq, ps2.Status2.OutP);
                        rx_value = (float)App_Factors.iso_rx2.ValueWithOffset(ps2.Status2.Freq, sr.dBmValue);
                    }

                    sweep_points[0].Y = (tx_out - rx_value) -
                                        (cal_item.Tx0 - cal_item.Rx0) + cal_item.RL0; //- this.settings.Offset;

                    lblF.Text  = "F:" + sweep_points[0].X.ToString("0.0") + "MHz";
                    lblTx.Text = "Tx:" + tx_out.ToString("0.0") + "dBm";
                }

                lblRx.Text    = "Rx:" + sr.dBmValue.ToString("0.0") + "dBm";
                lblNoise.Text = "Noise:" + sr.dBmNosie.ToString("0.0") + "dBm";
                pltIso.Add(sweep_points, 0, PointsDone);

                //处理扫时
            }
            else
            {
                sweep_points[0].X = PointsDone;

                //功放1扫时
                if (rf_involved == RFInvolved.Rf_1)
                {
                    Cal_Carrier = RL0_Tables.Cal_Carrier(FuncModule.ISO, RFInvolved.Rf_1);
                    cal_item    = Cal_Carrier.GetItem(ps1.Status2.Freq);

                    if (App_Configure.Cnfgs.Cal_Use_Table)
                    {
                        tx_out   = ps1.Status2.OutP + Tx_Tables.iso_tx1_disp.Offset(ps1.Status2.Freq, ps1.Status2.OutP, Tx_Tables.iso_offset1_disp);
                        rx_value = sr.dBmValue + Rx_Tables.Offset(ps1.Status2.Freq, FuncModule.ISO);
                    }
                    else
                    {
                        tx_out   = (float)App_Factors.iso_tx1_disp.ValueWithOffset(ps1.Status2.Freq, ps1.Status2.OutP);
                        rx_value = (float)App_Factors.iso_rx1.ValueWithOffset(ps1.Status2.Freq, sr.dBmValue);
                    }

                    sweep_points[0].Y = (tx_out - rx_value) -
                                        (cal_item.Tx0 - cal_item.Rx0) + cal_item.RL0; //- this.settings.Offset;

                    lblF.Text  = "F:" + ps1.Status2.Freq.ToString("0.0") + "MHz";
                    lblTx.Text = "Tx:" + tx_out.ToString("0.0") + "dBm";

                    //功放2扫时
                }
                else
                {
                    Cal_Carrier = RL0_Tables.Cal_Carrier(FuncModule.ISO, RFInvolved.Rf_2);
                    cal_item    = Cal_Carrier.GetItem(ps2.Status2.Freq);

                    if (App_Configure.Cnfgs.Cal_Use_Table)
                    {
                        tx_out   = ps2.Status2.OutP + Tx_Tables.iso_tx2_disp.Offset(ps2.Status2.Freq, ps2.Status2.OutP, Tx_Tables.iso_offset2_disp);
                        rx_value = sr.dBmValue + Rx_Tables.Offset(ps2.Status2.Freq, FuncModule.ISO);
                    }
                    else
                    {
                        tx_out   = (float)App_Factors.iso_tx2_disp.ValueWithOffset(ps2.Status2.Freq, ps2.Status2.OutP);
                        rx_value = (float)App_Factors.iso_rx2.ValueWithOffset(ps2.Status2.Freq, sr.dBmValue);
                    }

                    sweep_points[0].Y = (tx_out - rx_value) -
                                        (cal_item.Tx0 - cal_item.Rx0) + cal_item.RL0; //- this.settings.Offset;

                    lblF.Text  = "F:" + ps2.Status2.Freq.ToString("0.0") + "MHz";
                    lblTx.Text = "Tx:" + tx_out.ToString("0.0") + "dBm";
                }

                lblRx.Text    = "Rx:" + rx_value.ToString("0.0") + "dBm";
                lblNoise.Text = "Noise:" + sr.dBmNosie.ToString("0.0") + "dBm";
                pltIso.Add(sweep_points, 0, PointsDone);
            }
        }
Beispiel #4
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            //完成一趟操作
            case MessageID.ISO_SWEEP_DONE:
            {
                Sweeping = false;

                //if (bErrorRf)
                //{
                //    SweepObj.CloneReference(ref ps1, ref ps2, ref sr, ref rfr_errors1, ref rfr_errors2);
                //    bCalsuccess = false;
                //    MessageBox.Show(rfr_errors1.ToString() + "\n\r" + rfr_errors2.ToString());
                //}
                //if (bErrorSpec)
                //{
                //    bCalsuccess = false;
                //    MessageBox.Show("SPECTRUM_Error");
                //}

                if (bErrorRf == true || bErrorSpec == true)
                {
                    bCalsuccess = false;
                    MessageBox.Show(this, "Automatic calibration failed, please check the external attenuator!");
                    this.DialogResult = DialogResult.Cancel;
                }
                else
                {
                    this.DialogResult = DialogResult.OK;
                }

                break;
            }

            //完成单点扫描
            case MessageID.ISO_SUCCED:
            {
                float          tx_out, rx_value;
                Auto_CAL_Items Cal_Carrier;

                SweepObj.CloneReference(ref ps1, ref ps2, ref sr, ref rfr_errors1, ref rfr_errors2);

                if (rf_involved == RFInvolved.Rf_1)
                {
                    if (App_Configure.Cnfgs.Cal_Use_Table)
                    {
                        tx_out   = ps1.Status2.OutP + Tx_Tables.iso_tx1_disp.Offset(ps1.Status2.Freq, ps1.Status2.OutP, Tx_Tables.iso_offset1_disp);
                        rx_value = sr.dBmValue + Rx_Tables.Offset(ps1.Status2.Freq, FuncModule.ISO);
                    }
                    else
                    {
                        tx_out   = (float)App_Factors.iso_tx1_disp.ValueWithOffset(ps1.Status2.Freq, ps1.Status2.OutP);
                        rx_value = (float)App_Factors.iso_rx1.ValueWithOffset(ps1.Status2.Freq, sr.dBmValue);
                    }

                    Cal_Carrier = RL0_Tables.Cal_Carrier(FuncModule.ISO, RFInvolved.Rf_1);
                    Cal_Carrier.GetItem(PointsDone).Tx0 = tx_out;
                    Cal_Carrier.GetItem(PointsDone).Rx0 = rx_value;
                }
                else
                {
                    if (App_Configure.Cnfgs.Cal_Use_Table)
                    {
                        tx_out   = ps2.Status2.OutP + Tx_Tables.iso_tx2_disp.Offset(ps2.Status2.Freq, ps2.Status2.OutP, Tx_Tables.iso_offset2_disp);
                        rx_value = sr.dBmValue + Rx_Tables.Offset(ps2.Status2.Freq, FuncModule.ISO);
                    }
                    else
                    {
                        tx_out   = (float)App_Factors.iso_tx2_disp.ValueWithOffset(ps2.Status2.Freq, ps2.Status2.OutP);
                        rx_value = (float)App_Factors.iso_rx2.ValueWithOffset(ps2.Status2.Freq, sr.dBmValue);
                    }

                    Cal_Carrier = RL0_Tables.Cal_Carrier(FuncModule.ISO, RFInvolved.Rf_2);
                    Cal_Carrier.GetItem(PointsDone).Tx0 = tx_out;
                    Cal_Carrier.GetItem(PointsDone).Rx0 = rx_value;
                }

                PointsDone++;

                pbrCAL.Value = PointsDone;

                break;
            }

            //功放操作错误
            case MessageID.RF_ERROR:
            {
                bErrorRf = true;

                break;
            }

            //频谱分析错误
            case MessageID.SPECTRUM_ERROR:
            {
                bErrorSpec = true;

                break;
            }

            //频谱分析成功
            case MessageID.SPECTRUEME_SUCCED:
            {
                SweepObj.Spectrum_Succed();

                break;
            }

            //功放操作成功
            case MessageID.RF_SUCCED_ALL:
            {
                if (m.WParam.ToInt32() == App_Configure.Cnfgs.ComAddr1)
                {
                    SweepObj.Power1_Succed();
                }

                else if (m.WParam.ToInt32() == App_Configure.Cnfgs.ComAddr2)
                {
                    SweepObj.Power2_Succed();
                }

                break;
            }

            default:
            {
                base.WndProc(ref m);
                break;
            }
            }
        }