|
@@ -0,0 +1,538 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading;
|
|
|
+using System.IO;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using Tps_LQ_Transmitter.com;
|
|
|
+
|
|
|
+namespace Tps_LQ_Transmitter.models
|
|
|
+{
|
|
|
+ class FskModulationIndexAndMaxFreqOffset : BaseModel
|
|
|
+ {
|
|
|
+ public FskModulationIndexAndMaxFreqOffset()
|
|
|
+ {
|
|
|
+ TemplateName = "FSK调制指数及最大频偏指标测试";
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// FSK调制指数及最大频偏指标测试
|
|
|
+ /// </summary>
|
|
|
+ public override bool Run(TestNode parameters)
|
|
|
+ {
|
|
|
+ double y_value, x_value;
|
|
|
+ ShowMessage(MsgType.Info, string.Format("第{0}个频点FSK调制指数及最大频偏指标测试开始", parameters.PointIndex));
|
|
|
+ Random random = new Random();
|
|
|
+ //获取仪器
|
|
|
+ var SA = this.tps.GetDevice("频谱仪");
|
|
|
+
|
|
|
+ // TransmitterSerialPort SerialClient = new TransmitterSerialPort();
|
|
|
+ OutData Data = new OutData();
|
|
|
+ DataType ModulationIndexPrint = new DataType();
|
|
|
+ DataType leftModulationIndexPrint = new DataType();
|
|
|
+ DataType rightModulationIndexPrint = new DataType();
|
|
|
+ DataType MaxFreqOffsetPrint = new DataType();
|
|
|
+ DataType leftFreqOffsetPrint = new DataType();
|
|
|
+ DataType rightFreqOffsetPrint = new DataType();
|
|
|
+
|
|
|
+ if (SA == null)
|
|
|
+ {
|
|
|
+ ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行", parameters.Channel, parameters.Name));
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ OpenExcel("FSK调制系数", out Spire.Xls.Workbook workbook, out Spire.Xls.Worksheet sheet);
|
|
|
+ if (sheet == null)
|
|
|
+ {
|
|
|
+ ShowMessage(MsgType.Error, "找不到" + tps.TestProject + "模板.xlsx");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //MatchModulaPara CfigModuParas = new MatchModulaPara();
|
|
|
+ //CfigModuParas = LoadModulationWorkBook();
|
|
|
+ //if (CfigModuParas == null)
|
|
|
+ //{
|
|
|
+ // return false;
|
|
|
+ //}
|
|
|
+
|
|
|
+ ConfigParameter PowerPara = new ConfigParameter();
|
|
|
+ //PowerPara.StepFrequency = 0;
|
|
|
+ ////PowerPara.ComPort = parameters.Parameters.GetParameter<string>("串口");
|
|
|
+ //PowerPara.OutLoss = parameters.Parameters.GetParameter<double>("输出损耗");
|
|
|
+ //PowerPara.StartFrequency = parameters.Parameters.GetParameter<double>("起始频率");
|
|
|
+ //PowerPara.StepFrequency = parameters.Parameters.GetParameter<double>("频率步进");
|
|
|
+ //PowerPara.FrequencyNumber = parameters.Parameters.GetParameter<int>("频点数量");
|
|
|
+ //PowerPara.StopFrequency = parameters.Parameters.GetParameter<double>("终止频率");
|
|
|
+ PowerPara.SPAN = parameters.Parameters.GetParameter<string>("扫描带宽(SPAN)");
|
|
|
+ PowerPara.REF = parameters.Parameters.GetParameter<string>("参考电平(REF)");
|
|
|
+ PowerPara.RBW = parameters.Parameters.GetParameter<string>("分辨率带宽(RBW)");
|
|
|
+ PowerPara.VBW = parameters.Parameters.GetParameter<string>("视频带宽(VBW)");
|
|
|
+ PowerPara.LimitOffset = parameters.Parameters.GetParameter<double>("临界偏移");
|
|
|
+ PowerPara.ShakeCompensate = parameters.Parameters.GetParameter<double>("抖动补偿");
|
|
|
+ // PowerPara.ControlDelay = parameters.Parameters.GetParameter<int>("控制延时");
|
|
|
+ PowerPara.ModulationIndexLower = parameters.Parameters.GetParameter<double>("调制系数下限");
|
|
|
+ PowerPara.ModulationIndexUpper = parameters.Parameters.GetParameter<double>("调制系数上限");
|
|
|
+ PowerPara.BitRate = parameters.Parameters.GetParameter<double>("码率");
|
|
|
+ if ( (PowerPara.SPAN == null) || (PowerPara.REF == null) || (PowerPara.RBW == null) || (PowerPara.VBW == null)||
|
|
|
+ (PowerPara.ModulationIndexLower==0) || (PowerPara.ModulationIndexUpper==0) || (PowerPara.BitRate == 0))
|
|
|
+ {
|
|
|
+ ShowMessage(MsgType.Error, string.Format("配置文件中频率参数为空,{0}/{1}无法运行", parameters.Channel, parameters.Name));
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //if (PowerPara.ControlDelay == 0)
|
|
|
+ //{
|
|
|
+ // PowerPara.ControlDelay = 10;
|
|
|
+ //}
|
|
|
+ double[] PowerDeltleft = new double[parameters.PointTotal];
|
|
|
+ double[] PowerDeltright = new double[parameters.PointTotal];
|
|
|
+ Data.ModulationIndex = new string[parameters.PointTotal];
|
|
|
+ Data.leftModulationIndex = new string[parameters.PointTotal];
|
|
|
+ Data.rightModulationIndex = new string[parameters.PointTotal];
|
|
|
+ Data.MaxFreqOffset = new string[parameters.PointTotal];
|
|
|
+ Data.leftFreqOffset = new string[parameters.PointTotal];
|
|
|
+ Data.rightFreqOffset = new string[parameters.PointTotal];
|
|
|
+
|
|
|
+ if (true)//需具备仪器
|
|
|
+ {
|
|
|
+ SA.Write("仪器复位"); SA.Query("OPC");
|
|
|
+ SA.Write("SPAN", PowerPara.SPAN); SA.Query("OPC");
|
|
|
+ SA.Write("RBW", PowerPara.RBW); SA.Query("OPC");
|
|
|
+ SA.Write("VBW", PowerPara.VBW); SA.Query("OPC");
|
|
|
+ SA.Write("REF", PowerPara.REF); SA.Query("OPC");
|
|
|
+
|
|
|
+
|
|
|
+ SA.Write("MARK打开", "1"); SA.Query("OPC");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //if ((PowerPara.FrequencyNumber != 0) && (PowerPara.FrequencyNumber != 1) && (PowerPara.StepFrequency == 0))
|
|
|
+ //{
|
|
|
+ // PowerPara.StepFrequency = ((int)(((PowerPara.StopFrequency - PowerPara.StartFrequency) / (PowerPara.FrequencyNumber - 1)) * 100)) / 100;
|
|
|
+ //}
|
|
|
+ //if(PowerPara.StepFrequency != 0)
|
|
|
+ //{
|
|
|
+ // PowerPara.FrequencyNumber = ((int)((PowerPara.StopFrequency - PowerPara.StartFrequency) / PowerPara.StepFrequency)) + 1;
|
|
|
+ //}
|
|
|
+
|
|
|
+ //double CenterFreq;
|
|
|
+ //double[] PowerDeltleft = new double[parameters.PointTotal];
|
|
|
+ //double[] PowerDeltright = new double[parameters.PointTotal];
|
|
|
+ //Data.ModulationIndex = new string[parameters.PointTotal];
|
|
|
+ //Data.leftModulationIndex = new string[parameters.PointTotal];
|
|
|
+ //Data.rightModulationIndex = new string[parameters.PointTotal];
|
|
|
+ //Data.MaxFreqOffset = new string[parameters.PointTotal];
|
|
|
+ //Data.leftFreqOffset = new string[parameters.PointTotal];
|
|
|
+ //Data.rightFreqOffset = new string[parameters.PointTotal];
|
|
|
+
|
|
|
+ // for (int point = 0;; point++)
|
|
|
+ {
|
|
|
+ //CenterFreq = PowerPara.StartFrequency + PowerPara.StepFrequency * point;
|
|
|
+ //if (CenterFreq > PowerPara.StopFrequency ||( PowerPara.FrequencyNumber == 1 && point == 1))
|
|
|
+ //{
|
|
|
+ // break;
|
|
|
+ //}
|
|
|
+ if(true)//需具备仪器
|
|
|
+ {
|
|
|
+ // 控制
|
|
|
+ // SerialClient.DUT_Transmitter_Ctrol(PowerPara.ComPort, Convert.ToByte(point + 1));
|
|
|
+ //Thread.Sleep(PowerPara.ControlDelay);//单位ms
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ SA.Write("CENTER", parameters.CenterFreq.ToString()); SA.Query("OPC");
|
|
|
+ SA.Write("SingleOrCont", "0"); SA.Query("OPC");
|
|
|
+ SA.Write("单次扫描"); SA.Query("OPC");
|
|
|
+ SA.Write("PEAK", "1"); SA.Query("OPC");
|
|
|
+ // PowerDeltleft[parameters.PointIndex] = 2239000000;
|
|
|
+ PowerDeltleft[parameters.PointIndex] = double.Parse(SA.Query("读MARK频率", "1")); SA.Query("OPC");
|
|
|
+
|
|
|
+
|
|
|
+ //控串口为0xEB 0x90 0x02 0xxx 0x00
|
|
|
+ this.tps.SerialClient.DUT_Transmitter_Ctrol(this.tps.ThridByte, this.tps.FourthByte, 0x00);
|
|
|
+ Thread.Sleep(this.tps.ControlDelay);//单位ms
|
|
|
+ SA.Write("SingleOrCont", "0"); SA.Query("OPC");
|
|
|
+ SA.Write("单次扫描"); SA.Query("OPC");
|
|
|
+ SA.Write("PEAK", "1"); SA.Query("OPC");
|
|
|
+ // PowerDeltright[parameters.PointIndex] = 2256030000;
|
|
|
+ PowerDeltright[parameters.PointIndex] = double.Parse(SA.Query("读MARK频率", "1")); SA.Query("OPC");
|
|
|
+
|
|
|
+
|
|
|
+ Data.MaxFreqOffset[parameters.PointIndex] = Math.Round(Math.Abs(PowerDeltleft[parameters.PointIndex] - PowerDeltright[parameters.PointIndex])/1000000,2).ToString();//MHz
|
|
|
+ Data.ModulationIndex[parameters.PointIndex] = Math.Round(Math.Abs(PowerDeltleft[parameters.PointIndex] - PowerDeltright[parameters.PointIndex])/1000000 / (PowerPara.BitRate / 2.0),2).ToString();//(F0-F1)/(码率/2),F0、F1单位为MHz,码率单位为Mbps.
|
|
|
+ }
|
|
|
+
|
|
|
+ ModulationIndexPrint.Lower = PowerPara.ModulationIndexLower;
|
|
|
+ ModulationIndexPrint.Upper = PowerPara.ModulationIndexUpper;
|
|
|
+ ModulationIndexPrint.Test_name = parameters.Channel + "-FSK调制系数测试-" + parameters.CenterFreq.ToString() + "MHz";
|
|
|
+ //leftModulationIndexPrint.Test_name = parameters.Channel + "-fL调制系数测试-" + parameters.CenterFreq.ToString() + "MHz";
|
|
|
+ // rightModulationIndexPrint.Test_name = parameters.Channel + "-fH调制系数测试-" + parameters.CenterFreq.ToString() + "MHz";
|
|
|
+
|
|
|
+ MaxFreqOffsetPrint.Test_name = parameters.Channel + "-FSK最大频偏(MHz)-" + parameters.CenterFreq.ToString() + "MHz";
|
|
|
+ // leftFreqOffsetPrint.Test_name = parameters.Channel + "-fL(KHz)-" + parameters.CenterFreq.ToString() + "MHz";
|
|
|
+ // rightFreqOffsetPrint.Test_name = parameters.Channel + "-fH(KHz)-" + parameters.CenterFreq.ToString() + "MHz";
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ModulationIndexPrint.TestVal = double.Parse(Data.ModulationIndex[parameters.PointIndex]);
|
|
|
+ //leftModulationIndexPrint.TestVal = double.Parse(Data.leftModulationIndex[parameters.PointIndex]);
|
|
|
+ //rightModulationIndexPrint.TestVal = double.Parse(Data.rightModulationIndex[parameters.PointIndex]);
|
|
|
+
|
|
|
+ MaxFreqOffsetPrint.TestVal = double.Parse(Data.MaxFreqOffset[parameters.PointIndex]);
|
|
|
+ // leftFreqOffsetPrint.TestVal = double.Parse(Data.leftFreqOffset[parameters.PointIndex]);
|
|
|
+ // rightFreqOffsetPrint.TestVal = double.Parse(Data.rightFreqOffset[parameters.PointIndex]);
|
|
|
+
|
|
|
+ if ((ModulationIndexPrint.TestVal >= ModulationIndexPrint.Lower) &&( ModulationIndexPrint.TestVal <= ModulationIndexPrint.Upper))
|
|
|
+ {
|
|
|
+ ModulationIndexPrint.Result = "是";
|
|
|
+ MaxFreqOffsetPrint.Result = "是";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ModulationIndexPrint.Result = "否";
|
|
|
+ MaxFreqOffsetPrint.Result = "否";
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ tps.TestTableAddCell(MaxFreqOffsetPrint.Test_name, "/", "/", MaxFreqOffsetPrint.TestVal.ToString(), MaxFreqOffsetPrint.Result);
|
|
|
+
|
|
|
+
|
|
|
+ tps.TestTableAddCell(ModulationIndexPrint.Test_name, ModulationIndexPrint.Lower.ToString(), ModulationIndexPrint.Upper.ToString(), ModulationIndexPrint.TestVal.ToString(), ModulationIndexPrint.Result);
|
|
|
+
|
|
|
+
|
|
|
+ if (parameters.Channel == "通道1")
|
|
|
+ {
|
|
|
+
|
|
|
+ //tps.SetTestTableCellValue(point, 9, ModulationIndexPrint.Result,Data.ModulationIndex[point]);
|
|
|
+ WriteExcelData(sheet, parameters.PointIndex, 1, ModulationIndexPrint.Test_name, ModulationIndexPrint.Lower.ToString(), ModulationIndexPrint.Upper.ToString(), ModulationIndexPrint.TestVal.ToString(), ModulationIndexPrint.Result);
|
|
|
+ // WriteExcelData(sheet, parameters.PointIndex, 5, leftModulationIndexPrint.Test_name, leftModulationIndexPrint.Lower.ToString(), leftModulationIndexPrint.Upper.ToString(), leftModulationIndexPrint.TestVal.ToString(), leftModulationIndexPrint.Result);
|
|
|
+ // WriteExcelData(sheet, parameters.PointIndex, 9, rightModulationIndexPrint.Test_name, rightModulationIndexPrint.Lower.ToString(), rightModulationIndexPrint.Upper.ToString(), rightModulationIndexPrint.TestVal.ToString(), rightModulationIndexPrint.Result);
|
|
|
+ WriteExcelData(sheet, parameters.PointIndex, 3, MaxFreqOffsetPrint.Test_name, "/", "/", MaxFreqOffsetPrint.TestVal.ToString(), MaxFreqOffsetPrint.Result);
|
|
|
+ // WriteExcelData(sheet, parameters.PointIndex, 7, leftFreqOffsetPrint.Test_name, "/", "/", leftFreqOffsetPrint.TestVal.ToString(), leftFreqOffsetPrint.Result);
|
|
|
+ // WriteExcelData(sheet, parameters.PointIndex, 11, rightFreqOffsetPrint.Test_name, "/", "/", rightFreqOffsetPrint.TestVal.ToString(), rightFreqOffsetPrint.Result);
|
|
|
+ // tps.SetTestTableCellValue(point, 6, Data.MaxFreqOffset[point]);
|
|
|
+ }
|
|
|
+ else if (parameters.Channel == "通道2")
|
|
|
+ {
|
|
|
+
|
|
|
+ WriteExcelData(sheet, parameters.PointIndex, 2, ModulationIndexPrint.Test_name, ModulationIndexPrint.Lower.ToString(), ModulationIndexPrint.Upper.ToString(), ModulationIndexPrint.TestVal.ToString(), ModulationIndexPrint.Result);
|
|
|
+ // WriteExcelData(sheet, parameters.PointIndex, 6, leftModulationIndexPrint.Test_name, leftModulationIndexPrint.Lower.ToString(), leftModulationIndexPrint.Upper.ToString(), leftModulationIndexPrint.TestVal.ToString(), leftModulationIndexPrint.Result);
|
|
|
+ // WriteExcelData(sheet, parameters.PointIndex, 10, rightModulationIndexPrint.Test_name, rightModulationIndexPrint.Lower.ToString(), rightModulationIndexPrint.Upper.ToString(), rightModulationIndexPrint.TestVal.ToString(), rightModulationIndexPrint.Result);
|
|
|
+ WriteExcelData(sheet, parameters.PointIndex, 4, MaxFreqOffsetPrint.Test_name, "/", "/", MaxFreqOffsetPrint.TestVal.ToString(), MaxFreqOffsetPrint.Result);
|
|
|
+ // WriteExcelData(sheet, parameters.PointIndex, 8, leftFreqOffsetPrint.Test_name, "/", "/", leftFreqOffsetPrint.TestVal.ToString(), leftFreqOffsetPrint.Result);
|
|
|
+ // WriteExcelData(sheet, parameters.PointIndex, 11, rightFreqOffsetPrint.Test_name, "/", "/", rightFreqOffsetPrint.TestVal.ToString(), rightFreqOffsetPrint.Result);
|
|
|
+ //tps.SetTestTableCellValue(point + 15, 9, ModulationIndexPrint.Result, Data.ModulationIndex[point]);
|
|
|
+ //tps.SetTestTableCellValue(point + 15, 6, Data.MaxFreqOffset[point]);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ SaveExcel(workbook);
|
|
|
+ ShowMessage(MsgType.Info, string.Format("第{0}个频点FSK调制指数及最大频偏指标测试结束", parameters.PointIndex));
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void PsaPeakValue_Tracedata(AppLibs.Devices.IVISA psa, out double Y_Maxvalue, out double X_Maxvalue, bool IsReturnX = false)
|
|
|
+ {
|
|
|
+ System.Threading.Thread.Sleep(20);
|
|
|
+ X_Maxvalue = 0;
|
|
|
+ Y_Maxvalue = 0;
|
|
|
+
|
|
|
+ psa.Write("单次扫描");
|
|
|
+
|
|
|
+ psa.Query("OPC");
|
|
|
+ string tracedata = psa.Query("读曲线");
|
|
|
+ string[] tracedatas = tracedata.Split(',');
|
|
|
+ double[] tracedata_double = new double[tracedatas.Length];
|
|
|
+ for (int i = 0; i < tracedatas.Length; i++)
|
|
|
+ {
|
|
|
+ tracedata_double[i] = double.Parse(tracedatas[i]);
|
|
|
+ }
|
|
|
+ Y_Maxvalue = tracedata_double.Max();
|
|
|
+ if (IsReturnX)
|
|
|
+ {
|
|
|
+ int x = Array.IndexOf(tracedata_double, Y_Maxvalue);
|
|
|
+ double startfreq = double.Parse(psa.Query("读起始频率"));
|
|
|
+ double stopfreq = double.Parse(psa.Query("读截止频率"));
|
|
|
+ double counts = double.Parse(psa.Query("测试点数读取"));
|
|
|
+ X_Maxvalue = startfreq + (stopfreq - startfreq) * x / (counts - 1);
|
|
|
+ }
|
|
|
+ Y_Maxvalue = Math.Round(Y_Maxvalue, 3);
|
|
|
+ }
|
|
|
+ public MatchModulaPara LoadModulationWorkBook()
|
|
|
+ {
|
|
|
+ MatchModulaPara pars = new MatchModulaPara();
|
|
|
+ string FileName = Path.Combine(Bundle.bundle.BundleDir, "config\\ModulationMode.xlsx");
|
|
|
+ if (!File.Exists(FileName))
|
|
|
+ {
|
|
|
+ ShowMessage(MsgType.Error, "找不到ModulationMode.xlsx");
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ Spire.Xls.Workbook workbook = new Spire.Xls.Workbook();
|
|
|
+ workbook.LoadFromFile(FileName);
|
|
|
+
|
|
|
+
|
|
|
+ //获取第一个工作表sheet1
|
|
|
+ Spire.Xls.Worksheet sheet = workbook.Worksheets[0];
|
|
|
+ int num = 0;
|
|
|
+ int blankRows = 0;
|
|
|
+
|
|
|
+ while (num++ < 200)
|
|
|
+ {
|
|
|
+ //索引从1开始
|
|
|
+ string col1 = sheet.Range[num, 1].Value2 != null ? sheet.Range[num, 1].Value2.ToString() : "";
|
|
|
+ col1 = col1.Trim();
|
|
|
+ if (string.IsNullOrEmpty(col1))
|
|
|
+ {
|
|
|
+ blankRows++;
|
|
|
+ if (blankRows > 5)
|
|
|
+ {
|
|
|
+ //连续5个空行以上则退出
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ blankRows = 0;
|
|
|
+ }
|
|
|
+ if (col1.Equals("功率变化(dB)"))
|
|
|
+ {
|
|
|
+ List<ModulationMatchParameter> ModulationTable = ReadParameters(sheet, num);
|
|
|
+
|
|
|
+ foreach (var item in ModulationTable)
|
|
|
+ {
|
|
|
+ if (pars.ModulaParameters.ContainsKey(item.CfgRelative))
|
|
|
+ {
|
|
|
+ ShowMessage(MsgType.Error, string.Format("调制对应表:{0} 存在同名参数:{1},无法重复添加参数", sheet.Name, item.CfgRelative));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ pars.ModulaParameters.Add(item.CfgRelative, item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return pars;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ List<ModulationMatchParameter> ReadParameters(Spire.Xls.Worksheet sheet, int rowIndex)
|
|
|
+ {
|
|
|
+ List<ModulationMatchParameter> ModulationTable = new List<ModulationMatchParameter>();
|
|
|
+ string col1 = sheet.Range[rowIndex , 1].Value2 != null ? sheet.Range[rowIndex , 1].Value2.ToString() : "";
|
|
|
+ string col2 = sheet.Range[rowIndex , 2].Value2 != null ? sheet.Range[rowIndex , 2].Value2.ToString() : "";
|
|
|
+ string col3 = sheet.Range[rowIndex , 3].Value2 != null ? sheet.Range[rowIndex , 3].Value2.ToString() : "";
|
|
|
+
|
|
|
+ if (!(col1 == "功率变化(dB)" && col2 == "调制指数(mf)" && col3 == "最大频偏(KHz)"))
|
|
|
+ {
|
|
|
+ ShowMessage(MsgType.Error, "'调制对应表'行首标题位置和格式不正确");
|
|
|
+ return ModulationTable;
|
|
|
+ }
|
|
|
+
|
|
|
+ int num = rowIndex ;
|
|
|
+ //默认最多30行
|
|
|
+ while (num++ < rowIndex + 100)
|
|
|
+ {
|
|
|
+ col1 = sheet.Range[num, 1].Value2 != null ? sheet.Range[num, 1].Value2.ToString() : "";
|
|
|
+ col2 = sheet.Range[num, 2].Value2 != null ? sheet.Range[num, 2].Value2.ToString() : "";
|
|
|
+ col3 = sheet.Range[num, 3].Value2 != null ? sheet.Range[num, 3].Value2.ToString() : "";
|
|
|
+ if (string.IsNullOrEmpty(col1) || string.IsNullOrEmpty(col2) || string.IsNullOrEmpty(col3))
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ ModulationMatchParameter ObjModulation = new ModulationMatchParameter();
|
|
|
+ ObjModulation.CfgRelative = col1;
|
|
|
+ ObjModulation.CfgModulation = col2;
|
|
|
+ ObjModulation.CfgFreqOffset = col3;
|
|
|
+
|
|
|
+ ModulationTable.Add(ObjModulation);
|
|
|
+ }
|
|
|
+ return ModulationTable;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 一个调制指数的配置信息
|
|
|
+ /// </summary>
|
|
|
+ public class MatchModulaPara
|
|
|
+ {
|
|
|
+ public Dictionary<string, ModulationMatchParameter> ModulaParameters;
|
|
|
+ public MatchModulaPara()
|
|
|
+ {
|
|
|
+ ModulaParameters = new Dictionary<string, ModulationMatchParameter>();
|
|
|
+ }
|
|
|
+ public string GetModulaParameter(string name)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(name))
|
|
|
+ return null;
|
|
|
+
|
|
|
+ if (this.ModulaParameters.ContainsKey(name) == false)
|
|
|
+ return null;
|
|
|
+
|
|
|
+ string val1 = this.ModulaParameters[name].CfgModulation.Trim();
|
|
|
+ return val1;
|
|
|
+ }
|
|
|
+ public string GetFreqOffsetParameter(string name)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(name))
|
|
|
+ return null;
|
|
|
+
|
|
|
+ if (this.ModulaParameters.ContainsKey(name) == false)
|
|
|
+ return null;
|
|
|
+
|
|
|
+ string val2 = this.ModulaParameters[name].CfgFreqOffset.Trim();
|
|
|
+ return val2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 调制指数3个对应项
|
|
|
+ /// </summary>
|
|
|
+ public class ModulationMatchParameter
|
|
|
+ {
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 功率变化(dB)
|
|
|
+ /// </summary>
|
|
|
+ public string CfgRelative{ get; set; }
|
|
|
+ /// <summary>
|
|
|
+ /// 调制指数(mf)
|
|
|
+ /// </summary>
|
|
|
+ public string CfgModulation { get; set; }
|
|
|
+ /// <summary>
|
|
|
+ /// 最大频偏(KHz)
|
|
|
+ /// </summary>
|
|
|
+ public string CfgFreqOffset { get; set; }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ public class ConfigParameter
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// 串口
|
|
|
+ /// </summary>
|
|
|
+ public string ComPort { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// 输出损耗
|
|
|
+ /// </summary>
|
|
|
+ public double OutLoss { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// 产品测试的起始频率
|
|
|
+ /// </summary>
|
|
|
+ public double StartFrequency { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// 产品测试的频率步进
|
|
|
+ /// </summary>
|
|
|
+ public double StepFrequency { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// 产品测试的频点数量
|
|
|
+ /// </summary>
|
|
|
+ public int FrequencyNumber { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// 产品的工作频带上限(终止频率)
|
|
|
+ /// 功能:用于判断从起始频率按一定的步进测试是否超出产品工作频段上限
|
|
|
+ /// </summary>
|
|
|
+ public double StopFrequency { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ ///设置频谱仪的SPAN
|
|
|
+ /// </summary>
|
|
|
+ public string SPAN { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// 设置参考电平
|
|
|
+ /// </summary>
|
|
|
+ public string REF { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// 设置RBW
|
|
|
+ /// </summary>
|
|
|
+ public string RBW { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// 设置VBW
|
|
|
+ /// </summary>
|
|
|
+ public string VBW { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// 控制延时
|
|
|
+ /// </summary>
|
|
|
+ public int ControlDelay { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// 临界偏移
|
|
|
+ /// </summary>
|
|
|
+ public double LimitOffset { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// 抖动补偿
|
|
|
+ /// </summary>
|
|
|
+ public double ShakeCompensate { set; get; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 调制系数下限
|
|
|
+ /// </summary>
|
|
|
+ public double ModulationIndexLower { get; set; }
|
|
|
+ /// <summary>
|
|
|
+ ///调制系数上限
|
|
|
+ /// </summary>
|
|
|
+ public double ModulationIndexUpper { get; set; }
|
|
|
+ /// <summary>
|
|
|
+ /// 码率
|
|
|
+ /// </summary>
|
|
|
+ public double BitRate { get; set; }
|
|
|
+ }
|
|
|
+ public class OutData
|
|
|
+ {
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ ///调制系数
|
|
|
+ /// </summary>
|
|
|
+ public string[] ModulationIndex { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ ///主频左侧调制系数
|
|
|
+ /// </summary>
|
|
|
+ public string[] leftModulationIndex { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ ///主频右侧调制系数
|
|
|
+ /// </summary>
|
|
|
+ public string[] rightModulationIndex { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// 最大频偏
|
|
|
+ /// </summary>
|
|
|
+ public string[] MaxFreqOffset { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// FL频偏
|
|
|
+ /// </summary>
|
|
|
+ public string[] leftFreqOffset { set; get; }
|
|
|
+ /// <summary>
|
|
|
+ /// FH频偏
|
|
|
+ /// </summary>
|
|
|
+ public string[] rightFreqOffset { set; get; }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ //public class DataType
|
|
|
+ //{
|
|
|
+
|
|
|
+ // /// <summary>
|
|
|
+ // /// 测试名称
|
|
|
+ // /// </summary>
|
|
|
+ // public string Test_name { set; get; }
|
|
|
+ // /// <summary>
|
|
|
+ // /// 指标下限
|
|
|
+ // /// </summary>
|
|
|
+ // public double Lower { set; get; }
|
|
|
+ // /// <summary>
|
|
|
+ // /// 指标上限
|
|
|
+ // /// </summary>
|
|
|
+ // public double Upper { set; get; }
|
|
|
+ // /// <summary>
|
|
|
+ // /// 测试值
|
|
|
+ // /// </summary>
|
|
|
+ // public double TestVal { set; get; }
|
|
|
+ // /// <summary>
|
|
|
+ // /// 判断结果
|
|
|
+ // /// </summary>
|
|
|
+ // public bool Result { set; get; }
|
|
|
+
|
|
|
+
|
|
|
+ //}
|
|
|
+ }
|
|
|
+}
|