Browse Source

单台单频点功率、调制、谐波调试完成

ceac_pqy@163.com 4 years ago
parent
commit
1fa60e197d

+ 16 - 12
exe/apps/DevicesApp/commands/程控命令.xml

@@ -52,11 +52,11 @@
 		<Command Key="打开同步信号" Value="OUTPut:SYNC ON" Description="打开同步信号"/>
 		<Command Key="关闭同步信号" Value="OUTPut:SYNC OFF" Description="关闭同步信号"/>
 		
-		<Command Key="设置脉冲周期" Value="PULSe:PERiod {0}" Description="设置脉冲周期,{0} <>|MINimum|MAXimum"/>
+		<Command Key="设置脉冲周期" Value="PULSe:PERiod {0}" Description="设置脉冲周期,{0}  秒 |MINimum|MAXimum"/>
 		<Command Key="脉冲宽度配置模式" Value="FUNCtion:PULSe:HOLD {0}" Description="设置函数发生器以保持脉冲宽度或脉冲占空比,{0} WIDTh|DCYCle"/>
-		<Command Key="设置脉冲宽度" Value="FUNCtion:PULSe:WIDTh {0}" Description="设置脉冲宽度,{0} <>|MINimum|MAXimum"/>
-		<Command Key="设置脉冲占空比" Value="FUNCtion:PULSe:DCYCle {0}" Description="设置脉冲占空比,{0} < 百分比 >|MINimum|MAXimum"/>
-		<Command Key="设置边沿时间" Value="FUNCtion:PULSe:TRANsition {0}" Description="设置上升沿和下降沿的边沿时间,{0} < >|MINimum|MAXimum"/>
+		<Command Key="设置脉冲宽度" Value="FUNCtion:PULSe:WIDTh {0}" Description="设置脉冲宽度,{0}  秒 |MINimum|MAXimum"/>
+		<Command Key="设置脉冲占空比" Value="FUNCtion:PULSe:DCYCle {0}" Description="设置脉冲占空比,{0} 百分比|MINimum|MAXimum"/>
+		<Command Key="设置边沿时间" Value="FUNCtion:PULSe:TRANsition {0}" Description="设置上升沿和下降沿的边沿时间,{0}  秒|MINimum|MAXimum"/>
 		
 		<Command Key="AM调制波形" Value="AM:INTernal {0}" Description="选择AM调制波形仅在内部源时使用,{0} SINusoid|SQUare|RAMP|NRAMp|TRIangle|NOISe|USER"/>
 		<Command Key="AM调制频率" Value="AM:INTernal:FREQuency {0}" Description="设置AM调制波形频率仅在内部源时使用,{0} SINusoid|SQUare|RAMP|NRAMp|TRIangle|NOISe|USER"/>
@@ -72,15 +72,15 @@
 		
 		<Command Key="PWM调制波形" Value="PWM:INTernal {0}" Description="选择PWM调制波形仅在内部源时使用,{0} SINusoid|SQUare|RAMP|NRAMp|TRIangle|NOISe|USER"/>
 		<Command Key="PWM调制频率" Value="PWM:INTernal:FREQuency {0}" Description="设置PWM调制波形频率仅在内部源时使用,{0} SINusoid|SQUare|RAMP|NRAMp|TRIangle|NOISe|USER"/>
-		<Command Key="PWM调制占空比" Value="PWM:DEViation:DCYCle {0}" Description="PWM调制占空比,{0} < 偏差,百分比 >|MINimum|MAXimum"/>
+		<Command Key="PWM调制占空比" Value="PWM:DEViation:DCYCle {0}" Description="PWM调制占空比,{0}  偏差,百分比 |MINimum|MAXimum"/>
 		<Command Key="PWM调制源" Value="PWM:SOURce {0}" Description="选择PWM调制源内部或外部,{0} INTernal|EXTernal"/>
 		<Command Key="PWM调制开" Value="PWM:STATe ON" Description="PWM调制开"/>
 		<Command Key="PWM调制关" Value="PWM:STATe OFF" Description="PWM调制关"/>
 		
-		<Command Key="设置起始频率" Value="FREQuency:STARt {0} MHz" Description="设置起始频率 {0} < 频率 >|MINimum|MAXimum,单位MHz"/>
-		<Command Key="设置停止频率" Value="FREQuency:STOP {0} MHz" Description="设置停止频率 {0} < 频率 >|MINimum|MAXimum,单位MHz"/>
-		<Command Key="设置中心频率" Value="FREQuency:CENTer {0} MHz" Description="设置中心频率 {0} < 频率 >|MINimum|MAXimum,单位MHz"/>
-		<Command Key="设置频率跨距" Value="FREQuency:SPAN {0} MHz" Description="设置频率跨距 {0} < 频率 >|MINimum|MAXimum,单位MHz"/>
+		<Command Key="设置起始频率" Value="FREQuency:STARt {0} MHz" Description="设置起始频率 {0} 频率|MINimum|MAXimum,单位MHz"/>
+		<Command Key="设置停止频率" Value="FREQuency:STOP {0} MHz" Description="设置停止频率 {0}  频率|MINimum|MAXimum,单位MHz"/>
+		<Command Key="设置中心频率" Value="FREQuency:CENTer {0} MHz" Description="设置中心频率 {0}  频率|MINimum|MAXimum,单位MHz"/>
+		<Command Key="设置频率跨距" Value="FREQuency:SPAN {0} MHz" Description="设置频率跨距 {0} 频率|MINimum|MAXimum,单位MHz"/>
 		
 		<Command Key="设置扫描间隔模式" Value="SWEep:SPACing {0}" Description="设置扫描间隔模式 {0} LINear|LOGarithmic"/>		
 		<Command Key="读扫描时间" Value="SWEep:TIME?" Description="从起始频率到停止频率进行扫描所需的秒数。 ,MINimum|MAXimum"/>
@@ -270,7 +270,7 @@
 	<DeviceCommand DeviceType="频谱仪">
       <Models>
 		<string>FSQ</string>
-        <string>FSU</string>
+        <string>FSU-26</string>
       </Models>
       <Commands>
 	    <Command Key="仪器复位" Value="*RST" Description="复位"/>
@@ -293,6 +293,10 @@
 		<Command Key="RBWAUTO" Value=":BWIDth:AUTO 1" Description="设置分辨率带宽自动"/>
         <Command Key="VBW" Value=":BWIDth:VID {0}" Description="设置视频带宽,{0}VBW,单位Hz"/>
         <Command Key="VBWAUTO" Value=":BWIDth:VID:AUTO 1" Description="设置视频带宽自动"/>
+		<Command Key="设置通道带宽" Value="SENS:POW:ACH:BWID {0}MHz" Description="设置通道带宽,单位MHz"/>
+		<Command Key="设置通道功率模式" Value="CALC:MARK:FUNC:POW:SEL ACP" Description="设置通道功率模式"/>
+		<Command Key="读通道功率" Value="CALC:MARK:FUNC:POW:RES? CPOWer" Description="读通道功率,单位dBm"/>
+		
 		
         <Command Key="PEAK" Value=":CALC:MARK{0}:MAX" Description="标记峰值,{0}MARK点"/>
 		<Command Key="NextPeak" Value=":CALC:MARK{0}:MAX:NEXT" Description="标记次峰值,{0}MARK点"/>
@@ -432,7 +436,7 @@
 		<Command Key="触发源EXTernal" Value=":TRIGger:SOURce EXTernal" Description="设置触发源为EXTernal"/>
 		<Command Key="触发源VIDeo" Value=":TRIGger:SOURce EXTernal" Description="设置触发源为VIDeo"/>
 		<Command Key="查询触发源" Value=":TRIGger:SOURce?" Description="查询触发源IMMediate|EXTernal|VIDeo"/>
-		<Command Key="设置视频触发延时" Value=":TRIGger:VIDeo:DELay {0}" Description="设置视频触发延时,<percentage> or <time>,range:–100% to +200% (–1 ms to +2 ms)"/>
+		<Command Key="设置视频触发延时" Value=":TRIGger:VIDeo:DELay {0}" Description="设置视频触发延时,percentage|time,range:–100% to +200% (–1 ms to +2 ms)"/>
 		<Command Key="查询视频触发延时" Value=":TRIGger:VIDeo:DELay?" Description="查询视频触发延时"/>
 		<Command Key="设置视频触发电平" Value=":TRIGger:VIDeo:LEVel {0}" Description="设置视频触发电平,range:30 dBm to –150 dBm"/>
 		<Command Key="查询视频触发电平" Value=":TRIGger:VIDeo:LEVel?" Description="查询视频触发电平,range:30 dBm to –150 dBm"/>
@@ -496,7 +500,7 @@
 		<Command Key="设置FreeRun" Value="TR3" Description="将所有通道触发设置为FreeRun"/>
 		
 		<Command Key="复位通道峰值" Value="CHPIRST {0}" Description="复位通道峰值,通道{0} 1|2"/>
-		<Command Key="读光标的值" Value="TTMKRO {0}?" Description="读光标的值,通道{0} 1|2|1&2,(百分比,功率)"/>
+		<Command Key="读光标的值" Value="TTMKRO {0}?" Description="读光标的值,通道{0} 1|2|1and2,and代替位与的符号(百分比,功率)"/>
 		<Command Key="设置测量点数" Value="YDRES {0}" Description="设置测量点数,{0} P200|P400"/>
 		<Command Key="查询测量点数" Value="YDRES?" Description="查询测量点数, P200|P400"/>
 		<Command Key="打开MARK" Value="MKSTATE {0},{1},ON" Description="打开MARK,通道{0} 1|2,MARK点{1}1~4"/>

+ 1 - 1
exe/apps/DevicesApp/本地仪器.xml

@@ -11,6 +11,6 @@
     <!--<DeviceInfo DeviceType="视频开关" DeviceModel="Pickering40161D" DeviceHandle="bus:19,slot:12" ClassType="DevicesApp.Devices.VideoSwitch" IsVirtual="false"/>-->
     <!--<DeviceInfo DeviceType="万用表" DeviceModel="KeysightM9182A" DeviceHandle="PXI19::10::INSTR" ClassType="DevicesApp.Devices.Multimeter" IsVirtual="false"/>-->
     <DeviceInfo DeviceType="信号源" DeviceModel="E4221B" DeviceHandle="GPIB0::34::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="true"/>
-    <DeviceInfo DeviceType="频谱仪" DeviceModel="E4440A" DeviceHandle="GPIB0::29::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="true"/> 
+    <DeviceInfo DeviceType="频谱仪" DeviceModel="FSU-26" DeviceHandle="TCPIP0::169.254.17.73::inst0::INSTR" ClassType="DevicesApp.Devices.Visa" IsVirtual="false"/> 
   </DeviceInfos>
 </LocalDevices>

BIN
exe/apps/Tps_LQ_Transmitter/Tps_LQ_Transmitter.dll


BIN
exe/apps/Tps_LQ_Transmitter/Tps_LQ_Transmitter.pdb


+ 2 - 2
exe/apps/Tps_LQ_Transmitter/bundle.config

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <configuration>
   <!--DevHostApp.dll 与bundle.config在同一个目录下-->
-  <Activator BundleName="发射机测试" Assembly="Tps_LQ_Transmitter.dll" Type="Tps_LQ_Transmitter.Bundle"/>
+  <Activator BundleName="6YX03B-9B" Assembly="Tps_LQ_Transmitter.dll" Type="Tps_LQ_Transmitter.Bundle"/>
   <Extension Point="MainPage">
