You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
6.9 KiB
C#
156 lines
6.9 KiB
C#
using Mesnac.Action.ChemicalWeighing.Entity;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.EngineeringDebuggingMode.InstrumentDataStateMonitor
|
|
{
|
|
public partial class InstrumentDataStateMonitor : Form
|
|
{
|
|
string DmName_3005 = "PR1DBT01";
|
|
string DmName_3006 = "SPV1DBT01";
|
|
|
|
public InstrumentDataStateMonitor()
|
|
{
|
|
InitializeComponent();
|
|
StateMonitor_3005(DmName_3005);
|
|
StateMonitor_3006(DmName_3006);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 根据属性名和现在选择的数据块名得到PLC数据块的具体引用
|
|
/// </summary>
|
|
/// <param name="dmValue">数据块属性名</param>
|
|
/// <returns></returns>
|
|
private DataKeyValue GetDataNameValue(string dmName, string dmValue)
|
|
{
|
|
return new DataKeyValue(dmName + dmValue);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 从PLC中读取值
|
|
/// </summary>
|
|
/// <param name="dmValue">要读取的属性</param>
|
|
/// <returns></returns>
|
|
private string GetDataToString(string dmName, string dmValue)
|
|
{
|
|
return GetDataNameValue(dmName, dmValue).NowValue.ToString();
|
|
}
|
|
|
|
private void DmChange_3005_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
DmName_3005 = dmNameValue[DmChange_3005.Text];
|
|
StateMonitor_3005(DmName_3005);
|
|
}
|
|
|
|
private void DmChange_3006_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
DmName_3006 = dmNameValue[DmChange_3006.Text];
|
|
StateMonitor_3006(DmName_3006);
|
|
}
|
|
|
|
private void Refresh_Click(object sender, EventArgs e)
|
|
{
|
|
StateMonitor_3005(DmName_3005);
|
|
StateMonitor_3006(DmName_3006);
|
|
}
|
|
|
|
private void StateMonitor_3005(string dmName)
|
|
{
|
|
Min_3005.Text = GetDataToString(dmName, "_Min");
|
|
Max_3005.Text = GetDataToString(dmName, "_Max");
|
|
Value_3005.Text = GetDataToString(dmName, "_Value");
|
|
Alarm_3005.Text = GetDataToString(dmName, "_Alarm");
|
|
}
|
|
|
|
private void StateMonitor_3006(string dmName)
|
|
{
|
|
Mlin_3006.Text = GetDataToString(dmName, "_Mlin");
|
|
Max_3006.Text = GetDataToString(dmName, "_Max");
|
|
SetValue_3006.Text = GetDataToString(dmName, "_SetValue");
|
|
Alarm_3006.Text = GetDataToString(dmName, "_Alarm");
|
|
}
|
|
|
|
private IDictionary<string, string> dmNameValue = new Dictionary<string, string>()
|
|
{
|
|
["输送线A_主气源压力传感器"] = "PR1DBT01",
|
|
["输送线A_1号压送罐压力传感器"] = "PR1DBT02",
|
|
["输送线A_2号压送罐压力传感器"] = "PR1DBT03",
|
|
["输送线A_出料口检测压力传感器"] = "PR1DBT04",
|
|
["输送线B_主气源压力传感器"] = "PR2DBT01",
|
|
["输送线B_1号压送罐压力传感器"] = "PR2DBT02",
|
|
["输送线B_2号压送罐压力传感器"] = "PR2DBT03",
|
|
["输送线B_出料口检测压力传感器"] = "PR2DBT04",
|
|
["输送线C_主气源压力传感器"] = "PR3DBT01",
|
|
["输送线C_1号压送罐压力传感器"] = "PR3DBT02",
|
|
["输送线C_2号压送罐压力传感器"] = "PR3DBT03",
|
|
["输送线C_出料口检测压力传感器"] = "PR3DBT04",
|
|
["大仓A压力传感器"] = "PR1ASI01",
|
|
["大仓B压力传感器"] = "PR1BSI01",
|
|
["大仓C压力传感器"] = "PR1CSI01",
|
|
["大仓D压力传感器"] = "PR1DSI01",
|
|
["大仓E压力传感器"] = "PR1ESI01",
|
|
["大仓F压力传感器"] = "PR1FSI01",
|
|
["大仓G压力传感器"] = "PR1GSI01",
|
|
["大仓H压力传感器"] = "PR1HSI01",
|
|
["大仓I压力传感器"] = "PR1ISI01",
|
|
["大仓J压力传感器"] = "PR1JSI01",
|
|
["大仓O压力传感器"] = "PR1OSI01",
|
|
["输送线A_管道压力传感器"] = "PR1PCP01",
|
|
["输送线B_管道压力传感器"] = "PR1PCP02",
|
|
["输送线C_管道压力传感器"] = "PR1PCP03",
|
|
["大仓A连续料位计"] = "LS1ASI01",
|
|
["大仓B连续料位计"] = "LS1BSI01",
|
|
["大仓C连续料位计"] = "LS1CSI01",
|
|
["大仓D连续料位计"] = "LS1DSI01",
|
|
["大仓E连续料位计"] = "LS1ESI01",
|
|
["大仓F连续料位计"] = "LS1FSI01",
|
|
["大仓G连续料位计"] = "LS1GSI01",
|
|
["大仓H连续料位计"] = "LS1HSI01",
|
|
["大仓I连续料位计"] = "LS1ISI01",
|
|
["大仓J连续料位计"] = "LS1JSI01",
|
|
["大仓O连续料位计"] = "LS1OSI01",
|
|
["大仓A顶部热电阻/测温开关"] = "HR1ASI01",
|
|
["大仓B顶部热电阻/测温开关"] = "HR1BSI01",
|
|
["大仓C顶部热电阻/测温开关"] = "HR1CSI01",
|
|
["大仓D顶部热电阻/测温开关"] = "HR1DSI01",
|
|
["大仓E顶部热电阻/测温开关"] = "HR1ESI01",
|
|
["大仓F顶部热电阻/测温开关"] = "HR1FSI01",
|
|
["大仓G顶部热电阻/测温开关"] = "HR1GSI01",
|
|
["大仓H顶部热电阻/测温开关"] = "HR1HSI01",
|
|
["大仓I顶部热电阻/测温开关"] = "HR1ISI01",
|
|
["大仓J顶部热电阻/测温开关"] = "HR1JSI01",
|
|
["大仓O顶部热电阻/测温开关"] = "HR1OSI01",
|
|
["输送线A_主管电磁比例阀"] = "SPV1DBT01",
|
|
["输送线A_辅管电磁比例阀"] = "SPV1DBT02",
|
|
["输送线B_主管电磁比例阀"] = "SPV2DBT01",
|
|
["输送线B_辅管电磁比例阀"] = "SPV2DBT02",
|
|
["输送线C_主管电磁比例阀"] = "SPV3DBT01",
|
|
["输送线C_辅管电磁比例阀"] = "SPV3DBT02",
|
|
["大仓A低部热电阻/测温开关"] = "From_SiloA",
|
|
["大仓B低部热电阻/测温开关"] = "From_SiloB",
|
|
["大仓C低部热电阻/测温开关"] = "From_SiloC",
|
|
["大仓D低部热电阻/测温开关"] = "From_SiloD",
|
|
["大仓E低部热电阻/测温开关"] = "From_SiloE",
|
|
["大仓F低部热电阻/测温开关"] = "From_SiloF",
|
|
["大仓G低部热电阻/测温开关"] = "From_SiloG",
|
|
["大仓H低部热电阻/测温开关"] = "From_SiloH",
|
|
["大仓I低部热电阻/测温开关"] = "From_SiloI",
|
|
["大仓J低部热电阻/测温开关"] = "From_SiloJ",
|
|
["大仓K低部热电阻/测温开关"] = "From_SiloK",
|
|
["大仓L低部热电阻/测温开关"] = "From_SiloL",
|
|
["大仓M低部热电阻/测温开关"] = "From_SiloM",
|
|
["大仓N低部热电阻/测温开关"] = "From_SiloN",
|
|
["大仓O低部热电阻/测温开关"] = "From_SiloO"
|
|
|
|
};
|
|
}
|
|
}
|