Commit 5e2f988a authored by leon.huang's avatar leon.huang

add data in time updata

parent a6ed3828
...@@ -138,7 +138,6 @@ namespace ModbusDemo.MessageFormat ...@@ -138,7 +138,6 @@ namespace ModbusDemo.MessageFormat
#endif #endif
public static void vGetaWay_Receive_Control(string sDataString, out string stResponseData) public static void vGetaWay_Receive_Control(string sDataString, out string stResponseData)
{ {
List<string> strOperation = new List<string>();
MqttRoot cControl = new MqttRoot(); MqttRoot cControl = new MqttRoot();
var jsonObj = new JObject(); var jsonObj = new JObject();
try try
...@@ -154,6 +153,7 @@ namespace ModbusDemo.MessageFormat ...@@ -154,6 +153,7 @@ namespace ModbusDemo.MessageFormat
{ {
for (int m = 0; m < cControl.ss[i].op.Count(); m++) 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 }; bool[] bOperationStatus = new bool[8] { false, false, false, false, false, false, false, false };
ModualCntrol cModualCntrol = new ModualCntrol ModualCntrol cModualCntrol = new ModualCntrol
{ {
...@@ -207,6 +207,7 @@ namespace ModbusDemo.MessageFormat ...@@ -207,6 +207,7 @@ namespace ModbusDemo.MessageFormat
bOperationStatus[j] = false; bOperationStatus[j] = false;
} }
} }
//Form1.vSuspend_Poll_Control(false); //Form1.vSuspend_Poll_Control(false);
} }
if (cModualCntrol.bControlStatus == true && cModualCntrol.strOperationChannelName.Count() <= 1) if (cModualCntrol.bControlStatus == true && cModualCntrol.strOperationChannelName.Count() <= 1)
...@@ -290,7 +291,6 @@ namespace ModbusDemo.MessageFormat ...@@ -290,7 +291,6 @@ namespace ModbusDemo.MessageFormat
} }
Thread.Sleep(100); Thread.Sleep(100);
} }
} }
public static Task vControl_Res_Poll() public static Task vControl_Res_Poll()
{ {
...@@ -298,6 +298,9 @@ namespace ModbusDemo.MessageFormat ...@@ -298,6 +298,9 @@ namespace ModbusDemo.MessageFormat
{ {
pcConfig.WriteConfig("匀浆池配置", "报警最高液位", "8"); pcConfig.WriteConfig("匀浆池配置", "报警最高液位", "8");
pcConfig.WriteConfig("匀浆池配置", "报警最低液位", "1"); pcConfig.WriteConfig("匀浆池配置", "报警最低液位", "1");
AllPond.cEastTransitPool.vSetMaxLevel = pcConfig.ReadConfig<double>("匀浆池配置","报警最高液位");
AllPond.cEastTransitPool.vSetMinLevel = pcConfig.ReadConfig<double>("匀浆池配置","报警最低液位");
} }
else else
{ {
...@@ -581,6 +584,7 @@ namespace ModbusDemo.MessageFormat ...@@ -581,6 +584,7 @@ namespace ModbusDemo.MessageFormat
ModualAlarm.vSet_Modual_Alarm(sbModbusID,(ushort)ModualAlarm.eAlarmCode.ChannelControlError, true, 1, str); ModualAlarm.vSet_Modual_Alarm(sbModbusID,(ushort)ModualAlarm.eAlarmCode.ChannelControlError, true, 1, str);
} }
} }
ModualPoll.vSend_Actual_Data(sbModbusID);
return bControlStatus; return bControlStatus;
} }
public static void vDelete_Same_Control(ModualCntrol cModualCntrol) public static void vDelete_Same_Control(ModualCntrol cModualCntrol)
...@@ -613,9 +617,9 @@ namespace ModbusDemo.MessageFormat ...@@ -613,9 +617,9 @@ namespace ModbusDemo.MessageFormat
dDownLevel = double.Parse(cCfgRoot.ss[i].cfg.down) dDownLevel = double.Parse(cCfgRoot.ss[i].cfg.down)
}; };
vSet_Pool_Alarm_Level(cLiquidLevelConfig.byModbusID,cLiquidLevelConfig.dUpLevel,cLiquidLevelConfig.dDownLevel); vSet_Pool_Alarm_Level(cLiquidLevelConfig.byModbusID,cLiquidLevelConfig.dUpLevel,cLiquidLevelConfig.dDownLevel);
string strChannelString = "d" + i.ToString();
for (int j = 0; j < 8; j++) for (int j = 0; j < 8; j++)
{ {
string strChannelString = "d" + j.ToString();
if (jsonObj["ss"][i]["cfg"].Value<string>("name") == strChannelString) if (jsonObj["ss"][i]["cfg"].Value<string>("name") == strChannelString)
{ {
cLiquidLevelConfig.stChannelNumber = strChannelString; cLiquidLevelConfig.stChannelNumber = strChannelString;
...@@ -649,7 +653,7 @@ namespace ModbusDemo.MessageFormat ...@@ -649,7 +653,7 @@ namespace ModbusDemo.MessageFormat
AllPond.cEastTransitPool.vSetMaxLevel = dMaxLevel; AllPond.cEastTransitPool.vSetMaxLevel = dMaxLevel;
AllPond.cEastTransitPool.vSetMinLevel = dMinLevel; AllPond.cEastTransitPool.vSetMinLevel = dMinLevel;
pcConfig.WriteConfig("匀浆池配置", "报警最高液位", AllPond.cEastTransitPool.vSetMaxLevel.ToString()); pcConfig.WriteConfig("匀浆池配置", "报警最高液位", AllPond.cEastTransitPool.vSetMaxLevel.ToString());
pcConfig.WriteConfig("匀浆池配置", "报警最低液位", AllPond.cEastTransitPool.vSetMaxLevel.ToString()); pcConfig.WriteConfig("匀浆池配置", "报警最低液位", AllPond.cEastTransitPool.vSetMinLevel.ToString());
} }
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -9,7 +9,8 @@ using ModbusDemo.Modular; ...@@ -9,7 +9,8 @@ using ModbusDemo.Modular;
using ModbusDemo.MessageFormat; using ModbusDemo.MessageFormat;
using ModbusDemo.Common; using ModbusDemo.Common;
using System.IO; using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace ModbusDemo.application namespace ModbusDemo.application
{ {
public class AutoControl public class AutoControl
...@@ -104,7 +105,6 @@ namespace ModbusDemo.application ...@@ -104,7 +105,6 @@ namespace ModbusDemo.application
TimeSpan timespan = ETime.Elapsed; // 获取当前实例测量得出的总时间 TimeSpan timespan = ETime.Elapsed; // 获取当前实例测量得出的总时间
for (int i = 0; i < 1; i++) for (int i = 0; i < 1; i++)
{ {
if (Eenabl == true) if (Eenabl == true)
{ {
if (timerun == false) if (timerun == false)
...@@ -310,9 +310,35 @@ namespace ModbusDemo.application ...@@ -310,9 +310,35 @@ namespace ModbusDemo.application
Control usEcontrolB = new Control(); Control usEcontrolB = new Control();
Control usWcontrol = new Control(); Control usWcontrol = new Control();
Control usWcontrolB = 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) while (true)
{ {
FileInfo file = new FileInfo(InIHelper.FileName);
if (ModualControl.cPoolLevelConfig.Count != 0) if (ModualControl.cPoolLevelConfig.Count != 0)
{ {
for (int i = 0; i < ModualControl.cPoolLevelConfig.Count; i++) for (int i = 0; i < ModualControl.cPoolLevelConfig.Count; i++)
...@@ -369,38 +395,13 @@ namespace ModbusDemo.application ...@@ -369,38 +395,13 @@ namespace ModbusDemo.application
Automatic_control(usWcontrolB.status, usEcontrolB.status); 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 else
{ {
usWcontrol.status = false; usWcontrol.status = false;
usEcontrol.status = false; usEcontrol.status = false;
Automatic_control(usWcontrol.status, usEcontrol.status); Automatic_control(usWcontrol.status, usEcontrol.status);
} }
Thread.Sleep(100);
} }
} }
} }
......
This diff is collapsed.
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