-    <Node Name="发射机测试" Page="测试项目" Group="测试项目" Text="发射机测试" Type="Tps_LQ_Transmitter.FrmMain" Image="aa.png" IsLazyLoad="true" Order="2" />
+    <Node Name="6YX03B-9B" Page="测试项目" Group="测试项目" Text="6YX03B-9B" Type="Tps_LQ_Transmitter.FrmMain" Image="aa.png" IsLazyLoad="true" Order="2" />
   </Extension>
 </configuration>

BIN
exe/apps/Tps_LQ_Transmitter/config/ModulationMode.xlsx


BIN
exe/apps/Tps_LQ_Transmitter/config/测试#常温检查#发射机.xlsx


BIN
exe/apps/Tps_LQ_Transmitter/config/测试#常温测试#发射机.xlsx


File diff suppressed because it is too large
+ 3179 - 0
exe/logs/202108.log


BIN
tps/TpsLabStudio/.vs/TpsLabStudio/v16/.suo


+ 1 - 1
tps/TpsLabStudio/Bundle.cs

@@ -15,7 +15,7 @@ namespace Tps_LQ_Transmitter
         public Bundle()
         {
             this.releaseTime = "2021-07-29";
-            this.bundleName = "林泉发射机测试";  //与配置文件<Bundle Name="林泉发射机测试">保持一致
+            this.bundleName = "6YX03B-9B";  //与配置文件<Bundle Name="林泉发射机测试">保持一致
         }
 
         public override bool Start(IHost host, IBundle bundle)

+ 26 - 0
tps/TpsLabStudio/FrmMain.cs

@@ -133,6 +133,7 @@ namespace Tps_LQ_Transmitter
                 currFileNode.Tps.MessageEvent -= Tps_MessageEvent;
                 currFileNode.Tps.ManualTableCellChanged -= Tps_ManualTableCellChanged;
                 currFileNode.Tps.TestTableCellChanged -= Tps_TestTableCellChanged;
+                currFileNode.Tps.AddTestTableCell -= Tps_TestTableAddCell;
             }
 
             currFileNode = fn;
@@ -141,6 +142,7 @@ namespace Tps_LQ_Transmitter
                 currFileNode.Tps.MessageEvent += Tps_MessageEvent;
                 currFileNode.Tps.ManualTableCellChanged += Tps_ManualTableCellChanged;
                 currFileNode.Tps.TestTableCellChanged += Tps_TestTableCellChanged;
+                currFileNode.Tps.AddTestTableCell += Tps_TestTableAddCell;
             }
 
             tbTestProject.Text = fn.TestProject;
@@ -154,11 +156,30 @@ namespace Tps_LQ_Transmitter
             //显示仪器列表,把当前TPS使用的仪器和仪器检查界面绑定
             frmDevice.ShowDevices(currFileNode.Tps.Devices);
         }
+        private void Tps_TestTableAddCell(string name, string  lower, string upper, string testval, string result)
+        {
+            this.Invoke(new Action(() => {
+                currFileNode.Tps.TestTable.Rows.Add(name, lower,upper,testval, result);
+
+                if (result=="是")
+                {      
+                    dgvTestData.Rows[currFileNode.Tps.TestTable.Rows.Count-1].Cells[4].Style.BackColor = Color.Green;
+                  
+                }
+                else
+                {                  
+                    dgvTestData.Rows[currFileNode.Tps.TestTable.Rows.Count-1].Cells[4].Style.BackColor = Color.Red;
+                   
+                }
+            }));
+        }
 
         private void Tps_TestTableCellChanged(int row, int cell,bool ok, object value)
         {
             this.Invoke(new Action(() => {
                 currFileNode.Tps.TestTable.Rows[row][cell] = value;
+               
+
                 if (ok)
                 {
                     dgvTestData.Rows[row].Cells[cell].Style.BackColor = Color.White;
@@ -492,5 +513,10 @@ namespace Tps_LQ_Transmitter
                 node.IsSelected = e.Cell.Checked;
             }
         }
+
+        private void dgvTestData_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        {
+
+        }
     }
 }

+ 35 - 0
tps/TpsLabStudio/MainTps.cs

@@ -14,6 +14,7 @@ namespace Tps_LQ_Transmitter
 {
     public delegate void DltShowMsg(MsgType msgType, string msg);
     public delegate void DltCellValueChanged(int row, int cell, bool ok, object value);
+    public delegate void DltCellValueAdd(string name, string lower, string upper, string testval, string result);
     /// <summary>
     /// 一个测试文件对应的测试项目
     /// </summary>
@@ -62,6 +63,8 @@ namespace Tps_LQ_Transmitter
 
         public event DltCellValueChanged ManualTableCellChanged;
         public event DltCellValueChanged TestTableCellChanged;
+        public event DltCellValueAdd AddTestTableCell;
+
 
         DataTable InitTestTable,InitManualTable; //原始数据的界面,用于初始化或者重置
         /// <summary>
@@ -734,6 +737,33 @@ namespace Tps_LQ_Transmitter
             }
         }
 
+        public AppLibs.Devices.IVISA GetDeviceModel(string ModelName)
+        {
+            DeviceNode node = this.Devices.FirstOrDefault(x => x.DeviceModel == ModelName);
+            //不存在或者状态不对,都返回空
+            if (node == null && node.State == false)
+            {
+                return null;
+            }
+            else
+            {
+                AppLibs.Devices.IDeviceHost devHost = Bundle.host.GetFirstOrDefaultService<AppLibs.Devices.IDeviceHost>();
+                if (devHost == null)
+                    return null;
+
+                DeviceParameter dev = devHost.GetFirstOrDefaultDeviceID(node.DeviceHandle);
+                //要地址,名称,型号一致
+                if (dev == null || !(node.DeviceType == dev.DeviceType && node.DeviceModel == dev.DeviceModel))
+                {
+                    return null;
+                }
+                else
+                {
+                    return (IVISA)dev;
+                }
+            }
+        }
+
         public void SetManualTableCellValue(int row, int col, bool ok, object value)
         {
             if (ManualTableCellChanged != null)
@@ -745,6 +775,11 @@ namespace Tps_LQ_Transmitter
             if (TestTableCellChanged != null)
                 TestTableCellChanged(row, col, ok, value);
         }
+        public void TestTableAddCell(string name, string lower, string upper, string testval,string result)
+        {
+            if (AddTestTableCell != null)
+                AddTestTableCell(name,lower,upper,testval,result);
+        }
 
         void SaveTestTable()
         {

+ 1 - 1
tps/TpsLabStudio/TpsLabStudio.csproj

@@ -21,7 +21,7 @@
     <OutputPath>..\..\exe\apps\Tps_LQ_Transmitter\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
+    <WarningLevel>0</WarningLevel>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>

+ 1 - 1
tps/TpsLabStudio/TpsLabStudio.csproj.user

@@ -5,6 +5,6 @@
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
     <StartAction>Program</StartAction>
-    <StartProgram>F:\Code\Transmitter-1-New\TpsLabStudio_LTS\exe\JGWorks.exe</StartProgram>
+    <StartProgram>F:\Code\Transmitter-3-New\TpsLabStudio_LTS\exe\JGWorks.exe</StartProgram>
   </PropertyGroup>
 </Project>

+ 2 - 2
tps/TpsLabStudio/bundle.config

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <configuration>
   <!--DevHostApp.dll 与bundle.config在同一个目录下-->
-  <Activator BundleName="发射机测试" Assembly="Tps_LQ_Transmitter.dll" Type="Tps_LQ_Transmitter.Bundle"/>
+  <Activator BundleName="6YX03B-9B" Assembly="Tps_LQ_Transmitter.dll" Type="Tps_LQ_Transmitter.Bundle"/>
   <Extension Point="MainPage">
-    <Node Name="发射机测试" Page="测试项目" Group="测试项目" Text="发射机测试" Type="Tps_LQ_Transmitter.FrmMain" Image="aa.png" IsLazyLoad="true" Order="2" />
+    <Node Name="6YX03B-9B" Page="测试项目" Group="测试项目" Text="6YX03B-9B" Type="Tps_LQ_Transmitter.FrmMain" Image="aa.png" IsLazyLoad="true" Order="2" />
   </Extension>
 </configuration>

BIN
tps/TpsLabStudio/config/ModulationMode.xlsx


BIN
tps/TpsLabStudio/config/测试#常温检查#发射机.xlsx


BIN
tps/TpsLabStudio/config/测试#常温测试#发射机.xlsx


+ 84 - 0
tps/TpsLabStudio/models/BaseModel.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.IO;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
@@ -69,5 +70,88 @@ namespace Tps_LQ_Transmitter.models
                 MessageEvent(msgType, msg);
             }
         }
+        public void OpenExcel(string sheetname, out Spire.Xls.Workbook workbook, out Spire.Xls.Worksheet sheet)
+        {
+            Spire.Xls.Worksheet sheet1 = null;
+            string TestFilePath = "F:";
+            string ModelFile = "F:/发射机/发射机模板/"+ tps.TestProject + "模板.xlsx";
+            string subPath = "F:/发射机/发射机测试数据/"+ tps.TestProject +"/";
+
+            if (false == System.IO.Directory.Exists(subPath))
+            {
+                System.IO.Directory.CreateDirectory(subPath);
+            }
+            workbook = new Spire.Xls.Workbook();
+            string FileName = subPath + tps.Serial + ".xlsx";
+            if (File.Exists(FileName))
+            {
+                workbook.LoadFromFile(FileName);
+                sheet1 = workbook.Worksheets[sheetname];
+                
+            }
+            else if (File.Exists(ModelFile))
+            {
+                workbook.LoadFromFile(ModelFile);
+                sheet1 = workbook.Worksheets["测试信息"];
+                sheet1.Range["A2"].Value2 = tps.Serial;//序列号
+                sheet1.Range["B2"].Value2 = tps.Tester;//检验员
+                sheet1.Range["C2"].Value2 = DateTime.Now.Date.ToString();//日期
+                sheet1.Range["D2"].Value2 = tps.Temperature;//温度
+                sheet1.Range["E2"].Value2 = tps.Humidity;//湿度
+                sheet1 = workbook.Worksheets[sheetname];
+                
+            }
+            
+            if (!File.Exists(ModelFile))
+            {
+                sheet1 = null;
+            }
+            sheet = sheet1;
+        }
+
+        public void WriteExcelData(Spire.Xls.Worksheet sheet, int row, int channel, string name, string lower, string upper, string val, string result)
+        {
+            int column = (channel - 1) * 6;
+
+            sheet.Range[row + 2, 1 + column].Value2 = name;
+            sheet.Range[row + 2, 2 + column].Value2 = lower;
+            sheet.Range[row + 2, 3 + column].Value2 = upper;
+            sheet.Range[row + 2, 4 + column].Value = val; 
+            sheet.Range[row + 2, 5 + column].Value2 = result;
+
+        }
+        public void SaveExcel(Spire.Xls.Workbook workbook)
+        {
+            string subPath = "F:/发射机/发射机测试数据/" + tps.TestProject + "/";
+            string FileName = subPath + tps.Serial + ".xlsx";
+            workbook.CalculateAllValue();
+            workbook.SaveToFile(FileName);
+        }
+        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 string Result { set; get; }
+
+
+        }
     }
 }

+ 64 - 41
tps/TpsLabStudio/models/HarmonicSuppression.cs

