Pārlūkot izejas kodu

电源测试程序,第二次提交,去除obj,debug提交

501776450 3 gadi atpakaļ
vecāks
revīzija
8ac058d348

BIN
exe/apps/PowerTestDemo/PowerTestDemo.dll


BIN
exe/apps/PowerTestDemo/PowerTestDemo.pdb


BIN
exe/apps/PowerTestDemo/config/测试#常温测试#DC16MK.xlsx


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1052 - 0
exe/logs/202108.log


BIN
tps/TpsAppDemo/.vs/PowerTestDemo/v16/.suo


+ 23 - 7
tps/TpsAppDemo/FrmMain.cs

@@ -161,17 +161,33 @@ namespace PowerTestDemo
             frmDevice.ShowDevices(currFileNode.Tps.Devices);
         }
 
-        private void Tps_TestTableCellChanged(int row, int cell, object value)
+        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.YellowGreen;
+                }
+                else
+                {
+                    dgvTestData.Rows[row].Cells[cell].Style.BackColor = Color.Red;
+                }
             }));
         }
 
-        private void Tps_ManualTableCellChanged(int row, int cell, object value)
+        private void Tps_ManualTableCellChanged(int row, int cell, bool ok, object value)
         {
             this.Invoke(new Action(() => {
                 currFileNode.Tps.ManualTable.Rows[row][cell] = value;
+                if (ok)
+                {
+                    dgvTestData.Rows[row].Cells[cell].Style.BackColor = Color.White;
+                }
+                else
+                {
+                    dgvTestData.Rows[row].Cells[cell].Style.BackColor = Color.Red;
+                }
             }));
         }
 
@@ -253,11 +269,11 @@ namespace PowerTestDemo
         private void BtnStop_Click(object sender, EventArgs e)
         {
             currFileNode.Tps.Stop();
-            if(task != null && task.IsCompleted == false)
-            {
-                //等待任务退出
-                task.Wait();
-            }
+            //if(task != null && task.IsCompleted == false)
+            //{
+            //    //等待任务退出
+            //    task.Wait();
+            //}
             BtnStart.Enabled = true;
             BtnLoadTpsConfig.Enabled = true;
         }

+ 5 - 5
tps/TpsAppDemo/MainTps.cs

@@ -13,7 +13,7 @@ using AppLibs.Devices;
 namespace PowerTestDemo
 {
     public delegate void DltShowMsg(MsgType msgType, string msg);
-    public delegate void DltCellValueChanged(int row, int cell, object value);
+    public delegate void DltCellValueChanged(int row, int cell,bool ok, object value);
     /// <summary>
     /// 一个测试文件对应的测试项目
     /// </summary>
@@ -723,16 +723,16 @@ namespace PowerTestDemo
             }
         }
 
-        public void SetManualTableCellValue(int row, int col, object value)
+        public void SetManualTableCellValue(int row, int col, bool ok, object value)
         {
             if (ManualTableCellChanged != null)
-                ManualTableCellChanged(row, col, value);
+                ManualTableCellChanged(row, col, ok, value);
         }
 
-        public void SetTestTableCellValue(int row, int col, object value)
+        public void SetTestTableCellValue(int row, int col, bool ok, object value)
         {
             if (TestTableCellChanged != null)
-                TestTableCellChanged(row, col, value);
+                TestTableCellChanged(row, col, ok, value);
         }
 
         void SaveTestTable()

+ 5 - 0
tps/TpsAppDemo/PowerTestDemo.csproj

@@ -95,9 +95,14 @@
       <DependentUpon>FrmMain.cs</DependentUpon>
     </Compile>
     <Compile Include="MainTps.cs" />
+    <Compile Include="models\InOutDelay.cs" />
+    <Compile Include="models\OutputOvershoot.cs" />
+    <Compile Include="models\OutputRipple.cs" />
+    <Compile Include="models\OutputCurrent.cs" />
     <Compile Include="models\InputCurrent.cs" />
     <Compile Include="models\InputSurge.cs" />
     <Compile Include="models\InputRipple.cs" />
