|
|
@@ -8,6 +8,9 @@ using System.Threading.Tasks; |
|
|
|
using System.Collections.Concurrent; |
|
|
|
using System.Diagnostics; |
|
|
|
using BPA.Helper; |
|
|
|
using System.Collections.Specialized; |
|
|
|
using System.Configuration; |
|
|
|
using BPASmartClient.CustomResource.UserControls.MessageShow; |
|
|
|
|
|
|
|
namespace BPASmartClient.Academy._50L |
|
|
|
{ |
|
|
@@ -18,10 +21,12 @@ namespace BPASmartClient.Academy._50L |
|
|
|
private PlcControl() { } |
|
|
|
public bool IsConnect => comm != null && comm.IsConnected(); |
|
|
|
public DeviceStatus DeviceStatus { get; set; } = new DeviceStatus(); |
|
|
|
public ConcurrentDictionary<string, string> AlarmInfo { get; private set; } = new ConcurrentDictionary<string, string>(); |
|
|
|
private ICommSiemens comm = CommHelper.Siemens; |
|
|
|
public string id { get; set; } = ""; |
|
|
|
public void Init() |
|
|
|
{ |
|
|
|
AlarmInfoGet(); |
|
|
|
Task.Factory.StartNew(() => |
|
|
|
{ |
|
|
|
CommHelper.CreateSiemens(CpuType.S7200Smart, Json<DevicePar>.Data.IpAddress).OnSuccess(s => |
|
|
@@ -36,6 +41,44 @@ namespace BPASmartClient.Academy._50L |
|
|
|
|
|
|
|
|
|
|
|
private volatile bool _isReadSuccess; |
|
|
|
|
|
|
|
public void AlarmInfoGet() |
|
|
|
{ |
|
|
|
var x = (NameValueCollection)ConfigurationManager.GetSection("Reactor_50L_Alarm/Alarm"); |
|
|
|
if (x != null) |
|
|
|
{ |
|
|
|
x.AllKeys.ToList().ForEach(o => |
|
|
|
{ |
|
|
|
if (!AlarmInfo.ContainsKey(o)) |
|
|
|
{ |
|
|
|
AlarmInfo.TryAdd(o, x.Get(o)); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
public void AlarmRead() |
|
|
|
{ |
|
|
|
if (this.IsConnect) |
|
|
|
{ |
|
|
|
AlarmInfo.Keys.ToList().ForEach(o => |
|
|
|
{ |
|
|
|
comm.Read<bool>(o).OnSuccess(p => |
|
|
|
{ |
|
|
|
if (RTrig.GetInstance($"{o}").Start(p.Content)) |
|
|
|
{ |
|
|
|
App.Current.Dispatcher.Invoke(() => |
|
|
|
{ |
|
|
|
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "报警", this.AlarmInfo[o]); |
|
|
|
MessageNotify.GetInstance.ShowAlarmLog(this.AlarmInfo[o]); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
Thread.Sleep(2000); |
|
|
|
} |
|
|
|
private void Read() |
|
|
|
{ |
|
|
|
TaskManage.GetInstance.StartLong(() => |
|
|
@@ -182,16 +225,17 @@ namespace BPASmartClient.Academy._50L |
|
|
|
}); |
|
|
|
comm.Read<bool>("DB1.DBX1003.7", 1).OnSuccess(s => DeviceStatus.HeartBeat = s.Content ); |
|
|
|
|
|
|
|
comm.Read<bool[]>("DB1.DBX2004.0", 16).OnSuccess(s => |
|
|
|
{ |
|
|
|
AlarmHelper.GetInstance.Get<AlarmData>("50L反应釜").EStop = s.Content[0]; |
|
|
|
AlarmHelper.GetInstance.Get<AlarmData>("50L反应釜").RotatingMachinesError = s.Content[1]; |
|
|
|
AlarmHelper.GetInstance.Get<AlarmData>("50L反应釜").AbnormalNegativePressureFan = s.Content[2]; |
|
|
|
AlarmHelper.GetInstance.Get<AlarmData>("50L反应釜").BrinePumpError = s.Content[3]; |
|
|
|
AlarmHelper.GetInstance.Get<AlarmData>("50L反应釜").CompressorError = s.Content[4]; |
|
|
|
AlarmHelper.GetInstance.Get<AlarmData>("50L反应釜").ReactorPressureLimit = s.Content[5]; |
|
|
|
}); |
|
|
|
|
|
|
|
//comm.Read<bool[]>("DB1.DBX2004.0", 16).OnSuccess(s => |
|
|
|
//{ |
|
|
|
// AlarmHelper.GetInstance.Get<AlarmData>("50L反应釜").EStop = s.Content[0]; |
|
|
|
// AlarmHelper.GetInstance.Get<AlarmData>("50L反应釜").RotatingMachinesError = s.Content[1]; |
|
|
|
// AlarmHelper.GetInstance.Get<AlarmData>("50L反应釜").AbnormalNegativePressureFan = s.Content[2]; |
|
|
|
// AlarmHelper.GetInstance.Get<AlarmData>("50L反应釜").BrinePumpError = s.Content[3]; |
|
|
|
// AlarmHelper.GetInstance.Get<AlarmData>("50L反应釜").CompressorError = s.Content[4]; |
|
|
|
// AlarmHelper.GetInstance.Get<AlarmData>("50L反应釜").ReactorPressureLimit = s.Content[5]; |
|
|
|
//}); |
|
|
|
AlarmRead(); |
|
|
|
|
|
|
|
Thread.Sleep(100); |
|
|
|
}, "数据获取", true); |
|
|
|
} |
|
|
|