Переглянути джерело

报警修改

reconfiguration
ZhaoGang 1 місяць тому
джерело
коміт
7544b28be9
5 змінених файлів з 99 додано та 36 видалено
  1. +9
    -9
      BPASmartClient.Academy/50L/AddData.cs
  2. +54
    -10
      BPASmartClient.Academy/50L/PlcControl.cs
  3. +28
    -15
      BPASmartClient.Academy/App.config
  4. +6
    -0
      BPASmartClient.Academy/BPASmartClient.Academy.csproj
  5. +2
    -2
      BPASmartClient.Academy/Model/Simens_PLC.cs

+ 9
- 9
BPASmartClient.Academy/50L/AddData.cs Переглянути файл

@@ -48,15 +48,15 @@ namespace BPASmartClient.Academy._50L
Data.TryAdd(fbd, 0);
}
});
AlarmHelper.GetInstance.AddNotify = (s) =>
{
App.Current.Dispatcher.Invoke(() =>
{
MessageNotify.GetInstance.ShowAlarmLog(s.Info);
});
};
AlarmHelper.GetInstance.Register<AlarmData>("50L反应釜");
AlarmHelper.GetInstance.Start();
//AlarmHelper.GetInstance.AddNotify = (s) =>
//{
// App.Current.Dispatcher.Invoke(() =>
// {
// MessageNotify.GetInstance.ShowAlarmLog(s.Info);
// });
//};
//AlarmHelper.GetInstance.Register<AlarmData>("50L反应釜");
//AlarmHelper.GetInstance.Start();
}
}
}

+ 54
- 10
BPASmartClient.Academy/50L/PlcControl.cs Переглянути файл

@@ -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);
}


+ 28
- 15
BPASmartClient.Academy/App.config Переглянути файл

@@ -1,18 +1,31 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="FlexBatchSystem">
<section name="Alarm" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</configSections>
<FlexBatchSystem>
<Alarm>
<add key="DB1.DBX2004.0" value="急停"/>
<add key="DB1.DBX2004.1" value="配料罐搅拌异常"/>
<add key="DB1.DBX2004.2" value="反应釜搅拌异常"/>
<add key="DB1.DBX2004.3" value="真空泵异常"/>
<add key="DB1.DBX2004.4" value="一体机柜急停按下"/>
<add key="DB1.DBX2004.5" value="空压机异常"/>
</Alarm>
</FlexBatchSystem>
<configSections>
<sectionGroup name="FlexBatchSystem">
<section name="Alarm" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
<sectionGroup name="Reactor_50L_Alarm">
<section name="Alarm" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</configSections>
<FlexBatchSystem>
<Alarm>
<add key="DB1.DBX2004.0" value="急停"/>
<add key="DB1.DBX2004.1" value="配料罐搅拌异常"/>
<add key="DB1.DBX2004.2" value="反应釜搅拌异常"/>
<add key="DB1.DBX2004.3" value="真空泵异常"/>
<add key="DB1.DBX2004.4" value="一体机柜急停按下"/>
<add key="DB1.DBX2004.5" value="空压机异常"/>
</Alarm>
</FlexBatchSystem>
<Reactor_50L_Alarm>
<Alarm>
<add key="DB1.DBX2004.0" value="急停"/>
<add key="DB1.DBX2004.1" value="反应釜旋转电机异常"/>
<add key="DB1.DBX2004.2" value="负压风机异常"/>
<add key="DB1.DBX2004.3" value="卤水泵异常"/>
<add key="DB1.DBX2004.4" value="空压机异常"/>
<add key="DB1.DBX2004.5" value="反应釜压力到达上限"/>
</Alarm>
</Reactor_50L_Alarm>
</configuration>

+ 6
- 0
BPASmartClient.Academy/BPASmartClient.Academy.csproj Переглянути файл

@@ -35,4 +35,10 @@
<Resource Include="50L\Page\罐.png" />
</ItemGroup>

<ItemGroup>
<None Update="App.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

+ 2
- 2
BPASmartClient.Academy/Model/Simens_PLC.cs Переглянути файл

@@ -97,11 +97,11 @@ namespace BPASmartClient.Academy.Model
//{
// IsConnected = false;
//}
if (p.Content)
if (RTrig.GetInstance($"{o}").Start(p.Content))
{
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", Simens_PLC.GetInstance.AlarmInfo[o], 2, 1);
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", Simens_PLC.GetInstance.AlarmInfo[o], 2, 3);
MessageNotify.GetInstance.ShowAlarmLog(Simens_PLC.GetInstance.AlarmInfo[o]);
});


Завантаження…
Відмінити
Зберегти