// 5 采样状态(可用颜色表示)、累计采样体积(重要)、累计采样时间、瞬时采样流量、三种故障报警 private void UpdatePanel_I(HerePaneItem panel) { var d = this.dataProvider.GetLatestData(DataProvider.DeviceKey_ISampler); if (d == null) { return; } string status = this.GetDisplayString(d, "status"); string volume = this.GetDisplayString(d, "volume"); string hours = this.GetDisplayString(d, "hours"); string flow = this.GetDisplayString(d, "flow"); string statusMsg; if (status == "1") { statusMsg = string.Format("采样状态: 运行"); } else { statusMsg = string.Format("采样状态: 停止"); } string volumeMsg = string.Format("累计采样体积: {0}L", volume); string hoursMsg = string.Format("累计采样时间: {0}h", hours); string flowMsg = string.Format("瞬时采样流量: {0}L/h", flow); this.DisplayPanelData(panel, statusMsg, volumeMsg, hoursMsg, flowMsg); }
public HerePaneItem AddItem(string deviceKey, string title) { HerePaneItem item = new HerePaneItem(); item.DeviceKey = deviceKey; item.Title = title; this.Panel.Children.Add(item); return item; }
public HerePaneItem AddItem(string deviceKey, string title) { HerePaneItem item = new HerePaneItem(); item.DeviceKey = deviceKey; item.Title = title; this.Panel.Children.Add(item); return(item); }
// 6 市电状态、备电时间、舱内温度、门禁报警、烟感报警、浸水报警 private void UpdatePanel_Shelter(HerePaneItem panel) { var d = this.dataProvider.GetLatestData(DataProvider.DeviceKey_Shelter); if (d == null) { return; } string batteryHours = ""; string mainPowerWay = ""; string temperature = ""; const string MainPowKey = "ifmainpoweroff"; const string BatteryHoursKey = "batteryhours"; const string TemperatureKey = "temperature"; if (d.ContainsKey(MainPowKey)) { string m = (string)d[MainPowKey]; mainPowerWay = (m == "1") ? "市电" : "蓄电池"; } if (d.ContainsKey(BatteryHoursKey)) { batteryHours = (string)d[BatteryHoursKey]; double v; if (double.TryParse(batteryHours, out v)) { batteryHours = Math.Round(v, 0).ToString(); } } if (d.ContainsKey(TemperatureKey)) { temperature = (string)d[TemperatureKey]; double v; if (double.TryParse(temperature, out v)) { temperature = Math.Round(v, 0).ToString(); } } string mainPowMsg = string.Format("供电方式: {0}", mainPowerWay); string batteryHoursMsg = string.Format("备电时间: {0}h", batteryHours); string tempMsg = string.Format("舱内温度: {0}℃", temperature); this.DisplayPanelData(panel, mainPowMsg, batteryHoursMsg, tempMsg); }
// 7 仅工作状态 private void UpdatePanel_DWD(HerePaneItem panel) { var d = this.dataProvider.GetLatestData(DataProvider.DeviceKey_Dwd); if (d == null) { return; } if (!d.ContainsKey("islidopen")) { return; } string isLidOpen = (string)d["islidopen"]; string LidOpenMsg = (isLidOpen == "1") ? "雨水采集" : "沉降灰采集"; this.DisplayPanelData(panel, "采样状态:" + LidOpenMsg); }
// 1 剂量率 private void UpdatePanel_HPIC(HerePaneItem panel) { var d = this.dataProvider.GetLatestData(DataProvider.DeviceKey_Hpic); if (d == null) { return; } if (d.ContainsKey("doserate")) { string doserate = d["doserate"] as string; double v; if (ConvertDouble(doserate, out v)) { string doserateMsg = "剂量率: " + v + "uGy/h"; this.DisplayPanelData(panel, doserateMsg); } } }
private void AddDevicePanes() { this.panes = new List <HerePaneItem>(); Config cfg = Config.Instance(); string[] deviceKeys = cfg.DeviceKeys; foreach (string deviceKey in deviceKeys) { string displayName = cfg.GetDisplayName(deviceKey); if (!string.IsNullOrEmpty(displayName)) { HerePaneItem herePaneItem = this.herePane.AddItem(deviceKey, displayName); panes.Add(herePaneItem); } } if (true) { var herePaneItem = panes[0]; } }
// 3 // 风速、风向、雨量 private void UpdatePanel_Weather(HerePaneItem panel) { var d = this.dataProvider.GetLatestData(DataProvider.DeviceKey_Weather); if (d == null) { return; } if (!d.ContainsKey("windspeed")) { return; } string windspeed = (string)d["windspeed"]; string direction = (string)d["direction"]; string raingauge = (string)d["raingauge"]; string windspeedMsg = string.Format("风速: {0}m/s", windspeed); string directionMsg = string.Format("风向: {0}°", direction); string raingaugeMsg = string.Format("雨量: {0}mm/min", raingauge); this.DisplayPanelData(panel, windspeedMsg, directionMsg, raingaugeMsg); }
private void DisplayPanelData(HerePaneItem panel, string data1, string data2 = "", string data3 = "", string data4 = "") { TextBlock text1 = panel[0]; TextBlock text2 = panel[1]; TextBlock text3 = panel[2]; TextBlock text4 = panel[3]; if (data1 != null && data1.Length > 0) { text1.Text = data1; } if (data2 != null && data2.Length > 0) { text2.Text = data2; } if (data3 != null && data3.Length > 0) { text3.Text = data3; } if (data4 != null && data4.Length > 0) { text4.Text = data4; } }
// 1 剂量率 private void UpdatePanel_HPIC(HerePaneItem panel) { var d = this.dataProvider.GetLatestData(DataProvider.DeviceKey_Hpic); if (d == null) { return; } const string Doserate = "doserate"; if (d.ContainsKey(Doserate)) { string doserate = d[Doserate] as string; double v; if (ConvertDouble(doserate, out v)) { this.CheckAlarm(panel, DBDataProvider.DeviceKey_Hpic, Doserate, 0, v); string doserateMsg = "剂量率: " + v + "nGy/h"; this.DisplayPanelData(panel, doserateMsg); } } }
// 2 总剂量率、发现核素(置信度=100,剂量率>5nSv/h,最好可以设置剂量率的阈值) /* * K-40 = K-40; (0, 100, 100) * I-131 = I-131; (0, 100, 100) * Bi-214 = Bi-214; (0, 100, 100) * Pb-214 = Pb-214; (0, 100, 100) * Cs-137 = Cs-137; (0, 100, 100) * Co-60 = Co-60; (0, 100, 100) * Am-241 = Am-241; (0, 100, 100) * Ba-140 = Ba-140;(0, 100, 100) * Cs-134 = Cs-134;(0, 100, 100) * I-133 = I-133; (0, 100, 100) * Rh-106m = Rh-106m;(0, 100, 100) * Ru-103 = Ru-103; (0, 100, 100) * Te-129 = Te-129;(0, 100, 100) */ private void UpdatePanel_NaI(HerePaneItem panel) { var d = this.dataProvider.GetLatestData(DataProvider.DeviceKey_NaI); if (d == null) { return; } if (!d.ContainsKey("doserate")) { return; } string doserate = (string)d["doserate"]; string[] nuclides = { "K-40", "I-131", "Bi-214", "Pb-214", "Cs-137", "Co-60", "Am-241", "Ba-140", "Cs-134", "I-133", "Rh-106m", "Ru-103", "Te-129" }; string[] nuclideMsgs = new string[3] { "", "", "" }; int i = 0; foreach (string nuclide in nuclides) { string nuclideKey = nuclide.ToLower(); if (d.ContainsKey(nuclideKey)) { string indicationKey = string.Format("Ind({0})", nuclideKey); string indication = (string)d[indicationKey]; if (indication == "100") { nuclideMsgs[i / 3] += string.Format("{0}, ", nuclide); i++; /* Now, only show nuclides name. * string nuclideDoserate = (string)d[nuclide.ToLower()]; * if (nuclideDoserate.Length > 0) * { * double v; * if (ConvertDouble(nuclideDoserate, out v)) * { * nuclideMsgs[i] = string.Format("{0}: {1}uSv/h", nuclide, v); * i++; * if (i >= 3) * { * break; * } * } * } */ } } } string doserateMsg = "总剂量率: " + doserate + "uSv/h"; for (int k = 0; k < 3; ++k) { nuclideMsgs[k] = nuclideMsgs[k].TrimEnd(' ', ','); } this.DisplayPanelData(panel, doserateMsg, nuclideMsgs[0], nuclideMsgs[1], nuclideMsgs[2]); }
// 7 仅工作状态 private void UpdatePanel_DWD(HerePaneItem panel) { var d = this.dataProvider.GetLatestData(DataProvider.DeviceKey_Dwd); if (d == null) { return; } if (!d.ContainsKey("islidopen")) { return; } string isLidOpen = (string)d["islidopen"]; string LidOpenMsg = (isLidOpen == "1") ? "雨水采集" : "沉降灰采集"; this.DisplayPanelData(panel, "采样状态:" + LidOpenMsg); }
private void CheckAlarm(HerePaneItem panel, string deviceKey, string item, int index, string value) { double v; if (double.TryParse(value, out v)) { this.CheckAlarm(panel, deviceKey, item, index, v); } }
// 3 // 风速、风向、雨量 private void UpdatePanel_Weather(HerePaneItem panel) { var d = this.dataProvider.GetLatestData(DataProvider.DeviceKey_Weather); if (d == null) { return; } if (!d.ContainsKey("windspeed")) { return; } string windspeed = (string)d["windspeed"]; string direction = (string)d["direction"]; string raingauge = (string)d["raingauge"]; string windspeedMsg = string.Format("风速: {0}m/s", windspeed); string directionMsg = string.Format("风向: {0}°", direction); string raingaugeMsg = string.Format("雨量: {0}mm/min", raingauge); this.DisplayPanelData(panel, windspeedMsg, directionMsg, raingaugeMsg); }
// 6 市电状态、备电时间、舱内温度、门禁报警、烟感报警、浸水报警 private void UpdatePanel_Shelter(HerePaneItem panel) { var d = this.dataProvider.GetLatestData(DataProvider.DeviceKey_Shelter); if (d == null) { return; } string batteryHours = ""; string mainPowerWay = ""; string temperature = ""; const string MainPowKey = "ifmainpoweroff"; const string BatteryHoursKey = "batteryhours"; const string TemperatureKey = "temperature"; if (d.ContainsKey(MainPowKey)) { string m = (string)d[MainPowKey]; mainPowerWay = (m == "1") ? "市电" : "蓄电池"; } if (d.ContainsKey(BatteryHoursKey)) { batteryHours = (string)d[BatteryHoursKey]; double v; if (double.TryParse(batteryHours, out v)) { batteryHours = Math.Round(v, 0).ToString(); } } if (d.ContainsKey(TemperatureKey)) { temperature = (string)d[TemperatureKey]; double v; if (double.TryParse(temperature, out v)) { temperature = Math.Round(v, 0).ToString(); } } string mainPowMsg = string.Format("供电方式: {0}", mainPowerWay); string batteryHoursMsg = string.Format("备电时间: {0}h", batteryHours); string tempMsg = string.Format("舱内温度: {0}℃", temperature); this.DisplayPanelData(panel, mainPowMsg, batteryHoursMsg, tempMsg); }
// 2 总剂量率、发现核素(置信度=100,剂量率>5nSv/h,最好可以设置剂量率的阈值) /* * K-40 = K-40; (0, 100, 100) I-131 = I-131; (0, 100, 100) Bi-214 = Bi-214; (0, 100, 100) Pb-214 = Pb-214; (0, 100, 100) Cs-137 = Cs-137; (0, 100, 100) Co-60 = Co-60; (0, 100, 100) Am-241 = Am-241; (0, 100, 100) Ba-140 = Ba-140;(0, 100, 100) Cs-134 = Cs-134;(0, 100, 100) I-133 = I-133; (0, 100, 100) Rh-106m = Rh-106m;(0, 100, 100) Ru-103 = Ru-103; (0, 100, 100) Te-129 = Te-129;(0, 100, 100) */ private void UpdatePanel_NaI(HerePaneItem panel) { var d = this.dataProvider.GetLatestData(DataProvider.DeviceKey_NaI); if (d == null) { return; } if (!d.ContainsKey("doserate")) { return; } string doserate = (string)d["doserate"]; string[] nuclides = { "K-40", "I-131", "Bi-214", "Pb-214", "Cs-137", "Co-60", "Am-241", "Ba-140", "Cs-134", "I-133", "Rh-106m", "Ru-103", "Te-129" }; string[] nuclideMsgs = new string[3]{"", "", ""}; int i = 0; foreach (string nuclide in nuclides) { string nuclideKey = nuclide.ToLower(); if (d.ContainsKey(nuclideKey)) { string indicationKey = string.Format("Ind({0})", nuclideKey); string indication = (string)d[indicationKey]; if (indication == "100") { nuclideMsgs[i / 3] += string.Format("{0}, ", nuclide); i++; /* Now, only show nuclides name. string nuclideDoserate = (string)d[nuclide.ToLower()]; if (nuclideDoserate.Length > 0) { double v; if (ConvertDouble(nuclideDoserate, out v)) { nuclideMsgs[i] = string.Format("{0}: {1}uSv/h", nuclide, v); i++; if (i >= 3) { break; } } } */ } } } string doserateMsg = "总剂量率: " + doserate + "uSv/h"; for (int k = 0; k < 3; ++k) { nuclideMsgs[k] = nuclideMsgs[k].TrimEnd(' ', ','); } this.DisplayPanelData(panel, doserateMsg, nuclideMsgs[0], nuclideMsgs[1], nuclideMsgs[2]); }
// 5 采样状态(可用颜色表示)、累计采样体积(重要)、累计采样时间、瞬时采样流量、三种故障报警 private void UpdatePanel_I(HerePaneItem panel) { var d = this.dataProvider.GetLatestData(DataProvider.DeviceKey_ISampler); if (d == null) { return; } string status = this.GetDisplayString(d, "status"); string volume = this.GetDisplayString(d, "volume"); string hours = this.GetDisplayString(d, "hours"); string flow = this.GetDisplayString(d, "flow"); string statusMsg; if (status == "1") { statusMsg = string.Format("采样状态: 运行"); } else { statusMsg = string.Format("采样状态: 停止"); } string volumeMsg = string.Format("累计采样体积: {0}L", volume); string hoursMsg = string.Format("累计采样时间: {0}h", hours); string flowMsg = string.Format("瞬时采样流量: {0}L/h", flow); this.DisplayPanelData(panel, statusMsg, volumeMsg, hoursMsg, flowMsg); }
// 1 剂量率 private void UpdatePanel_HPIC(HerePaneItem panel) { var d = this.dataProvider.GetLatestData(DataProvider.DeviceKey_Hpic); if (d == null) { return; } if (d.ContainsKey("doserate")) { string doserate = d["doserate"] as string; double v; if (ConvertDouble(doserate, out v)) { string doserateMsg = "剂量率: " + v + "uGy/h"; this.DisplayPanelData(panel, doserateMsg); } } }
// #007ACC private void CheckAlarm(HerePaneItem panel, string deviceKey, string item, int index, double value) { var i = Config.Instance()[deviceKey].GetConfigItem(item); if (!i.Alarm) { return; } TextBlock text = panel[index]; if (value >= i.Red) { text.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 44)); } else if (value >= i.Yellow && value < i.Red) { text.Foreground = Brushes.Orange; } else { text.Foreground = new SolidColorBrush(Color.FromRgb(0x00, 0x7a, 0xCC)); } }
private void DisplayPanelData(HerePaneItem panel, string data1, string data2 = "", string data3 = "", string data4 = "") { TextBlock text1 = panel[0]; TextBlock text2 = panel[1]; TextBlock text3 = panel[2]; TextBlock text4 = panel[3]; if (data1 != null && data1.Length > 0) { text1.Text = data1; } if (data2 != null && data2.Length > 0) { text2.Text = data2; } if (data3 != null && data3.Length > 0) { text3.Text = data3; } if (data4 != null && data4.Length > 0) { text4.Text = data4; } }