Commit 84e25c95 几米阳光

添加温湿度处理

1 个父辈 92831692
...@@ -10,7 +10,10 @@ ...@@ -10,7 +10,10 @@
<add key="App_AutoRun" value="0"/> <add key="App_AutoRun" value="0"/>
<add key="App_Title" value="AC_SA_料仓"/> <add key="App_Title" value="AC_SA_料仓"/>
<add key="scanner_start_command" value="S"/> <add key="scanner_start_command" value="S"/>
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
<add key ="StartBlowValue" value ="4"/>
<!-- 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)-->
<add key ="StopBlowValue" value ="4"/>
<!--Server address--> <!--Server address-->
<!--<add key="http.server" value="http://localhost:80/"/>--> <!--<add key="http.server" value="http://localhost:80/"/>-->
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.lblWarnMsg = new System.Windows.Forms.Label(); this.lblWarnMsg = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox(); this.groupBox5 = new System.Windows.Forms.GroupBox();
this.chbAutoRead = new System.Windows.Forms.CheckBox();
this.label16 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label();
...@@ -66,9 +67,6 @@ ...@@ -66,9 +67,6 @@
this.label49 = new System.Windows.Forms.Label(); this.label49 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.axis_1_Alarm = new UserFromControl.IOStatusControl();
this.axis_3_Alarm = new UserFromControl.IOStatusControl();
this.axis_2_Alarm = new UserFromControl.IOStatusControl();
this.label38 = new System.Windows.Forms.Label(); this.label38 = new System.Windows.Forms.Label();
this.txtMiddleTarget = new System.Windows.Forms.TextBox(); this.txtMiddleTarget = new System.Windows.Forms.TextBox();
this.txtInoutTarget = new System.Windows.Forms.TextBox(); this.txtInoutTarget = new System.Windows.Forms.TextBox();
...@@ -153,7 +151,10 @@ ...@@ -153,7 +151,10 @@
this.groupBox6 = new System.Windows.Forms.GroupBox(); this.groupBox6 = new System.Windows.Forms.GroupBox();
this.btnOpenWCF = new System.Windows.Forms.Button(); this.btnOpenWCF = new System.Windows.Forms.Button();
this.btnCloseWCF = new System.Windows.Forms.Button(); this.btnCloseWCF = new System.Windows.Forms.Button();
this.chbAutoRead = new System.Windows.Forms.CheckBox(); this.lblTemp = new System.Windows.Forms.Label();
this.axis_1_Alarm = new UserFromControl.IOStatusControl();
this.axis_3_Alarm = new UserFromControl.IOStatusControl();
this.axis_2_Alarm = new UserFromControl.IOStatusControl();
this.groupBox5.SuspendLayout(); this.groupBox5.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
...@@ -222,11 +223,21 @@ ...@@ -222,11 +223,21 @@
this.groupBox5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupBox5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox5.Location = new System.Drawing.Point(507, 121); this.groupBox5.Location = new System.Drawing.Point(507, 121);
this.groupBox5.Name = "groupBox5"; this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(495, 326); this.groupBox5.Size = new System.Drawing.Size(495, 293);
this.groupBox5.TabIndex = 216; this.groupBox5.TabIndex = 216;
this.groupBox5.TabStop = false; this.groupBox5.TabStop = false;
this.groupBox5.Text = "伺服运动"; this.groupBox5.Text = "伺服运动";
// //
// chbAutoRead
//
this.chbAutoRead.AutoSize = true;
this.chbAutoRead.Location = new System.Drawing.Point(47, 165);
this.chbAutoRead.Name = "chbAutoRead";
this.chbAutoRead.Size = new System.Drawing.Size(99, 21);
this.chbAutoRead.TabIndex = 296;
this.chbAutoRead.Text = "自动读取位置";
this.chbAutoRead.UseVisualStyleBackColor = true;
//
// label16 // label16
// //
this.label16.AutoSize = true; this.label16.AutoSize = true;
...@@ -687,43 +698,13 @@ ...@@ -687,43 +698,13 @@
this.groupBox1.Controls.Add(this.label43); this.groupBox1.Controls.Add(this.label43);
this.groupBox1.Controls.Add(this.label42); this.groupBox1.Controls.Add(this.label42);
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(507, 451); this.groupBox1.Location = new System.Drawing.Point(507, 415);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(495, 193); this.groupBox1.Size = new System.Drawing.Size(495, 191);
this.groupBox1.TabIndex = 217; this.groupBox1.TabIndex = 217;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "伺服状态"; this.groupBox1.Text = "伺服状态";
// //
// axis_1_Alarm
//
this.axis_1_Alarm.IOName = "";
this.axis_1_Alarm.IOValue = 0;
this.axis_1_Alarm.isCanClick = false;
this.axis_1_Alarm.Location = new System.Drawing.Point(127, 49);
this.axis_1_Alarm.Name = "axis_1_Alarm";
this.axis_1_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_1_Alarm.TabIndex = 264;
//
// axis_3_Alarm
//
this.axis_3_Alarm.IOName = "";
this.axis_3_Alarm.IOValue = 0;
this.axis_3_Alarm.isCanClick = false;
this.axis_3_Alarm.Location = new System.Drawing.Point(329, 49);
this.axis_3_Alarm.Name = "axis_3_Alarm";
this.axis_3_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_3_Alarm.TabIndex = 266;
//
// axis_2_Alarm
//
this.axis_2_Alarm.IOName = "";
this.axis_2_Alarm.IOValue = 0;
this.axis_2_Alarm.isCanClick = false;
this.axis_2_Alarm.Location = new System.Drawing.Point(224, 49);
this.axis_2_Alarm.Name = "axis_2_Alarm";
this.axis_2_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_2_Alarm.TabIndex = 265;
//
// label38 // label38
// //
this.label38.AutoSize = true; this.label38.AutoSize = true;
...@@ -868,6 +849,7 @@ ...@@ -868,6 +849,7 @@
// //
// groupBox2 // groupBox2
// //
this.groupBox2.Controls.Add(this.lblTemp);
this.groupBox2.Controls.Add(this.btnClearLog); this.groupBox2.Controls.Add(this.btnClearLog);
this.groupBox2.Controls.Add(this.lblMsg); this.groupBox2.Controls.Add(this.lblMsg);
this.groupBox2.Controls.Add(this.btnSavePosition); this.groupBox2.Controls.Add(this.btnSavePosition);
...@@ -920,9 +902,9 @@ ...@@ -920,9 +902,9 @@
// btnClearLog // btnClearLog
// //
this.btnClearLog.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnClearLog.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClearLog.Location = new System.Drawing.Point(10, 390); this.btnClearLog.Location = new System.Drawing.Point(298, 392);
this.btnClearLog.Name = "btnClearLog"; this.btnClearLog.Name = "btnClearLog";
this.btnClearLog.Size = new System.Drawing.Size(105, 28); this.btnClearLog.Size = new System.Drawing.Size(88, 28);
this.btnClearLog.TabIndex = 224; this.btnClearLog.TabIndex = 224;
this.btnClearLog.Text = "清理日志"; this.btnClearLog.Text = "清理日志";
this.btnClearLog.UseVisualStyleBackColor = true; this.btnClearLog.UseVisualStyleBackColor = true;
...@@ -942,9 +924,9 @@ ...@@ -942,9 +924,9 @@
// btnSavePosition // btnSavePosition
// //
this.btnSavePosition.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnSavePosition.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSavePosition.Location = new System.Drawing.Point(342, 389); this.btnSavePosition.Location = new System.Drawing.Point(393, 391);
this.btnSavePosition.Name = "btnSavePosition"; this.btnSavePosition.Name = "btnSavePosition";
this.btnSavePosition.Size = new System.Drawing.Size(105, 30); this.btnSavePosition.Size = new System.Drawing.Size(88, 30);
this.btnSavePosition.TabIndex = 217; this.btnSavePosition.TabIndex = 217;
this.btnSavePosition.Text = "保存位置"; this.btnSavePosition.Text = "保存位置";
this.btnSavePosition.UseVisualStyleBackColor = true; this.btnSavePosition.UseVisualStyleBackColor = true;
...@@ -1741,7 +1723,7 @@ ...@@ -1741,7 +1723,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.btnOpenWCF); this.groupBox6.Controls.Add(this.btnOpenWCF);
this.groupBox6.Controls.Add(this.btnCloseWCF); this.groupBox6.Controls.Add(this.btnCloseWCF);
this.groupBox6.Location = new System.Drawing.Point(507, 648); this.groupBox6.Location = new System.Drawing.Point(507, 616);
this.groupBox6.Name = "groupBox6"; this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(497, 66); this.groupBox6.Size = new System.Drawing.Size(497, 66);
this.groupBox6.TabIndex = 269; this.groupBox6.TabIndex = 269;
...@@ -1770,15 +1752,46 @@ ...@@ -1770,15 +1752,46 @@
this.btnCloseWCF.UseVisualStyleBackColor = true; this.btnCloseWCF.UseVisualStyleBackColor = true;
this.btnCloseWCF.Click += new System.EventHandler(this.btnCloseWCF_Click); this.btnCloseWCF.Click += new System.EventHandler(this.btnCloseWCF_Click);
// //
// chbAutoRead // lblTemp
// //
this.chbAutoRead.AutoSize = true; this.lblTemp.AutoSize = true;
this.chbAutoRead.Location = new System.Drawing.Point(47, 165); this.lblTemp.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbAutoRead.Name = "chbAutoRead"; this.lblTemp.ForeColor = System.Drawing.Color.Black;
this.chbAutoRead.Size = new System.Drawing.Size(99, 21); this.lblTemp.Location = new System.Drawing.Point(11, 396);
this.chbAutoRead.TabIndex = 296; this.lblTemp.Name = "lblTemp";
this.chbAutoRead.Text = "自动读取位置"; this.lblTemp.Size = new System.Drawing.Size(159, 20);
this.chbAutoRead.UseVisualStyleBackColor = true; this.lblTemp.TabIndex = 270;
this.lblTemp.Text = "当前温度--,当前湿度--";
//
// axis_1_Alarm
//
this.axis_1_Alarm.IOName = "";
this.axis_1_Alarm.IOValue = 0;
this.axis_1_Alarm.isCanClick = false;
this.axis_1_Alarm.Location = new System.Drawing.Point(127, 49);
this.axis_1_Alarm.Name = "axis_1_Alarm";
this.axis_1_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_1_Alarm.TabIndex = 264;
//
// axis_3_Alarm
//
this.axis_3_Alarm.IOName = "";
this.axis_3_Alarm.IOValue = 0;
this.axis_3_Alarm.isCanClick = false;
this.axis_3_Alarm.Location = new System.Drawing.Point(329, 49);
this.axis_3_Alarm.Name = "axis_3_Alarm";
this.axis_3_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_3_Alarm.TabIndex = 266;
//
// axis_2_Alarm
//
this.axis_2_Alarm.IOName = "";
this.axis_2_Alarm.IOValue = 0;
this.axis_2_Alarm.isCanClick = false;
this.axis_2_Alarm.Location = new System.Drawing.Point(224, 49);
this.axis_2_Alarm.Name = "axis_2_Alarm";
this.axis_2_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_2_Alarm.TabIndex = 265;
// //
// FrmStoreBox // FrmStoreBox
// //
...@@ -1948,6 +1961,7 @@ ...@@ -1948,6 +1961,7 @@
private System.Windows.Forms.Button btnOpenWCF; private System.Windows.Forms.Button btnOpenWCF;
private System.Windows.Forms.Button btnCloseWCF; private System.Windows.Forms.Button btnCloseWCF;
private System.Windows.Forms.CheckBox chbAutoRead; private System.Windows.Forms.CheckBox chbAutoRead;
private System.Windows.Forms.Label lblTemp;
} }
} }
...@@ -146,6 +146,7 @@ namespace OnlineStore.ACSingleStore ...@@ -146,6 +146,7 @@ namespace OnlineStore.ACSingleStore
private DateTime preReadModblsTime = DateTime.Now; private DateTime preReadModblsTime = DateTime.Now;
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e)
{ {
lblTemp.Text = store.currTempStr;
//验证运动是否完成 //验证运动是否完成
//CheckWait(); //CheckWait();
//忙碌状态不读取状态 //忙碌状态不读取状态
......
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
<value>107, 16</value> <value>107, 16</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>118</value> <value>25</value>
</metadata> </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
......
...@@ -9,6 +9,7 @@ using System.Text; ...@@ -9,6 +9,7 @@ using System.Text;
namespace OnlineStore.Common namespace OnlineStore.Common
{ {
/// <summary> /// <summary>
/// 奥松温湿度服务器 /// 奥松温湿度服务器
/// </summary> /// </summary>
...@@ -56,7 +57,7 @@ namespace OnlineStore.Common ...@@ -56,7 +57,7 @@ namespace OnlineStore.Common
} }
return temperate; return temperate;
} }
public static double GetMaxTemperate(List<string> ipAddrList) public static double GetMaxHumidity(List<string> ipAddrList)
{ {
double maxValue = 0; double maxValue = 0;
foreach (string addr in ipAddrList) foreach (string addr in ipAddrList)
...@@ -159,7 +160,7 @@ namespace OnlineStore.Common ...@@ -159,7 +160,7 @@ namespace OnlineStore.Common
/// </summary> /// </summary>
public class ASTemperateParam public class ASTemperateParam
{ {
public ASTemperateParam(string clientipe, string add, string pwd, double wendu, double shidu,DateTime updateTime) public ASTemperateParam(string clientipe, string add, string pwd, double wendu, double shidu, DateTime updateTime)
{ {
this.IpAddress = clientipe; this.IpAddress = clientipe;
this.DeviceAddress = add; this.DeviceAddress = add;
...@@ -169,14 +170,14 @@ namespace OnlineStore.Common ...@@ -169,14 +170,14 @@ namespace OnlineStore.Common
this.UpdateTime = updateTime; this.UpdateTime = updateTime;
} }
//获取平均值时使用此 参数,只做显示用 //获取平均值时使用此 参数,只做显示用
public ASTemperateParam( double wendu, double shidu ) public ASTemperateParam(double wendu, double shidu)
{ {
this.IpAddress = ""; this.IpAddress = "";
this.DeviceAddress = ""; this.DeviceAddress = "";
this.Password = ""; this.Password = "";
this.Temperate = wendu; this.Temperate = wendu;
this.Humidity = shidu; this.Humidity = shidu;
this.UpdateTime = DateTime.Now ; this.UpdateTime = DateTime.Now;
} }
/// <summary> /// <summary>
/// 判断值是否在有效期内。默认有效期是一分钟 /// 判断值是否在有效期内。默认有效期是一分钟
......
...@@ -92,3 +92,7 @@ PRO,(轴三)进出轴最小限位,InoutAxis_PositionMin,0,,,,,,,,, ...@@ -92,3 +92,7 @@ PRO,(轴三)进出轴最小限位,InoutAxis_PositionMin,0,,,,,,,,,
PRO,(轴一)旋转轴最大限位,MiddleAxis_PositionMax,0,,,,,,,,, PRO,(轴一)旋转轴最大限位,MiddleAxis_PositionMax,0,,,,,,,,,
PRO,(轴二)升降轴最大限位,UpdownAxis_PositionMax,0,,,,,,,,, PRO,(轴二)升降轴最大限位,UpdownAxis_PositionMax,0,,,,,,,,,
PRO,(轴三)进出轴最大限位,InoutAxis_PositionMax,0,,,,,,,,, PRO,(轴三)进出轴最大限位,InoutAxis_PositionMax,0,,,,,,,,,
PRO,需要吹气的温度(温度标准),Max_Temperature,20,,,,,,
PRO,需要吹气的湿度(湿度标准),Max_Humidity,10,,,,,,
PRO,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,
PRO,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,
...@@ -65,7 +65,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -65,7 +65,8 @@ namespace OnlineStore.DeviceLibrary
this.Config = config; this.Config = config;
this.DIList = config.StoreDIList; this.DIList = config.StoreDIList;
this.DOList = config.StoreDOList; this.DOList = config.StoreDOList;
Max_Humidity = config.Max_Humidity;
Max_Temperature = config.Max_Temperature;
moveAxisList = new List<ConfigMoveAxis>(); moveAxisList = new List<ConfigMoveAxis>();
MoveAxisConfig(); MoveAxisConfig();
List<ACStorePosition> positionList = CSVPositionReader<ACStorePosition>.getPositionList(); List<ACStorePosition> positionList = CSVPositionReader<ACStorePosition>.getPositionList();
...@@ -273,7 +274,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -273,7 +274,7 @@ namespace OnlineStore.DeviceLibrary
//TODO 启动时先所有轴远点返回,测试暂时关闭 //TODO 启动时先所有轴远点返回,测试暂时关闭
storeRunStatus = StoreRunStatus.HomeMoving; storeRunStatus = StoreRunStatus.HomeMoving;
//启动温湿度服务器 //启动温湿度服务器
//HumitureServer.StartTemperateServer(Config.TemperateServer_Port); HumitureServer.StartTemperateServer(Config.TemperateServer_Port);
scanSocket.ConnectScanner(Config.Scanner_Ip, Config.Scanner_Port); scanSocket.ConnectScanner(Config.Scanner_Ip, Config.Scanner_Port);
ReturnHome(); ReturnHome();
...@@ -713,7 +714,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -713,7 +714,7 @@ namespace OnlineStore.DeviceLibrary
ShuoKeControls.ClosePort(); ShuoKeControls.ClosePort();
} }
scanSocket.StopScanner(); scanSocket.StopScanner();
//HumitureServer.StopTemperateServer(); HumitureServer.StopTemperateServer();
LogUtil.info(LOGGER, StoreName + ",停止运行,总运行时间:" + span.ToString()); LogUtil.info(LOGGER, StoreName + ",停止运行,总运行时间:" + span.ToString());
} }
...@@ -1300,6 +1301,124 @@ namespace OnlineStore.DeviceLibrary ...@@ -1300,6 +1301,124 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
#region 温湿度处理
/// <summary>
/// 湿度标准,超过后需要报警
/// </summary>
private float Max_Humidity = 0;
/// <summary>
/// 温度标准,超过后需要报警
/// </summary>
private float Max_Temperature = 0;
private bool IsInBlowing = false;
private DateTime LastBeginBlowTime = DateTime.Now;
private DateTime LastEndBlowTime = new DateTime(1997, 1, 1);
private DateTime preLogTime = DateTime.Now;
private bool TempOrHumidityIsAlarm = false;
private float StartBlowValue = (float)ConfigAppSettings.GetNumValue(Setting_Init.StartBlowValue);
private float StopBlowValue = (float)ConfigAppSettings.GetNumValue(Setting_Init.StopBlowValue);
public string currTempStr = "";
private void HumidityProcess()
{
try
{
if ((DateTime.Now - preLogTime).TotalSeconds > 10)
{
preLogTime = DateTime.Now;
//用最大的湿度判断是否需要吹气,开始吹气的值=发过来的值-4
//温湿度
ASTemperateParam param = HumitureServer.GetTemperateParam(Config.GetTempAddrList());
double humidity = 0;
double temp = 0;
if (param != null)
{
humidity = param.Humidity;
temp = param.Temperate;
currTempStr=("当前湿度:" + humidity.ToString()+",当前温度:"+temp);
}
double currMaxHumidity = HumitureServer.GetMaxHumidity(Config.GetTempAddrList());
float startBlowHumidity = Max_Humidity - StartBlowValue;
float stopBlowHumidity = Max_Humidity - StopBlowValue;
//判断是否需要吹气
if (startBlowHumidity > 0 && startBlowHumidity < currMaxHumidity && IsInBlowing.Equals(false))
{
//判断是否距离上次结束指定的时间
TimeSpan span = DateTime.Now - LastEndBlowTime;
if (span.TotalMinutes > this.Config.BlowAir_Interval)
{
LOGGER.Info("当前最大湿度:" + currMaxHumidity.ToString() + ",开始吹气湿度:" + startBlowHumidity + ",当前不在吹气中,且间隔超过" + Config.BlowAir_Interval + "分钟,开始吹气!");
IsInBlowing = true;
Thread.Sleep(100);
KNDIOMove(IO_Type.StartOrStopBlow, IO_VALUE.HIGH);
LastBeginBlowTime = DateTime.Now;
LastEndBlowTime = DateTime.Now;
}
}
if (IsInBlowing && stopBlowHumidity > currMaxHumidity)
{
LOGGER.Info("当前最大湿度:" + currMaxHumidity.ToString() + ",停止吹气湿度:" + stopBlowHumidity + ",停止吹气!");
IsInBlowing = false;
Thread.Sleep(100);
KNDIOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
LastEndBlowTime = DateTime.Now;
}
if (IsInBlowing)
{
//判断是否需要结束吹气
TimeSpan span = DateTime.Now - LastBeginBlowTime;
if (span.TotalMinutes > this.Config.BlowAir_Time)
{
LOGGER.Info("已经吹气" + span.TotalMinutes + "分钟,超过配置的吹气时间" + Config.BlowAir_Time + "分钟,停止吹气!");
IsInBlowing = false;
Thread.Sleep(100);
KNDIOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
LastEndBlowTime = DateTime.Now;
}
}
//如果开始吹气并且当前达到报警值
if (IsInBlowing.Equals(true) && humidity > Max_Humidity)
{
TempOrHumidityIsAlarm = true;
}
else
{
TempOrHumidityIsAlarm = false;
}
//如果湿度没有报警,温度达到范围也需要报警
if (temp > Max_Temperature && Max_Temperature > 0)
{
LOGGER.Info("当前温度【" + param.Temperate + "】超过最高温度【" + Max_Temperature + "】,开始报警!");
TempOrHumidityIsAlarm = true;
Thread.Sleep(100);
KNDIOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
}
else if (temp < Max_Temperature)
{
if (IsInBlowing.Equals(false) && TempOrHumidityIsAlarm)
{
LOGGER.Info("不在吹气中,且当前温度【" + param.Temperate + "】低于【" + Max_Temperature + "】,关闭报警!");
TempOrHumidityIsAlarm = false;
Thread.Sleep(100);
KNDIOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
}
}
}
}
catch (Exception ex)
{
LOGGER.Error(StoreName + "HumidityProcess出错:" + ex.ToString());
}
}
#endregion
#region 与服务器通信定时器,每1秒向服务器通知一次状态,同时执行出库操作 #region 与服务器通信定时器,每1秒向服务器通知一次状态,同时执行出库操作
private bool isInProcess = false; private bool isInProcess = false;
public void server_connect_timer_Tick(object sender, EventArgs e) public void server_connect_timer_Tick(object sender, EventArgs e)
...@@ -1309,6 +1428,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1309,6 +1428,7 @@ namespace OnlineStore.DeviceLibrary
{ {
return; return;
} }
HumidityProcess();
LedProcess(); LedProcess();
isInProcess = true; isInProcess = true;
if (ACStoreManager.IsConnectServer) if (ACStoreManager.IsConnectServer)
......
...@@ -410,7 +410,54 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -410,7 +410,54 @@ namespace OnlineStore.LoadCSVLibrary
/// PRO (轴三)进出轴最大限位 InoutAxis_PositionMax /// PRO (轴三)进出轴最大限位 InoutAxis_PositionMax
/// </summary> /// </summary>
[ConfigProAttribute("InoutAxis_PositionMax", false)] [ConfigProAttribute("InoutAxis_PositionMax", false)]
/// <summary>
/// PRO 需要吹气的温度(温度标准) Max_Temperature 10
/// </summary>
[ConfigProAttribute("Max_Temperature", false)]
public int Max_Temperature { get; set; }
/// <summary>
/// PRO 需要吹气的湿度(湿度标准) Max_Humidity 10
/// </summary>
[ConfigProAttribute("Max_Humidity", false)]
public int Max_Humidity { get; set; }
/// <summary>
/// PRO 每次吹气的时间(分钟) BlowAir_Time 10
/// </summary>
[ConfigProAttribute("BlowAir_Time", false)]
public int BlowAir_Time { get; set; }
/// <summary>
/// PRO 两次吹气间隔(分钟) BlowAir_Interval 10
/// </summary>
[ConfigProAttribute("BlowAir_Interval", false)]
public int BlowAir_Interval { get; set; }
public int InoutAxis_PositionMax { get; set; } public int InoutAxis_PositionMax { get; set; }
private List<string> TempAddrList = null;
public static char TempAddrSpilt = '#';
/// <summary>
/// 温湿度地址列表
/// </summary>
public List<string> GetTempAddrList()
{
if (TempAddrList == null)
{
TempAddrList = new List<string>();
string[] array = Temperate_Serveraddress.Split(TempAddrSpilt);
if (array.Length > 0)
{
foreach (string str in array)
{
if (!str.Equals(""))
{
TempAddrList.Add(str);
}
}
}
}
return TempAddrList;
}
protected override void initMustHavePro() protected override void initMustHavePro()
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!