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.
129 lines
5.1 KiB
C#
129 lines
5.1 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.ParametersWithPCStateMonitor
|
|
{
|
|
public partial class ParametersWithPCStateMonitor : Form
|
|
{
|
|
string DmChange_Pressure = "mainPress_V1";
|
|
string DmChange_Weight = "Hopper_1";
|
|
public ParametersWithPCStateMonitor()
|
|
{
|
|
InitializeComponent();
|
|
StateMonitor_Pressure(DmChange_Pressure);
|
|
StateMonitor_Weight(DmChange_Weight);
|
|
}
|
|
|
|
private void StateMonitor_Pressure(string dmName)
|
|
{
|
|
ActualValue.Text = GetDataToString(dmName, "_ActualValue");
|
|
LowLimit.Text = GetDataToString(dmName, "_LowLimit");
|
|
HighLimit.Text = GetDataToString(dmName, "_HighLimit");
|
|
Alarm.Text = GetDataToString(dmName, "_Alarm");
|
|
}
|
|
|
|
private void StateMonitor_Weight(string dmName)
|
|
{
|
|
ActWeight.Text = GetDataToString(dmName, "_ActWeight");
|
|
HighWeight.Text = GetDataToString(dmName, "_HighWeight");
|
|
LowWeight.Text = GetDataToString(dmName, "_LowWeight");
|
|
HighLevel.Text = GetDataToString(dmName, "_HighLevel");
|
|
LowLevel.Text = GetDataToString(dmName, "_LowLevel");
|
|
}
|
|
|
|
private void ListBox_DmChange_Pressure_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
DmChange_Pressure = dmNameValue[ListBox_DmChange_Pressure.Text];
|
|
StateMonitor_Pressure(DmChange_Pressure);
|
|
}
|
|
|
|
private void ListBox_DmChange_Weight_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
DmChange_Weight = dmNameValue[ListBox_DmChange_Weight.Text];
|
|
StateMonitor_Weight(DmChange_Weight);
|
|
}
|
|
|
|
private void Refresh_Click(object sender, EventArgs e)
|
|
{
|
|
StateMonitor_Pressure(DmChange_Pressure);
|
|
StateMonitor_Weight(DmChange_Weight);
|
|
}
|
|
|
|
private IDictionary<string, string> dmNameValue = new Dictionary<string, string>()
|
|
{
|
|
["压送秤A气源压力"] = "mainPress_V1",
|
|
["压送秤A顶部压力"] = "topPressure_V1",
|
|
["压送秤A底部压力"] = "linePressure_V1",
|
|
["压送秤B气源压力"] = "mainPress_V2",
|
|
["压送秤B顶部压力"] = "topPressure_V2",
|
|
["压送秤B底部压力"] = "linePressure_V2",
|
|
["压送秤C气源压力"] = "mainPress_V3",
|
|
["压送秤C顶部压力"] = "topPressure_V3",
|
|
["压送秤C底部压力"] = "linePressure_V3",
|
|
["压送秤D气源压力"] = "mainPress_V4",
|
|
["压送秤D顶部压力"] = "topPressure_V4",
|
|
["压送秤D底部压力"] = "linePressure_V4",
|
|
["压送秤E气源压力"] = "mainPress_V5",
|
|
["压送秤E顶部压力"] = "topPressure_V5",
|
|
["压送秤E底部压力"] = "linePressure_V5",
|
|
["日罐压力B1"] = "presDaybin_B1",
|
|
["日罐压力B2"] = "presDaybin_B2",
|
|
["日罐压力B3"] = "presDaybin_B3",
|
|
["日罐压力B4"] = "presDaybin_B4",
|
|
["日罐压力B5"] = "presDaybin_B5",
|
|
["日罐压力B6"] = "presDaybin_B6",
|
|
["日罐压力B7"] = "presDaybin_B7",
|
|
["日罐压力B8"] = "presDaybin_B8",
|
|
["日罐压力B9"] = "presDaybin_B9",
|
|
["日罐压力B10"] = "presDaybin_B10",
|
|
["日罐压力B11"] = "presDaybin_B11",
|
|
["日罐压力B12"] = "presDaybin_B12",
|
|
["管道压力传感器1"] = "PR2PCP01",
|
|
["管道压力传感器2"] = "PR2PCP02",
|
|
["管道压力传感器3"] = "PR2PCP03",
|
|
["干混缓存A重量"] = "Hopper_1",
|
|
["干混缓存B重量"] = "Hopper_2",
|
|
["干混缓存C重量"] = "Hopper_3",
|
|
["干混缓存D重量"] = "Hopper_4",
|
|
["压送秤A重量"] = "Vessel_1",
|
|
["压送秤B重量"] = "Vessel_2",
|
|
["压送秤C重量"] = "Vessel_3",
|
|
["压送秤D重量"] = "Vessel_4",
|
|
["压送秤E重量"] = "Vessel_5",
|
|
["热水秤A重量"] = "WScale_1",
|
|
["热水秤B重量"] = "WScale_2",
|
|
["冷水秤A重量"] = "WScale_3",
|
|
["冷水秤B重量"] = "WScale_4",
|
|
|
|
};
|
|
|
|
/// <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();
|
|
}
|
|
}
|
|
}
|