@@ -27,11 +27,19 @@ namespace Tps_LQ_Transmitter.models
             OutData Data = new OutData();
             DataType HarmonicSuppressionPrint = new DataType();
 
-            //if (SA == null)
-            //{
-            //    ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行", parameters.Channel, parameters.Name));
-            //    return false;
-            //}
+            if (SA == null)
+            {
+                ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行", parameters.Channel, parameters.Name));
+                return false;
+            }
+            OpenExcel("谐波抑制", out Spire.Xls.Workbook workbook, out Spire.Xls.Worksheet sheet);
+            if (sheet == null)
+            {
+                ShowMessage(MsgType.Error, "找不到" + tps.TestProject + "模板.xlsx");
+                return false;
+            }
+
+            sheet.Range["L1"].Value2 = tps.Serial;
             ConfigParameter PowerPara = new ConfigParameter();
             PowerPara.ComPort = parameters.Parameters.GetParameter<string>("串口");
             PowerPara.OutLoss = parameters.Parameters.GetParameter<double>("输出损耗");
@@ -58,13 +66,13 @@ namespace Tps_LQ_Transmitter.models
             {
                 PowerPara.ControlDelay = 10;
             }
-            if (false)//需具备仪器
+            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("SingleOrCont", "0"); SA.Query("OPC");
+              //  SA.Write("SingleOrCont", "0"); SA.Query("OPC");
             }
 
 
@@ -89,14 +97,15 @@ namespace Tps_LQ_Transmitter.models
                 {
                     break;
                 }
-                if(false)//需具备仪器
+                if(true)//需具备仪器
                 {
                     //控制
-                    SerialClient.DUT_Transmitter_Ctrol(PowerPara.ComPort, Convert.ToByte(point + 1));
+                   // SerialClient.DUT_Transmitter_Ctrol(PowerPara.ComPort, Convert.ToByte(point + 1));
                     Thread.Sleep(PowerPara.ControlDelay);//单位ms
 
                     SA.Write("REF", PowerPara.REF); SA.Query("OPC");
                     SA.Write("CENTER", CenterFreq.ToString()); SA.Query("OPC");
+                    SA.Write("SingleOrCont", "0"); SA.Query("OPC");
                     PsaPeakValue_Tracedata(SA, out y_value, out x_value, false);
                     Power = y_value;
 
@@ -105,13 +114,14 @@ namespace Tps_LQ_Transmitter.models
 
                 double[] HarmonicTimeVal = new double[PowerPara.HarmonicTime.Length];
                 double HarmonicMinTimeVal = 0;
-                if (false)//需具备仪器
+                if (true)//需具备仪器
                 {
                     SA.Write("REF", PowerPara.SmallSignalREF); SA.Query("OPC");
 
                     for (harmonic_num = 0; harmonic_num < PowerPara.HarmonicTime.Length; harmonic_num++)
                     {
                         SA.Write("CENTER", (CenterFreq * PowerPara.HarmonicTime[harmonic_num]).ToString()); SA.Query("OPC");//N次谐波
+                        SA.Write("SingleOrCont", "0"); SA.Query("OPC");
                         PsaPeakValue_Tracedata(SA, out y_value, out x_value, false);
                         Data.HarmonicSuppression[point, harmonic_num] = Math.Round(Power - y_value, 2);
 
@@ -129,30 +139,41 @@ namespace Tps_LQ_Transmitter.models
 
                 }
 
-
+                HarmonicSuppressionPrint.Test_name = parameters.Channel + "-谐波抑制测试-" + CenterFreq.ToString() + "MHz";
                 HarmonicSuppressionPrint.Lower = PowerPara.HarmonicSuppressionLower;
                 HarmonicSuppressionPrint.TestVal = HarmonicMinTimeVal;
-                HarmonicSuppressionPrint.TestVal = random.Next(4000, 12000) / 100.0;//随机数
+              //  HarmonicSuppressionPrint.TestVal = random.Next(4000, 12000) / 100.0;//随机数
                 if (HarmonicSuppressionPrint.TestVal >= HarmonicSuppressionPrint.Lower)
                 {
-                    HarmonicSuppressionPrint.Result = true;
+                    HarmonicSuppressionPrint.Result = "是";
                 }
                 else
                 {
-                    HarmonicSuppressionPrint.Result = false;
+                    HarmonicSuppressionPrint.Result = "否";
                 }
+                tps.TestTableAddCell(HarmonicSuppressionPrint.Test_name, HarmonicSuppressionPrint.Lower.ToString(), "/", HarmonicSuppressionPrint.TestVal.ToString(), HarmonicSuppressionPrint.Result);
                 if (parameters.Channel == "通道1")
                 {
-                    tps.SetTestTableCellValue(point, 15, HarmonicSuppressionPrint.Result, HarmonicSuppressionPrint.TestVal);
+                    if (point == 0)
+                    {
+                        WriteExcelData(sheet, point - 1, 1, "测试名称", "下限", "上限", "测试值", "通过");
+                    }
+                    WriteExcelData(sheet, point, 1, HarmonicSuppressionPrint.Test_name, HarmonicSuppressionPrint.Lower.ToString(),"/", HarmonicSuppressionPrint.TestVal.ToString(), HarmonicSuppressionPrint.Result);
+                   // tps.SetTestTableCellValue(point, 15, HarmonicSuppressionPrint.Result, HarmonicSuppressionPrint.TestVal);
                 }
                 else if (parameters.Channel == "通道2")
                 {
-                    tps.SetTestTableCellValue(point + 15, 15, HarmonicSuppressionPrint.Result, HarmonicSuppressionPrint.TestVal);
+                    if (point == 0)
+                    {
+                        WriteExcelData(sheet, point-1, 2, "测试名称", "下限", "上限", "测试值", "通过");
+                    }
+                    WriteExcelData(sheet, point, 2, HarmonicSuppressionPrint.Test_name, HarmonicSuppressionPrint.Lower.ToString(), "/", HarmonicSuppressionPrint.TestVal.ToString(), HarmonicSuppressionPrint.Result);
+                   // tps.SetTestTableCellValue(point + 15, 15, HarmonicSuppressionPrint.Result, HarmonicSuppressionPrint.TestVal);
                 }
 
             }
 
-            
+            SaveExcel(workbook);
             return true;
         }
 
@@ -163,6 +184,7 @@ namespace Tps_LQ_Transmitter.models
             Y_Maxvalue = 0;
 
             psa.Write("单次扫描");
+
             psa.Query("OPC");
             string tracedata = psa.Query("读曲线");
             string[] tracedatas = tracedata.Split(',');
@@ -171,7 +193,7 @@ namespace Tps_LQ_Transmitter.models
             {
                 tracedata_double[i] = double.Parse(tracedatas[i]);
             }
-            Y_Maxvalue = Math.Round(tracedata_double.Max(), 3);
+            Y_Maxvalue = tracedata_double.Max();
             if (IsReturnX)
             {
                 int x = Array.IndexOf(tracedata_double, Y_Maxvalue);
@@ -180,6 +202,7 @@ namespace Tps_LQ_Transmitter.models
                 double counts = double.Parse(psa.Query("测试点数读取"));
                 X_Maxvalue = startfreq + (stopfreq - startfreq) * x / (counts - 1);
             }
+            Y_Maxvalue = Math.Round(Y_Maxvalue, 3);
         }
         public class ConfigParameter
         {
@@ -251,32 +274,32 @@ namespace Tps_LQ_Transmitter.models
             
 
         }
-        public class DataType
-        {
+        //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; }
+        //    /// <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; }
 
 
-        }
+        //}
     }
     
 

+ 69 - 46
tps/TpsLabStudio/models/ModulationIndexAndMaxFreqOffset.cs

@@ -30,11 +30,18 @@ namespace Tps_LQ_Transmitter.models
             DataType ModulationIndexPrint = new DataType();
             DataType MaxFreqOffsetPrint = new DataType();
 
-            //if (SA == null)
-            //{
-            //    ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行", parameters.Channel, parameters.Name));
-            //    return false;
-            //}
+            if (SA == null)
+            {
+                ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行", parameters.Channel, parameters.Name));
+                return false;
+            }
+            OpenExcel("调制系数", 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();
 
@@ -63,7 +70,7 @@ namespace Tps_LQ_Transmitter.models
             {
                 PowerPara.ControlDelay = 10;
             }
-            if (false)//需具备仪器
+            if (true)//需具备仪器
             {
                 SA.Write("仪器复位"); SA.Query("OPC");
                 SA.Write("SPAN", PowerPara.SPAN); SA.Query("OPC");
@@ -71,7 +78,7 @@ namespace Tps_LQ_Transmitter.models
                 SA.Write("VBW", PowerPara.VBW); SA.Query("OPC");
                 SA.Write("REF", PowerPara.REF); SA.Query("OPC");
 
-                SA.Write("SingleOrCont", "0"); SA.Query("OPC");
+                
                 SA.Write("MARK打开", "1"); SA.Query("OPC");
                 SA.Write("MARK打开", "2"); SA.Query("OPC");
                 SA.Write("DELT打开", "2"); SA.Query("OPC");
@@ -99,16 +106,18 @@ namespace Tps_LQ_Transmitter.models
                 {
                     break;
                 }
-                if(false)//需具备仪器
+                if(true)//需具备仪器
                 {
                     // 控制
-                    SerialClient.DUT_Transmitter_Ctrol(PowerPara.ComPort, Convert.ToByte(point + 1));
+                  //  SerialClient.DUT_Transmitter_Ctrol(PowerPara.ComPort, Convert.ToByte(point + 1));
                     Thread.Sleep(PowerPara.ControlDelay);//单位ms
 
 
 
                     SA.Write("CENTER", CenterFreq.ToString()); SA.Query("OPC");
+                    SA.Write("SingleOrCont", "0"); SA.Query("OPC");
                     SA.Write("PEAK", "1"); SA.Query("OPC");
+                    SA.Write("PEAK", "2"); SA.Query("OPC");
                     SA.Write("NextPeak", "2"); SA.Query("OPC");
 
                     if(SA.Query("IDN")=="N9030A")//N9030A型号频谱仪
@@ -123,45 +132,57 @@ namespace Tps_LQ_Transmitter.models
 
                 }
 
-                PowerDelt[point] = random.Next(500, 1200) / 100.0;//随机数
+               // PowerDelt[point] = random.Next(500, 1200) / 100.0;//随机数
                 double temp = 30;
                 string RelativeVal= "0";
                 foreach (KeyValuePair<string, ModulationMatchParameter> kvp in CfigModuParas.ModulaParameters)
                 {
-                    if ((Math.Abs(PowerDelt[point] - double.Parse(kvp.Value.CfgRelative))) < temp)
+                    if ((Math.Abs(Math.Abs(PowerDelt[point]) - double.Parse(kvp.Value.CfgRelative))) < temp)
                     {
-                        temp = Math.Abs(PowerDelt[point] - double.Parse(kvp.Value.CfgRelative));
+                        temp = Math.Abs(Math.Abs(PowerDelt[point]) - double.Parse(kvp.Value.CfgRelative));
                         RelativeVal = kvp.Value.CfgRelative;
                     }                    
                 }
 
                 Data.ModulationIndex[point] = CfigModuParas.GetModulaParameter(RelativeVal);//调制系数
-               // Data.MaxFreqOffset[point] = CfigModuParas.GetFreqOffsetParameter(RelativeVal);//最大频偏
+                // Data.MaxFreqOffset[point] = CfigModuParas.GetFreqOffsetParameter(RelativeVal);//最大频偏
 
+                ModulationIndexPrint.Test_name = parameters.Channel + "-调制系数测试-" + CenterFreq.ToString() + "MHz";
                 ModulationIndexPrint.Lower = PowerPara.ModulationIndexLower;
                 ModulationIndexPrint.Upper = PowerPara.ModulationIndexUpper;
                 ModulationIndexPrint.TestVal = double.Parse(Data.ModulationIndex[point]);
                 if (ModulationIndexPrint.TestVal >= ModulationIndexPrint.Lower && ModulationIndexPrint.TestVal <= ModulationIndexPrint.Upper)
                 {
-                    ModulationIndexPrint.Result = true;
+                    ModulationIndexPrint.Result = "是";
                 }
                 else
                 {
-                    ModulationIndexPrint.Result = false;
+                    ModulationIndexPrint.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]);
-                   // tps.SetTestTableCellValue(point, 6, Data.MaxFreqOffset[point]);
+                    if (point == 0)
+                    {
+                        WriteExcelData(sheet, point - 1, 1, "测试名称", "下限", "上限", "测试值", "通过");
+                    }
+                    //tps.SetTestTableCellValue(point, 9, ModulationIndexPrint.Result,Data.ModulationIndex[point]);
+                    WriteExcelData(sheet, point, 1, ModulationIndexPrint.Test_name, ModulationIndexPrint.Lower.ToString(), ModulationIndexPrint.Upper.ToString(), ModulationIndexPrint.TestVal.ToString(), ModulationIndexPrint.Result);
+                    // tps.SetTestTableCellValue(point, 6, Data.MaxFreqOffset[point]);
                 }
                 else if (parameters.Channel == "通道2")
                 {
-                    tps.SetTestTableCellValue(point + 15, 9, ModulationIndexPrint.Result, Data.ModulationIndex[point]);
+                    if (point == 0)
+                    {
+                        WriteExcelData(sheet, point - 1, 2, "测试名称", "下限", "上限", "测试值", "通过");
+                    }
+                    WriteExcelData(sheet, point, 2, ModulationIndexPrint.Test_name, ModulationIndexPrint.Lower.ToString(), ModulationIndexPrint.Upper.ToString(), ModulationIndexPrint.TestVal.ToString(), ModulationIndexPrint.Result);
+                    //tps.SetTestTableCellValue(point + 15, 9, ModulationIndexPrint.Result, Data.ModulationIndex[point]);
                     //tps.SetTestTableCellValue(point + 15, 6, Data.MaxFreqOffset[point]);
                 }
 
             }
+            SaveExcel(workbook);
             return true;
         }
 
@@ -172,6 +193,7 @@ namespace Tps_LQ_Transmitter.models
             Y_Maxvalue = 0;
 
             psa.Write("单次扫描");
+
             psa.Query("OPC");
             string tracedata = psa.Query("读曲线");
             string[] tracedatas = tracedata.Split(',');
@@ -180,7 +202,7 @@ namespace Tps_LQ_Transmitter.models
             {
                 tracedata_double[i] = double.Parse(tracedatas[i]);
             }
-            Y_Maxvalue = Math.Round(tracedata_double.Max(), 3);
+            Y_Maxvalue = tracedata_double.Max();
             if (IsReturnX)
             {
                 int x = Array.IndexOf(tracedata_double, Y_Maxvalue);
@@ -189,6 +211,7 @@ namespace Tps_LQ_Transmitter.models
                 double counts = double.Parse(psa.Query("测试点数读取"));
                 X_Maxvalue = startfreq + (stopfreq - startfreq) * x / (counts - 1);
             }
+            Y_Maxvalue = Math.Round(Y_Maxvalue, 3);
         }
         public MatchModulaPara LoadModulationWorkBook()
         {
@@ -408,31 +431,31 @@ namespace Tps_LQ_Transmitter.models
            
 
         }
-        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; }
-
-
-        }
+        //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; }
+
+
+        //}
     }
 }

+ 88 - 70
tps/TpsLabStudio/models/NormalTemperatureTest.cs

@@ -32,6 +32,13 @@ namespace Tps_LQ_Transmitter.models
                 return false;
             }
             */
+            OpenExcel("测试过程值", out Spire.Xls.Workbook workbook, out Spire.Xls.Worksheet sheet);
+            if (sheet == null)
+            {
+                ShowMessage(MsgType.Error, "找不到"+ tps.TestProject + "模板.xlsx");
+                return false;
+            }
+           
             ConfigParameter PowerPara = new ConfigParameter();
             PowerPara.IntervalTime = parameters.Parameters.GetParameter<int>("相对时间");//min
             PowerPara.TestTime = parameters.Parameters.GetParameter<int>("测试次数");//min
@@ -44,10 +51,17 @@ namespace Tps_LQ_Transmitter.models
             {
                 currentTime1 = DateTime.Now;
                 TimesCounter.Restart();
-                tps.SetTestTableCellValue(time, 3, true, currentTime1.Hour.ToString()+":"+ currentTime1.Minute.ToString());//测试时间
-                tps.SetTestTableCellValue(time + PowerPara.TestTime, 3, true, currentTime1.Hour.ToString() + ":" + currentTime1.Minute.ToString());//测试时间
-                MainTest(parameters,time);             
                 
+                //tps.SetTestTableCellValue(time, 3, true, currentTime1.Hour.ToString()+":"+ currentTime1.Minute.ToString());//测试时间
+                //tps.SetTestTableCellValue(time + PowerPara.TestTime, 3, true, currentTime1.Hour.ToString() + ":" + currentTime1.Minute.ToString());//测试时间
+                tps.TestTableAddCell("绝对时间","/", "/", currentTime1.Hour.ToString() + ":" + currentTime1.Minute.ToString(), "/");
+                WriteExcelData(sheet,  1 + time * 10, 1,"绝对时间", "/", "/", currentTime1.Hour.ToString() + ":" + currentTime1.Minute.ToString(), "/");
+               
+                MainTest(parameters,time,workbook,sheet);
+                if (time == 3)
+                {
+                    IntervalTime = IntervalTime * 2;
+                }
                 while (TimesCounter.Elapsed.TotalSeconds <= IntervalTime && time!= PowerPara.TestTime-1)
                 {
                     Thread.Sleep(100);
@@ -60,10 +74,11 @@ namespace Tps_LQ_Transmitter.models
                 TimesCounter.Stop();
                 time = time + 1;
             }
-   
+            SaveExcel(workbook);
+
             return true;
         }
-        public bool MainTest(TestNode parameters,int time)
+        public bool MainTest(TestNode parameters,int time, Spire.Xls.Workbook workbook,  Spire.Xls.Worksheet sheet)
         {
            
             Random random = new Random();
@@ -149,7 +164,7 @@ namespace Tps_LQ_Transmitter.models
             }
             int channel = 0;
             int point = 0;
-            bool Result;
+            string Result;
             double CenterFreq;
             double[] PowerDelt = new double[PowerPara.FrequencyNumber];
             Data.Power = new double[PowerPara.FrequencyNumber];
@@ -188,6 +203,7 @@ namespace Tps_LQ_Transmitter.models
                     #region 电压、电流测试
                     //Data.VoltVal[point] = DC.Query("读取电压");
                     //Data.CurrentVal[point] = DC.Query("读取电流");
+                    VoltDataPrint.Test_name = "通道" + (channel+1).ToString() + "-" + "电压测试-" + CenterFreq.ToString() + "MHz";
                     VoltDataPrint.Lower = PowerPara.VoltLower;
                     VoltDataPrint.Upper = PowerPara.VoltUpper;
                     //VoltDataPrint.TestVal = double.Parse(Data.VoltVal[point]);
@@ -195,6 +211,7 @@ namespace Tps_LQ_Transmitter.models
                     Judge(VoltDataPrint.Lower, VoltDataPrint.Upper, VoltDataPrint.TestVal, out Result);
                     VoltDataPrint.Result = Result;
 
+                    CurrentDataPrint.Test_name = "通道" + (channel + 1).ToString() + "-" + "电流测试-" + CenterFreq.ToString() + "MHz";
                     CurrentDataPrint.Lower = PowerPara.CurrentLower;
                     CurrentDataPrint.Upper = PowerPara.CurrentUpper;
                     //CurrentDataPrint.TestVal = double.Parse(Data.CurrentVal[point]);
@@ -210,14 +227,17 @@ namespace Tps_LQ_Transmitter.models
                     // PsaPeakValue_Tracedata(SA, out y_value, out x_value, true);
                     // Data.Power[point] = y_value + PowerPara.OutLoss;//功率
                     Data.Power[point] = random.Next(3000, 4000) / 100.0;//随机数
-                  
+
+                    PowerPrint.Test_name = "通道" + (channel + 1).ToString() + "-" + "功率测试(W)-" + CenterFreq.ToString() + "MHz";
+                    PowerPrint.Lower = PowerPara.PowerLower;
+                    PowerPrint.Upper = PowerPara.PowerUpper;
                     PowerPrint.TestVal = Math.Round(Math.Pow(10, (Data.Power[point] / 10)) / 1000, 2);//功率W                  
-                    Judge(PowerPara.PowerLower, PowerPara.PowerUpper, PowerPrint.TestVal, out Result);
+                    Judge(PowerPrint.Lower, PowerPrint.Upper, PowerPrint.TestVal, out Result);
                     PowerPrint.Result = Result;
 
 
 
-
+                    FreqPrint.Test_name = "通道" + (channel + 1).ToString() + "-" + "频率测试(MHz)-" + CenterFreq.ToString() + "MHz";
                     FreqPrint.Lower = 0 - ((PowerPara.FreqAccuracyUpper * CenterFreq) + CenterFreq);
                     FreqPrint.Upper = (PowerPara.FreqAccuracyUpper * CenterFreq) + CenterFreq;
                     // FreqPrint.TestVal = Math.Round(x_value / 1000000, 3);//实测频率
@@ -246,42 +266,58 @@ namespace Tps_LQ_Transmitter.models
                     Data.MaxFreqOffset[point] = CfigModuParas.GetFreqOffsetParameter(RelativeVal);//最大频偏kHz
                     Data.DBMaxFreqOffset[point] = PowerDelt[point].ToString();//最大频偏dB
 
-  
+
                     //ModulationIndexPrint.TestVal = double.Parse(Data.ModulationIndex[point]);
                     //Judge (PowerPara.ModulationIndexLower, PowerPara.ModulationIndexUpper, ModulationIndexPrint.TestVal, out Result);
                     //ModulationIndexPrint.Result = Result;
 
-                    
+                    MaxFreqOffsetPrint.Test_name = "通道" + (channel + 1).ToString() + "-" + "调制频偏(KHz)-" + CenterFreq.ToString() + "MHz";
+                    DBMaxFreqOffsetPrint.Test_name = "通道" + (channel + 1).ToString() + "-" + "调制频偏(dB)-" + CenterFreq.ToString() + "MHz";
+                    MaxFreqOffsetPrint.Lower = PowerPara.MaxFreqOffsetLower;
+                    MaxFreqOffsetPrint.Upper = PowerPara.MaxFreqOffsetUpper;
                     MaxFreqOffsetPrint.TestVal = double.Parse(Data.MaxFreqOffset[point]);
                     DBMaxFreqOffsetPrint.TestVal = double.Parse(Data.DBMaxFreqOffset[point]);
 
