MainMachine _IOMonitor.cs
4.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
using CodeLibrary;
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DeviceLibrary
{
partial class MainMachine
{
public bool LeftDoorOpen = false;
public bool RightDoorOpen = false;
public bool PrintDoorOpen = false;
void ioMonitor()
{
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
//if (!PrintDoorOpen)
IOMove(IO_Type.PrinterDoor_Lock, IO_VALUE.LOW);
//if (!LeftDoorOpen)
IOMove(IO_Type.LeftDoor_Lock, IO_VALUE.LOW);
//if (!RightDoorOpen)
IOMove(IO_Type.RightDoor_Lock, IO_VALUE.LOW);
LeftDoorOpen = true;
RightDoorOpen = true;
PrintDoorOpen = true;
}
//if (!PrintDoorOpen && IOValue(IO_Type.PrinterDoor_Check).Equals(IO_VALUE.HIGH))
//{
// IOMove(IO_Type.PrinterDoor_Lock, IO_VALUE.HIGH);
//}
//else
//{
// PrintDoorOpen = false;
//}
//if (!LeftDoorOpen && IOValue(IO_Type.LeftDoor_Check).Equals(IO_VALUE.LOW))
//{
// IOMove(IO_Type.LeftDoor_Lock, IO_VALUE.HIGH);
//}
//else {
// LeftDoorOpen = false;
//}
//if (!RightDoorOpen && IOValue(IO_Type.RightDoor_Check).Equals(IO_VALUE.LOW))
//{
// IOMove(IO_Type.RightDoor_Lock, IO_VALUE.HIGH);
//}
//else
//{
// RightDoorOpen = false;
//}
if (RobotManage.dauxiKS107.Distance < Setting_Init.Device_Liquid_level_distance) {
Msg.add(crc.GetString("Res0163.f6ad5099","冷凝液回收桶已满"), MsgLevel.warning);
}
if (IOValue(IO_Type.Airpressure_Check).Equals(IO_VALUE.LOW)) {
Msg.add(crc.GetString("Res0079","未检测到气压信号."), MsgLevel.warning);
}
//airprocess();
}
public double Current_Humidity = 0;
public double Current_Temperate = 0;
bool airisopen = false;
DateTime lastAirprocesstime = DateTime.Now;
void airprocess()
{
if ((DateTime.Now - lastAirprocesstime).TotalSeconds < 5)
return;
lastAirprocesstime = DateTime.Now;
//var temp = HumitureController.QueryData();
var temp = HumitureController.LastData;
Current_Humidity = temp.Humidity;
Current_Temperate = temp.Temperate;
//var tempIsOK = Current_Temperate < ServerCM.Max_Temperature;
var humiNeedStart = Current_Humidity > ServerCM.Max_Humidity - Setting_Init.Device_HumidityStartOffser;
var humiNeedStop = Current_Humidity < ServerCM.Max_Humidity - Setting_Init.Device_HumidityEndOffser;
if (humiNeedStart && !airisopen)
{
IOMove(IO_Type.Fan, IO_VALUE.HIGH);
airisopen = true;
LogUtil.info($"开始吹气,当前最大湿度:{Current_Humidity} > {ServerCM.Max_Humidity}-{Setting_Init.Device_HumidityStartOffser}.");
}
else if (humiNeedStop && airisopen)
{
IOMove(IO_Type.Fan, IO_VALUE.LOW);
airisopen = false;
LogUtil.info($"关闭吹气,当前最大湿度:{Current_Humidity} < {ServerCM.Max_Humidity}-{Setting_Init.Device_HumidityEndOffser}.");
}
}
bool lastTHoutRangeStatus = false;
DateTime lastTHoutRangeTime = DateTime.MaxValue;
bool IsTHoutRange()
{
if (HumitureController.LastData.Humidity > ServerCM.Max_Humidity// || HumitureController.LastData.Humidity < ServerCM.Min_Humidity
|| HumitureController.LastData.Temperate > ServerCM.Max_Temperature)
{
if (!lastTHoutRangeStatus)
lastTHoutRangeTime = DateTime.Now;
lastTHoutRangeStatus = true;
return true;
}
else
{
if (lastTHoutRangeStatus)
lastTHoutRangeTime = DateTime.MaxValue;
lastTHoutRangeStatus = false;
return false;
}
}
bool IsTHoutRangeOver30m() {
return (DateTime.Now - lastTHoutRangeTime).TotalMinutes > 30;
}
}
}