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
5e2f988a
Commit
5e2f988a
authored
Jun 21, 2019
by
leon.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add data in time updata
parent
a6ed3828
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
384 additions
and
207 deletions
+384
-207
ModualControl.cs
ModbusDemo/MessageFormat/ModualControl.cs
+8
-4
ModualPoll.cs
ModbusDemo/Modular/ModualPoll.cs
+77
-11
AllPond.cs
ModbusDemo/application/AllPond.cs
+219
-93
AutoControl.cs
ModbusDemo/application/AutoControl.cs
+30
-29
Form1.cs
ModbusDemo/windows/Form1.cs
+50
-70
No files found.
ModbusDemo/MessageFormat/ModualControl.cs
View file @
5e2f988a
...
...
@@ -138,7 +138,6 @@ namespace ModbusDemo.MessageFormat
#endif
public
static
void
vGetaWay_Receive_Control
(
string
sDataString
,
out
string
stResponseData
)
{
List
<
string
>
strOperation
=
new
List
<
string
>();
MqttRoot
cControl
=
new
MqttRoot
();
var
jsonObj
=
new
JObject
();
try
...
...
@@ -154,6 +153,7 @@ namespace ModbusDemo.MessageFormat
{
for
(
int
m
=
0
;
m
<
cControl
.
ss
[
i
].
op
.
Count
();
m
++)
{
List
<
string
>
strOperation
=
new
List
<
string
>();
bool
[]
bOperationStatus
=
new
bool
[
8
]
{
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
};
ModualCntrol
cModualCntrol
=
new
ModualCntrol
{
...
...
@@ -207,6 +207,7 @@ namespace ModbusDemo.MessageFormat
bOperationStatus
[
j
]
=
false
;
}
}
//Form1.vSuspend_Poll_Control(false);
}
if
(
cModualCntrol
.
bControlStatus
==
true
&&
cModualCntrol
.
strOperationChannelName
.
Count
()
<=
1
)
...
...
@@ -290,7 +291,6 @@ namespace ModbusDemo.MessageFormat
}
Thread
.
Sleep
(
100
);
}
}
public
static
Task
vControl_Res_Poll
()
{
...
...
@@ -298,6 +298,9 @@ namespace ModbusDemo.MessageFormat
{
pcConfig
.
WriteConfig
(
"匀浆池配置"
,
"报警最高液位"
,
"8"
);
pcConfig
.
WriteConfig
(
"匀浆池配置"
,
"报警最低液位"
,
"1"
);
AllPond
.
cEastTransitPool
.
vSetMaxLevel
=
pcConfig
.
ReadConfig
<
double
>(
"匀浆池配置"
,
"报警最高液位"
);
AllPond
.
cEastTransitPool
.
vSetMinLevel
=
pcConfig
.
ReadConfig
<
double
>(
"匀浆池配置"
,
"报警最低液位"
);
}
else
{
...
...
@@ -581,6 +584,7 @@ namespace ModbusDemo.MessageFormat
ModualAlarm
.
vSet_Modual_Alarm
(
sbModbusID
,(
ushort
)
ModualAlarm
.
eAlarmCode
.
ChannelControlError
,
true
,
1
,
str
);
}
}
ModualPoll
.
vSend_Actual_Data
(
sbModbusID
);
return
bControlStatus
;
}
public
static
void
vDelete_Same_Control
(
ModualCntrol
cModualCntrol
)
...
...
@@ -613,9 +617,9 @@ namespace ModbusDemo.MessageFormat
dDownLevel
=
double
.
Parse
(
cCfgRoot
.
ss
[
i
].
cfg
.
down
)
};
vSet_Pool_Alarm_Level
(
cLiquidLevelConfig
.
byModbusID
,
cLiquidLevelConfig
.
dUpLevel
,
cLiquidLevelConfig
.
dDownLevel
);
string
strChannelString
=
"d"
+
i
.
ToString
();
for
(
int
j
=
0
;
j
<
8
;
j
++)
{
string
strChannelString
=
"d"
+
j
.
ToString
();
if
(
jsonObj
[
"ss"
][
i
][
"cfg"
].
Value
<
string
>(
"name"
)
==
strChannelString
)
{
cLiquidLevelConfig
.
stChannelNumber
=
strChannelString
;
...
...
@@ -649,7 +653,7 @@ namespace ModbusDemo.MessageFormat
AllPond
.
cEastTransitPool
.
vSetMaxLevel
=
dMaxLevel
;
AllPond
.
cEastTransitPool
.
vSetMinLevel
=
dMinLevel
;
pcConfig
.
WriteConfig
(
"匀浆池配置"
,
"报警最高液位"
,
AllPond
.
cEastTransitPool
.
vSetMaxLevel
.
ToString
());
pcConfig
.
WriteConfig
(
"匀浆池配置"
,
"报警最低液位"
,
AllPond
.
cEastTransitPool
.
vSetM
ax
Level
.
ToString
());
pcConfig
.
WriteConfig
(
"匀浆池配置"
,
"报警最低液位"
,
AllPond
.
cEastTransitPool
.
vSetM
in
Level
.
ToString
());
}
}
...
...
ModbusDemo/Modular/ModualPoll.cs
View file @
5e2f988a
This diff is collapsed.
Click to expand it.
ModbusDemo/application/AllPond.cs
View file @
5e2f988a
This diff is collapsed.
Click to expand it.
ModbusDemo/application/AutoControl.cs
View file @
5e2f988a
...
...
@@ -9,7 +9,8 @@ using ModbusDemo.Modular;
using
ModbusDemo.MessageFormat
;
using
ModbusDemo.Common
;
using
System.IO
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
ModbusDemo.application
{
public
class
AutoControl
...
...
@@ -104,7 +105,6 @@ namespace ModbusDemo.application
TimeSpan
timespan
=
ETime
.
Elapsed
;
// 获取当前实例测量得出的总时间
for
(
int
i
=
0
;
i
<
1
;
i
++)
{
if
(
Eenabl
==
true
)
{
if
(
timerun
==
false
)
...
...
@@ -310,9 +310,35 @@ namespace ModbusDemo.application
Control
usEcontrolB
=
new
Control
();
Control
usWcontrol
=
new
Control
();
Control
usWcontrolB
=
new
Control
();
FileInfo
file
=
new
FileInfo
(
InIHelper
.
FileName
);
if
(
file
.
Length
!=
0
)
{
usEcontrol
.
modularx
=
InIHelper
.
ReadConfig
<
int
>(
"Channel number"
,
"东液位通道"
);
usWcontrol
.
modularx
=
InIHelper
.
ReadConfig
<
int
>(
"Channel number"
,
"西液位通道"
);
usWcontrol
.
maxLevel
=
InIHelper
.
ReadConfig
<
float
>(
"MaxLevel"
,
"西·中转池"
);
usWcontrol
.
minLevel
=
InIHelper
.
ReadConfig
<
float
>(
"MinLevel"
,
"西·中转池"
);
usEcontrol
.
maxLevel
=
InIHelper
.
ReadConfig
<
float
>(
"MaxLevel"
,
"东·中转池"
);
usEcontrol
.
minLevel
=
InIHelper
.
ReadConfig
<
float
>(
"MinLevel"
,
"东·中转池"
);
usEcontrol
.
realTimeLevel
=
ModualPoll
.
cx18x
.
sX18xDataStruct
[
usEcontrol
.
modularx
].
dNowConvertData
[
0
];
usWcontrol
.
realTimeLevel
=
ModualPoll
.
cx18x
.
sX18xDataStruct
[
usWcontrol
.
modularx
].
dNowConvertData
[
0
];
CriticalValueMonitoring
(
ref
usEcontrol
,
true
,
"东·中转池"
,
out
usEcontrolB
);
CriticalValueMonitoring
(
ref
usWcontrol
,
true
,
"西·中转池"
,
out
usWcontrolB
);
Automatic_control
(
usWcontrolB
.
status
,
usEcontrolB
.
status
);
}
while
(
true
)
{
FileInfo
file
=
new
FileInfo
(
InIHelper
.
FileName
);
if
(
ModualControl
.
cPoolLevelConfig
.
Count
!=
0
)
{
for
(
int
i
=
0
;
i
<
ModualControl
.
cPoolLevelConfig
.
Count
;
i
++)
...
...
@@ -369,38 +395,13 @@ namespace ModbusDemo.application
Automatic_control
(
usWcontrolB
.
status
,
usEcontrolB
.
status
);
}
else
if
(
file
.
Length
!=
0
)
{
usEcontrol
.
modularx
=
InIHelper
.
ReadConfig
<
int
>(
"Channel number"
,
"东液位通道"
);
usWcontrol
.
modularx
=
InIHelper
.
ReadConfig
<
int
>(
"Channel number"
,
"西液位通道"
);
usWcontrol
.
maxLevel
=
InIHelper
.
ReadConfig
<
float
>(
"MaxLevel"
,
"西·中转池"
);
usWcontrol
.
minLevel
=
InIHelper
.
ReadConfig
<
float
>(
"MinLevel"
,
"西·中转池"
);
usEcontrol
.
maxLevel
=
InIHelper
.
ReadConfig
<
float
>(
"MaxLevel"
,
"东·中转池"
);
usEcontrol
.
minLevel
=
InIHelper
.
ReadConfig
<
float
>(
"MinLevel"
,
"东·中转池"
);
usEcontrol
.
realTimeLevel
=
ModualPoll
.
cx18x
.
sX18xDataStruct
[
usEcontrol
.
modularx
].
dNowConvertData
[
0
];
usWcontrol
.
realTimeLevel
=
ModualPoll
.
cx18x
.
sX18xDataStruct
[
usWcontrol
.
modularx
].
dNowConvertData
[
0
];
CriticalValueMonitoring
(
ref
usEcontrol
,
true
,
"东·中转池"
,
out
usEcontrolB
);
CriticalValueMonitoring
(
ref
usWcontrol
,
true
,
"西·中转池"
,
out
usWcontrolB
);
Automatic_control
(
usWcontrolB
.
status
,
usEcontrolB
.
status
);
}
else
{
usWcontrol
.
status
=
false
;
usEcontrol
.
status
=
false
;
Automatic_control
(
usWcontrol
.
status
,
usEcontrol
.
status
);
}
Thread
.
Sleep
(
100
);
}
}
}
...
...
ModbusDemo/windows/Form1.cs
View file @
5e2f988a
This diff is collapsed.
Click to expand it.
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