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.

166 lines
8.0 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 ElectronicMachineryDataStateMonitor : Form
{
string DmName_FOR_MOTOR = "DM1GDP01";
string DmName_FOR_MOTOR_S = "DM1GDS06";
string DmName_FOR_MOTOR_VFD = "DM1DSM01";
public ElectronicMachineryDataStateMonitor()
{
InitializeComponent();
StateMonitor_FOR_MOTOR(DmName_FOR_MOTOR);
StateMonitor_FOR_MOTOR_S(DmName_FOR_MOTOR_S);
StateMonitor_FOR_MOTOR_VFD(DmName_FOR_MOTOR_VFD);
}
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 = PlcCommunicationUtil.GetDataToString(dmName, "_ManualMode");
AutoMode.Text = PlcCommunicationUtil.GetDataToString(dmName, "_AutoMode");
StartManual.Text = PlcCommunicationUtil.GetDataToString(dmName, "_StartManual");
StopManual.Text = PlcCommunicationUtil.GetDataToString(dmName, "_StopManual");
StartAuto.Text = PlcCommunicationUtil.GetDataToString(dmName, "_StartAuto");
StopAuto.Text = PlcCommunicationUtil.GetDataToString(dmName, "_StopAuto");
AlarmReset.Text = PlcCommunicationUtil.GetDataToString(dmName, "_AlarmReset");
Running.Text = PlcCommunicationUtil.GetDataToString(dmName, "_Running");
Run.Text = PlcCommunicationUtil.GetDataToString(dmName, "_Run");
Alarm.Text = PlcCommunicationUtil.GetDataToString(dmName, "_Alarm");
}
private void DmChange_FOR_MOTOR_S_SelectedIndexChanged(object sender, EventArgs e)
{
switch (DmChange_FOR_MOTOR_S.Text)
{
case "磨粉主机电机":
DmName_FOR_MOTOR_S = "DM1GDS06";
break;
case "磨粉风机电机":
DmName_FOR_MOTOR_S = "DM1GDS07";
break;
}
StateMonitor_FOR_MOTOR_S(DmName_FOR_MOTOR_S);
}
private void StateMonitor_FOR_MOTOR_S(String dmName)
{
ManualMode_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_ManualMode");
AutoMode_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_AutoMode");
StartManual_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_StartManual");
StopManual_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_StopManual");
StartAuto_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_StartAuto");
StopAuto_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_StopAuto");
AlarmReset_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_AlarmReset");
Running_M_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_RunningM");
Running_S_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_RunningS");
Running_T_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_RunningT");
Run_M_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_RunM");
Run_S_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_RunS");
Run_T_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_RunT");
Alarm_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_Alarm");
Alarm_M_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_AlarmM");
Alarm_S_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_AlarmS");
Alarm_T_S.Text = PlcCommunicationUtil.GetDataToString(dmName, "_AlarmT");
}
private void DmChange_FOR_MOTOR_VFD_SelectedIndexChanged(object sender, EventArgs e)
{
switch (DmChange_FOR_MOTOR_VFD.Text)
{
case "筛分机A电机":
DmName_FOR_MOTOR_VFD = "DM1DSM01";
break;
case "筛分机B电机":
DmName_FOR_MOTOR_VFD = "DM2DSM01";
break;
case "筛分机C电机":
DmName_FOR_MOTOR_VFD = "DM3DSM01";
break;
case "磨粉旋转阀电机":
DmName_FOR_MOTOR_VFD = "DM1GDS12";
break;
}
StateMonitor_FOR_MOTOR_VFD(DmName_FOR_MOTOR_VFD);
}
private void StateMonitor_FOR_MOTOR_VFD(string dmName)
{
Auto_BT_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_AutoBT");
Man_BT_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_ManBT");
Start_A_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_StartA");
Stop_A_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_StopA");
Start_M_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_StartM");
Stop_M_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_StopM");
AlarmReset_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_AlarmReset");
EXT_Estop_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_EXTEstop");
AutoMode_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_AutoMode");
ManMode_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_ManMode");
VVVF_OK_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_VVVFOK");
Running_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_Running");
Alarm_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_Alarm");
Error_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_Error");
Enable_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_Enable");
Polarity_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_Polarity");
SetSpeed_A_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_SetSpeedA");
SetSpeed_M_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_SetSpeedM");
ACT_Speed_VFD.Text = PlcCommunicationUtil.GetDataToString(dmName, "_ACTSpeed");
}
private void Refresh_Click(object sender, EventArgs e)
{
StateMonitor_FOR_MOTOR(DmName_FOR_MOTOR);
StateMonitor_FOR_MOTOR_S(DmName_FOR_MOTOR_S);
StateMonitor_FOR_MOTOR_VFD(DmName_FOR_MOTOR_VFD);
}
}
}