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
Expand all
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
This diff is collapsed.
Click to expand it.
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