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

add local teset bind

parent 8f1fbb7e
......@@ -103,7 +103,7 @@ namespace ModbusDemo.MessageFormat
}
private const double OPENCURRENT = 7;
private const double CLOSECURRENT = 4;
private const double CLOSECURRENT = 5;
public class pcLiquidLevelConfig
{
public byte byModbusID;
......
......@@ -43,7 +43,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;DEBUG_TEST1</DefineConstants>
<DefineConstants>TRACE;DEBUG;DEBUG_TEST</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
......
This diff is collapsed.
......@@ -172,7 +172,6 @@ namespace ModbusDemo.application
else
{
ModualAlarm.vSet_Modual_Alarm(EmodbusId[i],
(ushort)ModbusComm.eModbusErrorCode.MB_EMASTERNOERR |
(ushort)ModualAlarm.eAlarmCode.ChannelCommunError, true, 1,
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7");
}
......@@ -188,7 +187,6 @@ namespace ModbusDemo.application
else
{
ModualAlarm.vSet_Modual_Alarm(EmodbusId[i + 1],
(ushort)ModbusComm.eModbusErrorCode.MB_EMASTERNOERR |
(ushort)ModualAlarm.eAlarmCode.ChannelCommunError, true, 1,
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7");
}
......@@ -266,7 +264,6 @@ namespace ModbusDemo.application
else
{
ModualAlarm.vSet_Modual_Alarm(WmodbusId[i],
(ushort)ModbusComm.eModbusErrorCode.MB_EMASTERNOERR |
(ushort)ModualAlarm.eAlarmCode.ChannelCommunError, true, 1,
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7");
}
......@@ -282,7 +279,6 @@ namespace ModbusDemo.application
else
{
ModualAlarm.vSet_Modual_Alarm(WmodbusId[i+1],
(ushort)ModbusComm.eModbusErrorCode.MB_EMASTERNOERR |
(ushort)ModualAlarm.eAlarmCode.ChannelCommunError, true, 1,
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7");
}
......
......@@ -60,34 +60,84 @@ namespace ModbusDemo.application
bool bMapStatus = true;
if (bOpen == true)
{
if (byControlID == 31 && strOperationChannelName[0] == "d1")
#region 东中转池开映射
if (byControlID == 16 && strOperationChannelName[0] == "d0")
{
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;
}
else if (byControlID == 16 && strOperationChannelName[0] == "d2")
else if (byControlID == 39 && strOperationChannelName[0] == "d0")
{
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;
}
else if (byControlID == 35 && strOperationChannelName[0] == "d2")
else if (byControlID == 90 && strOperationChannelName[0] == "d0")
{
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;
}
else if (byControlID == 39 && strOperationChannelName[0] == "d2")
else if (byControlID == 90 && strOperationChannelName[0] == "d2")
{
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
{
byMapIdleID = byControlID;
......@@ -98,6 +148,84 @@ namespace ModbusDemo.application
}
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")
{
bDelege_Operation = AllPond.cEastTransitPool.cSouthWater.bClose_Machine;
......
......@@ -26,7 +26,7 @@ namespace ModbusDemo
{
public partial class Form1 : Form
{
const bool LOCALDEBUG = true;
const bool LOCALDEBUG = false;
private bool bStart = false;
AutoResetEvent exitEvent;
private int waitTime;
......@@ -58,9 +58,9 @@ namespace ModbusDemo
exitEvent = new AutoResetEvent(false);
waitTime = 6000;
t_UpgradeConn = new Thread(UpgradeProc);
t_UpgradeConn.IsBackground = true;
t_UpgradeConn.Start();
//t_UpgradeConn = new Thread(UpgradeProc);
//t_UpgradeConn.IsBackground = true;
//t_UpgradeConn.Start();
run();
}
......@@ -349,6 +349,7 @@ namespace ModbusDemo
vControlResponseBack(mqttBackTopic,mqttData_Back);
ListHandle.Remove(ListHandle[i]);
}
ModualPoll.vCheckAlarm_And_Send(mqttClient);
Thread.Sleep(100);
}
}
......@@ -366,7 +367,6 @@ namespace ModbusDemo
bSetDataIsRunning = true;
ModualPoll.vAllNodePoll();
mqttData = ModualPoll.stAll_Poll_Package();
ModualPoll.vCheckAlarm_And_Send(mqttClient);
label5.Text = ModbusComm.usCommunFailTimes.ToString();
}
}
......@@ -1128,12 +1128,12 @@ namespace ModbusDemo
MqttReceiveThread.Priority = ThreadPriority.AboveNormal;
Task task1 = Task.Factory.StartNew(async() => {await ModualControl.vControl_Res_Poll();});
// t_AutoControl = new Thread(AtuoControl_run)
//{
// IsBackground = true
//};
//t_AutoControl.Start();
//t_AutoControl.Priority = ThreadPriority.Normal;
t_AutoControl = new Thread(AtuoControl_run)
{
IsBackground = true
};
t_AutoControl.Start();
t_AutoControl.Priority = ThreadPriority.Normal;
}
totxt.Log(DateTime.Now.ToString() + " =>Open " + comPort.PortName + " sucessfully!");
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