+    <Compile Include="models\OutputVoltage.cs" />
     <Compile Include="models\InputVoltage.cs" />
     <Compile Include="models\BaseModel.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />

BIN
tps/TpsAppDemo/config/~$测试#常温测试#DC16MK.xlsx


BIN
tps/TpsAppDemo/config/测试#常温测试#DC16MK.xlsx


+ 92 - 0
tps/TpsAppDemo/models/InOutDelay.cs

@@ -0,0 +1,92 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using PowerTestDemo.com;
+using AppLibs.Devices;
+using System.Threading;
+
+namespace PowerTestDemo.models
+{
+    /// <summary>
+    /// 增益测试测试模板,继承自指标测试模板基类
+    /// </summary>
+    public class InOutDelay : BaseModel
+    {
+        /// <summary>
+        /// 测试模板名称,测试指标配置表中的模板名称源自这个参数
+        /// </summary>
+        public InOutDelay()
+        {
+            //首先要定义模板名称,excel 自动测试项总表中的指标测试模板的名称要和这个名称一致
+            TemplateName = "输入输出延时模板"; 
+        }
+
+        /// <summary>
+        /// 重写的Run方法,当执行到这个测试指标项时,Run会被调用
+        /// </summary>
+        /// <param name="parameters"></param>
+        /// <returns></returns>
+        public override bool Run(TestNode parameters)
+        {
+            //检查当前指标需要的仪器是否OK,
+            //var sig = this.tps.GetDevice("信号源1");
+            //var spe = this.tps.GetDevice("频谱仪");
+            //if(sig == null || spe == null)
+            //{
+            //    ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行",parameters.Channel,parameters.Name));
+            //    return false;
+            //}
+
+            double[] threshold = parameters.Parameters.GetParameterToArray<double>("+15V1阈值");
+            int delay = parameters.Parameters.GetParameter<int>("通道延迟");
+
+            if (threshold == null)
+            {
+                ShowMessage(MsgType.Error, string.Format("配置文件中频率参数为空,{0}/{1}无法运行", parameters.Channel, parameters.Name));
+                return false;
+            }
+
+            //开始测试
+            Thread.Sleep(50);
+            Random rd = new Random();
+            double result = 0;
+            result = 13 + rd.NextDouble() * 8;
+            result = double.Parse(String.Format("{0:F2}", result));      
+            if (parameters.Channel == "+15V1")
+                this.tps.SetTestTableCellValue(10, 1, true, result );
+            else if (parameters.Channel == "-15V1")
+                this.tps.SetTestTableCellValue(10, 2, true, result );
+            else if (parameters.Channel == "+5V1")
+                this.tps.SetTestTableCellValue(10, 3, true, result );
+            else if (parameters.Channel == "-5V")
+                this.tps.SetTestTableCellValue(10, 4, true, result );
+            else if (parameters.Channel == "+12V")
+                this.tps.SetTestTableCellValue(10, 5, true, result );
+            else if (parameters.Channel == "+15V2")
+                this.tps.SetTestTableCellValue(10, 6, true, result );
+            else if (parameters.Channel == "-15V2")
+                this.tps.SetTestTableCellValue(10, 7, true, result );
+            else if (parameters.Channel == "+5V2")
+                this.tps.SetTestTableCellValue(10, 8, true, result );
+            else if (parameters.Channel == "+50V")
+                this.tps.SetTestTableCellValue(10, 9, true, result );
+            else if (parameters.Channel == "+25V")
+                this.tps.SetTestTableCellValue(10, 10, true, result);
+            else if (parameters.Channel == "+28V")
+                this.tps.SetTestTableCellValue(10, 11, true, result);
+
+            //当测试过程比较久时,要走合适的地方检测IsRuning
+            if (IsRuning == false)
+            {
+                //过程中如果IsRunning为false,表示按了停止测试按钮,要退出程序运行
+                return false;
+            }
+
+            return true;
+        }
+
+    }
+}

+ 20 - 17
tps/TpsAppDemo/models/InputCurrent.cs

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
 using System.Windows.Forms;
 using PowerTestDemo.com;
 using AppLibs.Devices;
