diff --git a/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
new file mode 100644
index 0000000..beefbcc
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
@@ -0,0 +1,106 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto
+{
+ class SensitivityContentParam
+ {
+ //当前测量模式0,频率;1周期
+ private string checkModel;
+ //当前频率
+ private string freq;
+
+ //当前周期
+ private string period;
+
+ //当前灵敏度
+ private string ampl;
+
+ //当前检测值频率
+ private string reFreq;
+
+ //当前检测值周期
+ private string rePeriod;
+
+ public string Freq
+ {
+ get
+ {
+ return freq;
+ }
+
+ set
+ {
+ freq = value;
+ }
+ }
+
+ public string Period
+ {
+ get
+ {
+ return period;
+ }
+
+ set
+ {
+ period = value;
+ }
+ }
+
+ public string Ampl
+ {
+ get
+ {
+ return ampl;
+ }
+
+ set
+ {
+ ampl = value;
+ }
+ }
+
+ public string ReFreq
+ {
+ get
+ {
+ return reFreq;
+ }
+
+ set
+ {
+ reFreq = value;
+ }
+ }
+
+ public string RePeriod
+ {
+ get
+ {
+ return rePeriod;
+ }
+
+ set
+ {
+ rePeriod = value;
+ }
+ }
+
+ public string CheckModel
+ {
+ get
+ {
+ return checkModel;
+ }
+
+ set
+ {
+ checkModel = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
new file mode 100644
index 0000000..beefbcc
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
@@ -0,0 +1,106 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto
+{
+ class SensitivityContentParam
+ {
+ //当前测量模式0,频率;1周期
+ private string checkModel;
+ //当前频率
+ private string freq;
+
+ //当前周期
+ private string period;
+
+ //当前灵敏度
+ private string ampl;
+
+ //当前检测值频率
+ private string reFreq;
+
+ //当前检测值周期
+ private string rePeriod;
+
+ public string Freq
+ {
+ get
+ {
+ return freq;
+ }
+
+ set
+ {
+ freq = value;
+ }
+ }
+
+ public string Period
+ {
+ get
+ {
+ return period;
+ }
+
+ set
+ {
+ period = value;
+ }
+ }
+
+ public string Ampl
+ {
+ get
+ {
+ return ampl;
+ }
+
+ set
+ {
+ ampl = value;
+ }
+ }
+
+ public string ReFreq
+ {
+ get
+ {
+ return reFreq;
+ }
+
+ set
+ {
+ reFreq = value;
+ }
+ }
+
+ public string RePeriod
+ {
+ get
+ {
+ return rePeriod;
+ }
+
+ set
+ {
+ rePeriod = value;
+ }
+ }
+
+ public string CheckModel
+ {
+ get
+ {
+ return checkModel;
+ }
+
+ set
+ {
+ checkModel = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
index 6ffc6c4..1e88523 100644
--- a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
@@ -1,4 +1,6 @@
-using System;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,9 +9,7 @@
{
interface CounterCheckService
{
- bool passTest(int testValue);
-
- void beginTest();
+
}
}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
new file mode 100644
index 0000000..beefbcc
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
@@ -0,0 +1,106 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto
+{
+ class SensitivityContentParam
+ {
+ //当前测量模式0,频率;1周期
+ private string checkModel;
+ //当前频率
+ private string freq;
+
+ //当前周期
+ private string period;
+
+ //当前灵敏度
+ private string ampl;
+
+ //当前检测值频率
+ private string reFreq;
+
+ //当前检测值周期
+ private string rePeriod;
+
+ public string Freq
+ {
+ get
+ {
+ return freq;
+ }
+
+ set
+ {
+ freq = value;
+ }
+ }
+
+ public string Period
+ {
+ get
+ {
+ return period;
+ }
+
+ set
+ {
+ period = value;
+ }
+ }
+
+ public string Ampl
+ {
+ get
+ {
+ return ampl;
+ }
+
+ set
+ {
+ ampl = value;
+ }
+ }
+
+ public string ReFreq
+ {
+ get
+ {
+ return reFreq;
+ }
+
+ set
+ {
+ reFreq = value;
+ }
+ }
+
+ public string RePeriod
+ {
+ get
+ {
+ return rePeriod;
+ }
+
+ set
+ {
+ rePeriod = value;
+ }
+ }
+
+ public string CheckModel
+ {
+ get
+ {
+ return checkModel;
+ }
+
+ set
+ {
+ checkModel = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
index 6ffc6c4..1e88523 100644
--- a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
@@ -1,4 +1,6 @@
-using System;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,9 +9,7 @@
{
interface CounterCheckService
{
- bool passTest(int testValue);
-
- void beginTest();
+
}
}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
new file mode 100644
index 0000000..4c3f336
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service
+{
+ interface GPIBService
+ {
+ #region GPIB
+ ///
+ /// 获取GPIB设备
+ ///
+ ///
+ string[] getId();
+
+ int open(string id);
+
+ int close();
+
+ int write(string content);
+
+ string read();
+ #endregion
+
+ #region LAN
+ int openLAN(string ip);
+
+ #endregion
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
new file mode 100644
index 0000000..beefbcc
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
@@ -0,0 +1,106 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto
+{
+ class SensitivityContentParam
+ {
+ //当前测量模式0,频率;1周期
+ private string checkModel;
+ //当前频率
+ private string freq;
+
+ //当前周期
+ private string period;
+
+ //当前灵敏度
+ private string ampl;
+
+ //当前检测值频率
+ private string reFreq;
+
+ //当前检测值周期
+ private string rePeriod;
+
+ public string Freq
+ {
+ get
+ {
+ return freq;
+ }
+
+ set
+ {
+ freq = value;
+ }
+ }
+
+ public string Period
+ {
+ get
+ {
+ return period;
+ }
+
+ set
+ {
+ period = value;
+ }
+ }
+
+ public string Ampl
+ {
+ get
+ {
+ return ampl;
+ }
+
+ set
+ {
+ ampl = value;
+ }
+ }
+
+ public string ReFreq
+ {
+ get
+ {
+ return reFreq;
+ }
+
+ set
+ {
+ reFreq = value;
+ }
+ }
+
+ public string RePeriod
+ {
+ get
+ {
+ return rePeriod;
+ }
+
+ set
+ {
+ rePeriod = value;
+ }
+ }
+
+ public string CheckModel
+ {
+ get
+ {
+ return checkModel;
+ }
+
+ set
+ {
+ checkModel = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
index 6ffc6c4..1e88523 100644
--- a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
@@ -1,4 +1,6 @@
-using System;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,9 +9,7 @@
{
interface CounterCheckService
{
- bool passTest(int testValue);
-
- void beginTest();
+
}
}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
new file mode 100644
index 0000000..4c3f336
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service
+{
+ interface GPIBService
+ {
+ #region GPIB
+ ///
+ /// 获取GPIB设备
+ ///
+ ///
+ string[] getId();
+
+ int open(string id);
+
+ int close();
+
+ int write(string content);
+
+ string read();
+ #endregion
+
+ #region LAN
+ int openLAN(string ip);
+
+ #endregion
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
index 6c2a26e..32a0977 100644
--- a/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
@@ -1,42 +1,13 @@
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service;
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl;
-
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl
{
class CounterCheckServiceImpl:CounterCheckService
{
- CounterCheckParam counterCheckParam = null;
-
- public CounterCheckServiceImpl()
- {
- CounterCheckParamService counterCheckParamService = new CounterCheckParamServiceImpl();
- counterCheckParam = counterCheckParamService.getCounterCheckParams();
- }
- public bool passTest(int testValue)
- {
-
-
- return true;
- }
-
- public void beginTest()
- {
- //切换检测模式
-
- //启动output(一次)OUTPUT 0\OUTPUT 1
-
- //设置周期/频率、电压GPIB
-
- //主动读取检测数据LAN
-
- //检测数据是否在容差范围内
-
- //返回满足容差的数据
-
- }
}
diff --git a/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
new file mode 100644
index 0000000..beefbcc
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
@@ -0,0 +1,106 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto
+{
+ class SensitivityContentParam
+ {
+ //当前测量模式0,频率;1周期
+ private string checkModel;
+ //当前频率
+ private string freq;
+
+ //当前周期
+ private string period;
+
+ //当前灵敏度
+ private string ampl;
+
+ //当前检测值频率
+ private string reFreq;
+
+ //当前检测值周期
+ private string rePeriod;
+
+ public string Freq
+ {
+ get
+ {
+ return freq;
+ }
+
+ set
+ {
+ freq = value;
+ }
+ }
+
+ public string Period
+ {
+ get
+ {
+ return period;
+ }
+
+ set
+ {
+ period = value;
+ }
+ }
+
+ public string Ampl
+ {
+ get
+ {
+ return ampl;
+ }
+
+ set
+ {
+ ampl = value;
+ }
+ }
+
+ public string ReFreq
+ {
+ get
+ {
+ return reFreq;
+ }
+
+ set
+ {
+ reFreq = value;
+ }
+ }
+
+ public string RePeriod
+ {
+ get
+ {
+ return rePeriod;
+ }
+
+ set
+ {
+ rePeriod = value;
+ }
+ }
+
+ public string CheckModel
+ {
+ get
+ {
+ return checkModel;
+ }
+
+ set
+ {
+ checkModel = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
index 6ffc6c4..1e88523 100644
--- a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
@@ -1,4 +1,6 @@
-using System;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,9 +9,7 @@
{
interface CounterCheckService
{
- bool passTest(int testValue);
-
- void beginTest();
+
}
}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
new file mode 100644
index 0000000..4c3f336
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service
+{
+ interface GPIBService
+ {
+ #region GPIB
+ ///
+ /// 获取GPIB设备
+ ///
+ ///
+ string[] getId();
+
+ int open(string id);
+
+ int close();
+
+ int write(string content);
+
+ string read();
+ #endregion
+
+ #region LAN
+ int openLAN(string ip);
+
+ #endregion
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
index 6c2a26e..32a0977 100644
--- a/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
@@ -1,42 +1,13 @@
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service;
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl;
-
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl
{
class CounterCheckServiceImpl:CounterCheckService
{
- CounterCheckParam counterCheckParam = null;
-
- public CounterCheckServiceImpl()
- {
- CounterCheckParamService counterCheckParamService = new CounterCheckParamServiceImpl();
- counterCheckParam = counterCheckParamService.getCounterCheckParams();
- }
- public bool passTest(int testValue)
- {
-
-
- return true;
- }
-
- public void beginTest()
- {
- //切换检测模式
-
- //启动output(一次)OUTPUT 0\OUTPUT 1
-
- //设置周期/频率、电压GPIB
-
- //主动读取检测数据LAN
-
- //检测数据是否在容差范围内
-
- //返回满足容差的数据
-
- }
}
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs
new file mode 100644
index 0000000..89df386
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs
@@ -0,0 +1,151 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using Casic.Birmm.RbFreqStandMeasure.VISA.Port;
+using Casic.Birmm.RbFreqStandMeasure.VISA.Ulitity;
+using System;
+using System.Reflection;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl
+{
+ public class GPIBServiceImpl:GPIBService
+ {
+ public string[] getId()
+ {
+ string[] counterId;
+ try
+ {
+ counterId = PortUltility.FindAddresses(PortType.GPIB);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ counterId = null;
+ }
+ return counterId;
+ }
+
+ private PortOperatorBase _portOperatorBase;
+
+ public int open(string id)
+ {
+ int result = -1;
+ if (NewPortInstance("GPIB",id))
+ {
+ try
+ {
+ _portOperatorBase.Open();
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
+ result = -1;
+ }
+ }
+
+ return result;
+ }
+
+ private bool NewPortInstance(string type,string sensitivityId)
+ {
+ bool hasAddress = false;
+ bool hasException = false;
+
+ try
+ {
+ if (type == "GPIB")
+ _portOperatorBase = new GPIBPortOperator(sensitivityId);
+ else if (type == "LAN")
+ _portOperatorBase = new LANPortOperator("TCPIP0::"+ sensitivityId + "::INSTR");
+
+ hasAddress = true;
+ }
+ catch (Exception ex)
+ {
+ hasException = true;
+ }
+
+ if (!hasException) _portOperatorBase.Timeout = 2000;
+ return hasAddress;
+ }
+
+ public int close()
+ {
+ int result = -1;
+ try
+ {
+ _portOperatorBase.Close();
+
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ result = -1;
+ }
+
+ return result;
+ }
+
+ public int write(string content)
+ {
+ int result = -1;
+ try
+ {
+ _portOperatorBase.WriteLine(content);
+
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+
+ result = -1;
+ }
+ return result;
+ }
+
+ public string read()
+ {
+ string content = "";
+ try
+ {
+ content = _portOperatorBase.ReadLine();
+
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ content = "";
+ }
+ return content;
+ }
+
+ public int openLAN(string ip)
+ {
+ int result = -1;
+ if (NewPortInstance("LAN", ip))
+ {
+ try
+ {
+ _portOperatorBase.Open();
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
+ result = -1;
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * GPIB 频率:freq value
+ * 周期:pulse:period value
+ * output 0/1
+ *
+ * TCPIP 频率:MEAS:freq?
+ * 周期:MEAS:period?
+ * */
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
new file mode 100644
index 0000000..beefbcc
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
@@ -0,0 +1,106 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto
+{
+ class SensitivityContentParam
+ {
+ //当前测量模式0,频率;1周期
+ private string checkModel;
+ //当前频率
+ private string freq;
+
+ //当前周期
+ private string period;
+
+ //当前灵敏度
+ private string ampl;
+
+ //当前检测值频率
+ private string reFreq;
+
+ //当前检测值周期
+ private string rePeriod;
+
+ public string Freq
+ {
+ get
+ {
+ return freq;
+ }
+
+ set
+ {
+ freq = value;
+ }
+ }
+
+ public string Period
+ {
+ get
+ {
+ return period;
+ }
+
+ set
+ {
+ period = value;
+ }
+ }
+
+ public string Ampl
+ {
+ get
+ {
+ return ampl;
+ }
+
+ set
+ {
+ ampl = value;
+ }
+ }
+
+ public string ReFreq
+ {
+ get
+ {
+ return reFreq;
+ }
+
+ set
+ {
+ reFreq = value;
+ }
+ }
+
+ public string RePeriod
+ {
+ get
+ {
+ return rePeriod;
+ }
+
+ set
+ {
+ rePeriod = value;
+ }
+ }
+
+ public string CheckModel
+ {
+ get
+ {
+ return checkModel;
+ }
+
+ set
+ {
+ checkModel = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
index 6ffc6c4..1e88523 100644
--- a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
@@ -1,4 +1,6 @@
-using System;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,9 +9,7 @@
{
interface CounterCheckService
{
- bool passTest(int testValue);
-
- void beginTest();
+
}
}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
new file mode 100644
index 0000000..4c3f336
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service
+{
+ interface GPIBService
+ {
+ #region GPIB
+ ///
+ /// 获取GPIB设备
+ ///
+ ///
+ string[] getId();
+
+ int open(string id);
+
+ int close();
+
+ int write(string content);
+
+ string read();
+ #endregion
+
+ #region LAN
+ int openLAN(string ip);
+
+ #endregion
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
index 6c2a26e..32a0977 100644
--- a/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
@@ -1,42 +1,13 @@
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service;
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl;
-
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl
{
class CounterCheckServiceImpl:CounterCheckService
{
- CounterCheckParam counterCheckParam = null;
-
- public CounterCheckServiceImpl()
- {
- CounterCheckParamService counterCheckParamService = new CounterCheckParamServiceImpl();
- counterCheckParam = counterCheckParamService.getCounterCheckParams();
- }
- public bool passTest(int testValue)
- {
-
-
- return true;
- }
-
- public void beginTest()
- {
- //切换检测模式
-
- //启动output(一次)OUTPUT 0\OUTPUT 1
-
- //设置周期/频率、电压GPIB
-
- //主动读取检测数据LAN
-
- //检测数据是否在容差范围内
-
- //返回满足容差的数据
-
- }
}
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs
new file mode 100644
index 0000000..89df386
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs
@@ -0,0 +1,151 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using Casic.Birmm.RbFreqStandMeasure.VISA.Port;
+using Casic.Birmm.RbFreqStandMeasure.VISA.Ulitity;
+using System;
+using System.Reflection;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl
+{
+ public class GPIBServiceImpl:GPIBService
+ {
+ public string[] getId()
+ {
+ string[] counterId;
+ try
+ {
+ counterId = PortUltility.FindAddresses(PortType.GPIB);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ counterId = null;
+ }
+ return counterId;
+ }
+
+ private PortOperatorBase _portOperatorBase;
+
+ public int open(string id)
+ {
+ int result = -1;
+ if (NewPortInstance("GPIB",id))
+ {
+ try
+ {
+ _portOperatorBase.Open();
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
+ result = -1;
+ }
+ }
+
+ return result;
+ }
+
+ private bool NewPortInstance(string type,string sensitivityId)
+ {
+ bool hasAddress = false;
+ bool hasException = false;
+
+ try
+ {
+ if (type == "GPIB")
+ _portOperatorBase = new GPIBPortOperator(sensitivityId);
+ else if (type == "LAN")
+ _portOperatorBase = new LANPortOperator("TCPIP0::"+ sensitivityId + "::INSTR");
+
+ hasAddress = true;
+ }
+ catch (Exception ex)
+ {
+ hasException = true;
+ }
+
+ if (!hasException) _portOperatorBase.Timeout = 2000;
+ return hasAddress;
+ }
+
+ public int close()
+ {
+ int result = -1;
+ try
+ {
+ _portOperatorBase.Close();
+
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ result = -1;
+ }
+
+ return result;
+ }
+
+ public int write(string content)
+ {
+ int result = -1;
+ try
+ {
+ _portOperatorBase.WriteLine(content);
+
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+
+ result = -1;
+ }
+ return result;
+ }
+
+ public string read()
+ {
+ string content = "";
+ try
+ {
+ content = _portOperatorBase.ReadLine();
+
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ content = "";
+ }
+ return content;
+ }
+
+ public int openLAN(string ip)
+ {
+ int result = -1;
+ if (NewPortInstance("LAN", ip))
+ {
+ try
+ {
+ _portOperatorBase.Open();
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
+ result = -1;
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * GPIB 频率:freq value
+ * 周期:pulse:period value
+ * output 0/1
+ *
+ * TCPIP 频率:MEAS:freq?
+ * 周期:MEAS:period?
+ * */
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs
index fe91b8a..bceec15 100644
--- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs
@@ -1,4 +1,6 @@
-using Casic.Birmm.RbFreqStandMeasure.Tools;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
using Casic.Birmm.RbFreqStandMeasure.VISA.Port;
using Casic.Birmm.RbFreqStandMeasure.VISA.Ulitity;
using System;
@@ -11,160 +13,57 @@
{
class SensitivityServiceImpl:SensitivityService
{
- public string[] getSeneitivityId()
+
+ public void beginTest(GPIBService gPIBService,string freq,CounterCheckParam counterCheckParam,
+ out SensitivityContentParam sensitivityContentParam)
{
- string[] counterId;
+ sensitivityContentParam = new SensitivityContentParam();
try
{
- counterId = PortUltility.FindAddresses(PortType.GPIB);
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
- counterId = null;
- }
- return counterId;
- }
+ //启动output(一次)OUTPUT 0\OUTPUT 1
+ gPIBService.write("OUTPUT?");
- private PortOperatorBase _portOperatorBase;
- public int open(string sensitivityId)
- {
- int result = -1;
- if (NewPortInstance(sensitivityId))
- {
- try
+ string outputStatus = gPIBService.read();
+
+ if (outputStatus == "0")
+ gPIBService.write("OUTPUT 1");
+
+ //设置周期/频率、电压GPIB
+ gPIBService.write("FREQ " + freq);
+
+ bool lessTolerance = false;
+ while (!lessTolerance)
{
- _portOperatorBase.Open();
- result = 0;
+
+ //主动读取检测数据LAN
+
+ //检测数据是否在容差范围内
+
+ //返回满足容差的数据
+
+ lessTolerance = true;
}
- catch(Exception ex) {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
- result = -1;
- }
- }
-
- return result;
- }
-
- private bool NewPortInstance(string sensitivityId)
- {
- bool hasAddress = false;
- bool hasException = false;
-
- try
- {
- _portOperatorBase = new GPIBPortOperator(sensitivityId);
- hasAddress = true;
- }
- catch (Exception ex)
- {
- hasException = true;
- }
-
-
- if (!hasException) _portOperatorBase.Timeout = 2000;
- return hasAddress;
- }
-
- public int close()
- {
- int result = -1;
- try
- {
- _portOperatorBase.Close();
-
- result = 0;
+
}
catch(Exception ex)
{
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
- result = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "beginTest:"+ex.Message);
+ sensitivityContentParam = null;
}
-
- return result;
- }
-
- public int write(string content)
- {
- int result = -1;
- try
- {
- _portOperatorBase.WriteLine(content);
-
- result = 0;
- }
- catch(Exception ex)
- {
-
- result = -1;
- }
- return result;
}
- public string read()
- {
- string content = "";
- try
- {
- content=_portOperatorBase.ReadLine();
-
- }
- catch(Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
- content = "";
- }
- return content;
- }
-
-
- public int setParams(string param1, string param2)
- {
- int result = 0;
- try
- {
-
- result = 0;
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "setParams:" + ex.Message);
- result = -1;
- }
- return result;
- }
-
- public int startCheck()
- {
- int result = 0;
- try
- {
-
- result = 0;
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startCheck:" + ex.Message);
- result = -1;
- }
- return result;
- }
-
- public int getCheckData()
- {
- int result = 0;
- try
- {
-
- result = 0;
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCheckData:" + ex.Message);
- result = -1;
- }
- return result;
- }
-
+ /**
+ *
+ * GPIBService gPIBService=new GPIBService();
+ * gPIBService.open();
+ * for(datagridview.row)
+ * {
+ * SensitivityService.beginTest()
+ * }
+ * gPIBService.close();
+ * */
}
}
+
+
+
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
new file mode 100644
index 0000000..beefbcc
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
@@ -0,0 +1,106 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto
+{
+ class SensitivityContentParam
+ {
+ //当前测量模式0,频率;1周期
+ private string checkModel;
+ //当前频率
+ private string freq;
+
+ //当前周期
+ private string period;
+
+ //当前灵敏度
+ private string ampl;
+
+ //当前检测值频率
+ private string reFreq;
+
+ //当前检测值周期
+ private string rePeriod;
+
+ public string Freq
+ {
+ get
+ {
+ return freq;
+ }
+
+ set
+ {
+ freq = value;
+ }
+ }
+
+ public string Period
+ {
+ get
+ {
+ return period;
+ }
+
+ set
+ {
+ period = value;
+ }
+ }
+
+ public string Ampl
+ {
+ get
+ {
+ return ampl;
+ }
+
+ set
+ {
+ ampl = value;
+ }
+ }
+
+ public string ReFreq
+ {
+ get
+ {
+ return reFreq;
+ }
+
+ set
+ {
+ reFreq = value;
+ }
+ }
+
+ public string RePeriod
+ {
+ get
+ {
+ return rePeriod;
+ }
+
+ set
+ {
+ rePeriod = value;
+ }
+ }
+
+ public string CheckModel
+ {
+ get
+ {
+ return checkModel;
+ }
+
+ set
+ {
+ checkModel = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
index 6ffc6c4..1e88523 100644
--- a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
@@ -1,4 +1,6 @@
-using System;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,9 +9,7 @@
{
interface CounterCheckService
{
- bool passTest(int testValue);
-
- void beginTest();
+
}
}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
new file mode 100644
index 0000000..4c3f336
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service
+{
+ interface GPIBService
+ {
+ #region GPIB
+ ///
+ /// 获取GPIB设备
+ ///
+ ///
+ string[] getId();
+
+ int open(string id);
+
+ int close();
+
+ int write(string content);
+
+ string read();
+ #endregion
+
+ #region LAN
+ int openLAN(string ip);
+
+ #endregion
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
index 6c2a26e..32a0977 100644
--- a/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
@@ -1,42 +1,13 @@
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service;
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl;
-
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl
{
class CounterCheckServiceImpl:CounterCheckService
{
- CounterCheckParam counterCheckParam = null;
-
- public CounterCheckServiceImpl()
- {
- CounterCheckParamService counterCheckParamService = new CounterCheckParamServiceImpl();
- counterCheckParam = counterCheckParamService.getCounterCheckParams();
- }
- public bool passTest(int testValue)
- {
-
-
- return true;
- }
-
- public void beginTest()
- {
- //切换检测模式
-
- //启动output(一次)OUTPUT 0\OUTPUT 1
-
- //设置周期/频率、电压GPIB
-
- //主动读取检测数据LAN
-
- //检测数据是否在容差范围内
-
- //返回满足容差的数据
-
- }
}
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs
new file mode 100644
index 0000000..89df386
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs
@@ -0,0 +1,151 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using Casic.Birmm.RbFreqStandMeasure.VISA.Port;
+using Casic.Birmm.RbFreqStandMeasure.VISA.Ulitity;
+using System;
+using System.Reflection;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl
+{
+ public class GPIBServiceImpl:GPIBService
+ {
+ public string[] getId()
+ {
+ string[] counterId;
+ try
+ {
+ counterId = PortUltility.FindAddresses(PortType.GPIB);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ counterId = null;
+ }
+ return counterId;
+ }
+
+ private PortOperatorBase _portOperatorBase;
+
+ public int open(string id)
+ {
+ int result = -1;
+ if (NewPortInstance("GPIB",id))
+ {
+ try
+ {
+ _portOperatorBase.Open();
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
+ result = -1;
+ }
+ }
+
+ return result;
+ }
+
+ private bool NewPortInstance(string type,string sensitivityId)
+ {
+ bool hasAddress = false;
+ bool hasException = false;
+
+ try
+ {
+ if (type == "GPIB")
+ _portOperatorBase = new GPIBPortOperator(sensitivityId);
+ else if (type == "LAN")
+ _portOperatorBase = new LANPortOperator("TCPIP0::"+ sensitivityId + "::INSTR");
+
+ hasAddress = true;
+ }
+ catch (Exception ex)
+ {
+ hasException = true;
+ }
+
+ if (!hasException) _portOperatorBase.Timeout = 2000;
+ return hasAddress;
+ }
+
+ public int close()
+ {
+ int result = -1;
+ try
+ {
+ _portOperatorBase.Close();
+
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ result = -1;
+ }
+
+ return result;
+ }
+
+ public int write(string content)
+ {
+ int result = -1;
+ try
+ {
+ _portOperatorBase.WriteLine(content);
+
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+
+ result = -1;
+ }
+ return result;
+ }
+
+ public string read()
+ {
+ string content = "";
+ try
+ {
+ content = _portOperatorBase.ReadLine();
+
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ content = "";
+ }
+ return content;
+ }
+
+ public int openLAN(string ip)
+ {
+ int result = -1;
+ if (NewPortInstance("LAN", ip))
+ {
+ try
+ {
+ _portOperatorBase.Open();
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
+ result = -1;
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * GPIB 频率:freq value
+ * 周期:pulse:period value
+ * output 0/1
+ *
+ * TCPIP 频率:MEAS:freq?
+ * 周期:MEAS:period?
+ * */
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs
index fe91b8a..bceec15 100644
--- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs
@@ -1,4 +1,6 @@
-using Casic.Birmm.RbFreqStandMeasure.Tools;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
using Casic.Birmm.RbFreqStandMeasure.VISA.Port;
using Casic.Birmm.RbFreqStandMeasure.VISA.Ulitity;
using System;
@@ -11,160 +13,57 @@
{
class SensitivityServiceImpl:SensitivityService
{
- public string[] getSeneitivityId()
+
+ public void beginTest(GPIBService gPIBService,string freq,CounterCheckParam counterCheckParam,
+ out SensitivityContentParam sensitivityContentParam)
{
- string[] counterId;
+ sensitivityContentParam = new SensitivityContentParam();
try
{
- counterId = PortUltility.FindAddresses(PortType.GPIB);
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
- counterId = null;
- }
- return counterId;
- }
+ //启动output(一次)OUTPUT 0\OUTPUT 1
+ gPIBService.write("OUTPUT?");
- private PortOperatorBase _portOperatorBase;
- public int open(string sensitivityId)
- {
- int result = -1;
- if (NewPortInstance(sensitivityId))
- {
- try
+ string outputStatus = gPIBService.read();
+
+ if (outputStatus == "0")
+ gPIBService.write("OUTPUT 1");
+
+ //设置周期/频率、电压GPIB
+ gPIBService.write("FREQ " + freq);
+
+ bool lessTolerance = false;
+ while (!lessTolerance)
{
- _portOperatorBase.Open();
- result = 0;
+
+ //主动读取检测数据LAN
+
+ //检测数据是否在容差范围内
+
+ //返回满足容差的数据
+
+ lessTolerance = true;
}
- catch(Exception ex) {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
- result = -1;
- }
- }
-
- return result;
- }
-
- private bool NewPortInstance(string sensitivityId)
- {
- bool hasAddress = false;
- bool hasException = false;
-
- try
- {
- _portOperatorBase = new GPIBPortOperator(sensitivityId);
- hasAddress = true;
- }
- catch (Exception ex)
- {
- hasException = true;
- }
-
-
- if (!hasException) _portOperatorBase.Timeout = 2000;
- return hasAddress;
- }
-
- public int close()
- {
- int result = -1;
- try
- {
- _portOperatorBase.Close();
-
- result = 0;
+
}
catch(Exception ex)
{
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
- result = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "beginTest:"+ex.Message);
+ sensitivityContentParam = null;
}
-
- return result;
- }
-
- public int write(string content)
- {
- int result = -1;
- try
- {
- _portOperatorBase.WriteLine(content);
-
- result = 0;
- }
- catch(Exception ex)
- {
-
- result = -1;
- }
- return result;
}
- public string read()
- {
- string content = "";
- try
- {
- content=_portOperatorBase.ReadLine();
-
- }
- catch(Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
- content = "";
- }
- return content;
- }
-
-
- public int setParams(string param1, string param2)
- {
- int result = 0;
- try
- {
-
- result = 0;
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "setParams:" + ex.Message);
- result = -1;
- }
- return result;
- }
-
- public int startCheck()
- {
- int result = 0;
- try
- {
-
- result = 0;
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startCheck:" + ex.Message);
- result = -1;
- }
- return result;
- }
-
- public int getCheckData()
- {
- int result = 0;
- try
- {
-
- result = 0;
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCheckData:" + ex.Message);
- result = -1;
- }
- return result;
- }
-
+ /**
+ *
+ * GPIBService gPIBService=new GPIBService();
+ * gPIBService.open();
+ * for(datagridview.row)
+ * {
+ * SensitivityService.beginTest()
+ * }
+ * gPIBService.close();
+ * */
}
}
+
+
+
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/SensitivityService.cs b/RbFreqStandMeasure/R_DevService/Service/SensitivityService.cs
index 4a54979..9eb0d13 100644
--- a/RbFreqStandMeasure/R_DevService/Service/SensitivityService.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/SensitivityService.cs
@@ -1,4 +1,6 @@
-using System;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,41 +9,9 @@
{
interface SensitivityService
{
-
- ///
- /// 获取GPIB设备
- ///
- ///
- string[] getSeneitivityId();
-
- int open(string sensitivityId);
-
- int close();
-
- int write(string content);
-
- string read();
+ //单行检测
+ void beginTest(GPIBService gPIBService,string freq,CounterCheckParam counterCheckParam,
+ out SensitivityContentParam sensitivityContentParam);
-
- ///
- /// GPIB+USB
- ///
- /// 周期或者频率
- /// 电压
- ///
- int setParams(string param1, string param2);
-
- ///
- /// GPIB_USB?要不要?
- ///
- ///
- int startCheck();
-
- ///
- /// GPIB+LAN
- ///
- ///
- int getCheckData();
-
}
}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
new file mode 100644
index 0000000..beefbcc
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
@@ -0,0 +1,106 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto
+{
+ class SensitivityContentParam
+ {
+ //当前测量模式0,频率;1周期
+ private string checkModel;
+ //当前频率
+ private string freq;
+
+ //当前周期
+ private string period;
+
+ //当前灵敏度
+ private string ampl;
+
+ //当前检测值频率
+ private string reFreq;
+
+ //当前检测值周期
+ private string rePeriod;
+
+ public string Freq
+ {
+ get
+ {
+ return freq;
+ }
+
+ set
+ {
+ freq = value;
+ }
+ }
+
+ public string Period
+ {
+ get
+ {
+ return period;
+ }
+
+ set
+ {
+ period = value;
+ }
+ }
+
+ public string Ampl
+ {
+ get
+ {
+ return ampl;
+ }
+
+ set
+ {
+ ampl = value;
+ }
+ }
+
+ public string ReFreq
+ {
+ get
+ {
+ return reFreq;
+ }
+
+ set
+ {
+ reFreq = value;
+ }
+ }
+
+ public string RePeriod
+ {
+ get
+ {
+ return rePeriod;
+ }
+
+ set
+ {
+ rePeriod = value;
+ }
+ }
+
+ public string CheckModel
+ {
+ get
+ {
+ return checkModel;
+ }
+
+ set
+ {
+ checkModel = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
index 6ffc6c4..1e88523 100644
--- a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
@@ -1,4 +1,6 @@
-using System;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,9 +9,7 @@
{
interface CounterCheckService
{
- bool passTest(int testValue);
-
- void beginTest();
+
}
}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
new file mode 100644
index 0000000..4c3f336
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service
+{
+ interface GPIBService
+ {
+ #region GPIB
+ ///
+ /// 获取GPIB设备
+ ///
+ ///
+ string[] getId();
+
+ int open(string id);
+
+ int close();
+
+ int write(string content);
+
+ string read();
+ #endregion
+
+ #region LAN
+ int openLAN(string ip);
+
+ #endregion
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
index 6c2a26e..32a0977 100644
--- a/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
@@ -1,42 +1,13 @@
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service;
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl;
-
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl
{
class CounterCheckServiceImpl:CounterCheckService
{
- CounterCheckParam counterCheckParam = null;
-
- public CounterCheckServiceImpl()
- {
- CounterCheckParamService counterCheckParamService = new CounterCheckParamServiceImpl();
- counterCheckParam = counterCheckParamService.getCounterCheckParams();
- }
- public bool passTest(int testValue)
- {
-
-
- return true;
- }
-
- public void beginTest()
- {
- //切换检测模式
-
- //启动output(一次)OUTPUT 0\OUTPUT 1
-
- //设置周期/频率、电压GPIB
-
- //主动读取检测数据LAN
-
- //检测数据是否在容差范围内
-
- //返回满足容差的数据
-
- }
}
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs
new file mode 100644
index 0000000..89df386
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs
@@ -0,0 +1,151 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using Casic.Birmm.RbFreqStandMeasure.VISA.Port;
+using Casic.Birmm.RbFreqStandMeasure.VISA.Ulitity;
+using System;
+using System.Reflection;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl
+{
+ public class GPIBServiceImpl:GPIBService
+ {
+ public string[] getId()
+ {
+ string[] counterId;
+ try
+ {
+ counterId = PortUltility.FindAddresses(PortType.GPIB);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ counterId = null;
+ }
+ return counterId;
+ }
+
+ private PortOperatorBase _portOperatorBase;
+
+ public int open(string id)
+ {
+ int result = -1;
+ if (NewPortInstance("GPIB",id))
+ {
+ try
+ {
+ _portOperatorBase.Open();
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
+ result = -1;
+ }
+ }
+
+ return result;
+ }
+
+ private bool NewPortInstance(string type,string sensitivityId)
+ {
+ bool hasAddress = false;
+ bool hasException = false;
+
+ try
+ {
+ if (type == "GPIB")
+ _portOperatorBase = new GPIBPortOperator(sensitivityId);
+ else if (type == "LAN")
+ _portOperatorBase = new LANPortOperator("TCPIP0::"+ sensitivityId + "::INSTR");
+
+ hasAddress = true;
+ }
+ catch (Exception ex)
+ {
+ hasException = true;
+ }
+
+ if (!hasException) _portOperatorBase.Timeout = 2000;
+ return hasAddress;
+ }
+
+ public int close()
+ {
+ int result = -1;
+ try
+ {
+ _portOperatorBase.Close();
+
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ result = -1;
+ }
+
+ return result;
+ }
+
+ public int write(string content)
+ {
+ int result = -1;
+ try
+ {
+ _portOperatorBase.WriteLine(content);
+
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+
+ result = -1;
+ }
+ return result;
+ }
+
+ public string read()
+ {
+ string content = "";
+ try
+ {
+ content = _portOperatorBase.ReadLine();
+
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ content = "";
+ }
+ return content;
+ }
+
+ public int openLAN(string ip)
+ {
+ int result = -1;
+ if (NewPortInstance("LAN", ip))
+ {
+ try
+ {
+ _portOperatorBase.Open();
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
+ result = -1;
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * GPIB 频率:freq value
+ * 周期:pulse:period value
+ * output 0/1
+ *
+ * TCPIP 频率:MEAS:freq?
+ * 周期:MEAS:period?
+ * */
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs
index fe91b8a..bceec15 100644
--- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs
@@ -1,4 +1,6 @@
-using Casic.Birmm.RbFreqStandMeasure.Tools;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
using Casic.Birmm.RbFreqStandMeasure.VISA.Port;
using Casic.Birmm.RbFreqStandMeasure.VISA.Ulitity;
using System;
@@ -11,160 +13,57 @@
{
class SensitivityServiceImpl:SensitivityService
{
- public string[] getSeneitivityId()
+
+ public void beginTest(GPIBService gPIBService,string freq,CounterCheckParam counterCheckParam,
+ out SensitivityContentParam sensitivityContentParam)
{
- string[] counterId;
+ sensitivityContentParam = new SensitivityContentParam();
try
{
- counterId = PortUltility.FindAddresses(PortType.GPIB);
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
- counterId = null;
- }
- return counterId;
- }
+ //启动output(一次)OUTPUT 0\OUTPUT 1
+ gPIBService.write("OUTPUT?");
- private PortOperatorBase _portOperatorBase;
- public int open(string sensitivityId)
- {
- int result = -1;
- if (NewPortInstance(sensitivityId))
- {
- try
+ string outputStatus = gPIBService.read();
+
+ if (outputStatus == "0")
+ gPIBService.write("OUTPUT 1");
+
+ //设置周期/频率、电压GPIB
+ gPIBService.write("FREQ " + freq);
+
+ bool lessTolerance = false;
+ while (!lessTolerance)
{
- _portOperatorBase.Open();
- result = 0;
+
+ //主动读取检测数据LAN
+
+ //检测数据是否在容差范围内
+
+ //返回满足容差的数据
+
+ lessTolerance = true;
}
- catch(Exception ex) {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
- result = -1;
- }
- }
-
- return result;
- }
-
- private bool NewPortInstance(string sensitivityId)
- {
- bool hasAddress = false;
- bool hasException = false;
-
- try
- {
- _portOperatorBase = new GPIBPortOperator(sensitivityId);
- hasAddress = true;
- }
- catch (Exception ex)
- {
- hasException = true;
- }
-
-
- if (!hasException) _portOperatorBase.Timeout = 2000;
- return hasAddress;
- }
-
- public int close()
- {
- int result = -1;
- try
- {
- _portOperatorBase.Close();
-
- result = 0;
+
}
catch(Exception ex)
{
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
- result = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "beginTest:"+ex.Message);
+ sensitivityContentParam = null;
}
-
- return result;
- }
-
- public int write(string content)
- {
- int result = -1;
- try
- {
- _portOperatorBase.WriteLine(content);
-
- result = 0;
- }
- catch(Exception ex)
- {
-
- result = -1;
- }
- return result;
}
- public string read()
- {
- string content = "";
- try
- {
- content=_portOperatorBase.ReadLine();
-
- }
- catch(Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
- content = "";
- }
- return content;
- }
-
-
- public int setParams(string param1, string param2)
- {
- int result = 0;
- try
- {
-
- result = 0;
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "setParams:" + ex.Message);
- result = -1;
- }
- return result;
- }
-
- public int startCheck()
- {
- int result = 0;
- try
- {
-
- result = 0;
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startCheck:" + ex.Message);
- result = -1;
- }
- return result;
- }
-
- public int getCheckData()
- {
- int result = 0;
- try
- {
-
- result = 0;
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCheckData:" + ex.Message);
- result = -1;
- }
- return result;
- }
-
+ /**
+ *
+ * GPIBService gPIBService=new GPIBService();
+ * gPIBService.open();
+ * for(datagridview.row)
+ * {
+ * SensitivityService.beginTest()
+ * }
+ * gPIBService.close();
+ * */
}
}
+
+
+
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/SensitivityService.cs b/RbFreqStandMeasure/R_DevService/Service/SensitivityService.cs
index 4a54979..9eb0d13 100644
--- a/RbFreqStandMeasure/R_DevService/Service/SensitivityService.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/SensitivityService.cs
@@ -1,4 +1,6 @@
-using System;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,41 +9,9 @@
{
interface SensitivityService
{
-
- ///
- /// 获取GPIB设备
- ///
- ///
- string[] getSeneitivityId();
-
- int open(string sensitivityId);
-
- int close();
-
- int write(string content);
-
- string read();
+ //单行检测
+ void beginTest(GPIBService gPIBService,string freq,CounterCheckParam counterCheckParam,
+ out SensitivityContentParam sensitivityContentParam);
-
- ///
- /// GPIB+USB
- ///
- /// 周期或者频率
- /// 电压
- ///
- int setParams(string param1, string param2);
-
- ///
- /// GPIB_USB?要不要?
- ///
- ///
- int startCheck();
-
- ///
- /// GPIB+LAN
- ///
- ///
- int getCheckData();
-
}
}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj
index 1270437..67682c6 100644
--- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj
+++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj
@@ -310,6 +310,7 @@
+
diff --git a/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
new file mode 100644
index 0000000..beefbcc
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Dto/SensitivityContentParam.cs
@@ -0,0 +1,106 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto
+{
+ class SensitivityContentParam
+ {
+ //当前测量模式0,频率;1周期
+ private string checkModel;
+ //当前频率
+ private string freq;
+
+ //当前周期
+ private string period;
+
+ //当前灵敏度
+ private string ampl;
+
+ //当前检测值频率
+ private string reFreq;
+
+ //当前检测值周期
+ private string rePeriod;
+
+ public string Freq
+ {
+ get
+ {
+ return freq;
+ }
+
+ set
+ {
+ freq = value;
+ }
+ }
+
+ public string Period
+ {
+ get
+ {
+ return period;
+ }
+
+ set
+ {
+ period = value;
+ }
+ }
+
+ public string Ampl
+ {
+ get
+ {
+ return ampl;
+ }
+
+ set
+ {
+ ampl = value;
+ }
+ }
+
+ public string ReFreq
+ {
+ get
+ {
+ return reFreq;
+ }
+
+ set
+ {
+ reFreq = value;
+ }
+ }
+
+ public string RePeriod
+ {
+ get
+ {
+ return rePeriod;
+ }
+
+ set
+ {
+ rePeriod = value;
+ }
+ }
+
+ public string CheckModel
+ {
+ get
+ {
+ return checkModel;
+ }
+
+ set
+ {
+ checkModel = value;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
index 6ffc6c4..1e88523 100644
--- a/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/CounterCheckService.cs
@@ -1,4 +1,6 @@
-using System;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,9 +9,7 @@
{
interface CounterCheckService
{
- bool passTest(int testValue);
-
- void beginTest();
+
}
}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
new file mode 100644
index 0000000..4c3f336
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/GPIBService.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service
+{
+ interface GPIBService
+ {
+ #region GPIB
+ ///
+ /// 获取GPIB设备
+ ///
+ ///
+ string[] getId();
+
+ int open(string id);
+
+ int close();
+
+ int write(string content);
+
+ string read();
+ #endregion
+
+ #region LAN
+ int openLAN(string ip);
+
+ #endregion
+
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
index 6c2a26e..32a0977 100644
--- a/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/CounterCheckServiceImpl.cs
@@ -1,42 +1,13 @@
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service;
using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl;
-
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl
{
class CounterCheckServiceImpl:CounterCheckService
{
- CounterCheckParam counterCheckParam = null;
-
- public CounterCheckServiceImpl()
- {
- CounterCheckParamService counterCheckParamService = new CounterCheckParamServiceImpl();
- counterCheckParam = counterCheckParamService.getCounterCheckParams();
- }
- public bool passTest(int testValue)
- {
-
-
- return true;
- }
-
- public void beginTest()
- {
- //切换检测模式
-
- //启动output(一次)OUTPUT 0\OUTPUT 1
-
- //设置周期/频率、电压GPIB
-
- //主动读取检测数据LAN
-
- //检测数据是否在容差范围内
-
- //返回满足容差的数据
-
- }
}
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs
new file mode 100644
index 0000000..89df386
--- /dev/null
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/GPIBServiceImpl.cs
@@ -0,0 +1,151 @@
+using Casic.Birmm.RbFreqStandMeasure.Tools;
+using Casic.Birmm.RbFreqStandMeasure.VISA.Port;
+using Casic.Birmm.RbFreqStandMeasure.VISA.Ulitity;
+using System;
+using System.Reflection;
+
+namespace Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl
+{
+ public class GPIBServiceImpl:GPIBService
+ {
+ public string[] getId()
+ {
+ string[] counterId;
+ try
+ {
+ counterId = PortUltility.FindAddresses(PortType.GPIB);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ counterId = null;
+ }
+ return counterId;
+ }
+
+ private PortOperatorBase _portOperatorBase;
+
+ public int open(string id)
+ {
+ int result = -1;
+ if (NewPortInstance("GPIB",id))
+ {
+ try
+ {
+ _portOperatorBase.Open();
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
+ result = -1;
+ }
+ }
+
+ return result;
+ }
+
+ private bool NewPortInstance(string type,string sensitivityId)
+ {
+ bool hasAddress = false;
+ bool hasException = false;
+
+ try
+ {
+ if (type == "GPIB")
+ _portOperatorBase = new GPIBPortOperator(sensitivityId);
+ else if (type == "LAN")
+ _portOperatorBase = new LANPortOperator("TCPIP0::"+ sensitivityId + "::INSTR");
+
+ hasAddress = true;
+ }
+ catch (Exception ex)
+ {
+ hasException = true;
+ }
+
+ if (!hasException) _portOperatorBase.Timeout = 2000;
+ return hasAddress;
+ }
+
+ public int close()
+ {
+ int result = -1;
+ try
+ {
+ _portOperatorBase.Close();
+
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ result = -1;
+ }
+
+ return result;
+ }
+
+ public int write(string content)
+ {
+ int result = -1;
+ try
+ {
+ _portOperatorBase.WriteLine(content);
+
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+
+ result = -1;
+ }
+ return result;
+ }
+
+ public string read()
+ {
+ string content = "";
+ try
+ {
+ content = _portOperatorBase.ReadLine();
+
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
+ content = "";
+ }
+ return content;
+ }
+
+ public int openLAN(string ip)
+ {
+ int result = -1;
+ if (NewPortInstance("LAN", ip))
+ {
+ try
+ {
+ _portOperatorBase.Open();
+ result = 0;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
+ result = -1;
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * GPIB 频率:freq value
+ * 周期:pulse:period value
+ * output 0/1
+ *
+ * TCPIP 频率:MEAS:freq?
+ * 周期:MEAS:period?
+ * */
+ }
+}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs
index fe91b8a..bceec15 100644
--- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs
@@ -1,4 +1,6 @@
-using Casic.Birmm.RbFreqStandMeasure.Tools;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using Casic.Birmm.RbFreqStandMeasure.Tools;
using Casic.Birmm.RbFreqStandMeasure.VISA.Port;
using Casic.Birmm.RbFreqStandMeasure.VISA.Ulitity;
using System;
@@ -11,160 +13,57 @@
{
class SensitivityServiceImpl:SensitivityService
{
- public string[] getSeneitivityId()
+
+ public void beginTest(GPIBService gPIBService,string freq,CounterCheckParam counterCheckParam,
+ out SensitivityContentParam sensitivityContentParam)
{
- string[] counterId;
+ sensitivityContentParam = new SensitivityContentParam();
try
{
- counterId = PortUltility.FindAddresses(PortType.GPIB);
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
- counterId = null;
- }
- return counterId;
- }
+ //启动output(一次)OUTPUT 0\OUTPUT 1
+ gPIBService.write("OUTPUT?");
- private PortOperatorBase _portOperatorBase;
- public int open(string sensitivityId)
- {
- int result = -1;
- if (NewPortInstance(sensitivityId))
- {
- try
+ string outputStatus = gPIBService.read();
+
+ if (outputStatus == "0")
+ gPIBService.write("OUTPUT 1");
+
+ //设置周期/频率、电压GPIB
+ gPIBService.write("FREQ " + freq);
+
+ bool lessTolerance = false;
+ while (!lessTolerance)
{
- _portOperatorBase.Open();
- result = 0;
+
+ //主动读取检测数据LAN
+
+ //检测数据是否在容差范围内
+
+ //返回满足容差的数据
+
+ lessTolerance = true;
}
- catch(Exception ex) {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "open:" + ex.Message);
- result = -1;
- }
- }
-
- return result;
- }
-
- private bool NewPortInstance(string sensitivityId)
- {
- bool hasAddress = false;
- bool hasException = false;
-
- try
- {
- _portOperatorBase = new GPIBPortOperator(sensitivityId);
- hasAddress = true;
- }
- catch (Exception ex)
- {
- hasException = true;
- }
-
-
- if (!hasException) _portOperatorBase.Timeout = 2000;
- return hasAddress;
- }
-
- public int close()
- {
- int result = -1;
- try
- {
- _portOperatorBase.Close();
-
- result = 0;
+
}
catch(Exception ex)
{
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
- result = -1;
+ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "beginTest:"+ex.Message);
+ sensitivityContentParam = null;
}
-
- return result;
- }
-
- public int write(string content)
- {
- int result = -1;
- try
- {
- _portOperatorBase.WriteLine(content);
-
- result = 0;
- }
- catch(Exception ex)
- {
-
- result = -1;
- }
- return result;
}
- public string read()
- {
- string content = "";
- try
- {
- content=_portOperatorBase.ReadLine();
-
- }
- catch(Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCounterId : " + ex.Message);
- content = "";
- }
- return content;
- }
-
-
- public int setParams(string param1, string param2)
- {
- int result = 0;
- try
- {
-
- result = 0;
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "setParams:" + ex.Message);
- result = -1;
- }
- return result;
- }
-
- public int startCheck()
- {
- int result = 0;
- try
- {
-
- result = 0;
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startCheck:" + ex.Message);
- result = -1;
- }
- return result;
- }
-
- public int getCheckData()
- {
- int result = 0;
- try
- {
-
- result = 0;
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getCheckData:" + ex.Message);
- result = -1;
- }
- return result;
- }
-
+ /**
+ *
+ * GPIBService gPIBService=new GPIBService();
+ * gPIBService.open();
+ * for(datagridview.row)
+ * {
+ * SensitivityService.beginTest()
+ * }
+ * gPIBService.close();
+ * */
}
}
+
+
+
\ No newline at end of file
diff --git a/RbFreqStandMeasure/R_DevService/Service/SensitivityService.cs b/RbFreqStandMeasure/R_DevService/Service/SensitivityService.cs
index 4a54979..9eb0d13 100644
--- a/RbFreqStandMeasure/R_DevService/Service/SensitivityService.cs
+++ b/RbFreqStandMeasure/R_DevService/Service/SensitivityService.cs
@@ -1,4 +1,6 @@
-using System;
+using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model;
+using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,41 +9,9 @@
{
interface SensitivityService
{
-
- ///
- /// 获取GPIB设备
- ///
- ///
- string[] getSeneitivityId();
-
- int open(string sensitivityId);
-
- int close();
-
- int write(string content);
-
- string read();
+ //单行检测
+ void beginTest(GPIBService gPIBService,string freq,CounterCheckParam counterCheckParam,
+ out SensitivityContentParam sensitivityContentParam);
-
- ///
- /// GPIB+USB
- ///
- /// 周期或者频率
- /// 电压
- ///
- int setParams(string param1, string param2);
-
- ///
- /// GPIB_USB?要不要?
- ///
- ///
- int startCheck();
-
- ///
- /// GPIB+LAN
- ///
- ///
- int getCheckData();
-
}
}
\ No newline at end of file
diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj
index 1270437..67682c6 100644
--- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj
+++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj
@@ -310,6 +310,7 @@
+
diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe
index e09b5b8..e879a62 100644
--- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe
+++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe
Binary files differ