-                    Judge(PowerPara.MaxFreqOffsetLower, PowerPara.MaxFreqOffsetUpper, MaxFreqOffsetPrint.TestVal, out Result);
+                    Judge(MaxFreqOffsetPrint.Lower, MaxFreqOffsetPrint.Upper, MaxFreqOffsetPrint.TestVal, out Result);
                     MaxFreqOffsetPrint.Result = Result;
                     DBMaxFreqOffsetPrint.Result = Result;
-
+                    tps.TestTableAddCell(VoltDataPrint.Test_name, VoltDataPrint.Lower.ToString(), VoltDataPrint.Upper.ToString(), VoltDataPrint.TestVal.ToString(), VoltDataPrint.Result);
+                    tps.TestTableAddCell(CurrentDataPrint.Test_name, CurrentDataPrint.Lower.ToString(), CurrentDataPrint.Upper.ToString(), CurrentDataPrint.TestVal.ToString(), CurrentDataPrint.Result);
+                    tps.TestTableAddCell(FreqPrint.Test_name, FreqPrint.Lower.ToString(), FreqPrint.Upper.ToString(), FreqPrint.TestVal.ToString(), FreqPrint.Result);
+                    tps.TestTableAddCell(DBMaxFreqOffsetPrint.Test_name, DBMaxFreqOffsetPrint.Lower.ToString(), DBMaxFreqOffsetPrint.Upper.ToString(), DBMaxFreqOffsetPrint.TestVal.ToString(), DBMaxFreqOffsetPrint.Result);
+                    tps.TestTableAddCell(MaxFreqOffsetPrint.Test_name, MaxFreqOffsetPrint.Lower.ToString(), MaxFreqOffsetPrint.Upper.ToString(), MaxFreqOffsetPrint.TestVal.ToString(), MaxFreqOffsetPrint.Result);
+                    tps.TestTableAddCell(PowerPrint.Test_name, PowerPrint.Lower.ToString(), PowerPrint.Upper.ToString(), PowerPrint.TestVal.ToString(), PowerPrint.Result);
                     #endregion
                     if (channel == 0)
                     {
-                        //  tps.SetTestTableCellValue(point, 2, SpuriousSuppressionPrint.Result, SpuriousSuppressionPrint.TestVal);//相对时间(min)
-                        //  tps.SetTestTableCellValue(point, 3, SpuriousSuppressionPrint.Result, SpuriousSuppressionPrint.TestVal);//绝对时间
-                        tps.SetTestTableCellValue(point + time, 4, VoltDataPrint.Result, VoltDataPrint.TestVal);//供电电压(V)
-                        tps.SetTestTableCellValue(point + time, 5, CurrentDataPrint.Result, CurrentDataPrint.TestVal);//消耗电流(A)
-                        tps.SetTestTableCellValue(point + time, 6, FreqPrint.Result, FreqPrint.TestVal);//输出频率(kHz)
-                        tps.SetTestTableCellValue(point + time, 7, DBMaxFreqOffsetPrint.Result, DBMaxFreqOffsetPrint.TestVal);//调制频偏(dB)
-                        tps.SetTestTableCellValue(point + time, 8, MaxFreqOffsetPrint.Result, MaxFreqOffsetPrint.TestVal);//调制频偏(kHz)
-                        tps.SetTestTableCellValue(point + time, 9, PowerPrint.Result, PowerPrint.TestVal);//输出功率(W)
+                        WriteExcelData(sheet, point + 2 + time * 10, 1, VoltDataPrint.Test_name, VoltDataPrint.Lower.ToString(), VoltDataPrint.Upper.ToString(), VoltDataPrint.TestVal.ToString(), VoltDataPrint.Result);
+                        WriteExcelData(sheet, point + 3 + time * 10, 1, CurrentDataPrint.Test_name, CurrentDataPrint.Lower.ToString(), CurrentDataPrint.Upper.ToString(), CurrentDataPrint.TestVal.ToString(), CurrentDataPrint.Result);
+                        WriteExcelData(sheet, point + 4 + time * 10, 1, FreqPrint.Test_name, FreqPrint.Lower.ToString(), FreqPrint.Upper.ToString(), FreqPrint.TestVal.ToString(), FreqPrint.Result);
+                        WriteExcelData(sheet, point + 5 + time * 10, 1, DBMaxFreqOffsetPrint.Test_name, DBMaxFreqOffsetPrint.Lower.ToString(), DBMaxFreqOffsetPrint.Upper.ToString(), DBMaxFreqOffsetPrint.TestVal.ToString(), DBMaxFreqOffsetPrint.Result);
+                        WriteExcelData(sheet, point + 6 + time * 10, 1, MaxFreqOffsetPrint.Test_name, MaxFreqOffsetPrint.Lower.ToString(), MaxFreqOffsetPrint.Upper.ToString(), MaxFreqOffsetPrint.TestVal.ToString(), MaxFreqOffsetPrint.Result);
+                        WriteExcelData(sheet, point + 7 + time * 10, 1, PowerPrint.Test_name, PowerPrint.Lower.ToString(), PowerPrint.Upper.ToString(), PowerPrint.TestVal.ToString(), PowerPrint.Result);
+                        //tps.SetTestTableCellValue(point + time, 4, VoltDataPrint.Result, VoltDataPrint.TestVal);//供电电压(V)
+                        //tps.SetTestTableCellValue(point + time, 5, CurrentDataPrint.Result, CurrentDataPrint.TestVal);//消耗电流(A)
+                        //tps.SetTestTableCellValue(point + time, 6, FreqPrint.Result, FreqPrint.TestVal);//输出频率(kHz)
+                        //tps.SetTestTableCellValue(point + time, 7, DBMaxFreqOffsetPrint.Result, DBMaxFreqOffsetPrint.TestVal);//调制频偏(dB)
+                        //tps.SetTestTableCellValue(point + time, 8, MaxFreqOffsetPrint.Result, MaxFreqOffsetPrint.TestVal);//调制频偏(kHz)
+                        //tps.SetTestTableCellValue(point + time, 9, PowerPrint.Result, PowerPrint.TestVal);//输出功率(W)
 
                     }
                     else if (channel == 1)
                     {
-                        // tps.SetTestTableCellValue(point + 5, 2, SpuriousSuppressionPrint.Result, SpuriousSuppressionPrint.TestVal);//相对时间(min)
-                        // tps.SetTestTableCellValue(point + 5, 3, SpuriousSuppressionPrint.Result, SpuriousSuppressionPrint.TestVal);//绝对时间
-                        tps.SetTestTableCellValue(point + time + 5, 4, VoltDataPrint.Result, VoltDataPrint.TestVal);//供电电压(V)
-                        tps.SetTestTableCellValue(point + time + 5, 5, CurrentDataPrint.Result, CurrentDataPrint.TestVal);//消耗电流(A)
-                        tps.SetTestTableCellValue(point + time + 5, 6, FreqPrint.Result, FreqPrint.TestVal);//输出频率(kHz)
-                        tps.SetTestTableCellValue(point + time + 5, 7, DBMaxFreqOffsetPrint.Result, DBMaxFreqOffsetPrint.TestVal);//调制频偏(dB)
-                        tps.SetTestTableCellValue(point + time + 5, 8, MaxFreqOffsetPrint.Result, MaxFreqOffsetPrint.TestVal);//调制频偏(kHz)
-                        tps.SetTestTableCellValue(point + time + 5, 9, PowerPrint.Result, PowerPrint.TestVal);//输出功率(W)
+                        WriteExcelData(sheet, point + 2 + time * 10, 2, VoltDataPrint.Test_name, VoltDataPrint.Lower.ToString(), VoltDataPrint.Upper.ToString(), VoltDataPrint.TestVal.ToString(), VoltDataPrint.Result);
+                        WriteExcelData(sheet, point + 3 + time * 10, 2, CurrentDataPrint.Test_name, CurrentDataPrint.Lower.ToString(), CurrentDataPrint.Upper.ToString(), CurrentDataPrint.TestVal.ToString(), CurrentDataPrint.Result);
+                        WriteExcelData(sheet, point + 4 + time * 10, 2, FreqPrint.Test_name, FreqPrint.Lower.ToString(), FreqPrint.Upper.ToString(), FreqPrint.TestVal.ToString(), FreqPrint.Result);
+                        WriteExcelData(sheet, point + 5 + time * 10, 2, DBMaxFreqOffsetPrint.Test_name, DBMaxFreqOffsetPrint.Lower.ToString(), DBMaxFreqOffsetPrint.Upper.ToString(), DBMaxFreqOffsetPrint.TestVal.ToString(), DBMaxFreqOffsetPrint.Result);
+                        WriteExcelData(sheet, point + 6 + time * 10, 2, MaxFreqOffsetPrint.Test_name, MaxFreqOffsetPrint.Lower.ToString(), MaxFreqOffsetPrint.Upper.ToString(), MaxFreqOffsetPrint.TestVal.ToString(), MaxFreqOffsetPrint.Result);
+                        WriteExcelData(sheet, point + 7 + time * 10, 2, PowerPrint.Test_name, PowerPrint.Lower.ToString(), PowerPrint.Upper.ToString(), PowerPrint.TestVal.ToString(), PowerPrint.Result);
+                        //tps.SetTestTableCellValue(point + time + 5, 4, VoltDataPrint.Result, VoltDataPrint.TestVal);//供电电压(V)
+                        //tps.SetTestTableCellValue(point + time + 5, 5, CurrentDataPrint.Result, CurrentDataPrint.TestVal);//消耗电流(A)
+                        //tps.SetTestTableCellValue(point + time + 5, 6, FreqPrint.Result, FreqPrint.TestVal);//输出频率(kHz)
+                        //tps.SetTestTableCellValue(point + time + 5, 7, DBMaxFreqOffsetPrint.Result, DBMaxFreqOffsetPrint.TestVal);//调制频偏(dB)
+                        //tps.SetTestTableCellValue(point + time + 5, 8, MaxFreqOffsetPrint.Result, MaxFreqOffsetPrint.TestVal);//调制频偏(kHz)
+                        //tps.SetTestTableCellValue(point + time + 5, 9, PowerPrint.Result, PowerPrint.TestVal);//输出功率(W)
 
                     }
                 }
@@ -318,20 +354,24 @@ namespace Tps_LQ_Transmitter.models
                     //SA.Write("STOP", PowerPara.RightStop.ToString()); SA.Query("OPC");
                     //PsaPeakValue_Tracedata(SA, out y_value, out x_value, false);
                     //PowerRigth = Power - y_value;
+                    SpuriousSuppressionPrint.Test_name = "通道" + (channel + 1).ToString() + "-" + "杂波抑制测试(KHz)-" + CenterFreq.ToString() + "MHz";
                     SpuriousSuppressionPrint.Lower = PowerPara.SpuriousSuppressionLower;
                     //SpuriousSuppressionPrint.TestVal = Math.Round(Math.Min(PowerLeft, PowerRigth), 2);
                     SpuriousSuppressionPrint.TestVal = random.Next(4000, 12000) / 100.0;//随机数
                     Judge(SpuriousSuppressionPrint.Lower, 201, SpuriousSuppressionPrint.TestVal, out Result);
                     SpuriousSuppressionPrint.Result = Result;
