Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
PastureGateway
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
steven.sha
PastureGateway
Commits
506c66e6
Commit
506c66e6
authored
Jun 24, 2019
by
leon.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add local teset bind
parent
8f1fbb7e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
189 additions
and
60 deletions
+189
-60
ModualControl.cs
ModbusDemo/MessageFormat/ModualControl.cs
+1
-1
ModbusDemo.csproj
ModbusDemo/ModbusDemo.csproj
+1
-1
AllPond.cs
ModbusDemo/application/AllPond.cs
+41
-36
AutoControl.cs
ModbusDemo/application/AutoControl.cs
+0
-4
ControlMap.cs
ModbusDemo/application/ControlMap.cs
+135
-7
Form1.cs
ModbusDemo/windows/Form1.cs
+11
-11
No files found.
ModbusDemo/MessageFormat/ModualControl.cs
View file @
506c66e6
...
...
@@ -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
;
...
...
ModbusDemo/ModbusDemo.csproj
View file @
506c66e6
...
...
@@ -43,7 +43,7 @@
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
bin\Debug\
</OutputPath>
<DefineConstants>
TRACE;DEBUG;DEBUG_TEST
1
</DefineConstants>
<DefineConstants>
TRACE;DEBUG;DEBUG_TEST
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
<Prefer32Bit>
false
</Prefer32Bit>
...
...
ModbusDemo/application/AllPond.cs
View file @
506c66e6
...
...
@@ -11,7 +11,7 @@ namespace ModbusDemo.application
#if DEBUG_TEST
public
static
class
AllPond
{
#
region
东中转池
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
.
pcOperation
cEastTransitPoolSouthWaterBase
=
new
ModualPool
.
pcOperation
...
...
@@ -120,7 +120,6 @@ namespace ModbusDemo.application
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
class
cEastTransitPool
{
public
static
double
vSetMaxLevel
;
...
...
@@ -137,10 +136,10 @@ namespace ModbusDemo.application
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
.
pcLiquidlevel
cWestTransitPoolLevel
=
new
ModualPool
.
pcLiquidlevel
(
"WestTransitPoolLevel"
,
13
,
"d
0
"
);
private
static
ModualPool
.
pcLiquidlevel
cWestTransitPoolLevel
=
new
ModualPool
.
pcLiquidlevel
(
"WestTransitPoolLevel"
,
13
,
"d
3
"
);
private
static
ModualPool
.
pcOperation
cWestTransitPoolSouthWaterBase
=
new
ModualPool
.
pcOperation
{
byModbusID
=
35
,
...
...
@@ -254,6 +253,8 @@ namespace ModbusDemo.application
public
static
double
vSetMinLevel
;
public
static
ModualPool
.
pcTemperature
cTemper
{
get
=>
cWestTransitPoolTemper
;
set
=>
cWestTransitPoolTemper
=
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
cPumb2
{
get
=>
cWestTransitPoolPumb2
;
set
=>
cWestTransitPoolPumb2
=
value
;
}
public
static
ModualPool
.
pcMachine
cStirrer1
{
get
=>
cWestTransitPoolStirrer1
;
set
=>
cWestTransitPoolStirrer1
=
value
;
}
...
...
@@ -262,17 +263,18 @@ namespace ModbusDemo.application
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
.
pcLiquidlevel
cDesiltingPoolLevel
=
new
ModualPool
.
pcLiquidlevel
(
"DesiltingPoolLevel"
,
13
,
"d
0
"
);
private
static
ModualPool
.
pcLiquidlevel
cDesiltingPoolLevel
=
new
ModualPool
.
pcLiquidlevel
(
"DesiltingPoolLevel"
,
13
,
"d
4
"
);
private
static
ModualPool
.
pcOperation
cDesiltingPoolPumb1Base
=
new
ModualPool
.
pcOperation
{
byModbusID
=
3
1
,
strOperationNumber
=
"d
2
"
,
strChannelNumber
=
new
string
[]
{
"d
2"
,
"d3
"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
byModbusID
=
3
9
,
strOperationNumber
=
"d
4
"
,
strChannelNumber
=
new
string
[]
{
"d
4
"
},
bOpenOperation
=
new
bool
[]
{
true
},
bCloseOperation
=
new
bool
[]
{
false
},
bHadRefControl
=
false
,
byResModbusID
=
0
,
strResChannelNumber
=
null
...
...
@@ -282,10 +284,10 @@ namespace ModbusDemo.application
private
static
ModualPool
.
pcOperation
cDesiltingPoolPumb2Base
=
new
ModualPool
.
pcOperation
{
byModbusID
=
39
,
strOperationNumber
=
"d
2
"
,
strChannelNumber
=
new
string
[]
{
"d
2"
,
"d3
"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
true
},
strOperationNumber
=
"d
5
"
,
strChannelNumber
=
new
string
[]
{
"d
5
"
},
bOpenOperation
=
new
bool
[]
{
true
},
bCloseOperation
=
new
bool
[]
{
false
},
bHadRefControl
=
false
,
byResModbusID
=
0
,
strResChannelNumber
=
null
...
...
@@ -322,9 +324,9 @@ namespace ModbusDemo.application
{
byModbusID
=
31
,
strOperationNumber
=
"d4"
,
strChannelNumber
=
new
string
[]
{
"d4"
,
"d5"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
strChannelNumber
=
new
string
[]
{
"d4"
},
bOpenOperation
=
new
bool
[]
{
true
},
bCloseOperation
=
new
bool
[]
{
false
},
bHadRefControl
=
false
,
byResModbusID
=
0xFF
,
strResChannelNumber
=
null
...
...
@@ -334,8 +336,8 @@ namespace ModbusDemo.application
private
static
ModualPool
.
pcOperation
cDesiltingPoolStirrer2Base
=
new
ModualPool
.
pcOperation
{
byModbusID
=
90
,
strOperationNumber
=
"d
1
"
,
strChannelNumber
=
new
string
[]
{
"d
1
"
},
strOperationNumber
=
"d
5
"
,
strChannelNumber
=
new
string
[]
{
"d
5
"
},
bOpenOperation
=
new
bool
[]
{
true
},
bCloseOperation
=
new
bool
[]
{
false
},
bHadRefControl
=
false
,
...
...
@@ -390,7 +392,8 @@ namespace ModbusDemo.application
}
#
endregion
#
region
出料池
private
static
ModualPool
.
pcTemperature
cDischargePoolTemper
=
new
ModualPool
.
pcTemperature
(
"DischargePoolTemper"
,
27
,
"d0"
);
private
static
ModualPool
.
pcLiquidlevel
cDischargePoolLevel
=
new
ModualPool
.
pcLiquidlevel
(
"DischargePoolLevel"
,
13
,
"d0"
);
...
...
@@ -433,18 +436,18 @@ namespace ModbusDemo.application
}
#
endregion
#
region
匀浆池
private
static
ModualPool
.
pcTemperature
cSlurryPoolTemper
=
new
ModualPool
.
pcTemperature
(
"SlurryPoolTemper"
,
27
,
"d0"
);
private
static
ModualPool
.
pcLiquidlevel
cSlurryPoolLevel
=
new
ModualPool
.
pcLiquidlevel
(
"SlurryPoolLevel"
,
13
,
"d
0
"
);
private
static
ModualPool
.
pcLiquidlevel
cSlurryPoolLevel
=
new
ModualPool
.
pcLiquidlevel
(
"SlurryPoolLevel"
,
13
,
"d
2
"
);
private
static
ModualPool
.
pcOperation
cSlurryPoolPumb1Base
=
new
ModualPool
.
pcOperation
{
byModbusID
=
31
,
strOperationNumber
=
"d
2
"
,
strChannelNumber
=
new
string
[]
{
"d
2"
,
"d3
"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
strOperationNumber
=
"d
0
"
,
strChannelNumber
=
new
string
[]
{
"d
0
"
},
bOpenOperation
=
new
bool
[]
{
true
},
bCloseOperation
=
new
bool
[]
{
false
},
bHadRefControl
=
false
,
byResModbusID
=
0
,
strResChannelNumber
=
null
...
...
@@ -454,10 +457,10 @@ namespace ModbusDemo.application
private
static
ModualPool
.
pcOperation
cSlurryPoolStirrer1Base
=
new
ModualPool
.
pcOperation
{
byModbusID
=
31
,
strOperationNumber
=
"d
4
"
,
strChannelNumber
=
new
string
[]
{
"d
4"
,
"d5"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
strOperationNumber
=
"d
1
"
,
strChannelNumber
=
new
string
[]
{
"d
1"
},
bOpenOperation
=
new
bool
[]
{
true
},
bCloseOperation
=
new
bool
[]
{
false
},
bHadRefControl
=
false
,
byResModbusID
=
0xFF
,
strResChannelNumber
=
null
...
...
@@ -476,7 +479,8 @@ namespace ModbusDemo.application
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
.
pcLiquidlevel
cOctagonalPoolLevel
=
new
ModualPool
.
pcLiquidlevel
(
"OctagonalPoolLevel"
,
13
,
"d0"
);
...
...
@@ -546,7 +550,8 @@ namespace ModbusDemo.application
public
static
ModualPool
.
pcMachine
cStirrer2
{
get
=>
cOctagonalPoolStirrer2
;
set
=>
cOctagonalPoolStirrer2
=
value
;
}
}
#
endregion
#
region
中控柜
private
static
ModualPool
.
pcButtonOperation
cFeedstockStartButton1Base
=
new
ModualPool
.
pcButtonOperation
{
byModbusID
=
16
,
...
...
@@ -878,8 +883,8 @@ namespace ModbusDemo.application
public
static
ModualPool
.
pcButton
cPauseButton8
{
get
=>
cFeedstockPauseButton8
;
set
=>
cFeedstockPauseButton8
=
value
;
}
public
static
ModualPool
.
pcButton
cHandButton8
{
get
=>
cFeedstockHandButton8
;
set
=>
cFeedstockHandButton8
=
value
;
}
}
#
endregion
}
#else
public
static
class
AllPond
{
...
...
ModbusDemo/application/AutoControl.cs
View file @
506c66e6
...
...
@@ -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"
);
}
...
...
ModbusDemo/application/ControlMap.cs
View file @
506c66e6
...
...
@@ -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
]
==
"d
0
"
)
else
if
(
byControlID
==
16
&&
strOperationChannelName
[
0
]
==
"d
2
"
)
{
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
==
3
5
&&
strOperationChannelName
[
0
]
==
"d0
"
)
else
if
(
byControlID
==
3
9
&&
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
;
...
...
ModbusDemo/windows/Form1.cs
View file @
506c66e6
...
...
@@ -26,7 +26,7 @@ namespace ModbusDemo
{
public
partial
class
Form1
:
Form
{
const
bool
LOCALDEBUG
=
tru
e
;
const
bool
LOCALDEBUG
=
fals
e
;
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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment