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>
......
...@@ -11,7 +11,7 @@ namespace ModbusDemo.application ...@@ -11,7 +11,7 @@ namespace ModbusDemo.application
#if DEBUG_TEST #if DEBUG_TEST
public static class AllPond public static class AllPond
{ {
#region 东中转池
private static ModualPool.pcTemperature cEastTransitPoolTemper = new ModualPool.pcTemperature("EastTransitPoolTemper", 27, "d0"); private static ModualPool.pcTemperature cEastTransitPoolTemper = new ModualPool.pcTemperature("EastTransitPoolTemper", 27, "d0");
private static ModualPool.pcLiquidlevel cEastTransitPoolLevel = new ModualPool.pcLiquidlevel("EastTransitPoolLevel", 13, "d0"); private static ModualPool.pcLiquidlevel cEastTransitPoolLevel = new ModualPool.pcLiquidlevel("EastTransitPoolLevel", 13, "d0");
private static ModualPool.pcOperation cEastTransitPoolSouthWaterBase = new ModualPool.pcOperation private static ModualPool.pcOperation cEastTransitPoolSouthWaterBase = new ModualPool.pcOperation
...@@ -120,7 +120,6 @@ namespace ModbusDemo.application ...@@ -120,7 +120,6 @@ namespace ModbusDemo.application
private static ModualPool.pcMachine cEastTransitPoolStirrer4 = new ModualPool.pcMachine("EastTransitPoolStirrer_4", cEastTransitPoolStirrer4Base); private static ModualPool.pcMachine cEastTransitPoolStirrer4 = new ModualPool.pcMachine("EastTransitPoolStirrer_4", cEastTransitPoolStirrer4Base);
public static List<ModualPool.pcMachine> EastTransitPoolList = new List<ModualPool.pcMachine>(new ModualPool.pcMachine[] { cEastTransitPoolSouthWater, cEastTransitPoolNorthWater, cEastTransitPoolPumb1, cEastTransitPoolPumb2, cEastTransitPoolStirrer1, cEastTransitPoolStirrer2, cEastTransitPoolStirrer3, cEastTransitPoolStirrer4 }); public static List<ModualPool.pcMachine> EastTransitPoolList = new List<ModualPool.pcMachine>(new ModualPool.pcMachine[] { cEastTransitPoolSouthWater, cEastTransitPoolNorthWater, cEastTransitPoolPumb1, cEastTransitPoolPumb2, cEastTransitPoolStirrer1, cEastTransitPoolStirrer2, cEastTransitPoolStirrer3, cEastTransitPoolStirrer4 });
public static class cEastTransitPool public static class cEastTransitPool
{ {
public static double vSetMaxLevel; public static double vSetMaxLevel;
...@@ -137,10 +136,10 @@ namespace ModbusDemo.application ...@@ -137,10 +136,10 @@ namespace ModbusDemo.application
public static ModualPool.pcMachine cStirrer4 { get => cEastTransitPoolStirrer4; set => cEastTransitPoolStirrer4 = value; } public static ModualPool.pcMachine cStirrer4 { get => cEastTransitPoolStirrer4; set => cEastTransitPoolStirrer4 = value; }
} }
#endregion
#region 西中转池
private static ModualPool.pcTemperature cWestTransitPoolTemper = new ModualPool.pcTemperature("WestTransitPoolTemper", 27, "d0"); private static ModualPool.pcTemperature cWestTransitPoolTemper = new ModualPool.pcTemperature("WestTransitPoolTemper", 27, "d0");
private static ModualPool.pcLiquidlevel cWestTransitPoolLevel = new ModualPool.pcLiquidlevel("WestTransitPoolLevel", 13, "d0"); private static ModualPool.pcLiquidlevel cWestTransitPoolLevel = new ModualPool.pcLiquidlevel("WestTransitPoolLevel", 13, "d3");
private static ModualPool.pcOperation cWestTransitPoolSouthWaterBase = new ModualPool.pcOperation private static ModualPool.pcOperation cWestTransitPoolSouthWaterBase = new ModualPool.pcOperation
{ {
byModbusID = 35, byModbusID = 35,
...@@ -254,6 +253,8 @@ namespace ModbusDemo.application ...@@ -254,6 +253,8 @@ namespace ModbusDemo.application
public static double vSetMinLevel; public static double vSetMinLevel;
public static ModualPool.pcTemperature cTemper { get => cWestTransitPoolTemper; set => cWestTransitPoolTemper = value; } public static ModualPool.pcTemperature cTemper { get => cWestTransitPoolTemper; set => cWestTransitPoolTemper = value; }
public static ModualPool.pcLiquidlevel cLevel { get => cWestTransitPoolLevel; set => cWestTransitPoolLevel = value; } public static ModualPool.pcLiquidlevel cLevel { get => cWestTransitPoolLevel; set => cWestTransitPoolLevel = value; }
public static ModualPool.pcMachine cSouthWater { get => cWestTransitPoolSouthWater; set => cWestTransitPoolSouthWater = value; }
public static ModualPool.pcMachine cNorthWater { get => cWestTransitPoolNorthWater; set => cWestTransitPoolNorthWater = value; }
public static ModualPool.pcMachine cPumb1 { get => cWestTransitPoolPumb1; set => cWestTransitPoolPumb1 = value; } public static ModualPool.pcMachine cPumb1 { get => cWestTransitPoolPumb1; set => cWestTransitPoolPumb1 = value; }
public static ModualPool.pcMachine cPumb2 { get => cWestTransitPoolPumb2; set => cWestTransitPoolPumb2 = value; } public static ModualPool.pcMachine cPumb2 { get => cWestTransitPoolPumb2; set => cWestTransitPoolPumb2 = value; }
public static ModualPool.pcMachine cStirrer1 { get => cWestTransitPoolStirrer1; set => cWestTransitPoolStirrer1 = value; } public static ModualPool.pcMachine cStirrer1 { get => cWestTransitPoolStirrer1; set => cWestTransitPoolStirrer1 = value; }
...@@ -262,17 +263,18 @@ namespace ModbusDemo.application ...@@ -262,17 +263,18 @@ namespace ModbusDemo.application
public static ModualPool.pcMachine cStirrer4 { get => cWestTransitPoolStirrer4; set => cWestTransitPoolStirrer4 = value; } public static ModualPool.pcMachine cStirrer4 { get => cWestTransitPoolStirrer4; set => cWestTransitPoolStirrer4 = value; }
} }
#endregion
#region 沉砂池
private static ModualPool.pcTemperature cDesiltingPoolTemper = new ModualPool.pcTemperature("DesiltingPoolTemper", 27, "d0"); private static ModualPool.pcTemperature cDesiltingPoolTemper = new ModualPool.pcTemperature("DesiltingPoolTemper", 27, "d0");
private static ModualPool.pcLiquidlevel cDesiltingPoolLevel = new ModualPool.pcLiquidlevel("DesiltingPoolLevel", 13, "d0"); private static ModualPool.pcLiquidlevel cDesiltingPoolLevel = new ModualPool.pcLiquidlevel("DesiltingPoolLevel", 13, "d4");
private static ModualPool.pcOperation cDesiltingPoolPumb1Base = new ModualPool.pcOperation private static ModualPool.pcOperation cDesiltingPoolPumb1Base = new ModualPool.pcOperation
{ {
byModbusID = 31, byModbusID = 39,
strOperationNumber = "d2", strOperationNumber = "d4",
strChannelNumber = new string[] { "d2", "d3" }, strChannelNumber = new string[] { "d4" },
bOpenOperation = new bool[] { true, true }, bOpenOperation = new bool[] { true},
bCloseOperation = new bool[] { false, false }, bCloseOperation = new bool[] { false},
bHadRefControl = false, bHadRefControl = false,
byResModbusID = 0, byResModbusID = 0,
strResChannelNumber = null strResChannelNumber = null
...@@ -282,10 +284,10 @@ namespace ModbusDemo.application ...@@ -282,10 +284,10 @@ namespace ModbusDemo.application
private static ModualPool.pcOperation cDesiltingPoolPumb2Base = new ModualPool.pcOperation private static ModualPool.pcOperation cDesiltingPoolPumb2Base = new ModualPool.pcOperation
{ {
byModbusID = 39, byModbusID = 39,
strOperationNumber = "d2", strOperationNumber = "d5",
strChannelNumber = new string[] { "d2", "d3" }, strChannelNumber = new string[] { "d5" },
bOpenOperation = new bool[] { true, true }, bOpenOperation = new bool[] { true },
bCloseOperation = new bool[] { false, true }, bCloseOperation = new bool[] { false},
bHadRefControl = false, bHadRefControl = false,
byResModbusID = 0, byResModbusID = 0,
strResChannelNumber = null strResChannelNumber = null
...@@ -322,9 +324,9 @@ namespace ModbusDemo.application ...@@ -322,9 +324,9 @@ namespace ModbusDemo.application
{ {
byModbusID = 31, byModbusID = 31,
strOperationNumber = "d4", strOperationNumber = "d4",
strChannelNumber = new string[] { "d4","d5" }, strChannelNumber = new string[] { "d4"},
bOpenOperation = new bool[] { true,true }, bOpenOperation = new bool[] { true},
bCloseOperation = new bool[] { false,false }, bCloseOperation = new bool[] { false },
bHadRefControl = false, bHadRefControl = false,
byResModbusID = 0xFF, byResModbusID = 0xFF,
strResChannelNumber = null strResChannelNumber = null
...@@ -334,8 +336,8 @@ namespace ModbusDemo.application ...@@ -334,8 +336,8 @@ namespace ModbusDemo.application
private static ModualPool.pcOperation cDesiltingPoolStirrer2Base = new ModualPool.pcOperation private static ModualPool.pcOperation cDesiltingPoolStirrer2Base = new ModualPool.pcOperation
{ {
byModbusID = 90, byModbusID = 90,
strOperationNumber = "d1", strOperationNumber = "d5",
strChannelNumber = new string[] { "d1" }, strChannelNumber = new string[] { "d5" },
bOpenOperation = new bool[] { true }, bOpenOperation = new bool[] { true },
bCloseOperation = new bool[] { false }, bCloseOperation = new bool[] { false },
bHadRefControl = false, bHadRefControl = false,
...@@ -390,7 +392,8 @@ namespace ModbusDemo.application ...@@ -390,7 +392,8 @@ namespace ModbusDemo.application
} }
#endregion
#region 出料池
private static ModualPool.pcTemperature cDischargePoolTemper = new ModualPool.pcTemperature("DischargePoolTemper", 27, "d0"); private static ModualPool.pcTemperature cDischargePoolTemper = new ModualPool.pcTemperature("DischargePoolTemper", 27, "d0");
private static ModualPool.pcLiquidlevel cDischargePoolLevel = new ModualPool.pcLiquidlevel("DischargePoolLevel", 13, "d0"); private static ModualPool.pcLiquidlevel cDischargePoolLevel = new ModualPool.pcLiquidlevel("DischargePoolLevel", 13, "d0");
...@@ -433,18 +436,18 @@ namespace ModbusDemo.application ...@@ -433,18 +436,18 @@ namespace ModbusDemo.application
} }
#endregion
#region 匀浆池
private static ModualPool.pcTemperature cSlurryPoolTemper = new ModualPool.pcTemperature("SlurryPoolTemper", 27, "d0"); private static ModualPool.pcTemperature cSlurryPoolTemper = new ModualPool.pcTemperature("SlurryPoolTemper", 27, "d0");
private static ModualPool.pcLiquidlevel cSlurryPoolLevel = new ModualPool.pcLiquidlevel("SlurryPoolLevel", 13, "d0"); private static ModualPool.pcLiquidlevel cSlurryPoolLevel = new ModualPool.pcLiquidlevel("SlurryPoolLevel", 13, "d2");
private static ModualPool.pcOperation cSlurryPoolPumb1Base = new ModualPool.pcOperation private static ModualPool.pcOperation cSlurryPoolPumb1Base = new ModualPool.pcOperation
{ {
byModbusID = 31, byModbusID = 31,
strOperationNumber = "d2", strOperationNumber = "d0",
strChannelNumber = new string[] { "d2", "d3" }, strChannelNumber = new string[] { "d0" },
bOpenOperation = new bool[] { true, true }, bOpenOperation = new bool[] { true},
bCloseOperation = new bool[] { false, false }, bCloseOperation = new bool[] { false},
bHadRefControl = false, bHadRefControl = false,
byResModbusID = 0, byResModbusID = 0,
strResChannelNumber = null strResChannelNumber = null
...@@ -454,10 +457,10 @@ namespace ModbusDemo.application ...@@ -454,10 +457,10 @@ namespace ModbusDemo.application
private static ModualPool.pcOperation cSlurryPoolStirrer1Base = new ModualPool.pcOperation private static ModualPool.pcOperation cSlurryPoolStirrer1Base = new ModualPool.pcOperation
{ {
byModbusID = 31, byModbusID = 31,
strOperationNumber = "d4", strOperationNumber = "d1",
strChannelNumber = new string[] { "d4","d5" }, strChannelNumber = new string[] { "d1"},
bOpenOperation = new bool[] { true,true }, bOpenOperation = new bool[] { true },
bCloseOperation = new bool[] { false,false }, bCloseOperation = new bool[] { false},
bHadRefControl = false, bHadRefControl = false,
byResModbusID = 0xFF, byResModbusID = 0xFF,
strResChannelNumber = null strResChannelNumber = null
...@@ -476,7 +479,8 @@ namespace ModbusDemo.application ...@@ -476,7 +479,8 @@ namespace ModbusDemo.application
public static ModualPool.pcMachine cStirrer1 { get => cSlurryPoolStirrer1; set => cSlurryPoolStirrer1 = value; } public static ModualPool.pcMachine cStirrer1 { get => cSlurryPoolStirrer1; set => cSlurryPoolStirrer1 = value; }
} }
#endregion
#region 八角池
private static ModualPool.pcTemperature cOctagonalPoolTemper = new ModualPool.pcTemperature("OctagonalPoolTemper", 27, "d0"); private static ModualPool.pcTemperature cOctagonalPoolTemper = new ModualPool.pcTemperature("OctagonalPoolTemper", 27, "d0");
private static ModualPool.pcLiquidlevel cOctagonalPoolLevel = new ModualPool.pcLiquidlevel("OctagonalPoolLevel", 13, "d0"); private static ModualPool.pcLiquidlevel cOctagonalPoolLevel = new ModualPool.pcLiquidlevel("OctagonalPoolLevel", 13, "d0");
...@@ -546,7 +550,8 @@ namespace ModbusDemo.application ...@@ -546,7 +550,8 @@ namespace ModbusDemo.application
public static ModualPool.pcMachine cStirrer2 { get => cOctagonalPoolStirrer2; set => cOctagonalPoolStirrer2 = value; } public static ModualPool.pcMachine cStirrer2 { get => cOctagonalPoolStirrer2; set => cOctagonalPoolStirrer2 = value; }
} }
#endregion
#region 中控柜
private static ModualPool.pcButtonOperation cFeedstockStartButton1Base = new ModualPool.pcButtonOperation private static ModualPool.pcButtonOperation cFeedstockStartButton1Base = new ModualPool.pcButtonOperation
{ {
byModbusID = 16, byModbusID = 16,
...@@ -878,8 +883,8 @@ namespace ModbusDemo.application ...@@ -878,8 +883,8 @@ namespace ModbusDemo.application
public static ModualPool.pcButton cPauseButton8 { get => cFeedstockPauseButton8; set => cFeedstockPauseButton8 = value; } public static ModualPool.pcButton cPauseButton8 { get => cFeedstockPauseButton8; set => cFeedstockPauseButton8 = value; }
public static ModualPool.pcButton cHandButton8 { get => cFeedstockHandButton8; set => cFeedstockHandButton8 = value; } public static ModualPool.pcButton cHandButton8 { get => cFeedstockHandButton8; set => cFeedstockHandButton8 = value; }
} }
#endregion
} }
#else #else
public static class AllPond public static class AllPond
{ {
......
...@@ -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