+                    tps.TestTableAddCell(SpuriousSuppressionPrint.Test_name, SpuriousSuppressionPrint.Lower.ToString(), SpuriousSuppressionPrint.Upper.ToString(), SpuriousSuppressionPrint.TestVal.ToString(), SpuriousSuppressionPrint.Result);
                     if (channel == 0)
                     {
-                        tps.SetTestTableCellValue(point + time, 10, SpuriousSuppressionPrint.Result, SpuriousSuppressionPrint.TestVal);//杂波抑制(dBc)
-                      
+                        WriteExcelData(sheet, point + 8 + time * 10, 1, SpuriousSuppressionPrint.Test_name, SpuriousSuppressionPrint.Lower.ToString(), SpuriousSuppressionPrint.Upper.ToString(), SpuriousSuppressionPrint.TestVal.ToString(), SpuriousSuppressionPrint.Result);
+                        //tps.SetTestTableCellValue(point + time, 10, SpuriousSuppressionPrint.Result, SpuriousSuppressionPrint.TestVal);//杂波抑制(dBc)
+
                     }
                     else if (channel == 1)
                     {
-                        tps.SetTestTableCellValue(point + time + 5, 10, SpuriousSuppressionPrint.Result, SpuriousSuppressionPrint.TestVal);//杂波抑制(dBc)
-                     
+                        WriteExcelData(sheet, point + 8 + time * 10, 2, SpuriousSuppressionPrint.Test_name, SpuriousSuppressionPrint.Lower.ToString(), SpuriousSuppressionPrint.Upper.ToString(), SpuriousSuppressionPrint.TestVal.ToString(), SpuriousSuppressionPrint.Result);
+                        //tps.SetTestTableCellValue(point + time + 5, 10, SpuriousSuppressionPrint.Result, SpuriousSuppressionPrint.TestVal);//杂波抑制(dBc)
+
                     }
 
                 }
@@ -378,25 +418,28 @@ namespace Tps_LQ_Transmitter.models
                     //{
                     //    HarmonicMinTimeVal = HarmonicTimeVal[0];
                     //}
+                    HarmonicSuppressionPrint.Test_name = "通道" + (channel + 1).ToString() + "-" + "谐波抑制测试(KHz)-" + CenterFreq.ToString() + "MHz";
                     HarmonicSuppressionPrint.Lower = PowerPara.HarmonicSuppressionLower;
                     HarmonicSuppressionPrint.TestVal = HarmonicMinTimeVal;
                     HarmonicSuppressionPrint.TestVal = random.Next(4000, 12000) / 100.0;//随机数
                     Judge(HarmonicSuppressionPrint.Lower, 201, HarmonicSuppressionPrint.TestVal, out Result);
                     HarmonicSuppressionPrint.Result = Result;
+                    tps.TestTableAddCell(HarmonicSuppressionPrint.Test_name, HarmonicSuppressionPrint.Lower.ToString(), HarmonicSuppressionPrint.Upper.ToString(), HarmonicSuppressionPrint.TestVal.ToString(), HarmonicSuppressionPrint.Result);
                     if (channel == 0)
                     {
-                       
-                        tps.SetTestTableCellValue(point + time, 11, HarmonicSuppressionPrint.Result, HarmonicSuppressionPrint.TestVal);//谐波抑制(dBc)
+                         WriteExcelData(sheet, point + 9 + time * 10, 1, HarmonicSuppressionPrint.Test_name, HarmonicSuppressionPrint.Lower.ToString(), HarmonicSuppressionPrint.Upper.ToString(), HarmonicSuppressionPrint.TestVal.ToString(), HarmonicSuppressionPrint.Result);
+                        //tps.SetTestTableCellValue(point + time, 11, HarmonicSuppressionPrint.Result, HarmonicSuppressionPrint.TestVal);//谐波抑制(dBc)
                     }
                     else if (channel == 1)
                     {
-                        
-                        tps.SetTestTableCellValue(point + time + 5, 11, HarmonicSuppressionPrint.Result, HarmonicSuppressionPrint.TestVal);//谐波抑制(dBc)
+                        WriteExcelData(sheet, point + 9 + time * 10, 2, HarmonicSuppressionPrint.Test_name, HarmonicSuppressionPrint.Lower.ToString(), HarmonicSuppressionPrint.Upper.ToString(), HarmonicSuppressionPrint.TestVal.ToString(), HarmonicSuppressionPrint.Result);
+                        //tps.SetTestTableCellValue(point + time + 5, 11, HarmonicSuppressionPrint.Result, HarmonicSuppressionPrint.TestVal);//谐波抑制(dBc)
                     }
                 }
                 #endregion
                 
             }
+            
             return true;
         
         }
@@ -404,39 +447,39 @@ namespace Tps_LQ_Transmitter.models
         /// 判断上下限
         /// </summary>
         /// <returns></returns>
-        public void Judge(double Lower,double Upper,double TestValue,out bool JudgeResult)
+        public void Judge(double Lower,double Upper,double TestValue,out string JudgeResult)
         {
             if (Upper >= 200)
             {
                 if (TestValue >= Lower)
                 {
-                    JudgeResult = true;
+                    JudgeResult = "是";
                 }
                 else
                 {
-                    JudgeResult = false;
+                    JudgeResult = "否";
                 }
             }
             else if (Lower <= -200)
             {
                 if (TestValue <= Upper)
                 {
-                    JudgeResult = true;
+                    JudgeResult = "是";
                 }
                 else
                 {
-                    JudgeResult = false;
+                    JudgeResult = "否";
                 }
             }
             else
             {
                 if (TestValue >= Lower && TestValue <= Upper)
                 {
-                    JudgeResult = true;
+                    JudgeResult = "是";
                 }
                 else
                 {
-                    JudgeResult = false;
+                    JudgeResult = "否";
                 }
             }
            
@@ -767,32 +810,7 @@ namespace Tps_LQ_Transmitter.models
 
 
         }
-        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; }
-
-
-        }
+        
     }
    
 }

+ 106 - 61
tps/TpsLabStudio/models/PowerAndFreqStability.cs

@@ -28,7 +28,7 @@ namespace Tps_LQ_Transmitter.models
             Random random = new Random();
 
             //获取仪器
-            var SA = this.tps.GetDevice("频谱仪");
+            var SA = this.tps.GetDeviceModel("FSU-26");
 
             TransmitterSerialPort SerialClient = new TransmitterSerialPort();
             PowerAndFreqStabilityOutData Data = new PowerAndFreqStabilityOutData();
@@ -38,11 +38,19 @@ namespace Tps_LQ_Transmitter.models
             DataType PowerSumPrint = new DataType();//两路功率总和(w)
             DataType PowerFlatnessPrint = new DataType();//两路功率不平度(dB)
 
-            //if (SA == null)
-            //{
-            //    ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行", parameters.Channel, parameters.Name));
-            //    return false;
-            //}
+            if (SA == null)
+            {
+                ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行", parameters.Channel, parameters.Name));
+                return false;
+            }
+          //  y_value = double.Parse(SA.Query("读通道功率"));
+            OpenExcel("功率及频率稳定度", out Spire.Xls.Workbook workbook, out Spire.Xls.Worksheet sheet);
+            if (sheet == null)
+            {
+                ShowMessage(MsgType.Error, "找不到" + tps.TestProject + "模板.xlsx");
+                return false;
+            }
+
             ConfigParameter PowerPara = new ConfigParameter();
             PowerPara.ComPort = parameters.Parameters.GetParameter<string>("串口");
             PowerPara.OutLoss = parameters.Parameters.GetParameter<double>("输出损耗");
@@ -71,13 +79,16 @@ namespace Tps_LQ_Transmitter.models
             {
                 PowerPara.ControlDelay = 10;
             }
-            if(false)//需具备仪器
+            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("设置通道带宽", "2"); SA.Query("OPC");
+
+                
                 SA.Write("SingleOrCont", "0"); SA.Query("OPC");
 
             }
@@ -116,68 +127,89 @@ namespace Tps_LQ_Transmitter.models
                 {
                     break;
                 }
-                if (false)//需具备仪器
+                if (true)//需具备仪器
                 {
                     //控制
-                    SerialClient.DUT_Transmitter_Ctrol(PowerPara.ComPort, Convert.ToByte(point + 1));
+                  //  SerialClient.DUT_Transmitter_Ctrol(PowerPara.ComPort, Convert.ToByte(point + 1));
                     Thread.Sleep(PowerPara.ControlDelay);//单位ms
 
 
                     SA.Write("CENTER", CenterFreq.ToString()); SA.Query("OPC");
+                    SA.Write("单次扫描"); SA.Query("OPC");
+                    SA.Query("OPC");
+                    
+                    SA.Write("设置通道功率模式"); SA.Query("OPC");                     
+
                     PsaPeakValue_Tracedata(SA, out y_value, out x_value, true);
+                    y_value = double.Parse(SA.Query("读通道功率"));
+
                     Data.Power[point] = y_value + PowerPara.OutLoss;//功率
 
                 }
 
-                Data.Power[point] = random.Next(3000, 4000) / 100.0;//随机数
-
+                //Data.Power[point] = random.Next(3000, 4000) / 100.0;//随机数
+                PowerPrint.Test_name = parameters.Channel + "-功率测试(W)-" + CenterFreq.ToString() + "MHz";
                 PowerPrint.Lower = PowerPara.PowerLower;
                 PowerPrint.Upper = PowerPara.PowerUpper;
                 PowerPrint.TestVal = Math.Round(Math.Pow(10, (Data.Power[point] / 10)) / 1000, 2);//功率W
 
                 if ((PowerPrint.TestVal >= PowerPrint.Lower) && (PowerPrint.TestVal <= PowerPrint.Upper))
                 {
-                    PowerPrint.Result = true;
+                    PowerPrint.Result = "是";
                 }
                 else
                 {
-                    PowerPrint.Result = false;
+                    PowerPrint.Result = "否";
                 }
- 
-                FreqPrint.Lower =0-((PowerPara.FreqAccuracyUpper * CenterFreq) + CenterFreq);
-                FreqPrint.Upper = (PowerPara.FreqAccuracyUpper * CenterFreq) + CenterFreq;
-               // FreqPrint.TestVal = Math.Round(x_value / 1000000, 3);//实测频率
-                FreqPrint.TestVal = random.Next(-600, 6000) / 100.0 + CenterFreq;//随机数
+                FreqPrint.Test_name = parameters.Channel + "-频率测试(MHz)-" + CenterFreq.ToString() + "MHz";
+                FreqPrint.Lower =Math.Round(0-((PowerPara.FreqAccuracyUpper * CenterFreq) + CenterFreq),2);
+                FreqPrint.Upper = Math.Round((PowerPara.FreqAccuracyUpper * CenterFreq) + CenterFreq,2);
+                FreqPrint.TestVal = Math.Round(x_value / 1000000, 3);//实测频率
+                //FreqPrint.TestVal = random.Next(-600, 6000) / 100.0 + CenterFreq;//随机数
                 if ((FreqPrint.TestVal >= FreqPrint.Lower) && (FreqPrint.TestVal <= FreqPrint.Upper))
                 {
-                    FreqPrint.Result = true;
+                    FreqPrint.Result = "是";
                 }
                 else
                 {
-                    FreqPrint.Result = false;
+                    FreqPrint.Result = "否";
                 }
 
-               
+                FreqAccuracyPrint.Test_name = parameters.Channel + "-频率稳定度测试-" + CenterFreq.ToString() + "MHz";
                 FreqAccuracyPrint.Upper = PowerPara.FreqAccuracyUpper;