+using System.Threading;
 
 namespace PowerTestDemo.models
 {
@@ -30,31 +31,33 @@ namespace PowerTestDemo.models
         /// <returns></returns>
         public override bool Run(TestNode parameters)
         {
-            //检查当前指标需要的仪器是否OK,
-            var sig = this.tps.GetDevice("信号源1");
-            var spe = this.tps.GetDevice("频谱仪");
-            if(sig == null || spe == null)
-            {
-                ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行",parameters.Channel,parameters.Name));
-                return false;
-            }
+            ////检查当前指标需要的仪器是否OK,
+            //var sig = this.tps.GetDevice("信号源1");
+            //var spe = this.tps.GetDevice("频谱仪");
+            //if(sig == null || spe == null)
+            //{
+            //    ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行",parameters.Channel,parameters.Name));
+            //    return false;
+            //}
 
-            int[] values = parameters.Parameters.GetParameterToArray<int>("频率");
-            int delay  = parameters.Parameters.GetParameter<int>("通道延迟");
+            int ch = parameters.Parameters.GetParameter<int>("板卡通道");
+            double[] ratedThreshold = parameters.Parameters.GetParameterToArray<double>("额定阈值");
+            double[] downThreshold = parameters.Parameters.GetParameterToArray<double>("下拉偏阈值");
+            double[] upThreshold = parameters.Parameters.GetParameterToArray<double>("上拉偏阈值");
 
-            if (values == null)
+            if (ratedThreshold == null)
             {
                 ShowMessage(MsgType.Error, string.Format("配置文件中频率参数为空,{0}/{1}无法运行",parameters.Channel,parameters.Name));
                 return false;
             }
 
-            sig.Write("设置频率", "2000");
-            
             //开始测试
-            this.tps.SetTestTableCellValue(1, 4, values[0]);
-            this.tps.SetTestTableCellValue(1, 5, values[1]);
-            this.tps.SetTestTableCellValue(1, 6, values[2]);
-            tps.SetManualTableCellValue(1, 2, 111);
+            Thread.Sleep(1000);
+            Random rd = new Random();
+            double result = 0;
+            result = 4.5 + rd.NextDouble();
+            result = double.Parse(String.Format("{0:F1}", result));
+            this.tps.SetTestTableCellValue(3, 3, false,result);
 
             //当测试过程比较久时,要走合适的地方检测IsRuning
             if (IsRuning == false)

+ 17 - 13
tps/TpsAppDemo/models/InputRipple.cs

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
 using System.Windows.Forms;
 using PowerTestDemo.com;
 using AppLibs.Devices;
+using System.Threading;
 
 namespace PowerTestDemo.models
 {
@@ -31,28 +32,31 @@ namespace PowerTestDemo.models
         public override bool Run(TestNode parameters)
         {
             //检查当前指标需要的仪器是否OK,
-            var sig = this.tps.GetDevice("信号源1");
-            var spe = this.tps.GetDevice("频谱仪");
-            if(sig == null || spe == null)
-            {
-                ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行",parameters.Channel,parameters.Name));
-                return false;
-            }
+            //var sig = this.tps.GetDevice("信号源1");
+            //var spe = this.tps.GetDevice("频谱仪");
+            //if(sig == null || spe == null)
+            //{
+            //    ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行",parameters.Channel,parameters.Name));
+            //    return false;
+            //}
 
-            int[] values = parameters.Parameters.GetParameterToArray<int>("频率");
+            double[] threshold = parameters.Parameters.GetParameterToArray<double>("阈值");
             int delay  = parameters.Parameters.GetParameter<int>("通道延迟");
 
-            if (values == null)
+            if (threshold == null)
             {
                 ShowMessage(MsgType.Error, string.Format("配置文件中频率参数为空,{0}/{1}无法运行",parameters.Channel,parameters.Name));
                 return false;
             }
 
             //开始测试
-            this.tps.SetTestTableCellValue(0, 4, values[0]);
-            this.tps.SetTestTableCellValue(0, 5, values[1]);
-            this.tps.SetTestTableCellValue(0, 6, values[2]);
-            tps.SetManualTableCellValue(0, 2, delay);
+            Thread.Sleep(1000);
+            Random rd = new Random();
+            double result = 0;
+            result = 45 + rd.NextDouble()*5;
+            result = double.Parse(String.Format("{0:F1}", result));
+            this.tps.SetTestTableCellValue(3, 7, true, result);
+
 
             //当测试过程比较久时,要走合适的地方检测IsRuning
             if (IsRuning == false)

+ 19 - 15
tps/TpsAppDemo/models/InputSurge.cs

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
 using System.Windows.Forms;
 using PowerTestDemo.com;
 using AppLibs.Devices;
+using System.Threading;
 
 namespace PowerTestDemo.models
 {
@@ -31,28 +32,31 @@ namespace PowerTestDemo.models
         public override bool Run(TestNode parameters)
         {
             //检查当前指标需要的仪器是否OK,
-            var sig = this.tps.GetDevice("信号源1");
-            var spe = this.tps.GetDevice("频谱仪");
-            if(sig == null || spe == null)
-            {
-                ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行",parameters.Channel,parameters.Name));
-                return false;
-            }
+            //var sig = this.tps.GetDevice("信号源1");
+            //var spe = this.tps.GetDevice("频谱仪");
+            //if(sig == null || spe == null)
+            //{
+            //    ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行",parameters.Channel,parameters.Name));
+            //    return false;
+            //}
 
-            int[] values = parameters.Parameters.GetParameterToArray<int>("频率");
-            int delay  = parameters.Parameters.GetParameter<int>("通道延迟");
+            double[] threshold = parameters.Parameters.GetParameterToArray<double>("阈值");
+            int delay = parameters.Parameters.GetParameter<int>("通道延迟");
 
-            if (values == null)
+            if (threshold == null)
             {
-                ShowMessage(MsgType.Error, string.Format("配置文件中频率参数为空,{0}/{1}无法运行",parameters.Channel,parameters.Name));
+                ShowMessage(MsgType.Error, string.Format("配置文件中频率参数为空,{0}/{1}无法运行", parameters.Channel, parameters.Name));
                 return false;
             }
 
             //开始测试
-            this.tps.SetTestTableCellValue(0, 4, values[0]);
-            this.tps.SetTestTableCellValue(0, 5, values[1]);
-            this.tps.SetTestTableCellValue(0, 6, values[2]);
-            tps.SetManualTableCellValue(0, 2, delay);
+            Thread.Sleep(1000);
+            Random rd = new Random();
+            double result = 0;
+            result = 10 + rd.NextDouble() * 5;
+            result = double.Parse(String.Format("{0:F2}", result));
+            this.tps.SetTestTableCellValue(3, 5, true, result);
+
 
             //当测试过程比较久时,要走合适的地方检测IsRuning
             if (IsRuning == false)

+ 7 - 4
tps/TpsAppDemo/models/InputVoltage.cs

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
 using System.Windows.Forms;
 using PowerTestDemo.com;
 using AppLibs.Devices;
+using System.Threading;
 
 namespace PowerTestDemo.models
 {
@@ -51,10 +52,12 @@ namespace PowerTestDemo.models
             }
 
             //开始测试
-            this.tps.SetTestTableCellValue(0, 4, ratedThreshold[0]);
-            this.tps.SetTestTableCellValue(0, 5, downThreshold[1]);
-            this.tps.SetTestTableCellValue(0, 6, upThreshold[0]);
-            tps.SetManualTableCellValue(0, 2, 1);
+            Thread.Sleep(1000);
+            Random rd = new Random();
+            double result = 0;
+            result = 27.5 + rd.NextDouble();
+            result = double.Parse(String.Format("{0:F1}", result));
+            this.tps.SetTestTableCellValue(3, 1,true, result);
 
             //当测试过程比较久时,要走合适的地方检测IsRuning
             if (IsRuning == false)

+ 94 - 0
tps/TpsAppDemo/models/OutputCurrent.cs

@@ -0,0 +1,94 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using PowerTestDemo.com;
+using AppLibs.Devices;
+using System.Threading;
+
+namespace PowerTestDemo.models
+{
+    /// <summary>
+    /// 增益测试测试模板,继承自指标测试模板基类
+    /// </summary>
+    public class OutputCurrent : BaseModel
+    {
+        /// <summary>
+        /// 测试模板名称,测试指标配置表中的模板名称源自这个参数
+        /// </summary>
+        public OutputCurrent()
+        {
+            //首先要定义模板名称,excel 自动测试项总表中的指标测试模板的名称要和这个名称一致
+            TemplateName = "输出电流模板"; 
+        }
+
+        /// <summary>
+        /// 重写的Run方法,当执行到这个测试指标项时,Run会被调用
+        /// </summary>
+        /// <param name="parameters"></param>
+        /// <returns></returns>
+        public override bool Run(TestNode parameters)
+        {
+            ////检查当前指标需要的仪器是否OK,
+            //var sig = this.tps.GetDevice("信号源1");
+            //var spe = this.tps.GetDevice("频谱仪");
+            //if(sig == null || spe == null)
+            //{
+            //    ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行",parameters.Channel,parameters.Name));
+            //    return false;
+            //}
+
+            int ch = parameters.Parameters.GetParameter<int>("板卡通道");
+            double[] ratedThreshold = parameters.Parameters.GetParameterToArray<double>("+15V1空载阈值");
+            double[] downThreshold = parameters.Parameters.GetParameterToArray<double>("下拉偏阈值");
+            double[] upThreshold = parameters.Parameters.GetParameterToArray<double>("上拉偏阈值");
+
+            if (ratedThreshold == null)
+            {
+                ShowMessage(MsgType.Error, string.Format("配置文件中频率参数为空,{0}/{1}无法运行",parameters.Channel,parameters.Name));
+                return false;
+            }
+
+            //开始测试
+            Thread.Sleep(50);
+            Random rd = new Random();
+            double result = 0;
+            result =rd.NextDouble();
+            result = double.Parse(String.Format("{0:F1}", result));
+            if (parameters.Channel == "+15V1")
+                this.tps.SetTestTableCellValue(7, 1, true, result + 2.2);
+            else if (parameters.Channel == "-15V1")
+                this.tps.SetTestTableCellValue(7, 2, true, result + 0.6);
+            else if (parameters.Channel == "+5V1")
+                this.tps.SetTestTableCellValue(7, 3, true, result + 6.5);
+            else if (parameters.Channel == "-5V")
+                this.tps.SetTestTableCellValue(7, 4, false, result + 0.8);
+            else if (parameters.Channel == "+12V")
+                this.tps.SetTestTableCellValue(7, 5, true, result + 1.4);
+            else if (parameters.Channel == "+15V2")
+                this.tps.SetTestTableCellValue(7, 6, false, result + 0.7);
+            else if (parameters.Channel == "-15V2")
+                this.tps.SetTestTableCellValue(7, 7, false, result + 0.8);
+            else if (parameters.Channel == "+5V2")
+                this.tps.SetTestTableCellValue(7, 8, true, result + 6.5);
+            else if (parameters.Channel == "+50V")
+                this.tps.SetTestTableCellValue(7, 9, false, (result/10) + 0.1);
+            else if (parameters.Channel == "+25V")
+                this.tps.SetTestTableCellValue(7, 10, true, result + 1.0);
+            else if (parameters.Channel == "+28V")
+                this.tps.SetTestTableCellValue(7, 11, true,0.01);
+
+            //当测试过程比较久时,要走合适的地方检测IsRuning
+            if (IsRuning == false)
+            {
+                //过程中如果IsRunning为false,表示按了停止测试按钮,要退出程序运行
+                return false;
+            }
+
+            return true;
+        }
+
+    }
+}

+ 92 - 0
tps/TpsAppDemo/models/OutputOvershoot.cs

@@ -0,0 +1,92 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using PowerTestDemo.com;
+using AppLibs.Devices;
+using System.Threading;
+
+namespace PowerTestDemo.models
+{
+    /// <summary>
+    /// 增益测试测试模板,继承自指标测试模板基类
+    /// </summary>
+    public class OutputOvershoot : BaseModel
+    {
+        /// <summary>
+        /// 测试模板名称,测试指标配置表中的模板名称源自这个参数
+        /// </summary>
+        public OutputOvershoot()
+        {
+            //首先要定义模板名称,excel 自动测试项总表中的指标测试模板的名称要和这个名称一致
+            TemplateName = "输出过冲模板"; 
+        }
+
+        /// <summary>
+        /// 重写的Run方法,当执行到这个测试指标项时,Run会被调用
+        /// </summary>
+        /// <param name="parameters"></param>
+        /// <returns></returns>
+        public override bool Run(TestNode parameters)
+        {
+            //检查当前指标需要的仪器是否OK,
+            //var sig = this.tps.GetDevice("信号源1");
+            //var spe = this.tps.GetDevice("频谱仪");
+            //if(sig == null || spe == null)
+            //{
+            //    ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行",parameters.Channel,parameters.Name));
+            //    return false;
+            //}
+
+            double[] threshold = parameters.Parameters.GetParameterToArray<double>("阈值");
+            int delay = parameters.Parameters.GetParameter<int>("通道延迟");
+
+            if (threshold == null)
+            {
+                ShowMessage(MsgType.Error, string.Format("配置文件中频率参数为空,{0}/{1}无法运行", parameters.Channel, parameters.Name));
+                return false;
+            }
+
+            //开始测试
+            Thread.Sleep(50);
+            Random rd = new Random();
+            double result = 0;
+            result = 3 + rd.NextDouble() * 5;
+            result = double.Parse(String.Format("{0:F2}", result));      
+            if (parameters.Channel == "+15V1")
+                this.tps.SetTestTableCellValue(8, 1, true, result );
+            else if (parameters.Channel == "-15V1")
+                this.tps.SetTestTableCellValue(8, 2, true, result );
+            else if (parameters.Channel == "+5V1")
+                this.tps.SetTestTableCellValue(8, 3, true, result );
+            else if (parameters.Channel == "-5V")
+                this.tps.SetTestTableCellValue(8, 4, true, result );
+            else if (parameters.Channel == "+12V")
+                this.tps.SetTestTableCellValue(8, 5, true, result );
+            else if (parameters.Channel == "+15V2")
+                this.tps.SetTestTableCellValue(8, 6, true, result );
+            else if (parameters.Channel == "-15V2")
+                this.tps.SetTestTableCellValue(8, 7, true, result );
+            else if (parameters.Channel == "+5V2")
+                this.tps.SetTestTableCellValue(8, 8, true, result );
+            else if (parameters.Channel == "+50V")
+                this.tps.SetTestTableCellValue(8, 9, true, result );
+            else if (parameters.Channel == "+25V")
+                this.tps.SetTestTableCellValue(8, 10, true, result);
+            else if (parameters.Channel == "+28V")
+                this.tps.SetTestTableCellValue(8, 11, true, result);
+
+            //当测试过程比较久时,要走合适的地方检测IsRuning
+            if (IsRuning == false)
+            {
+                //过程中如果IsRunning为false,表示按了停止测试按钮,要退出程序运行
+                return false;
+            }
+
+            return true;
+        }
+
+    }
+}

+ 93 - 0
tps/TpsAppDemo/models/OutputRipple.cs

@@ -0,0 +1,93 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using PowerTestDemo.com;
+using AppLibs.Devices;
+using System.Threading;
+
+namespace PowerTestDemo.models
+{
+    /// <summary>
+    /// 增益测试测试模板,继承自指标测试模板基类
+    /// </summary>
+    public class OutputRipple : BaseModel
+    {
+        /// <summary>
+        /// 测试模板名称,测试指标配置表中的模板名称源自这个参数
+        /// </summary>
+        public OutputRipple()
+        {
+            //首先要定义模板名称,excel 自动测试项总表中的指标测试模板的名称要和这个名称一致
+            TemplateName = "输出纹波模板"; 
+        }
+
+        /// <summary>
+        /// 重写的Run方法,当执行到这个测试指标项时,Run会被调用
+        /// </summary>
+        /// <param name="parameters"></param>
+        /// <returns></returns>
+        public override bool Run(TestNode parameters)
+        {
+            //检查当前指标需要的仪器是否OK,
+            //var sig = this.tps.GetDevice("信号源1");
+            //var spe = this.tps.GetDevice("频谱仪");
+            //if(sig == null || spe == null)
+            //{
+            //    ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行",parameters.Channel,parameters.Name));
+            //    return false;
+            //}
+
+            double[] threshold = parameters.Parameters.GetParameterToArray<double>("阈值");
+            int delay  = parameters.Parameters.GetParameter<int>("通道延迟");
+
+            if (threshold == null)
+            {
+                ShowMessage(MsgType.Error, string.Format("配置文件中频率参数为空,{0}/{1}无法运行",parameters.Channel,parameters.Name));
+                return false;
+            }
+
+            //开始测试
+            Thread.Sleep(100);
+            Random rd = new Random();
+            double result = 0;
+            result = 45 + rd.NextDouble()*5;
+            result = double.Parse(String.Format("{0:F1}", result));
+            if (parameters.Channel == "+15V1")
+                this.tps.SetTestTableCellValue(9, 1, true, result + 2.2);
+            else if (parameters.Channel == "-15V1")
+                this.tps.SetTestTableCellValue(9, 2, true, result + 0.6);
+            else if (parameters.Channel == "+5V1")
+                this.tps.SetTestTableCellValue(9, 3, true, result + 6.5);
+            else if (parameters.Channel == "-5V")
+                this.tps.SetTestTableCellValue(9, 4, false, result + 0.8);
+            else if (parameters.Channel == "+12V")
+                this.tps.SetTestTableCellValue(9, 5, true, result + 1.4);
+            else if (parameters.Channel == "+15V2")
+                this.tps.SetTestTableCellValue(9, 6, false, result + 0.7);
+            else if (parameters.Channel == "-15V2")
+                this.tps.SetTestTableCellValue(9, 7, false, result + 0.8);
+            else if (parameters.Channel == "+5V2")
+                this.tps.SetTestTableCellValue(9, 8, true, result + 6.5);
+            else if (parameters.Channel == "+50V")
+                this.tps.SetTestTableCellValue(9, 9, false, (result / 10) + 0.1);
+            else if (parameters.Channel == "+25V")
+                this.tps.SetTestTableCellValue(9, 10, true, result + 1.0);
+            else if (parameters.Channel == "+28V")
+                this.tps.SetTestTableCellValue(9, 11, true, 0.01);
+
+
+            //当测试过程比较久时,要走合适的地方检测IsRuning
+            if (IsRuning == false)
+            {
+                //过程中如果IsRunning为false,表示按了停止测试按钮,要退出程序运行
+                return false;
+            }
+
+            return true;
+        }
+
+    }
+}

+ 94 - 0
tps/TpsAppDemo/models/OutputVoltage.cs

@@ -0,0 +1,94 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using PowerTestDemo.com;
+using AppLibs.Devices;
+using System.Threading;
+
+namespace PowerTestDemo.models
+{
+    /// <summary>
+    /// 增益测试测试模板,继承自指标测试模板基类
+    /// </summary>
+    public class OutputVoltage : BaseModel
+    {
+        /// <summary>
+        /// 测试模板名称,测试指标配置表中的模板名称源自这个参数
+        /// </summary>
+        public OutputVoltage()
+        {
+            //首先要定义模板名称,excel 自动测试项总表中的指标测试模板的名称要和这个名称一致
+            TemplateName = "输出电压模板"; 
+        }
+
+        /// <summary>
+        /// 重写的Run方法,当执行到这个测试指标项时,Run会被调用
+        /// </summary>
+        /// <param name="parameters"></param>
+        /// <returns></returns>
+        public override bool Run(TestNode parameters)
+        {
+            //检查当前指标需要的仪器是否OK,
+            //var sig = this.tps.GetDevice("信号源1");
+            //var spe = this.tps.GetDevice("频谱仪");
+            //if(sig == null || spe == null)
+            //{
+            //    ShowMessage(MsgType.Error, string.Format("仪器不齐全,{0}/{1}无法运行",parameters.Channel,parameters.Name));
+            //    return false;
+            //}
+
+            int ch = parameters.Parameters.GetParameter<int>("板卡通道");
+            double[] ratedThreshold= parameters.Parameters.GetParameterToArray<double>("+15V1空载阈值");
+            double[] downThreshold = parameters.Parameters.GetParameterToArray<double>("下拉偏阈值");
+            double[] upThreshold = parameters.Parameters.GetParameterToArray<double>("上拉偏阈值");
+
+            if (ratedThreshold == null)
+            {
+                ShowMessage(MsgType.Error, string.Format("配置文件中频率参数为空,{0}/{1}无法运行",parameters.Channel,parameters.Name));
+                return false;
+            }
+
+            //开始测试
+            Thread.Sleep(50);
+            Random rd = new Random();
+            double result = 0;
+            result = rd.NextDouble();
+            result = double.Parse(String.Format("{0:F2}", result));
+            if (parameters.Channel == "+15V1")
+                this.tps.SetTestTableCellValue(6, 1, true, result + 14.5);
+            else if (parameters.Channel == "-15V1")
+                this.tps.SetTestTableCellValue(6, 2, true, result - 15.5);
+            else if (parameters.Channel == "+5V1")
+                this.tps.SetTestTableCellValue(6, 3, true, result + 4.5);
+            else if (parameters.Channel == "-5V")
+                this.tps.SetTestTableCellValue(6, 4, true, result - 5.5);
+            else if (parameters.Channel == "+12V")
+                this.tps.SetTestTableCellValue(6, 5, true, result + 11.5);
+            else if (parameters.Channel == "+15V2")
+                this.tps.SetTestTableCellValue(6, 6, true, result + 14.5);
+            else if (parameters.Channel == "-15V2")
+                this.tps.SetTestTableCellValue(6, 7, true, result - 15.5);
+            else if (parameters.Channel == "+5V2")
+                this.tps.SetTestTableCellValue(6, 8, true, result + 4.5);
+            else if (parameters.Channel == "+50V")
+                this.tps.SetTestTableCellValue(6, 9, true, result + 49.5);
+            else if (parameters.Channel == "+25V")
+                this.tps.SetTestTableCellValue(6, 10, true, result + 24.5);
+            else if (parameters.Channel == "+28V")
+                this.tps.SetTestTableCellValue(6, 11, true, result + 27.5);
+
+            //当测试过程比较久时,要走合适的地方检测IsRuning
+            if (IsRuning == false)
+            {
+                //过程中如果IsRunning为false,表示按了停止测试按钮,要退出程序运行
+                return false;
+            }
+
+            return true;
+        }
+
+    }
+}

+ 1 - 1
tps/TpsAppDemo/obj/Debug/PowerTestDemo.csproj.CoreCompileInputs.cache

@@ -1 +1 @@
-07a568a9e76648861aba87fb0807aa9b2863f23b
+b6980d62716f9ff510a475e9830f216ebe3c159e

+ 0 - 1
tps/TpsAppDemo/obj/Debug/PowerTestDemo.csproj.FileListAbsolute.txt

@@ -18,4 +18,3 @@ E:\PowerTestStudio\exe\apps\PowerTestDemo\PowerTestDemo.dll
 E:\PowerTestStudio\exe\apps\PowerTestDemo\PowerTestDemo.pdb
 E:\PowerTestStudio\exe\apps\PowerTestDemo\config\测试#常温测试#DC16MK.xlsx
 E:\PowerTestStudio\exe\apps\PowerTestDemo\config\测试#常温测试#035变频模块.xlsx
-E:\PowerTestStudio\tps\TpsAppDemo\obj\Debug\PowerTestDemo.csproj.AssemblyReference.cache

BIN
tps/TpsAppDemo/obj/Debug/PowerTestDemo.csproj.GenerateResource.cache


BIN
tps/TpsAppDemo/obj/Debug/PowerTestDemo.dll


BIN
tps/TpsAppDemo/obj/Debug/PowerTestDemo.pdb