Commit 506c66e6 authored by leon.huang's avatar leon.huang

add local teset bind

parent 8f1fbb7e
...@@ -103,7 +103,7 @@ namespace ModbusDemo.MessageFormat ...@@ -103,7 +103,7 @@ namespace ModbusDemo.MessageFormat
} }
private const double OPENCURRENT = 7; private const double OPENCURRENT = 7;
private const double CLOSECURRENT = 4; private const double CLOSECURRENT = 5;
public class pcLiquidLevelConfig public class pcLiquidLevelConfig
{ {
public byte byModbusID; public byte byModbusID;
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;DEBUG_TEST1</DefineConstants> <DefineConstants>TRACE;DEBUG;DEBUG_TEST</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
......
This diff is collapsed.
...@@ -172,7 +172,6 @@ namespace ModbusDemo.application ...@@ -172,7 +172,6 @@ namespace ModbusDemo.application
else else
{ {
ModualAlarm.vSet_Modual_Alarm(EmodbusId[i], ModualAlarm.vSet_Modual_Alarm(EmodbusId[i],
(ushort)ModbusComm.eModbusErrorCode.MB_EMASTERNOERR |
(ushort)ModualAlarm.eAlarmCode.ChannelCommunError, true, 1, (ushort)ModualAlarm.eAlarmCode.ChannelCommunError, true, 1,
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7");
} }
...@@ -188,7 +187,6 @@ namespace ModbusDemo.application ...@@ -188,7 +187,6 @@ namespace ModbusDemo.application
else else
{ {
ModualAlarm.vSet_Modual_Alarm(EmodbusId[i + 1], ModualAlarm.vSet_Modual_Alarm(EmodbusId[i + 1],
(ushort)ModbusComm.eModbusErrorCode.MB_EMASTERNOERR |
(ushort)ModualAlarm.eAlarmCode.ChannelCommunError, true, 1, (ushort)ModualAlarm.eAlarmCode.ChannelCommunError, true, 1,
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7");
} }
...@@ -266,7 +264,6 @@ namespace ModbusDemo.application ...@@ -266,7 +264,6 @@ namespace ModbusDemo.application
else else
{ {
ModualAlarm.vSet_Modual_Alarm(WmodbusId[i], ModualAlarm.vSet_Modual_Alarm(WmodbusId[i],
(ushort)ModbusComm.eModbusErrorCode.MB_EMASTERNOERR |
(ushort)ModualAlarm.eAlarmCode.ChannelCommunError, true, 1, (ushort)ModualAlarm.eAlarmCode.ChannelCommunError, true, 1,
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7");
} }
...@@ -282,7 +279,6 @@ namespace ModbusDemo.application ...@@ -282,7 +279,6 @@ namespace ModbusDemo.application
else else
{ {
ModualAlarm.vSet_Modual_Alarm(WmodbusId[i+1], ModualAlarm.vSet_Modual_Alarm(WmodbusId[i+1],
(ushort)ModbusComm.eModbusErrorCode.MB_EMASTERNOERR |
(ushort)ModualAlarm.eAlarmCode.ChannelCommunError, true, 1, (ushort)ModualAlarm.eAlarmCode.ChannelCommunError, true, 1,
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7");
} }
......
...@@ -60,34 +60,84 @@ namespace ModbusDemo.application ...@@ -60,34 +60,84 @@ namespace ModbusDemo.application
bool bMapStatus = true; bool bMapStatus = true;
if (bOpen == true) if (bOpen == true)
{ {
if (byControlID == 31 && strOperationChannelName[0] == "d1") #region 东中转池开映射
if (byControlID == 16 && strOperationChannelName[0] == "d0")
{ {
bDelege_Operation = AllPond.cEastTransitPool.cSouthWater.bOpen_Machine; bDelege_Operation = AllPond.cEastTransitPool.cSouthWater.bOpen_Machine;
} }
else if (byControlID == 16 && strOperationChannelName[0] == "d0") else if (byControlID == 16 && strOperationChannelName[0] == "d2")
{ {
bDelege_Operation = AllPond.cEastTransitPool.cNorthWater.bOpen_Machine; bDelege_Operation = AllPond.cEastTransitPool.cNorthWater.bOpen_Machine;
} }
else if (byControlID == 16 && strOperationChannelName[0] == "d2") else if (byControlID == 39 && strOperationChannelName[0] == "d0")
{ {
bDelege_Operation = AllPond.cEastTransitPool.cPumb1.bOpen_Machine; bDelege_Operation = AllPond.cEastTransitPool.cPumb1.bOpen_Machine;
} }
else if (byControlID == 35 && strOperationChannelName[0] == "d0") else if (byControlID == 39 && strOperationChannelName[0] == "d2")
{ {
bDelege_Operation = AllPond.cEastTransitPool.cPumb2.bOpen_Machine; bDelege_Operation = AllPond.cEastTransitPool.cPumb2.bOpen_Machine;
} }
else if (byControlID == 35 && strOperationChannelName[0] == "d2") else if (byControlID == 90 && strOperationChannelName[0] == "d0")
{ {
bDelege_Operation = AllPond.cEastTransitPool.cStirrer1.bOpen_Machine; bDelege_Operation = AllPond.cEastTransitPool.cStirrer1.bOpen_Machine;
} }
else if (byControlID == 39 && strOperationChannelName[0] == "d0") else if (byControlID == 90 && strOperationChannelName[0] == "d1")
{ {
bDelege_Operation = AllPond.cEastTransitPool.cStirrer2.bOpen_Machine; bDelege_Operation = AllPond.cEastTransitPool.cStirrer2.bOpen_Machine;
} }
else if (byControlID == 39 && strOperationChannelName[0] == "d2") else if (byControlID == 90 && strOperationChannelName[0] == "d2")
{ {
bDelege_Operation = AllPond.cEastTransitPool.cStirrer3.bOpen_Machine; bDelege_Operation = AllPond.cEastTransitPool.cStirrer3.bOpen_Machine;
} }
else if (byControlID == 90 && strOperationChannelName[0] == "d3")
{
bDelege_Operation = AllPond.cEastTransitPool.cStirrer4.bOpen_Machine;
}
#endregion
#region 西中转池开映射
else if (byControlID == 35 && strOperationChannelName[0] == "d0")
{
bDelege_Operation = AllPond.cWestTransitPool.cSouthWater.bOpen_Machine;
}
else if (byControlID == 35 && strOperationChannelName[0] == "d2")
{
bDelege_Operation = AllPond.cWestTransitPool.cNorthWater.bOpen_Machine;
}
else if (byControlID == 31 && strOperationChannelName[0] == "d2")
{
bDelege_Operation = AllPond.cWestTransitPool.cPumb1.bOpen_Machine;
}
else if (byControlID == 31 && strOperationChannelName[0] == "d4")
{
bDelege_Operation = AllPond.cWestTransitPool.cPumb1.bOpen_Machine;
}
#endregion
#region 沉砂池开映射
else if (byControlID == 90 && strOperationChannelName[0] == "d4")
{
bDelege_Operation = AllPond.cDesiltingPool.cStirrer1.bOpen_Machine;
}
else if (byControlID == 90 && strOperationChannelName[0] == "d5")
{
bDelege_Operation = AllPond.cDesiltingPool.cStirrer2.bOpen_Machine;
}
#endregion
#region 出料池开映射
#endregion
#region 匀浆池开映射
else if (byControlID == 31 && strOperationChannelName[0] == "d0")
{
bDelege_Operation = AllPond.cSlurryPool.cPumb1.bOpen_Machine;
}
else if (byControlID == 31 && strOperationChannelName[0] == "d1")
{
bDelege_Operation = AllPond.cSlurryPool.cStirrer1.bOpen_Machine;
}
#endregion
#region 八角池开映射
#endregion
#region 中控柜开映射和暂停映射
#endregion
else else
{ {
byMapIdleID = byControlID; byMapIdleID = byControlID;
...@@ -98,6 +148,84 @@ namespace ModbusDemo.application ...@@ -98,6 +148,84 @@ namespace ModbusDemo.application
} }
else else
{ {
#region 东中转池关映射
if (byControlID == 16 && strOperationChannelName[0] == "d0")
{
bDelege_Operation = AllPond.cEastTransitPool.cSouthWater.bClose_Machine;
}
else if (byControlID == 16 && strOperationChannelName[0] == "d2")
{
bDelege_Operation = AllPond.cEastTransitPool.cNorthWater.bClose_Machine;
}
else if (byControlID == 39 && strOperationChannelName[0] == "d0")
{
bDelege_Operation = AllPond.cEastTransitPool.cPumb1.bClose_Machine;
}
else if (byControlID == 39 && strOperationChannelName[0] == "d2")
{
bDelege_Operation = AllPond.cEastTransitPool.cPumb2.bClose_Machine;
}
else if (byControlID == 90 && strOperationChannelName[0] == "d0")
{
bDelege_Operation = AllPond.cEastTransitPool.cStirrer1.bClose_Machine;
}
else if (byControlID == 90 && strOperationChannelName[0] == "d1")
{
bDelege_Operation = AllPond.cEastTransitPool.cStirrer2.bClose_Machine;
}
else if (byControlID == 90 && strOperationChannelName[0] == "d2")
{
bDelege_Operation = AllPond.cEastTransitPool.cStirrer3.bClose_Machine;
}
else if (byControlID == 90 && strOperationChannelName[0] == "d3")
{
bDelege_Operation = AllPond.cEastTransitPool.cStirrer4.bClose_Machine;
}
#endregion
#region 西中转池关映射
else if (byControlID == 35 && strOperationChannelName[0] == "d0")
{
bDelege_Operation = AllPond.cWestTransitPool.cSouthWater.bClose_Machine;
}
else if (byControlID == 35 && strOperationChannelName[0] == "d2")
{
bDelege_Operation = AllPond.cWestTransitPool.cNorthWater.bClose_Machine;
}
else if (byControlID == 31 && strOperationChannelName[0] == "d2")
{
bDelege_Operation = AllPond.cWestTransitPool.cPumb1.bClose_Machine;
}
else if (byControlID == 31 && strOperationChannelName[0] == "d4")
{
bDelege_Operation = AllPond.cWestTransitPool.cPumb1.bClose_Machine;
}
#endregion
#region 沉砂池关映射
else if (byControlID == 90 && strOperationChannelName[0] == "d4")
{
bDelege_Operation = AllPond.cDesiltingPool.cStirrer1.bClose_Machine;
}
else if (byControlID == 90 && strOperationChannelName[0] == "d5")
{
bDelege_Operation = AllPond.cDesiltingPool.cStirrer2.bClose_Machine;
}
#endregion
#region 出料池关映射
#endregion
#region 匀浆池关映射
else if (byControlID == 31 && strOperationChannelName[0] == "d0")
{
bDelege_Operation = AllPond.cSlurryPool.cPumb1.bClose_Machine;
}
else if (byControlID == 31 && strOperationChannelName[0] == "d1")
{
bDelege_Operation = AllPond.cSlurryPool.cStirrer1.bClose_Machine;
}
#endregion
#region 八角池关映射
#endregion
#region 中控柜关映射和手动映射
#endregion
if (byControlID == 31 && strOperationChannelName[0] == "d1") if (byControlID == 31 && strOperationChannelName[0] == "d1")
{ {
bDelege_Operation = AllPond.cEastTransitPool.cSouthWater.bClose_Machine; bDelege_Operation = AllPond.cEastTransitPool.cSouthWater.bClose_Machine;
......
...@@ -26,7 +26,7 @@ namespace ModbusDemo ...@@ -26,7 +26,7 @@ namespace ModbusDemo
{ {
public partial class Form1 : Form public partial class Form1 : Form
{ {
const bool LOCALDEBUG = true; const bool LOCALDEBUG = false;
private bool bStart = false; private bool bStart = false;
AutoResetEvent exitEvent; AutoResetEvent exitEvent;
private int waitTime; private int waitTime;
...@@ -58,9 +58,9 @@ namespace ModbusDemo ...@@ -58,9 +58,9 @@ namespace ModbusDemo
exitEvent = new AutoResetEvent(false); exitEvent = new AutoResetEvent(false);
waitTime = 6000; waitTime = 6000;
t_UpgradeConn = new Thread(UpgradeProc); //t_UpgradeConn = new Thread(UpgradeProc);
t_UpgradeConn.IsBackground = true; //t_UpgradeConn.IsBackground = true;
t_UpgradeConn.Start(); //t_UpgradeConn.Start();
run(); run();
} }
...@@ -349,6 +349,7 @@ namespace ModbusDemo ...@@ -349,6 +349,7 @@ namespace ModbusDemo
vControlResponseBack(mqttBackTopic,mqttData_Back); vControlResponseBack(mqttBackTopic,mqttData_Back);
ListHandle.Remove(ListHandle[i]); ListHandle.Remove(ListHandle[i]);
} }
ModualPoll.vCheckAlarm_And_Send(mqttClient);
Thread.Sleep(100); Thread.Sleep(100);
} }
} }
...@@ -366,7 +367,6 @@ namespace ModbusDemo ...@@ -366,7 +367,6 @@ namespace ModbusDemo
bSetDataIsRunning = true; bSetDataIsRunning = true;
ModualPoll.vAllNodePoll(); ModualPoll.vAllNodePoll();
mqttData = ModualPoll.stAll_Poll_Package(); mqttData = ModualPoll.stAll_Poll_Package();
ModualPoll.vCheckAlarm_And_Send(mqttClient);
label5.Text = ModbusComm.usCommunFailTimes.ToString(); label5.Text = ModbusComm.usCommunFailTimes.ToString();
} }
} }
...@@ -1128,12 +1128,12 @@ namespace ModbusDemo ...@@ -1128,12 +1128,12 @@ namespace ModbusDemo
MqttReceiveThread.Priority = ThreadPriority.AboveNormal; MqttReceiveThread.Priority = ThreadPriority.AboveNormal;
Task task1 = Task.Factory.StartNew(async() => {await ModualControl.vControl_Res_Poll();}); Task task1 = Task.Factory.StartNew(async() => {await ModualControl.vControl_Res_Poll();});
// t_AutoControl = new Thread(AtuoControl_run) t_AutoControl = new Thread(AtuoControl_run)
//{ {
// IsBackground = true IsBackground = true
//}; };
//t_AutoControl.Start(); t_AutoControl.Start();
//t_AutoControl.Priority = ThreadPriority.Normal; t_AutoControl.Priority = ThreadPriority.Normal;
} }
totxt.Log(DateTime.Now.ToString() + " =>Open " + comPort.PortName + " sucessfully!"); totxt.Log(DateTime.Now.ToString() + " =>Open " + comPort.PortName + " sucessfully!");
await Subscribe(); await Subscribe();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment