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.
126 lines
3.5 KiB
C#
126 lines
3.5 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.ElectronicMachinaryStateMonitor
|
|
{
|
|
public partial class ElectronicMachineryStateMonitor : Form
|
|
{
|
|
string DmName_FOR_MOTOR = "DM1GDP01";
|
|
public ElectronicMachineryStateMonitor()
|
|
{
|
|
InitializeComponent();
|
|
StateMonitor_FOR_MOTOR(DmName_FOR_MOTOR);
|
|
}
|
|
|
|
private void DmChange_FOR_MOTOR_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
switch (DmChange_FOR_MOTOR.Text)
|
|
{
|
|
case "二级除尘器除尘风机":
|
|
DmName_FOR_MOTOR = "DM1GDP01";
|
|
break;
|
|
case "大A组除尘风机":
|
|
DmName_FOR_MOTOR = "DM1ASIG01";
|
|
break;
|
|
case "大仓B组除尘风机":
|
|
DmName_FOR_MOTOR = "DM1BSIG01";
|
|
break;
|
|
case "大仓C组除尘风机":
|
|
DmName_FOR_MOTOR = "DM1CSIG01";
|
|
break;
|
|
case "大仓D组除尘风机":
|
|
DmName_FOR_MOTOR = "DM1DSIG01";
|
|
break;
|
|
case "磨粉分析机电机":
|
|
DmName_FOR_MOTOR = "DM1GDS01";
|
|
break;
|
|
case "磨粉除尘风机电机":
|
|
DmName_FOR_MOTOR = "DM1GDS02";
|
|
break;
|
|
case "磨粉罗茨风机电机":
|
|
DmName_FOR_MOTOR = "DM1GDS03";
|
|
break;
|
|
case "磨粉皮带正转电机":
|
|
DmName_FOR_MOTOR = "DM1GDS04";
|
|
break;
|
|
case "磨粉皮带反转电机":
|
|
DmName_FOR_MOTOR = "DM1GDS05";
|
|
break;
|
|
}
|
|
StateMonitor_FOR_MOTOR(DmName_FOR_MOTOR);
|
|
}
|
|
|
|
private void StateMonitor_FOR_MOTOR(String dmName)
|
|
{
|
|
ManualMode.Text = GetDataToString(dmName, "_ManualMode");
|
|
AutoMode.Text = GetDataToString(dmName, "_AutoMode");
|
|
StartManual.Text = GetDataToString(dmName, "_StartManual");
|
|
StopManual.Text = GetDataToString(dmName, "_StopManual");
|
|
StartAuto.Text = GetDataToString(dmName, "_StartAuto");
|
|
StopAuto.Text = GetDataToString(dmName, "_StopAuto");
|
|
AlarmReset.Text = GetDataToString(dmName, "_AlarmReset");
|
|
Running.Text = GetDataToString(dmName, "_Running");
|
|
Run.Text = GetDataToString(dmName, "_Run");
|
|
Alarm.Text = GetDataToString(dmName, "_Alarm");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <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();
|
|
}
|
|
}
|
|
}
|