-                //FreqAccuracyPrint.TestVal = Math.Round(Math.Abs(x_value - CenterFreq * 1000000) / (CenterFreq * 1000000), 6);//频率稳定度
-                FreqAccuracyPrint.TestVal = Math.Round(Math.Abs((random.Next(-600, 6000) / 100.0 + CenterFreq)*1000000 - CenterFreq * 1000000) / (CenterFreq * 1000000), 6);//随机数
+                FreqAccuracyPrint.TestVal = Math.Round(Math.Abs(x_value - CenterFreq * 1000000) / (CenterFreq * 1000000), 6);//频率稳定度
+                //FreqAccuracyPrint.TestVal = Math.Round(Math.Abs((random.Next(-600, 6000) / 100.0 + CenterFreq)*1000000 - CenterFreq * 1000000) / (CenterFreq * 1000000), 6);//随机数
                 if (FreqAccuracyPrint.TestVal <= FreqAccuracyPrint.Upper)
                 {
-                    FreqAccuracyPrint.Result = true;
+                    FreqAccuracyPrint.Result = "是";
                 }
                 else
                 {
-                    FreqAccuracyPrint.Result = false;
+                    FreqAccuracyPrint.Result = "否";
                 }
+                tps.TestTableAddCell(PowerPrint.Test_name, "/", PowerPrint.Upper.ToString(), PowerPrint.TestVal.ToString(), PowerPrint.Result);
+                tps.TestTableAddCell(FreqPrint.Test_name, FreqPrint.Lower.ToString(), FreqPrint.Upper.ToString(), FreqPrint.TestVal.ToString(), FreqPrint.Result);
                 if (parameters.Channel == "通道1")
                 {
-                    tps.SetTestTableCellValue(point, 10, PowerPrint.Result, PowerPrint.TestVal);
-                    tps.SetTestTableCellValue(point, 7, FreqPrint.Result, FreqPrint.TestVal);
+                    if (point == 0)
+                    {
+                        WriteExcelData(sheet, point - 1, 1, "测试名称", "下限", "上限", "测试值", "通过");
+                    }
+                    WriteExcelData(sheet, point, 1, PowerPrint.Test_name, "/", PowerPrint.Upper.ToString(), PowerPrint.TestVal.ToString(), PowerPrint.Result);
+                    WriteExcelData(sheet, point+15, 1, FreqPrint.Test_name, FreqPrint.Lower.ToString(), FreqPrint.Upper.ToString(), FreqPrint.TestVal.ToString(), FreqPrint.Result);
+                    //tps.SetTestTableCellValue(point, 10, PowerPrint.Result, PowerPrint.TestVal);
+                    //tps.SetTestTableCellValue(point, 7, FreqPrint.Result, FreqPrint.TestVal);
                 }
                 else if (parameters.Channel == "通道2")
                 {
-                    tps.SetTestTableCellValue(point, 11, PowerPrint.Result, PowerPrint.TestVal);
-                    tps.SetTestTableCellValue(point+15, 7, FreqPrint.Result,FreqPrint.TestVal);
+                    if (point == 0)
+                    {
+                        WriteExcelData(sheet, point - 1, 2, "测试名称", "下限", "上限", "测试值", "通过");
+                    }
+                    WriteExcelData(sheet, point, 2, PowerPrint.Test_name, "/", PowerPrint.Upper.ToString(), PowerPrint.TestVal.ToString(), PowerPrint.Result);
+                    WriteExcelData(sheet, point+15, 2, FreqPrint.Test_name, "/", FreqPrint.Upper.ToString(), FreqPrint.TestVal.ToString(), FreqPrint.Result);
+                    //tps.SetTestTableCellValue(point, 11, PowerPrint.Result, PowerPrint.TestVal);
+                    //tps.SetTestTableCellValue(point + 15, 7, FreqPrint.Result, FreqPrint.TestVal);
                 }
 
                 #region 功率不平度及两路功率总和计算
@@ -194,33 +226,44 @@ namespace Tps_LQ_Transmitter.models
 
                 if (WTempPowerVal[0, point] > -100 && WTempPowerVal[1, point] > -100)
                 {
+                    PowerSumPrint.Test_name =  "两路功率总和(W)-" + CenterFreq.ToString() + "MHz";
                     PowerSumPrint.Lower = PowerPara.PowerSumLower;
                     PowerSumPrint.TestVal = Math.Round(WTempPowerVal[0, point] + WTempPowerVal[1, point],2);//W
                     if ((PowerSumPrint.TestVal >= PowerSumPrint.Lower) && (PowerSumPrint.TestVal <= PowerSumPrint.Upper))
                     {
-                        PowerSumPrint.Result = true;
+                        PowerSumPrint.Result = "是";
                     }
                     else
                     {
-                        PowerSumPrint.Result = false;
+                        PowerSumPrint.Result = "否";
                     }
-
+                    PowerFlatnessPrint.Test_name =  "功率不平度(dB)-" + CenterFreq.ToString() + "MHz";
                     PowerFlatnessPrint.Upper = PowerPara.PowerFlatnessUpper;
                     PowerFlatnessPrint.TestVal = Math.Round(Math.Abs(dBTempPowerVal[0, point] - dBTempPowerVal[1, point]),2);//dB
                     if ((PowerFlatnessPrint.TestVal >= PowerFlatnessPrint.Lower) && (PowerFlatnessPrint.TestVal <= PowerFlatnessPrint.Upper))
                     {
-                        PowerFlatnessPrint.Result = true;
+                        PowerFlatnessPrint.Result = "是";
                     }
                     else
                     {
-                        PowerFlatnessPrint.Result = false;
+                        PowerFlatnessPrint.Result = "否";
                     }
-                    tps.SetTestTableCellValue(point, 12, PowerSumPrint.Result, PowerSumPrint.TestVal);
-                    tps.SetTestTableCellValue(point, 13, PowerFlatnessPrint.Result,PowerFlatnessPrint.TestVal);
-                   
+                    if (point == 0)
+                    {
+                        WriteExcelData(sheet, point - 1, 3, "测试名称", "下限", "上限", "测试值", "通过");
+                        WriteExcelData(sheet, point - 1, 4, "测试名称", "下限", "上限", "测试值", "通过");
+                    }
+                    tps.TestTableAddCell(PowerSumPrint.Test_name, PowerSumPrint.Lower.ToString(), "/", PowerSumPrint.TestVal.ToString(), PowerSumPrint.Result);
+                    tps.TestTableAddCell(PowerFlatnessPrint.Test_name, PowerFlatnessPrint.Lower.ToString(), "/", PowerFlatnessPrint.TestVal.ToString(), PowerFlatnessPrint.Result);
+                    WriteExcelData(sheet, point, 3, PowerSumPrint.Test_name, PowerSumPrint.Lower.ToString(), "/", PowerSumPrint.TestVal.ToString(), PowerSumPrint.Result);
+                    WriteExcelData(sheet, point, 4, PowerFlatnessPrint.Test_name, PowerFlatnessPrint.Lower.ToString(), "/", PowerFlatnessPrint.TestVal.ToString(), PowerFlatnessPrint.Result);
+                    //tps.SetTestTableCellValue(point, 12, PowerSumPrint.Result, PowerSumPrint.TestVal);
+                    //tps.SetTestTableCellValue(point, 13, PowerFlatnessPrint.Result,PowerFlatnessPrint.TestVal);
+
                 }
                 #endregion
             }
+            SaveExcel(workbook);
             return true;
         }
 
@@ -233,6 +276,7 @@ namespace Tps_LQ_Transmitter.models
             Y_Maxvalue = 0;
 
             psa.Write("单次扫描");
+
             psa.Query("OPC");
             string tracedata = psa.Query("读曲线");
             string[] tracedatas = tracedata.Split(',');
@@ -241,7 +285,7 @@ namespace Tps_LQ_Transmitter.models
             {
                 tracedata_double[i] = double.Parse(tracedatas[i]);
             }
-            Y_Maxvalue = Math.Round(tracedata_double.Max(), 3);
+            Y_Maxvalue = tracedata_double.Max();
             if (IsReturnX)
             {
                 int x = Array.IndexOf(tracedata_double, Y_Maxvalue);
@@ -250,6 +294,7 @@ namespace Tps_LQ_Transmitter.models
                 double counts = double.Parse(psa.Query("测试点数读取"));
                 X_Maxvalue = startfreq + (stopfreq - startfreq) * x / (counts - 1);
             }
+            Y_Maxvalue = Math.Round(Y_Maxvalue, 3);
         }
         public class ConfigParameter
         {
@@ -345,31 +390,31 @@ namespace Tps_LQ_Transmitter.models
             public double[] PowerFlatness { set; get; }
 
         }
-        public class DataType
-        {
+        //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; }
+        //    /// <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; }
 
 
-        }
+        //}
     }
 }

+ 56 - 36
tps/TpsLabStudio/models/SpuriousSuppression.cs

@@ -27,12 +27,19 @@ namespace Tps_LQ_Transmitter.models
             TransmitterSerialPort SerialClient = new TransmitterSerialPort();
             OutData Data = new OutData();
             DataType SpuriousSuppressionPrint = new DataType();
-          
-            //if (SA == null)
-            //{
-            //    ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行", parameters.Channel, parameters.Name));
-            //    return false;
-            //}
+
+            if (SA == null)
+            {
+                ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行", parameters.Channel, parameters.Name));
+                return false;
+            }
+            OpenExcel("杂波抑制", out Spire.Xls.Workbook workbook, out Spire.Xls.Worksheet sheet);
+            if (sheet == null)
+            {
+                ShowMessage(MsgType.Error, "找不到" + tps.TestProject + "模板.xlsx");
+                return false;
+            }
+
             ConfigParameter PowerPara = new ConfigParameter();
             PowerPara.ComPort = parameters.Parameters.GetParameter<string>("串口");
             PowerPara.OutLoss = parameters.Parameters.GetParameter<double>("输出损耗");
@@ -63,7 +70,7 @@ namespace Tps_LQ_Transmitter.models
             {
                 PowerPara.ControlDelay = 10;
             }
