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
bb1d1cfa
Commit
bb1d1cfa
authored
Jun 30, 2019
by
leon.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix feedback control bug
parent
09f7e49d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
299 additions
and
217 deletions
+299
-217
ModualControl.cs
ModbusDemo/MessageFormat/ModualControl.cs
+72
-54
ModualPoll.cs
ModbusDemo/Modular/ModualPoll.cs
+53
-16
AllPond.cs
ModbusDemo/application/AllPond.cs
+5
-5
AutoControl.cs
ModbusDemo/application/AutoControl.cs
+42
-15
ControlMap.cs
ModbusDemo/application/ControlMap.cs
+124
-124
ModualPool.cs
ModbusDemo/application/ModualPool.cs
+1
-1
Form1.cs
ModbusDemo/windows/Form1.cs
+2
-2
No files found.
ModbusDemo/MessageFormat/ModualControl.cs
View file @
bb1d1cfa
...
...
@@ -103,7 +103,7 @@ namespace ModbusDemo.MessageFormat
}
private
const
double
OPENCURRENT
=
7
;
private
const
double
CLOSECURRENT
=
6
;
private
const
double
CLOSECURRENT
=
5
;
public
class
pcLiquidLevelConfig
{
public
byte
byModbusID
;
...
...
@@ -292,6 +292,7 @@ namespace ModbusDemo.MessageFormat
public
static
Task
vControl_Res_Poll
()
{
vInit_Level_Config
();
double
dCurrertLevel
=
0
;
while
(
true
)
{
#
region
东中转反馈和液位检测
...
...
@@ -299,7 +300,7 @@ namespace ModbusDemo.MessageFormat
{
if
(
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
bHadRefControl
==
true
&&
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
bHadOpenPumb
==
true
)
{
if
(
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
dChannelCurrent
<
OPENCURRENT
&&
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
dChannelCurrent
!=
0
)
if
(
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
dChannelCurrent
<
OPENCURRENT
&&
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
dChannelCurrent
>=
4
&&
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
dChannelCurrent
<
21
)
{
bool
[]
bControlData
;
...
...
@@ -331,7 +332,7 @@ namespace ModbusDemo.MessageFormat
}
if
(
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
bHadRefControl
==
true
&&
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
bHadOpenPumb
==
false
)
{
if
(
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
dChannelCurrent
>
CLOSECURRENT
&&
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
dChannelCurrent
!=
0
)
if
(
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
dChannelCurrent
>
CLOSECURRENT
&&
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
dChannelCurrent
>=
4
&&
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
dChannelCurrent
<
21
)
{
if
(
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
iRefAlarmCnt
<
AllPond
.
EastTransitPoolList
[
sbEastTransitPoolIndex
].
MaxAlarmfeedback
)
{
...
...
@@ -352,13 +353,16 @@ namespace ModbusDemo.MessageFormat
}
Thread
.
Sleep
(
200
);
}
if
(
AllPond
.
cEastTransitPool
.
cLevel
.
dCurrentlevel
>=
AllPond
.
cEastTransitPool
.
vSetMaxLevel
||
AllPond
.
cEastTransitPool
.
cLevel
.
dCurrentlevel
<=
AllPond
.
cEastTransitPool
.
vSetMinLevel
)
if
(
(
dCurrertLevel
=
AllPond
.
cEastTransitPool
.
cLevel
.
dCurrentlevel
)
>
0
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cEastTransitPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
true
,
1
,
AllPond
.
cEastTransitPool
.
cLevel
.
strChannelNumber
);
}
else
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cEastTransitPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
false
,
1
,
AllPond
.
cEastTransitPool
.
cLevel
.
strChannelNumber
);
if
(
dCurrertLevel
>=
AllPond
.
cEastTransitPool
.
vSetMaxLevel
||
dCurrertLevel
<=
AllPond
.
cEastTransitPool
.
vSetMinLevel
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cEastTransitPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
true
,
1
,
AllPond
.
cEastTransitPool
.
cLevel
.
strChannelNumber
);
}
else
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cEastTransitPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
false
,
1
,
AllPond
.
cEastTransitPool
.
cLevel
.
strChannelNumber
);
}
}
Thread
.
Sleep
(
1000
);
#
endregion
...
...
@@ -367,7 +371,7 @@ namespace ModbusDemo.MessageFormat
{
if
(
AllPond
.
WestTransitPoolList
[
sbWestTransitPoolIndex
].
bHadRefControl
==
true
&&
AllPond
.
WestTransitPoolList
[
sbWestTransitPoolIndex
].
bHadOpenPumb
==
true
)
{
if
(
AllPond
.
WestTransitPoolList
[
sbWestTransitPoolIndex
].
dChannelCurrent
<
OPENCURRENT
&&
AllPond
.
WestTransitPoolList
[
sbWestTransitPoolIndex
].
dChannelCurrent
!=
0
)
if
(
AllPond
.
WestTransitPoolList
[
sbWestTransitPoolIndex
].
dChannelCurrent
<
OPENCURRENT
&&
AllPond
.
WestTransitPoolList
[
sbWestTransitPoolIndex
].
dChannelCurrent
>=
4
&&
AllPond
.
WestTransitPoolList
[
sbWestTransitPoolIndex
].
dChannelCurrent
<
21
)
{
bool
[]
bControlData
;
...
...
@@ -395,7 +399,7 @@ namespace ModbusDemo.MessageFormat
{
if
(
AllPond
.
WestTransitPoolList
[
sbWestTransitPoolIndex
].
dChannelCurrent
>
CLOSECURRENT
&&
AllPond
.
WestTransitPoolList
[
sbWestTransitPoolIndex
].
dChannelCurrent
!=
0
)
AllPond
.
WestTransitPoolList
[
sbWestTransitPoolIndex
].
dChannelCurrent
>=
4
&&
AllPond
.
WestTransitPoolList
[
sbWestTransitPoolIndex
].
dChannelCurrent
<
21
)
{
if
(
AllPond
.
WestTransitPoolList
[
sbWestTransitPoolIndex
].
iRefAlarmCnt
<
AllPond
.
WestTransitPoolList
[
sbWestTransitPoolIndex
].
MaxAlarmfeedback
)
{
...
...
@@ -414,15 +418,17 @@ namespace ModbusDemo.MessageFormat
Thread
.
Sleep
(
200
);
}
if
(
AllPond
.
cWestTransitPool
.
cLevel
.
dCurrentlevel
>=
AllPond
.
cWestTransitPool
.
vSetMaxLevel
||
AllPond
.
cWestTransitPool
.
cLevel
.
dCurrentlevel
<=
AllPond
.
cWestTransitPool
.
vSetMinLevel
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cWestTransitPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
true
,
1
,
AllPond
.
cWestTransitPool
.
cLevel
.
strChannelNumber
);
}
else
if
((
dCurrertLevel
=
AllPond
.
cWestTransitPool
.
cLevel
.
dCurrentlevel
)
>
0
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cWestTransitPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
false
,
1
,
AllPond
.
cWestTransitPool
.
cLevel
.
strChannelNumber
);
if
(
dCurrertLevel
>=
AllPond
.
cWestTransitPool
.
vSetMaxLevel
||
dCurrertLevel
<=
AllPond
.
cWestTransitPool
.
vSetMinLevel
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cWestTransitPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
true
,
1
,
AllPond
.
cWestTransitPool
.
cLevel
.
strChannelNumber
);
}
else
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cWestTransitPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
false
,
1
,
AllPond
.
cWestTransitPool
.
cLevel
.
strChannelNumber
);
}
}
Thread
.
Sleep
(
1000
);
#
endregion
#
region
沉砂池反馈和液位检测
...
...
@@ -430,7 +436,7 @@ namespace ModbusDemo.MessageFormat
{
if
(
AllPond
.
DesiltingPoolList
[
sbDesiltingPoolIndex
].
bHadRefControl
==
true
&&
AllPond
.
DesiltingPoolList
[
sbDesiltingPoolIndex
].
bHadOpenPumb
==
true
)
{
//泵是开的
if
(
AllPond
.
DesiltingPoolList
[
sbDesiltingPoolIndex
].
dChannelCurrent
<
OPENCURRENT
&&
AllPond
.
DesiltingPoolList
[
sbDesiltingPoolIndex
].
dChannelCurrent
!=
0
)
if
(
AllPond
.
DesiltingPoolList
[
sbDesiltingPoolIndex
].
dChannelCurrent
<
OPENCURRENT
&&
AllPond
.
DesiltingPoolList
[
sbDesiltingPoolIndex
].
dChannelCurrent
>=
4
&&
AllPond
.
DesiltingPoolList
[
sbDesiltingPoolIndex
].
dChannelCurrent
<
21
)
{
//电流小,当前电流也不等于0
bool
[]
bControlData
;
...
...
@@ -458,7 +464,7 @@ namespace ModbusDemo.MessageFormat
{
//泵是关的
if
(
AllPond
.
DesiltingPoolList
[
sbDesiltingPoolIndex
].
dChannelCurrent
>
CLOSECURRENT
&&
AllPond
.
DesiltingPoolList
[
sbDesiltingPoolIndex
].
dChannelCurrent
!=
0
)
AllPond
.
DesiltingPoolList
[
sbDesiltingPoolIndex
].
dChannelCurrent
>=
4
&&
AllPond
.
DesiltingPoolList
[
sbDesiltingPoolIndex
].
dChannelCurrent
<
21
)
{
if
(
AllPond
.
DesiltingPoolList
[
sbDesiltingPoolIndex
].
iRefAlarmCnt
<
AllPond
.
DesiltingPoolList
[
sbDesiltingPoolIndex
].
MaxAlarmfeedback
)
{
...
...
@@ -475,14 +481,17 @@ namespace ModbusDemo.MessageFormat
}
}
Thread
.
Sleep
(
200
);
}
if
(
AllPond
.
cDesiltingPool
.
cLevel
.
dCurrentlevel
>=
AllPond
.
cDesiltingPool
.
vSetMaxLevel
||
AllPond
.
cDesiltingPool
.
cLevel
.
dCurrentlevel
<=
AllPond
.
cDesiltingPool
.
vSetMinLevel
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cDesiltingPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
true
,
1
,
AllPond
.
cDesiltingPool
.
cLevel
.
strChannelNumber
);
}
else
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cDesiltingPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
false
,
1
,
AllPond
.
cDesiltingPool
.
cLevel
.
strChannelNumber
);
if
((
dCurrertLevel
=
AllPond
.
cDesiltingPool
.
cLevel
.
dCurrentlevel
)
>
0
)
{
if
(
dCurrertLevel
>=
AllPond
.
cDesiltingPool
.
vSetMaxLevel
||
dCurrertLevel
<=
AllPond
.
cDesiltingPool
.
vSetMinLevel
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cDesiltingPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
true
,
1
,
AllPond
.
cDesiltingPool
.
cLevel
.
strChannelNumber
);
}
else
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cDesiltingPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
false
,
1
,
AllPond
.
cDesiltingPool
.
cLevel
.
strChannelNumber
);
}
}
Thread
.
Sleep
(
1000
);
#
endregion
...
...
@@ -492,7 +501,7 @@ namespace ModbusDemo.MessageFormat
{
if
(
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
bHadRefControl
==
true
&&
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
bHadOpenPumb
==
true
)
{
if
(
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
dChannelCurrent
<
OPENCURRENT
&&
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
dChannelCurrent
!=
0
)
if
(
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
dChannelCurrent
<
OPENCURRENT
&&
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
dChannelCurrent
>=
4
&&
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
dChannelCurrent
<
21
)
{
bool
[]
bControlData
;
...
...
@@ -520,7 +529,7 @@ namespace ModbusDemo.MessageFormat
}
if
(
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
bHadRefControl
==
true
&&
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
bHadOpenPumb
==
false
)
{
if
(
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
dChannelCurrent
>
CLOSECURRENT
&&
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
dChannelCurrent
!=
0
)
if
(
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
dChannelCurrent
>
CLOSECURRENT
&&
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
dChannelCurrent
>=
4
&&
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
dChannelCurrent
<
21
)
{
if
(
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
iRefAlarmCnt
<
AllPond
.
DischargePoolList
[
sbDischargePoolIndex
].
MaxAlarmfeedback
)
{
...
...
@@ -537,14 +546,17 @@ namespace ModbusDemo.MessageFormat
}
}
Thread
.
Sleep
(
200
);
}
if
(
AllPond
.
cDischargePool
.
cLevel
.
dCurrentlevel
>=
AllPond
.
cDischargePool
.
vSetMaxLevel
||
AllPond
.
cDischargePool
.
cLevel
.
dCurrentlevel
<=
AllPond
.
cDischargePool
.
vSetMinLevel
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cDischargePool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
true
,
1
,
AllPond
.
cDischargePool
.
cLevel
.
strChannelNumber
);
}
else
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cDischargePool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
false
,
1
,
AllPond
.
cDischargePool
.
cLevel
.
strChannelNumber
);
if
((
dCurrertLevel
=
AllPond
.
cDischargePool
.
cLevel
.
dCurrentlevel
)
>
0
)
{
if
(
dCurrertLevel
>=
AllPond
.
cDischargePool
.
vSetMaxLevel
||
dCurrertLevel
<=
AllPond
.
cDischargePool
.
vSetMinLevel
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cDischargePool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
true
,
1
,
AllPond
.
cDischargePool
.
cLevel
.
strChannelNumber
);
}
else
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cDischargePool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
false
,
1
,
AllPond
.
cDischargePool
.
cLevel
.
strChannelNumber
);
}
}
Thread
.
Sleep
(
1000
);
#
endif
...
...
@@ -554,7 +566,7 @@ namespace ModbusDemo.MessageFormat
{
if
(
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
bHadRefControl
==
true
&&
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
bHadOpenPumb
==
true
)
{
if
(
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
dChannelCurrent
<
OPENCURRENT
&&
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
dChannelCurrent
!=
0
)
if
(
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
dChannelCurrent
<
OPENCURRENT
&&
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
dChannelCurrent
>=
4
&&
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
dChannelCurrent
<
21
)
{
bool
[]
bControlData
;
...
...
@@ -580,7 +592,7 @@ namespace ModbusDemo.MessageFormat
}
if
(
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
bHadRefControl
==
true
&&
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
bHadOpenPumb
==
false
)
{
if
(
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
dChannelCurrent
>
CLOSECURRENT
&&
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
dChannelCurrent
!=
0
)
if
(
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
dChannelCurrent
>
CLOSECURRENT
&&
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
dChannelCurrent
>=
4
&&
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
dChannelCurrent
<
21
)
{
if
(
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
iRefAlarmCnt
<
AllPond
.
SlurryPoolList
[
sbSlurryPoolIndex
].
MaxAlarmfeedback
)
{
...
...
@@ -597,14 +609,17 @@ namespace ModbusDemo.MessageFormat
}
}
Thread
.
Sleep
(
200
);
}
if
(
AllPond
.
cSlurryPool
.
cLevel
.
dCurrentlevel
>=
AllPond
.
cSlurryPool
.
vSetMaxLevel
||
AllPond
.
cSlurryPool
.
cLevel
.
dCurrentlevel
<=
AllPond
.
cSlurryPool
.
vSetMinLevel
)
}
if
((
dCurrertLevel
=
AllPond
.
cSlurryPool
.
cLevel
.
dCurrentlevel
)
>
0
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cSlurryPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
true
,
1
,
AllPond
.
cSlurryPool
.
cLevel
.
strChannelNumber
);
}
else
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cSlurryPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
false
,
1
,
AllPond
.
cSlurryPool
.
cLevel
.
strChannelNumber
);
if
(
dCurrertLevel
>=
AllPond
.
cSlurryPool
.
vSetMaxLevel
||
dCurrertLevel
<=
AllPond
.
cSlurryPool
.
vSetMinLevel
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cSlurryPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
true
,
1
,
AllPond
.
cSlurryPool
.
cLevel
.
strChannelNumber
);
}
else
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cSlurryPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
false
,
1
,
AllPond
.
cSlurryPool
.
cLevel
.
strChannelNumber
);
}
}
Thread
.
Sleep
(
1000
);
#
endregion
...
...
@@ -614,7 +629,7 @@ namespace ModbusDemo.MessageFormat
{
if
(
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
bHadRefControl
==
true
&&
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
bHadOpenPumb
==
true
)
{
if
(
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
dChannelCurrent
<
OPENCURRENT
&&
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
dChannelCurrent
!=
0
)
if
(
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
dChannelCurrent
<
OPENCURRENT
&&
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
dChannelCurrent
>=
4
&&
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
dChannelCurrent
<
21
)
{
bool
[]
bControlData
;
...
...
@@ -640,7 +655,7 @@ namespace ModbusDemo.MessageFormat
}
if
(
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
bHadRefControl
==
true
&&
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
bHadOpenPumb
==
false
)
{
if
(
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
dChannelCurrent
>
CLOSECURRENT
&&
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
dChannelCurrent
!=
0
)
if
(
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
dChannelCurrent
>
CLOSECURRENT
&&
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
dChannelCurrent
>=
4
&&
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
dChannelCurrent
<
21
)
{
if
(
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
iRefAlarmCnt
<
AllPond
.
OctagonalPoolList
[
sbOctagonalPoolIndex
].
MaxAlarmfeedback
)
{
...
...
@@ -657,14 +672,17 @@ namespace ModbusDemo.MessageFormat
}
}
}
if
(
AllPond
.
cOctagonalPool
.
cLevel
.
dCurrentlevel
>=
AllPond
.
cOctagonalPool
.
vSetMaxLevel
||
AllPond
.
cOctagonalPool
.
cLevel
.
dCurrentlevel
<=
AllPond
.
cOctagonalPool
.
vSetMinLevel
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cOctagonalPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
true
,
1
,
AllPond
.
cOctagonalPool
.
cLevel
.
strChannelNumber
);
}
else
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cOctagonalPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
false
,
1
,
AllPond
.
cOctagonalPool
.
cLevel
.
strChannelNumber
);
if
((
dCurrertLevel
=
AllPond
.
cOctagonalPool
.
cLevel
.
dCurrentlevel
)
>
0
)
{
if
(
dCurrertLevel
>=
AllPond
.
cOctagonalPool
.
vSetMaxLevel
||
dCurrertLevel
<=
AllPond
.
cOctagonalPool
.
vSetMinLevel
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cOctagonalPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
true
,
1
,
AllPond
.
cOctagonalPool
.
cLevel
.
strChannelNumber
);
}
else
{
ModualAlarm
.
vSet_Modual_Alarm
(
AllPond
.
cOctagonalPool
.
cLevel
.
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelLevelError
,
false
,
1
,
AllPond
.
cOctagonalPool
.
cLevel
.
strChannelNumber
);
}
}
Thread
.
Sleep
(
1000
);
#
endif
...
...
ModbusDemo/Modular/ModualPoll.cs
View file @
bb1d1cfa
...
...
@@ -564,31 +564,45 @@ namespace ModbusDemo.Modular
for
(
int
k
=
0
;
k
<
byX18xReadTypeNumber
;
k
++)
{
string
str
=
"d"
+
k
.
ToString
();
if
(
str
==
strChannelList
[
j
]
)
if
(
ModbusErrorCode
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
{
switch
(
cx18x
.
beChannelType
[
i
,
k
])
{
case
modual
.
eX18xSensorChannelType
.
Weiertai
:
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
((
double
.
Parse
(
strCalculData
[
k
])
-
4
)
/
16
*
8
);
break
;
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
((
double
.
Parse
(
strCalculData
[
k
])
-
4
)
/
16
*
8
-
1
);
break
;
case
modual
.
eX18xSensorChannelType
.
Mike_5
:
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
((
double
.
Parse
(
strCalculData
[
k
])
-
4
)
/
16
*
5
);
break
;
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
((
double
.
Parse
(
strCalculData
[
k
])
-
4
)
/
16
*
5
);
break
;
case
modual
.
eX18xSensorChannelType
.
Mike_6
:
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
((
double
.
Parse
(
strCalculData
[
k
])
-
4
)
/
16
*
6
);
break
;
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
((
double
.
Parse
(
strCalculData
[
k
])
-
4
)
/
16
*
6
);
break
;
case
modual
.
eX18xSensorChannelType
.
Mike_7
:
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
((
double
.
Parse
(
strCalculData
[
k
])
-
4
)
/
16
*
7
);
break
;
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
((
double
.
Parse
(
strCalculData
[
k
])
-
4
)
/
16
*
7
);
break
;
case
modual
.
eX18xSensorChannelType
.
NormalCurrent
:
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
double
.
Parse
(
strCalculData
[
k
]);
break
;
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
double
.
Parse
(
strCalculData
[
k
]);
break
;
case
modual
.
eX18xSensorChannelType
.
Null
:
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
0
;
break
;
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
0
;
break
;
default
:
break
;
break
;
}
}
else
{
if
(
cx18x
.
sX18xAlarmstruct
[
i
].
usCommFailTimes
[
k
]
>=
COMMFAILALARM
)
{
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
0
;
}
else
{
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
]
=
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
];
}
}
if
(
str
==
strChannelList
[
j
]
)
{
arrayList
.
Add
((
T
)
Convert
.
ChangeType
(
cx18x
.
sX18xDataStruct
[
i
].
dNowConvertData
[
k
],
typeof
(
T
)));
}
...
...
@@ -601,7 +615,6 @@ namespace ModbusDemo.Modular
{
if
(
byModbusID
==
ModualPoll
.
cx14P
.
byModbusID
[
i
])
{
if
((
ModbusErrorCode
|=
ModbusComm
.
Modbus_ReadHoldingRegistersTask
(
out
usRegValue
,
byModbusID
,
byX14pReadDataStartAddress
,
byX14pReadDataNumber
))
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
{
ModualAlarm
.
vSet_Modual_Alarm
(
byModbusID
,
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelCommunError
,
false
,
1
,
"d0"
,
"d1"
,
"d2"
,
"d3"
,
"d4"
,
"d5"
,
"d6"
,
"d7"
);
...
...
@@ -628,9 +641,33 @@ namespace ModbusDemo.Modular
{
ModualPoll
.
cx14P
.
sX14pDataStruct
[
i
].
dNowConvertData
[
k
]
=
double
.
Parse
(
strCalculData
[
k
]);
string
str
=
"d"
+
k
.
ToString
();
if
(
ModbusErrorCode
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERERR
)
{
switch
(
cx14P
.
eChannelType
[
i
,
k
])
{
case
modual
.
eX14pSensorChannelType
.
Normal
:
cx14P
.
sX14pDataStruct
[
i
].
dNowConvertData
[
k
]
=
cx14P
.
sX14pDataStruct
[
i
].
dNowConvertData
[
k
];
break
;
case
modual
.
eX14pSensorChannelType
.
Null
:
cx14P
.
sX14pDataStruct
[
i
].
dNowConvertData
[
k
]
=
0
;
break
;
}
}
else
{
if
(
cx14P
.
sX14PAlarmStruct
[
i
].
usCommFailTimes
[
k
]
>=
COMMFAILALARM
)
{
cx14P
.
sX14pDataStruct
[
i
].
dNowConvertData
[
k
]
=
0
;
}
else
{
cx14P
.
sX14pDataStruct
[
i
].
dNowConvertData
[
k
]
=
cx14P
.
sX14pDataStruct
[
i
].
dNowConvertData
[
k
];
}
}
if
(
str
==
strChannelList
[
j
])
{
arrayList
.
Add
((
T
)
Convert
.
ChangeType
(
ModualPoll
.
cx14P
.
sX14pDataStruct
[
i
].
dNowConvertData
[
k
],
typeof
(
T
)));
arrayList
.
Add
((
T
)
Convert
.
ChangeType
(
ModualPoll
.
cx14P
.
sX14pDataStruct
[
i
].
dNowConvertData
[
k
],
typeof
(
T
)));
}
}
}
...
...
ModbusDemo/application/AllPond.cs
View file @
bb1d1cfa
...
...
@@ -935,7 +935,7 @@ namespace ModbusDemo.application
strOperationNumber
=
"d2"
,
strChannelNumber
=
new
string
[]
{
"d2"
,
"d3"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
tru
e
},
bCloseOperation
=
new
bool
[]
{
false
,
fals
e
},
bHadRefControl
=
true
,
byResModbusID
=
86
,
strResChannelNumber
=
"d0"
...
...
@@ -972,13 +972,13 @@ namespace ModbusDemo.application
private
static
ModualPool
.
pcOperation
cEastTransitPoolStirrer3Base
=
new
ModualPool
.
pcOperation
{
byModbusID
=
20
,
strOperationNumber
=
"d
0
"
,
strChannelNumber
=
new
string
[]
{
"d
0"
,
"d1
"
},
strOperationNumber
=
"d
4
"
,
strChannelNumber
=
new
string
[]
{
"d
4"
,
"d5
"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bHadRefControl
=
true
,
byResModbusID
=
86
,
strResChannelNumber
=
"d
4
"
strResChannelNumber
=
"d
1
"
};
private
static
ModualPool
.
pcMachine
cEastTransitPoolStirrer3
=
new
ModualPool
.
pcMachine
(
"EastTransitPoolStirrer_3"
,
cEastTransitPoolStirrer3Base
);
...
...
@@ -1214,7 +1214,7 @@ namespace ModbusDemo.application
public
static
class
cDesiltingPool
{
public
static
double
vSetMaxLevel
;
public
static
double
vSetMaxLevel
;
public
static
double
vSetMinLevel
;
public
static
ModualPool
.
pcTemperature
cTemper
{
get
=>
cDesiltingPoolTemper
;
set
=>
cDesiltingPoolTemper
=
value
;
}
public
static
ModualPool
.
pcLiquidlevel
cLevel
{
get
=>
cDesiltingPoolLevel
;
set
=>
cDesiltingPoolLevel
=
value
;
}
...
...
ModbusDemo/application/AutoControl.cs
View file @
bb1d1cfa
...
...
@@ -532,7 +532,7 @@ namespace ModbusDemo.application
usControl
.
Minimum_Early_Warning
=
false
;
}
if
(
usControl
.
realTimeLevel
<
(
usControl
.
minLevel
-
usControl
.
minLevel
*
0.1
))
if
(
usControl
.
realTimeLevel
<
(
usControl
.
minLevel
))
{
usControl
.
status
=
false
;
usControl
.
Minimum_Early_Warning
=
true
;
...
...
@@ -560,12 +560,13 @@ namespace ModbusDemo.application
TimeSpan
timespan
=
ETime
.
Elapsed
;
// 获取当前实例测量得出的总时间
for
(
int
i
=
0
;
i
<
1
;
i
++)
{
ModbusComm
.
eModbusErrorCode
ModbusErrorCode
=
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
;
if
(
Eenabl
==
true
)
{
if
(
Etimerun
==
false
)
{
if
(
ModbusComm
.
Modbus_WriteMultipleCoils
(
EmodbusId
[
i
],
16
,
state_ON
)
if
(
(
ModbusErrorCode
|=
ModbusComm
.
Modbus_WriteMultipleCoils
(
EmodbusId
[
i
],
16
,
state_ON
)
)
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
{
...
...
@@ -580,7 +581,7 @@ namespace ModbusDemo.application
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelCommunError
,
true
,
1
,
"d0"
,
"d1"
,
"d2"
,
"d3"
,
"d4"
,
"d5"
,
"d6"
,
"d7"
);
}
if
(
ModbusComm
.
Modbus_WriteMultipleCoils
(
EmodbusId
[
i
+
1
],
16
,
state_ON
)
if
(
(
ModbusErrorCode
|=
ModbusComm
.
Modbus_WriteMultipleCoils
(
EmodbusId
[
i
+
1
],
16
,
state_ON
)
)
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
{
...
...
@@ -594,8 +595,14 @@ namespace ModbusDemo.application
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelCommunError
,
true
,
1
,
"d0"
,
"d1"
,
"d2"
,
"d3"
,
"d4"
,
"d5"
,
"d6"
,
"d7"
);
}
ETime
.
Start
();
// 开始监视运行时间
Etimerun
=
true
;
if
(
ModbusErrorCode
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
{
Etimerun
=
true
;
ETime
.
Start
();
// 开始监视运行时间
}
else
Etimerun
=
false
;
}
if
(
timespan
.
TotalMinutes
>
Runtimeout
)
{
...
...
@@ -618,7 +625,7 @@ namespace ModbusDemo.application
{
if
(
Etimerun
==
true
)
{
if
(
ModbusComm
.
Modbus_WriteMultipleCoils
(
EmodbusId
[
i
],
16
,
state_OFF
)
if
(
(
ModbusErrorCode
|=
ModbusComm
.
Modbus_WriteMultipleCoils
(
EmodbusId
[
i
],
16
,
state_OFF
)
)
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
{
...
...
@@ -632,7 +639,7 @@ namespace ModbusDemo.application
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelCommunError
,
true
,
1
,
"d0"
,
"d1"
,
"d2"
,
"d3"
,
"d4"
,
"d5"
,
"d6"
,
"d7"
);
}
if
(
ModbusComm
.
Modbus_WriteMultipleCoils
(
EmodbusId
[
i
+
1
],
16
,
state_OFF
)
if
(
(
ModbusErrorCode
|=
ModbusComm
.
Modbus_WriteMultipleCoils
(
EmodbusId
[
i
+
1
],
16
,
state_OFF
)
)
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
...
...
@@ -648,7 +655,8 @@ namespace ModbusDemo.application
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelCommunError
,
true
,
1
,
"d0"
,
"d1"
,
"d2"
,
"d3"
,
"d4"
,
"d5"
,
"d6"
,
"d7"
);
}
if
(
ModbusErrorCode
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
{
ETime
.
Reset
();
ETime
.
Stop
();
ModualAlarm
.
vSet_Modual_Alarm
(
EmodbusId
[
i
],
...
...
@@ -661,13 +669,18 @@ namespace ModbusDemo.application
"d0"
,
"d1"
,
"d2"
,
"d3"
,
"d4"
,
"d5"
,
"d6"
,
"d7"
);
Etimerun
=
false
;
}
else
Etimerun
=
true
;
}
}
if
(
Wenabl
==
true
)
{
if
(
Wtimerun
==
false
)
{
if
(
ModbusComm
.
Modbus_WriteMultipleCoils
(
WmodbusId
[
i
],
16
,
state_ON
)
if
(
(
ModbusErrorCode
|=
ModbusComm
.
Modbus_WriteMultipleCoils
(
WmodbusId
[
i
],
16
,
state_ON
)
)
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
{
...
...
@@ -682,7 +695,7 @@ namespace ModbusDemo.application
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelCommunError
,
true
,
1
,
"d0"
,
"d1"
,
"d2"
,
"d3"
,
"d4"
,
"d5"
,
"d6"
,
"d7"
);
}
if
(
ModbusComm
.
Modbus_WriteMultipleCoils
(
WmodbusId
[
i
+
1
],
16
,
state_ON
)
if
(
(
ModbusErrorCode
|=
ModbusComm
.
Modbus_WriteMultipleCoils
(
WmodbusId
[
i
+
1
],
16
,
state_ON
)
)
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
{
...
...
@@ -698,8 +711,13 @@ namespace ModbusDemo.application
"d0"
,
"d1"
,
"d2"
,
"d3"
,
"d4"
,
"d5"
,
"d6"
,
"d7"
);
}
if
(
ModbusErrorCode
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
{
WTime
.
Start
();
//开始监视
Wtimerun
=
true
;
}
else
Wtimerun
=
false
;
}
if
(
Wtime
.
TotalMinutes
>
Runtimeout
)
{
...
...
@@ -722,7 +740,7 @@ namespace ModbusDemo.application
{
if
(
Wtimerun
==
true
)
{
if
(
ModbusComm
.
Modbus_WriteMultipleCoils
(
WmodbusId
[
i
],
16
,
state_OFF
)
if
(
(
ModbusErrorCode
|=
ModbusComm
.
Modbus_WriteMultipleCoils
(
WmodbusId
[
i
],
16
,
state_OFF
)
)
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
...
...
@@ -738,7 +756,7 @@ namespace ModbusDemo.application
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelCommunError
,
true
,
1
,
"d0"
,
"d1"
,
"d2"
,
"d3"
,
"d4"
,
"d5"
,
"d6"
,
"d7"
);
}
if
(
ModbusComm
.
Modbus_WriteMultipleCoils
(
WmodbusId
[
i
+
1
],
16
,
state_OFF
)
if
(
(
ModbusErrorCode
|=
ModbusComm
.
Modbus_WriteMultipleCoils
(
WmodbusId
[
i
+
1
],
16
,
state_OFF
)
)
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
...
...
@@ -754,6 +772,8 @@ namespace ModbusDemo.application
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelCommunError
,
true
,
1
,
"d0"
,
"d1"
,
"d2"
,
"d3"
,
"d4"
,
"d5"
,
"d6"
,
"d7"
);
}
if
(
ModbusErrorCode
==
ModbusComm
.
eModbusErrorCode
.
MB_EMASTERNOERR
)
{
WTime
.
Reset
();
WTime
.
Stop
();
//停止监视
ModualAlarm
.
vSet_Modual_Alarm
(
WmodbusId
[
i
],
...
...
@@ -765,7 +785,10 @@ namespace ModbusDemo.application
(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelRunOverTimeError
,
false
,
1
,
"d0"
,
"d1"
,
"d2"
,
"d3"
,
"d4"
,
"d5"
,
"d6"
,
"d7"
);
Wtimerun
=
false
;
}
}
else
Wtimerun
=
true
;
}
}
//double Whours = Wtime.TotalHours;
...
...
@@ -789,7 +812,11 @@ namespace ModbusDemo.application
Control
usWcontrolB
=
new
Control
();
FileInfo
file
=
new
FileInfo
(
InIHelper
.
FileName
);
Run_flag_bit
=
true
;
while
(
true
)
InIHelper
.
WriteConfig
(
"MaxLevel"
,
"东·中转池"
,
"8"
);
InIHelper
.
WriteConfig
(
"MinLevel"
,
"东·中转池"
,
"1"
);
InIHelper
.
WriteConfig
(
"MaxLevel"
,
"西·中转池"
,
"8"
);
InIHelper
.
WriteConfig
(
"MinLevel"
,
"西·中转池"
,
"1"
);
while
(
true
)
{
if
(
ModualControl
.
cPoolLevelConfig
.
Count
!=
0
)
{
...
...
ModbusDemo/application/ControlMap.cs
View file @
bb1d1cfa
...
...
@@ -335,71 +335,71 @@ namespace ModbusDemo.application
if
(
bOpen
==
true
)
{
#
region
东中转池开映射
//
if (byControlID == 4 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.cSouthWater.bOpen_Machine;
//
}
//
else if (byControlID == 4 && strOperationChannelName[0] == "d2")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.cNorthWater.bOpen_Machine;
//
}
//
else if (byControlID == 20 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.c6Pumb1.bOpen_Machine;
//
}
//
else if (byControlID == 20 && strOperationChannelName[0] == "d2")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.c4Pumb2.bOpen_Machine;
//
}
//
else if (byControlID == 5 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.c2Stirrer1.bOpen_Machine;
//
}
//
else if (byControlID == 5 && strOperationChannelName[0] == "d2")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.c1Stirrer2.bOpen_Machine;
//
}
//
else if (byControlID == 20 && strOperationChannelName[0] == "d4")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.c5Stirrer3.bOpen_Machine;
//
}
//
else if (byControlID == 41 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.c7Stirrer4.bOpen_Machine;
//
}
if
(
byControlID
==
4
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cSouthWater
.
bOpen_Machine
;
}
else
if
(
byControlID
==
4
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cNorthWater
.
bOpen_Machine
;
}
else
if
(
byControlID
==
20
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
c6Pumb1
.
bOpen_Machine
;
}
else
if
(
byControlID
==
20
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
c4Pumb2
.
bOpen_Machine
;
}
else
if
(
byControlID
==
5
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
c2Stirrer1
.
bOpen_Machine
;
}
else
if
(
byControlID
==
5
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
c1Stirrer2
.
bOpen_Machine
;
}
else
if
(
byControlID
==
20
&&
strOperationChannelName
[
0
]
==
"d4"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
c5Stirrer3
.
bOpen_Machine
;
}
else
if
(
byControlID
==
41
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
c7Stirrer4
.
bOpen_Machine
;
}
#
endregion
#
region
西中转池开映射
//
else if (byControlID == 49 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.cSouthWater.bOpen_Machine;
//
}
//
else if (byControlID == 49 && strOperationChannelName[0] == "d2")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.cNorthWater.bOpen_Machine;
//
}
//
else if (byControlID == 37 && strOperationChannelName[0] == "d2")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.c6Pumb1.bOpen_Machine;
//
}
//
else if (byControlID == 8 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.c2Stirrer1.bOpen_Machine;
//
}
//
else if (byControlID == 8 && strOperationChannelName[0] == "d2")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.c1Stirrer2.bOpen_Machine;
//
}
//
else if (byControlID == 37 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.c5Stirrer3.bOpen_Machine;
//
}
//
else if (byControlID == 37 && strOperationChannelName[0] == "d4")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.c4Stirrer4.bOpen_Machine;
//
}
else
if
(
byControlID
==
49
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
cSouthWater
.
bOpen_Machine
;
}
else
if
(
byControlID
==
49
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
cNorthWater
.
bOpen_Machine
;
}
else
if
(
byControlID
==
37
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
c6Pumb1
.
bOpen_Machine
;
}
else
if
(
byControlID
==
8
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
c2Stirrer1
.
bOpen_Machine
;
}
else
if
(
byControlID
==
8
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
c1Stirrer2
.
bOpen_Machine
;
}
else
if
(
byControlID
==
37
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
c5Stirrer3
.
bOpen_Machine
;
}
else
if
(
byControlID
==
37
&&
strOperationChannelName
[
0
]
==
"d4"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
c4Stirrer4
.
bOpen_Machine
;
}
#
endregion
#
region
出料池开映射
if
(
byControlID
==
50
&&
strOperationChannelName
[
0
]
==
"d0"
)
else
if
(
byControlID
==
50
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cDischargePool
.
c2Pumb1
.
bOpen_Machine
;
}
...
...
@@ -484,71 +484,71 @@ namespace ModbusDemo.application
else
{
#
region
东中转池关映射
//
if (byControlID == 4 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.cSouthWater.bClose_Machine;
//
}
//
else if (byControlID == 4 && strOperationChannelName[0] == "d2")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.cNorthWater.bClose_Machine;
//
}
//
else if (byControlID == 20 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.c6Pumb1.bClose_Machine;
//
}
//
else if (byControlID == 20 && strOperationChannelName[0] == "d2")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.c4Pumb2.bClose_Machine;
//
}
//
else if (byControlID == 5 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.c2Stirrer1.bClose_Machine;
//
}
//
else if (byControlID == 5 && strOperationChannelName[0] == "d2")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.c1Stirrer2.bClose_Machine;
//
}
//
else if (byControlID == 20 && strOperationChannelName[0] == "d4")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.c5Stirrer3.bClose_Machine;
//
}
//
else if (byControlID == 41 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cEastTransitPool.c7Stirrer4.bClose_Machine;
//
}
if
(
byControlID
==
4
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cSouthWater
.
bClose_Machine
;
}
else
if
(
byControlID
==
4
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cNorthWater
.
bClose_Machine
;
}
else
if
(
byControlID
==
20
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
c6Pumb1
.
bClose_Machine
;
}
else
if
(
byControlID
==
20
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
c4Pumb2
.
bClose_Machine
;
}
else
if
(
byControlID
==
5
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
c2Stirrer1
.
bClose_Machine
;
}
else
if
(
byControlID
==
5
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
c1Stirrer2
.
bClose_Machine
;
}
else
if
(
byControlID
==
20
&&
strOperationChannelName
[
0
]
==
"d4"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
c5Stirrer3
.
bClose_Machine
;
}
else
if
(
byControlID
==
41
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
c7Stirrer4
.
bClose_Machine
;
}
#
endregion
//
#region 西中转池开映射
//
else if (byControlID == 49 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.cSouthWater.bClose_Machine;
//
}
//
else if (byControlID == 49 && strOperationChannelName[0] == "d2")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.cNorthWater.bClose_Machine;
//
}
//
else if (byControlID == 37 && strOperationChannelName[0] == "d2")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.c6Pumb1.bClose_Machine;
//
}
//
else if (byControlID == 8 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.c2Stirrer1.bClose_Machine;
//
}
//
else if (byControlID == 8 && strOperationChannelName[0] == "d2")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.c1Stirrer2.bClose_Machine;
//
}
//
else if (byControlID == 37 && strOperationChannelName[0] == "d0")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.c5Stirrer3.bClose_Machine;
//
}
//
else if (byControlID == 37 && strOperationChannelName[0] == "d4")
//
{
//
bDelege_Operation = AllPond.cWestTransitPool.c4Stirrer4.bClose_Machine;
//
}
//
#endregion
#
region
西中转池开映射
else
if
(
byControlID
==
49
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
cSouthWater
.
bClose_Machine
;
}
else
if
(
byControlID
==
49
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
cNorthWater
.
bClose_Machine
;
}
else
if
(
byControlID
==
37
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
c6Pumb1
.
bClose_Machine
;
}
else
if
(
byControlID
==
8
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
c2Stirrer1
.
bClose_Machine
;
}
else
if
(
byControlID
==
8
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
c1Stirrer2
.
bClose_Machine
;
}
else
if
(
byControlID
==
37
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
c5Stirrer3
.
bClose_Machine
;
}
else
if
(
byControlID
==
37
&&
strOperationChannelName
[
0
]
==
"d4"
)
{
bDelege_Operation
=
AllPond
.
cWestTransitPool
.
c4Stirrer4
.
bClose_Machine
;
}
#
endregion
#
region
出料池关映射
if
(
byControlID
==
50
&&
strOperationChannelName
[
0
]
==
"d0"
)
else
if
(
byControlID
==
50
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cDischargePool
.
c2Pumb1
.
bClose_Machine
;
}
...
...
ModbusDemo/application/ModualPool.cs
View file @
bb1d1cfa
...
...
@@ -93,7 +93,7 @@ namespace ModbusDemo.application
public
byte
byResModbusID
;
public
string
strResChannelNumber
;
public
int
iRefAlarmCnt
=
0
;
public
int
MaxAlarmfeedback
=
2
;
public
int
MaxAlarmfeedback
=
5
;
}
public
class
pcMachine
:
pcOperation
{
...
...
ModbusDemo/windows/Form1.cs
View file @
bb1d1cfa
...
...
@@ -103,7 +103,7 @@ namespace ModbusDemo
}
else
{
mqttIp
=
"
172.16.1.24"
;
//""
mqttIp
=
"
47.101.50.24"
;
mqttClientId
=
GetTimeStamp
()
+
"sxz"
;
mqttPort
=
1883
;
mqttUsername
=
"pasture"
;
...
...
@@ -1110,7 +1110,7 @@ namespace ModbusDemo
}
else
{
comPort
.
PortName
=
"COM
6
"
;
comPort
.
PortName
=
"COM
5
"
;
}
comPort
.
BaudRate
=
9600
;
comPort
.
Parity
=
Parity
.
None
;
...
...
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