/// <summary> /// 以频率f为参数,从自动校准辅助列表返回与之最接近的列表项 /// </summary> /// <param name="f"></param> /// <returns></returns> internal Auto_CAL_Item GetItem(float f) { Auto_CAL_Item item = null; if (items != null) { for (int i = 0; i < items.Length; i++) { if (Math.Abs(items[i].F0 - f) < 0.001f) { item = items[i]; break; } } } //若找不到,则返回大于它的具有最小F0的列表项 if (item == null) { for (int i = 0; i < items.Length; i++) { if ((items[i].F0 - f) >= 0.001f) { item = items[i]; break; } } } return(item); }
internal void Clone(Auto_CAL_Item dest) { if (dest != null) { dest.F0 = this.F0; dest.RL0 = this.RL0; dest.Tx0 = this.Tx0; dest.Rx0 = this.Rx0; } }
/// <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); } }