-            if(false)//需具备仪器
+            if(true)//需具备仪器
             {
                 SA.Write("仪器复位"); SA.Query("OPC");
                 SA.Write("SPAN", PowerPara.SPAN); SA.Query("OPC");
@@ -94,10 +101,10 @@ namespace Tps_LQ_Transmitter.models
                 {
                     break;
                 }
-                if (false)//需具备仪器
+                if (true)//需具备仪器
                 {
                     // 控制
-                    SerialClient.DUT_Transmitter_Ctrol(PowerPara.ComPort, Convert.ToByte(point + 1));
+                 //   SerialClient.DUT_Transmitter_Ctrol(PowerPara.ComPort, Convert.ToByte(point + 1));
                     Thread.Sleep(PowerPara.ControlDelay);//单位ms    
 
                     SA.Write("REF", PowerPara.REF); SA.Query("OPC");
@@ -117,26 +124,39 @@ namespace Tps_LQ_Transmitter.models
                     PowerRigth = Power - y_value;
 
                 }
+                SpuriousSuppressionPrint.Test_name = parameters.Channel + "-杂波抑制测试-" + CenterFreq.ToString() + "MHz";
                 SpuriousSuppressionPrint.Lower = PowerPara.SpuriousSuppressionLower;
                 //SpuriousSuppressionPrint.TestVal = Math.Round(Math.Min(PowerLeft, PowerRigth), 2);
                 SpuriousSuppressionPrint.TestVal = random.Next(4000, 12000) / 100.0;//随机数
                 if (SpuriousSuppressionPrint.TestVal >= SpuriousSuppressionPrint.Lower)
                 {
-                    SpuriousSuppressionPrint.Result = true;
+                    SpuriousSuppressionPrint.Result = "是";
                 }
                 else
                 {
-                    SpuriousSuppressionPrint.Result = false;
+                    SpuriousSuppressionPrint.Result = "否";
                 }
+                tps.TestTableAddCell(SpuriousSuppressionPrint.Test_name, SpuriousSuppressionPrint.Lower.ToString(), "/", SpuriousSuppressionPrint.TestVal.ToString(), SpuriousSuppressionPrint.Result);
                 if (parameters.Channel == "通道1")
                 {
-                    tps.SetTestTableCellValue(point, 14, SpuriousSuppressionPrint.Result,SpuriousSuppressionPrint.TestVal);                
+                    if (point == 0)
+                    {
+                        WriteExcelData(sheet, point - 1, 1, "测试名称", "下限", "上限", "测试值", "通过");
+                    }
+                    //tps.SetTestTableCellValue(point, 14, SpuriousSuppressionPrint.Result,SpuriousSuppressionPrint.TestVal);    
+                    WriteExcelData(sheet, point, 1, SpuriousSuppressionPrint.Test_name, SpuriousSuppressionPrint.Lower.ToString(),"/", SpuriousSuppressionPrint.TestVal.ToString(), SpuriousSuppressionPrint.Result);
                 }
                 else if (parameters.Channel == "通道2")
                 {
-                    tps.SetTestTableCellValue(point + 15, 14, SpuriousSuppressionPrint.Result, SpuriousSuppressionPrint.TestVal);                
+                    if (point == 0)
+                    {
+                        WriteExcelData(sheet, point - 1, 2, "测试名称", "下限", "上限", "测试值", "通过");
+                    }
+                    //tps.SetTestTableCellValue(point + 15, 14, SpuriousSuppressionPrint.Result, SpuriousSuppressionPrint.TestVal);           
+                    WriteExcelData(sheet, point, 2, SpuriousSuppressionPrint.Test_name, SpuriousSuppressionPrint.Lower.ToString(), "/", SpuriousSuppressionPrint.TestVal.ToString(), SpuriousSuppressionPrint.Result);
                 }
             }
+            SaveExcel(workbook);
             return true;
         }
 
@@ -248,31 +268,31 @@ namespace Tps_LQ_Transmitter.models
             public double[] SpuriousSuppression { set; get; }
             
         }
-        public class DataType
-        {
+        //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; }
+        //    /// <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; }
 
 
-        }
+        //}
     }
 }

+ 110 - 36
tps/TpsLabStudio/models/VoltAndCurrent.cs

@@ -3,8 +3,10 @@ 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;
+using System.Drawing;
 
 namespace Tps_LQ_Transmitter.models
 {
@@ -20,6 +22,7 @@ namespace Tps_LQ_Transmitter.models
         /// </summary>
         public override bool Run(TestNode parameters)
         {
+            object[] TableCell;
             TestParameters result = new TestParameters();
             Random random = new Random();
             //获取仪器
@@ -39,6 +42,15 @@ namespace Tps_LQ_Transmitter.models
                 return false;
             }
             */
+
+            OpenExcel("电压及电流", out Spire.Xls.Workbook workbook, out Spire.Xls.Worksheet sheet);
+            if (sheet == null)
+            {
+                ShowMessage(MsgType.Error, "找不到" + tps.TestProject + "模板.xlsx");
+                return false;
+            }
+
+
             ConfigParameter PowerPara = new ConfigParameter();
             PowerPara.ComPort = parameters.Parameters.GetParameter<string>("串口");
             PowerPara.StartFrequency = parameters.Parameters.GetParameter<double>("起始频率");
@@ -93,52 +105,114 @@ namespace Tps_LQ_Transmitter.models
                 Data.VoltVal[point] = DC.Query("读取电压");
                 Data.CurrentVal[point] = DC.Query("读取电流");
                 */
-                
 
+                VoltDataPrint.Test_name = parameters.Channel + "-电压测试-" + CenterFreq.ToString()+"MHz";
                 VoltDataPrint.Lower = PowerPara.VoltLower;
                 VoltDataPrint.Upper = PowerPara.VoltUpper;
                 //VoltDataPrint.TestVal = double.Parse(Data.VoltVal[point]);
                 VoltDataPrint.TestVal = random.Next(2500, 3000) / 100.0;//随机数
                 if ((VoltDataPrint.TestVal >= VoltDataPrint.Lower) && (VoltDataPrint.TestVal <= VoltDataPrint.Upper))
                 {
-                    VoltDataPrint.Result = true;
+                    VoltDataPrint.Result = "是";
                 }
                 else
                 {
-                    VoltDataPrint.Result = false;
+                    VoltDataPrint.Result = "否";
                 }
 
-
-
-                //CurrentDataPrint.Test_name = parameters.Channel + "-电流测试-" + CenterFreq.ToString();
+                CurrentDataPrint.Test_name = parameters.Channel + "-电流测试-" + CenterFreq.ToString() + "MHz";
                 CurrentDataPrint.Lower = PowerPara.CurrentLower;
                 CurrentDataPrint.Upper = PowerPara.CurrentUpper;
                 //CurrentDataPrint.TestVal = double.Parse(Data.CurrentVal[point]);
                 CurrentDataPrint.TestVal = random.Next(90, 160) / 100.0;
                 if ((CurrentDataPrint.TestVal >= CurrentDataPrint.Lower) && (CurrentDataPrint.TestVal <= CurrentDataPrint.Upper))
                 {
-                    CurrentDataPrint.Result = true;
+                    CurrentDataPrint.Result = "是";
                 }
                 else
                 {
-                    CurrentDataPrint.Result = false;
+                    CurrentDataPrint.Result = "否";
                 }
+
+                tps.TestTableAddCell(CurrentDataPrint.Test_name, CurrentDataPrint.Lower.ToString(), CurrentDataPrint.Upper.ToString(), CurrentDataPrint.TestVal.ToString(), CurrentDataPrint.Result);
+                tps.TestTableAddCell(VoltDataPrint.Test_name, VoltDataPrint.Lower.ToString(), VoltDataPrint.Upper.ToString(), VoltDataPrint.TestVal.ToString(), VoltDataPrint.Result);
+               
                 if (parameters.Channel == "通道1")
                 {
-                    tps.SetTestTableCellValue(point, 5, VoltDataPrint.Result, VoltDataPrint.TestVal);
-                    tps.SetTestTableCellValue(point, 6, CurrentDataPrint.Result,CurrentDataPrint.TestVal);
+                    if (point == 0)
+                    {
+                        WriteExcelData(sheet, point - 1, 1, "测试名称", "下限", "上限", "测试值", "通过");
+                    }
+
+                    WriteExcelData(sheet, point, 1, CurrentDataPrint.Test_name, CurrentDataPrint.Lower.ToString(), CurrentDataPrint.Upper.ToString(), CurrentDataPrint.TestVal.ToString(), CurrentDataPrint.Result);
+                    WriteExcelData(sheet, point+ PowerPara.FrequencyNumber, 1, VoltDataPrint.Test_name, VoltDataPrint.Lower.ToString(), VoltDataPrint.Upper.ToString(), VoltDataPrint.TestVal.ToString(), VoltDataPrint.Result);
+                    //tps.SetTestTableCellValue(point, 5, VoltDataPrint.Result, VoltDataPrint.TestVal);
+                    //tps.SetTestTableCellValue(point, 6, CurrentDataPrint.Result, CurrentDataPrint.TestVal);
                 }
                 else if (parameters.Channel == "通道2")
                 {
-                    tps.SetTestTableCellValue(point+15, 5, VoltDataPrint.Result, VoltDataPrint.TestVal);
-                    tps.SetTestTableCellValue(point+15, 6, CurrentDataPrint.Result,CurrentDataPrint.TestVal);
+                    if (point == 0)
+                    {
+                        WriteExcelData(sheet, point - 1, 2, "测试名称", "下限", "上限", "测试值", "通过");
+                    }
+                    WriteExcelData(sheet, point, 2, CurrentDataPrint.Test_name, CurrentDataPrint.Lower.ToString(), CurrentDataPrint.Upper.ToString(), CurrentDataPrint.TestVal.ToString(), CurrentDataPrint.Result);
+                    WriteExcelData(sheet, point+ PowerPara.FrequencyNumber, 2, VoltDataPrint.Test_name, VoltDataPrint.Lower.ToString(), VoltDataPrint.Upper.ToString(), VoltDataPrint.TestVal.ToString(), VoltDataPrint.Result);
+                    //tps.SetTestTableCellValue(point + 15, 5, VoltDataPrint.Result, VoltDataPrint.TestVal);
+                    //tps.SetTestTableCellValue(point + 15, 6, CurrentDataPrint.Result, CurrentDataPrint.TestVal);
                 }
-  
+
             }
+            SaveExcel(workbook);
             return true;
         }
+        //public void OpenExcel(string sheetname, out Spire.Xls.Workbook workbook,out Spire.Xls.Worksheet sheet )
+        //{
+        //    string TestFilePath = "F:";
+        //    string ModelFile = "F:/Transmitter_model.xlsx";
+        //    string subPath = "F:/发射机测试数据/常温测试/";
+
+        //    if (false == System.IO.Directory.Exists(subPath))
+        //    {
+        //        System.IO.Directory.CreateDirectory(subPath);
+        //    }
+        //    workbook = new Spire.Xls.Workbook();
+        //    string FileName = subPath + tps.Serial + ".xlsx";
+        //    if (File.Exists(FileName))
+        //    {
+        //        workbook.LoadFromFile(FileName);
+        //        //sheet = workbook.Worksheets[sheetname];
+        //    }
+        //    else if (File.Exists(ModelFile))
+        //    {
+        //        workbook.LoadFromFile(ModelFile);
+        //        //sheet = workbook.Worksheets[sheetname];
+        //    }
+        //    sheet = workbook.Worksheets[sheetname];
+        //    if (!File.Exists(ModelFile))
+        //    {
+        //       sheet = null;
+        //    }
 
+        //}
+        
+        //public void WriteExcelData(Spire.Xls.Worksheet sheet, int row,int channel,string name,double lower,double upper,double val,string result)
+        //{
+        //    int column = (channel - 1) * 6;
 
+        //    sheet.Range[row+2, 1 + column].Value2 = name;
+        //    sheet.Range[row+2, 2 + column].Value2 = lower.ToString();
+        //    sheet.Range[row+2, 3 + column].Value2 = upper.ToString();
+        //    sheet.Range[row+2, 4 + column].Value2 = val.ToString();
+        //    sheet.Range[row+2, 5 + column].Value2 = result;
+           
+
+        //}
+        //public void SaveExcel(Spire.Xls.Workbook workbook)
+        //{
+        //    string subPath = "F:/发射机测试数据/常温测试/";
+        //    string FileName = subPath + tps.Serial + ".xlsx";
+        //    workbook.SaveToFile(FileName);
+        //}
         public class ConfigParameter
         {
             /// <summary>
@@ -215,31 +289,31 @@ namespace Tps_LQ_Transmitter.models
             public string[] CurrentVal { set; get; }
         }
 
-        public class DataType
-        {
+        //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; }
+        //    /// <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 string Result { set; get; }
 
 
-        }
+        //}
     }
 }