优化代码

dep_nodyang
nodyang 1 year ago
parent d1b58cc778
commit 90662b1bcd

@ -21,7 +21,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using HslCommunication;
using IAction = Mesnac.Action.Base.IAction;
using Timer = System.Windows.Forms.Timer;
@ -846,9 +846,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
public void Run(RuntimeParameter runtime)
{
DB2102 = new DB2102Helper();
DB2103 = new DB2103Helper();
DB2107 = new DB2107Helper();
base.RunIni(runtime); //必须要调用
@ -859,7 +857,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
timer = new Timer();
timer.Interval = 1000;
timer.Enabled = true;
timer.Tick += new EventHandler(GetPlcValue);//添加事件
timer.Tick += GetPlcValue;//添加事件
}
@ -1782,9 +1780,24 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
conCurrentCache.TryAdd("plc", DateTime.Now);
// NewThreadDb2102();
// NewThreadDb2103();
// NewThreadDb2107();
OperateResult<byte[]> db2102All=PlcConnect.Instance.Read("DB2102.0.0", 214);
OperateResult<byte[]> db2103All=PlcConnect.Instance.Read("DB2103.0.0", 418);
OperateResult<byte[]> db2107All = PlcConnect.Instance.Read("DB2107.0.0", 2057);
DB2102 = new DB2102Helper(db2102All.Content);
DB2103 = new DB2103Helper(db2103All.Content);
DB2107 = new DB2107Helper();
NewThreadDb2102();
NewThreadDb2107();
NewThreadDb2103();
// DB2103 = new DB2103Helper();
// DB2107 = new DB2107Helper();
conCurrentCache.Clear();
stopwatch.Stop();
var send = stopwatch.ElapsedMilliseconds;
@ -1798,7 +1811,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
MesnacServiceManager.Instance.LoggingService.Info("被过滤");
}
}
catch(Exception)
catch(Exception ex)
{
conCurrentCache.Clear();
}
@ -2156,7 +2169,8 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
timer.Dispose();
}
ThreadPool.QueueUserWorkItem(new WaitCallback(NewThread));
NewThread("");
// ThreadPool.QueueUserWorkItem(new WaitCallback());
}

@ -84,9 +84,8 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
public void Run(RuntimeParameter runtime)
{
DB2107 = new DB2107Helper();
DB2103 = new DB2103Helper();
base.RunIni(runtime); //必须要调用的

@ -2,11 +2,11 @@
{
public class PlcAddressUtil
{
public static string IpAddress = "172.18.4.100";
public static int Port = 102;
//public static string IpAddress = "172.18.4.100";
//public static int Port = 102;
//测试的Plc
//public static string IpAddress = "192.168.0.100";
//public static int Port = 7788;
public static string IpAddress = "192.168.0.100";
public static int Port = 7788;
}
}

@ -4,119 +4,127 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HslCommunication;
namespace DataBlockHelper.DBHelpers
{
public class DB2102Helper
{
public FOR_VALVE_DoubleEntity DV2PCP01 => new FOR_VALVE_DoubleEntity(130);
public FOR_VALVE_DoubleEntity DV2PCP02 => new FOR_VALVE_DoubleEntity(132);
public FOR_VALVE_DoubleEntity DV2PCP03 => new FOR_VALVE_DoubleEntity(134);
public FOR_VALVE_DoubleEntity DV2PCP04 => new FOR_VALVE_DoubleEntity(136);
public FOR_VALVE_DoubleEntity DV2PCP05 => new FOR_VALVE_DoubleEntity(138);
public FOR_VALVE_DoubleEntity DV2PCP06 => new FOR_VALVE_DoubleEntity(140);
public FOR_VALVE_DoubleEntity DV2PCP07 => new FOR_VALVE_DoubleEntity(142);
public FOR_VALVE_DoubleEntity DV2PCP08 => new FOR_VALVE_DoubleEntity(144);
public FOR_VALVE_DoubleEntity DV2PCP09 => new FOR_VALVE_DoubleEntity(146);
public FOR_VALVE_DoubleEntity DV2PCP10 => new FOR_VALVE_DoubleEntity(148);
public FOR_VALVE_DoubleEntity DV2PCP11 => new FOR_VALVE_DoubleEntity(150);
public FOR_VALVE_DoubleEntity DV2PCP12 => new FOR_VALVE_DoubleEntity(152);
public FOR_VALVE_DoubleEntity DV2PCP13 => new FOR_VALVE_DoubleEntity(154);
public FOR_VALVE_DoubleEntity DV2PCP14 => new FOR_VALVE_DoubleEntity(156);
private byte[] _bytes;
public FOR_VALVE_SingleEntity BU1ASF01 => new FOR_VALVE_SingleEntity(0);
public FOR_VALVE_SingleEntity BU1BSF01 => new FOR_VALVE_SingleEntity(2);
public FOR_VALVE_SingleEntity BU1CSF01 => new FOR_VALVE_SingleEntity(4);
public FOR_VALVE_SingleEntity BU1DSF01 => new FOR_VALVE_SingleEntity(6);
public FOR_VALVE_SingleEntity BU1ESF01 => new FOR_VALVE_SingleEntity(8);
public FOR_VALVE_SingleEntity BU1FSF01 => new FOR_VALVE_SingleEntity(10);
public FOR_VALVE_SingleEntity BU1GSF01 => new FOR_VALVE_SingleEntity(12);
public FOR_VALVE_SingleEntity BU1HSF01 => new FOR_VALVE_SingleEntity(14);
public FOR_VALVE_SingleEntity BU1ISF01 => new FOR_VALVE_SingleEntity(16);
public FOR_VALVE_SingleEntity BU1JSF01 => new FOR_VALVE_SingleEntity(18);
public FOR_VALVE_SingleEntity BU1KSF01 => new FOR_VALVE_SingleEntity(20);
public FOR_VALVE_SingleEntity BU1LSF01 => new FOR_VALVE_SingleEntity(22);
public FOR_VALVE_SingleEntity BU1MSF01 => new FOR_VALVE_SingleEntity(24);
public FOR_VALVE_SingleEntity BU1NSF01 => new FOR_VALVE_SingleEntity(26);
public FOR_VALVE_SingleEntity BU1OSF01 => new FOR_VALVE_SingleEntity(28);
public FOR_VALVE_SingleEntity BU1BLT01 => new FOR_VALVE_SingleEntity(30);
public FOR_VALVE_SingleEntity BU1BLT02 => new FOR_VALVE_SingleEntity(32);
public FOR_VALVE_SingleEntity BU1BLT03 => new FOR_VALVE_SingleEntity(34);
public FOR_VALVE_SingleEntity BU1BLT04 => new FOR_VALVE_SingleEntity(36);
public FOR_VALVE_SingleEntity BU1BLT05 => new FOR_VALVE_SingleEntity(38);
public FOR_VALVE_SingleEntity BU1BLT06 => new FOR_VALVE_SingleEntity(40);
public FOR_VALVE_SingleEntity BU1BLT07 => new FOR_VALVE_SingleEntity(42);
public FOR_VALVE_SingleEntity BU2BLT01 => new FOR_VALVE_SingleEntity(44);
public FOR_VALVE_SingleEntity BU2BLT02 => new FOR_VALVE_SingleEntity(46);
public FOR_VALVE_SingleEntity BU2BLT03 => new FOR_VALVE_SingleEntity(48);
public FOR_VALVE_SingleEntity BU2BLT04 => new FOR_VALVE_SingleEntity(50);
public FOR_VALVE_SingleEntity BU2BLT05 => new FOR_VALVE_SingleEntity(52);
public FOR_VALVE_SingleEntity BU3BLT01 => new FOR_VALVE_SingleEntity(54);
public FOR_VALVE_SingleEntity BU3BLT02 => new FOR_VALVE_SingleEntity(56);
public FOR_VALVE_SingleEntity BU3BLT03 => new FOR_VALVE_SingleEntity(58);
public FOR_VALVE_SingleEntity BU3BLT04 => new FOR_VALVE_SingleEntity(60);
public FOR_VALVE_SingleEntity BU3BLT05 => new FOR_VALVE_SingleEntity(62);
public FOR_VALVE_SingleEntity BU3BLT06 => new FOR_VALVE_SingleEntity(64);
public FOR_VALVE_SingleEntity BU3BLT07 => new FOR_VALVE_SingleEntity(66);
public FOR_VALVE_SingleEntity BU4BLT01 => new FOR_VALVE_SingleEntity(68);
public FOR_VALVE_SingleEntity BU4BLT02 => new FOR_VALVE_SingleEntity(70);
public FOR_VALVE_SingleEntity BU4BLT03 => new FOR_VALVE_SingleEntity(72);
public FOR_VALVE_SingleEntity BU4BLT04 => new FOR_VALVE_SingleEntity(74);
public FOR_VALVE_SingleEntity BU4BLT05 => new FOR_VALVE_SingleEntity(76);
public FOR_VALVE_SingleEntity BU4BLT06 => new FOR_VALVE_SingleEntity(78);
public FOR_VALVE_SingleEntity BU4BLT07 => new FOR_VALVE_SingleEntity(80);
public FOR_VALVE_SingleEntity BU5BLT01 => new FOR_VALVE_SingleEntity(82);
public FOR_VALVE_SingleEntity BU5BLT02 => new FOR_VALVE_SingleEntity(84);
public FOR_VALVE_SingleEntity BU5BLT03 => new FOR_VALVE_SingleEntity(86);
public FOR_VALVE_SingleEntity BU5BLT04 => new FOR_VALVE_SingleEntity(88);
public FOR_VALVE_SingleEntity BU2ASF01 => new FOR_VALVE_SingleEntity(90);
public FOR_VALVE_SingleEntity BU2ASF02 => new FOR_VALVE_SingleEntity(92);
public FOR_VALVE_SingleEntity BU2BSF01 => new FOR_VALVE_SingleEntity(94);
public FOR_VALVE_SingleEntity BU2BSF02 => new FOR_VALVE_SingleEntity(96);
public FOR_VALVE_SingleEntity BU2CSF01 => new FOR_VALVE_SingleEntity(98);
public FOR_VALVE_SingleEntity BU2CSF02 => new FOR_VALVE_SingleEntity(100);
public FOR_VALVE_SingleEntity BU2DSF01 => new FOR_VALVE_SingleEntity(102);
public FOR_VALVE_SingleEntity BU2DSF02 => new FOR_VALVE_SingleEntity(104);
public FOR_VALVE_SingleEntity BU1ADB01 => new FOR_VALVE_SingleEntity(106);
public FOR_VALVE_SingleEntity BU1BDB01 => new FOR_VALVE_SingleEntity(108);
public FOR_VALVE_SingleEntity BU1CDB01 => new FOR_VALVE_SingleEntity(110);
public FOR_VALVE_SingleEntity BU1DDB01 => new FOR_VALVE_SingleEntity(112);
public FOR_VALVE_SingleEntity BU1EDB01 => new FOR_VALVE_SingleEntity(114);
public FOR_VALVE_SingleEntity BU1FDB01 => new FOR_VALVE_SingleEntity(116);
public FOR_VALVE_SingleEntity BU1GDB01 => new FOR_VALVE_SingleEntity(118);
public FOR_VALVE_SingleEntity BU1HDB01 => new FOR_VALVE_SingleEntity(120);
public FOR_VALVE_SingleEntity BU1IDB01 => new FOR_VALVE_SingleEntity(122);
public FOR_VALVE_SingleEntity BU1JDB01 => new FOR_VALVE_SingleEntity(124);
public FOR_VALVE_SingleEntity BU1KDB01 => new FOR_VALVE_SingleEntity(126);
public FOR_VALVE_SingleEntity BU1LDB01 => new FOR_VALVE_SingleEntity(128);
public DB2102Helper(byte[] bytes)
{
_bytes = bytes;
}
public FOR_VALVE_SingleEntity BU1DRB01 => new FOR_VALVE_SingleEntity(158);
public FOR_VALVE_SingleEntity BU2DRB01 => new FOR_VALVE_SingleEntity(160);
public FOR_VALVE_SingleEntity BU3DRB01 => new FOR_VALVE_SingleEntity(162);
public FOR_VALVE_SingleEntity BU4DRB01 => new FOR_VALVE_SingleEntity(164);
public FOR_VALVE_SingleEntity BU1GEB01 => new FOR_VALVE_SingleEntity(166);
public FOR_VALVE_SingleEntity BU2GEB01 => new FOR_VALVE_SingleEntity(168);
public FOR_VALVE_SingleEntity BU3GEB01 => new FOR_VALVE_SingleEntity(170);
public FOR_VALVE_SingleEntity BU4GEB01 => new FOR_VALVE_SingleEntity(172);
public FOR_VALVE_SingleEntity BU5GEB01 => new FOR_VALVE_SingleEntity(174);
public FOR_VALVE_SingleEntity BU6GEB01 => new FOR_VALVE_SingleEntity(176);
public FOR_VALVE_SingleEntity BU7GEB01 => new FOR_VALVE_SingleEntity(178);
public FOR_VALVE_SingleEntity BU8GEB01 => new FOR_VALVE_SingleEntity(180);
public FOR_VALVE_SingleEntity BUWeter1 => new FOR_VALVE_SingleEntity(182);
public FOR_VALVE_SingleEntity BUWeter2 => new FOR_VALVE_SingleEntity(184);
public FOR_VALVE_SingleEntity BUWeter3 => new FOR_VALVE_SingleEntity(186);
public FOR_VALVE_SingleEntity BUWeter4 => new FOR_VALVE_SingleEntity(188);
public FOR_VALVE_SingleEntity BUWeter5 => new FOR_VALVE_SingleEntity(190);
public FOR_VALVE_SingleEntity BUWeter6 => new FOR_VALVE_SingleEntity(192);
public FOR_VALVE_SingleEntity BUWeter7 => new FOR_VALVE_SingleEntity(194);
public FOR_VALVE_SingleEntity BUWeter8 => new FOR_VALVE_SingleEntity(196);
public FOR_VALVE_SingleEntity BU1GEB02 => new FOR_VALVE_SingleEntity(198);
public FOR_VALVE_SingleEntity BU2GEB02 => new FOR_VALVE_SingleEntity(200);
public FOR_VALVE_SingleEntity BU3GEB02 => new FOR_VALVE_SingleEntity(202);
public FOR_VALVE_SingleEntity BU4GEB02 => new FOR_VALVE_SingleEntity(204);
public FOR_VALVE_SingleEntity BU5GEB02 => new FOR_VALVE_SingleEntity(206);
public FOR_VALVE_SingleEntity BU6GEB02 => new FOR_VALVE_SingleEntity(208);
public FOR_VALVE_SingleEntity BU7GEB02 => new FOR_VALVE_SingleEntity(210);
public FOR_VALVE_SingleEntity BU8GEB02 => new FOR_VALVE_SingleEntity(212);
public FOR_VALVE_DoubleEntity DV2PCP01 => new FOR_VALVE_DoubleEntity(130,_bytes);
public FOR_VALVE_DoubleEntity DV2PCP02 => new FOR_VALVE_DoubleEntity(132,_bytes);
public FOR_VALVE_DoubleEntity DV2PCP03 => new FOR_VALVE_DoubleEntity(134,_bytes);
public FOR_VALVE_DoubleEntity DV2PCP04 => new FOR_VALVE_DoubleEntity(136,_bytes);
public FOR_VALVE_DoubleEntity DV2PCP05 => new FOR_VALVE_DoubleEntity(138,_bytes);
public FOR_VALVE_DoubleEntity DV2PCP06 => new FOR_VALVE_DoubleEntity(140,_bytes);
public FOR_VALVE_DoubleEntity DV2PCP07 => new FOR_VALVE_DoubleEntity(142,_bytes);
public FOR_VALVE_DoubleEntity DV2PCP08 => new FOR_VALVE_DoubleEntity(144,_bytes);
public FOR_VALVE_DoubleEntity DV2PCP09 => new FOR_VALVE_DoubleEntity(146,_bytes);
public FOR_VALVE_DoubleEntity DV2PCP10 => new FOR_VALVE_DoubleEntity(148,_bytes);
public FOR_VALVE_DoubleEntity DV2PCP11 => new FOR_VALVE_DoubleEntity(150,_bytes);
public FOR_VALVE_DoubleEntity DV2PCP12 => new FOR_VALVE_DoubleEntity(152,_bytes);
public FOR_VALVE_DoubleEntity DV2PCP13 => new FOR_VALVE_DoubleEntity(154,_bytes);
public FOR_VALVE_DoubleEntity DV2PCP14 => new FOR_VALVE_DoubleEntity(156,_bytes);
public FOR_VALVE_SingleEntity BU1ASF01 => new FOR_VALVE_SingleEntity(0,_bytes);
public FOR_VALVE_SingleEntity BU1BSF01 => new FOR_VALVE_SingleEntity(2,_bytes);
public FOR_VALVE_SingleEntity BU1CSF01 => new FOR_VALVE_SingleEntity(4,_bytes);
public FOR_VALVE_SingleEntity BU1DSF01 => new FOR_VALVE_SingleEntity(6,_bytes);
public FOR_VALVE_SingleEntity BU1ESF01 => new FOR_VALVE_SingleEntity(8,_bytes);
public FOR_VALVE_SingleEntity BU1FSF01 => new FOR_VALVE_SingleEntity(10,_bytes);
public FOR_VALVE_SingleEntity BU1GSF01 => new FOR_VALVE_SingleEntity(12,_bytes);
public FOR_VALVE_SingleEntity BU1HSF01 => new FOR_VALVE_SingleEntity(14,_bytes);
public FOR_VALVE_SingleEntity BU1ISF01 => new FOR_VALVE_SingleEntity(16,_bytes);
public FOR_VALVE_SingleEntity BU1JSF01 => new FOR_VALVE_SingleEntity(18,_bytes);
public FOR_VALVE_SingleEntity BU1KSF01 => new FOR_VALVE_SingleEntity(20,_bytes);
public FOR_VALVE_SingleEntity BU1LSF01 => new FOR_VALVE_SingleEntity(22,_bytes);
public FOR_VALVE_SingleEntity BU1MSF01 => new FOR_VALVE_SingleEntity(24,_bytes);
public FOR_VALVE_SingleEntity BU1NSF01 => new FOR_VALVE_SingleEntity(26,_bytes);
public FOR_VALVE_SingleEntity BU1OSF01 => new FOR_VALVE_SingleEntity(28,_bytes);
public FOR_VALVE_SingleEntity BU1BLT01 => new FOR_VALVE_SingleEntity(30,_bytes);
public FOR_VALVE_SingleEntity BU1BLT02 => new FOR_VALVE_SingleEntity(32,_bytes);
public FOR_VALVE_SingleEntity BU1BLT03 => new FOR_VALVE_SingleEntity(34,_bytes);
public FOR_VALVE_SingleEntity BU1BLT04 => new FOR_VALVE_SingleEntity(36,_bytes);
public FOR_VALVE_SingleEntity BU1BLT05 => new FOR_VALVE_SingleEntity(38,_bytes);
public FOR_VALVE_SingleEntity BU1BLT06 => new FOR_VALVE_SingleEntity(40,_bytes);
public FOR_VALVE_SingleEntity BU1BLT07 => new FOR_VALVE_SingleEntity(42,_bytes);
public FOR_VALVE_SingleEntity BU2BLT01 => new FOR_VALVE_SingleEntity(44,_bytes);
public FOR_VALVE_SingleEntity BU2BLT02 => new FOR_VALVE_SingleEntity(46,_bytes);
public FOR_VALVE_SingleEntity BU2BLT03 => new FOR_VALVE_SingleEntity(48,_bytes);
public FOR_VALVE_SingleEntity BU2BLT04 => new FOR_VALVE_SingleEntity(50,_bytes);
public FOR_VALVE_SingleEntity BU2BLT05 => new FOR_VALVE_SingleEntity(52,_bytes);
public FOR_VALVE_SingleEntity BU3BLT01 => new FOR_VALVE_SingleEntity(54,_bytes);
public FOR_VALVE_SingleEntity BU3BLT02 => new FOR_VALVE_SingleEntity(56,_bytes);
public FOR_VALVE_SingleEntity BU3BLT03 => new FOR_VALVE_SingleEntity(58,_bytes);
public FOR_VALVE_SingleEntity BU3BLT04 => new FOR_VALVE_SingleEntity(60,_bytes);
public FOR_VALVE_SingleEntity BU3BLT05 => new FOR_VALVE_SingleEntity(62,_bytes);
public FOR_VALVE_SingleEntity BU3BLT06 => new FOR_VALVE_SingleEntity(64,_bytes);
public FOR_VALVE_SingleEntity BU3BLT07 => new FOR_VALVE_SingleEntity(66,_bytes);
public FOR_VALVE_SingleEntity BU4BLT01 => new FOR_VALVE_SingleEntity(68,_bytes);
public FOR_VALVE_SingleEntity BU4BLT02 => new FOR_VALVE_SingleEntity(70,_bytes);
public FOR_VALVE_SingleEntity BU4BLT03 => new FOR_VALVE_SingleEntity(72,_bytes);
public FOR_VALVE_SingleEntity BU4BLT04 => new FOR_VALVE_SingleEntity(74,_bytes);
public FOR_VALVE_SingleEntity BU4BLT05 => new FOR_VALVE_SingleEntity(76,_bytes);
public FOR_VALVE_SingleEntity BU4BLT06 => new FOR_VALVE_SingleEntity(78,_bytes);
public FOR_VALVE_SingleEntity BU4BLT07 => new FOR_VALVE_SingleEntity(80,_bytes);
public FOR_VALVE_SingleEntity BU5BLT01 => new FOR_VALVE_SingleEntity(82,_bytes);
public FOR_VALVE_SingleEntity BU5BLT02 => new FOR_VALVE_SingleEntity(84,_bytes);
public FOR_VALVE_SingleEntity BU5BLT03 => new FOR_VALVE_SingleEntity(86,_bytes);
public FOR_VALVE_SingleEntity BU5BLT04 => new FOR_VALVE_SingleEntity(88,_bytes);
public FOR_VALVE_SingleEntity BU2ASF01 => new FOR_VALVE_SingleEntity(90,_bytes);
public FOR_VALVE_SingleEntity BU2ASF02 => new FOR_VALVE_SingleEntity(92,_bytes);
public FOR_VALVE_SingleEntity BU2BSF01 => new FOR_VALVE_SingleEntity(94,_bytes);
public FOR_VALVE_SingleEntity BU2BSF02 => new FOR_VALVE_SingleEntity(96,_bytes);
public FOR_VALVE_SingleEntity BU2CSF01 => new FOR_VALVE_SingleEntity(98,_bytes);
public FOR_VALVE_SingleEntity BU2CSF02 => new FOR_VALVE_SingleEntity(100,_bytes);
public FOR_VALVE_SingleEntity BU2DSF01 => new FOR_VALVE_SingleEntity(102,_bytes);
public FOR_VALVE_SingleEntity BU2DSF02 => new FOR_VALVE_SingleEntity(104,_bytes);
public FOR_VALVE_SingleEntity BU1ADB01 => new FOR_VALVE_SingleEntity(106,_bytes);
public FOR_VALVE_SingleEntity BU1BDB01 => new FOR_VALVE_SingleEntity(108,_bytes);
public FOR_VALVE_SingleEntity BU1CDB01 => new FOR_VALVE_SingleEntity(110,_bytes);
public FOR_VALVE_SingleEntity BU1DDB01 => new FOR_VALVE_SingleEntity(112,_bytes);
public FOR_VALVE_SingleEntity BU1EDB01 => new FOR_VALVE_SingleEntity(114,_bytes);
public FOR_VALVE_SingleEntity BU1FDB01 => new FOR_VALVE_SingleEntity(116,_bytes);
public FOR_VALVE_SingleEntity BU1GDB01 => new FOR_VALVE_SingleEntity(118,_bytes);
public FOR_VALVE_SingleEntity BU1HDB01 => new FOR_VALVE_SingleEntity(120,_bytes);
public FOR_VALVE_SingleEntity BU1IDB01 => new FOR_VALVE_SingleEntity(122,_bytes);
public FOR_VALVE_SingleEntity BU1JDB01 => new FOR_VALVE_SingleEntity(124,_bytes);
public FOR_VALVE_SingleEntity BU1KDB01 => new FOR_VALVE_SingleEntity(126,_bytes);
public FOR_VALVE_SingleEntity BU1LDB01 => new FOR_VALVE_SingleEntity(128,_bytes);
public FOR_VALVE_SingleEntity BU1DRB01 => new FOR_VALVE_SingleEntity(158,_bytes);
public FOR_VALVE_SingleEntity BU2DRB01 => new FOR_VALVE_SingleEntity(160,_bytes);
public FOR_VALVE_SingleEntity BU3DRB01 => new FOR_VALVE_SingleEntity(162,_bytes);
public FOR_VALVE_SingleEntity BU4DRB01 => new FOR_VALVE_SingleEntity(164,_bytes);
public FOR_VALVE_SingleEntity BU1GEB01 => new FOR_VALVE_SingleEntity(166,_bytes);
public FOR_VALVE_SingleEntity BU2GEB01 => new FOR_VALVE_SingleEntity(168,_bytes);
public FOR_VALVE_SingleEntity BU3GEB01 => new FOR_VALVE_SingleEntity(170,_bytes);
public FOR_VALVE_SingleEntity BU4GEB01 => new FOR_VALVE_SingleEntity(172,_bytes);
public FOR_VALVE_SingleEntity BU5GEB01 => new FOR_VALVE_SingleEntity(174,_bytes);
public FOR_VALVE_SingleEntity BU6GEB01 => new FOR_VALVE_SingleEntity(176,_bytes);
public FOR_VALVE_SingleEntity BU7GEB01 => new FOR_VALVE_SingleEntity(178,_bytes);
public FOR_VALVE_SingleEntity BU8GEB01 => new FOR_VALVE_SingleEntity(180,_bytes);
public FOR_VALVE_SingleEntity BUWeter1 => new FOR_VALVE_SingleEntity(182,_bytes);
public FOR_VALVE_SingleEntity BUWeter2 => new FOR_VALVE_SingleEntity(184,_bytes);
public FOR_VALVE_SingleEntity BUWeter3 => new FOR_VALVE_SingleEntity(186,_bytes);
public FOR_VALVE_SingleEntity BUWeter4 => new FOR_VALVE_SingleEntity(188,_bytes);
public FOR_VALVE_SingleEntity BUWeter5 => new FOR_VALVE_SingleEntity(190,_bytes);
public FOR_VALVE_SingleEntity BUWeter6 => new FOR_VALVE_SingleEntity(192,_bytes);
public FOR_VALVE_SingleEntity BUWeter7 => new FOR_VALVE_SingleEntity(194,_bytes);
public FOR_VALVE_SingleEntity BUWeter8 => new FOR_VALVE_SingleEntity(196,_bytes);
public FOR_VALVE_SingleEntity BU1GEB02 => new FOR_VALVE_SingleEntity(198,_bytes);
public FOR_VALVE_SingleEntity BU2GEB02 => new FOR_VALVE_SingleEntity(200,_bytes);
public FOR_VALVE_SingleEntity BU3GEB02 => new FOR_VALVE_SingleEntity(202,_bytes);
public FOR_VALVE_SingleEntity BU4GEB02 => new FOR_VALVE_SingleEntity(204,_bytes);
public FOR_VALVE_SingleEntity BU5GEB02 => new FOR_VALVE_SingleEntity(206,_bytes);
public FOR_VALVE_SingleEntity BU6GEB02 => new FOR_VALVE_SingleEntity(208,_bytes);
public FOR_VALVE_SingleEntity BU7GEB02 => new FOR_VALVE_SingleEntity(210,_bytes);
public FOR_VALVE_SingleEntity BU8GEB02 => new FOR_VALVE_SingleEntity(212,_bytes);
}
}

@ -4,96 +4,107 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HslCommunication;
namespace DataBlockHelper.DBHelpers
{
public class DB2103Helper
{
public FOR_MOTOREntity DM1ASI01 => new FOR_MOTOREntity(0);
public FOR_MOTOREntity DM1BSI01 => new FOR_MOTOREntity(2);
public FOR_MOTOREntity DM1CSI01 => new FOR_MOTOREntity(4);
public FOR_MOTOREntity DM1DSI01 => new FOR_MOTOREntity(6);
public FOR_MOTOREntity DM1ESI01 => new FOR_MOTOREntity(8);
public FOR_MOTOREntity DM1FSI01 => new FOR_MOTOREntity(10);
public FOR_MOTOREntity DM1GSI01 => new FOR_MOTOREntity(12);
public FOR_MOTOREntity DM1HSI01 => new FOR_MOTOREntity(14);
public FOR_MOTOREntity DM1ISI01 => new FOR_MOTOREntity(16);
public FOR_MOTOREntity DM1JSI01 => new FOR_MOTOREntity(18);
public FOR_MOTOREntity DM1KSI01 => new FOR_MOTOREntity(20);
public FOR_MOTOREntity DM1LSI01 => new FOR_MOTOREntity(22);
public FOR_MOTOREntity DM1MSI01 => new FOR_MOTOREntity(24);
public FOR_MOTOREntity DM1NSI01 => new FOR_MOTOREntity(26);
public FOR_MOTOREntity DM1OSI01 => new FOR_MOTOREntity(28);
public FOR_MOTOREntity DM1ADB01 => new FOR_MOTOREntity(30);
public FOR_MOTOREntity DM1BDB01 => new FOR_MOTOREntity(32);
public FOR_MOTOREntity DM1CDB01 => new FOR_MOTOREntity(34);
public FOR_MOTOREntity DM1DDB01 => new FOR_MOTOREntity(36);
public FOR_MOTOREntity DM1EDB01 => new FOR_MOTOREntity(38);
public FOR_MOTOREntity DM1FDB01 => new FOR_MOTOREntity(40);
public FOR_MOTOREntity DM1GDB01 => new FOR_MOTOREntity(42);
public FOR_MOTOREntity DM1HDB01 => new FOR_MOTOREntity(44);
public FOR_MOTOREntity DM1IDB01 => new FOR_MOTOREntity(46);
public FOR_MOTOREntity DM1JDB01 => new FOR_MOTOREntity(48);
public FOR_MOTOREntity DM1KDB01 => new FOR_MOTOREntity(50);
public FOR_MOTOREntity DM1LDB01 => new FOR_MOTOREntity(52);
public FOR_MOTOREntity DM1ADF01 => new FOR_MOTOREntity(54);
public FOR_MOTOREntity DM1BDF01 => new FOR_MOTOREntity(56);
public FOR_MOTOREntity DM1CDF01 => new FOR_MOTOREntity(58);
public FOR_MOTOREntity DM1DDF01 => new FOR_MOTOREntity(60);
public FOR_MOTOREntity DM1EDF01 => new FOR_MOTOREntity(62);
public FOR_MOTOREntity DM1FDF01 => new FOR_MOTOREntity(64);
public FOR_MOTOREntity DM1GDF01 => new FOR_MOTOREntity(66);
public FOR_MOTOREntity DM1HDF01 => new FOR_MOTOREntity(68);
public FOR_MOTOREntity DM1IDF01 => new FOR_MOTOREntity(70);
public FOR_MOTOREntity DM1JDF01 => new FOR_MOTOREntity(72);
public FOR_MOTOREntity DM1KDF01 => new FOR_MOTOREntity(74);
public FOR_MOTOREntity DM1LDF01 => new FOR_MOTOREntity(76);
public FOR_MOTOREntity DMFILTER => new FOR_MOTOREntity(78);
public FOR_MOTOREntity DM1ASF01 => new FOR_MOTOREntity(80);
public FOR_MOTOREntity DM1BSF01 => new FOR_MOTOREntity(82);
public FOR_MOTOREntity DM1CSF01 => new FOR_MOTOREntity(84);
public FOR_MOTOREntity DM1DSF01 => new FOR_MOTOREntity(86);
public FOR_MOTOREntity DM1ESF01 => new FOR_MOTOREntity(88);
public FOR_MOTOREntity DM1FSF01 => new FOR_MOTOREntity(90);
public FOR_MOTOREntity DM1GSF01 => new FOR_MOTOREntity(92);
public FOR_MOTOREntity DM1HSF01 => new FOR_MOTOREntity(94);
public FOR_MOTOREntity DM1ISF01 => new FOR_MOTOREntity(96);
public FOR_MOTOREntity DM1JSF01 => new FOR_MOTOREntity(98);
public FOR_MOTOREntity DM1KSF01 => new FOR_MOTOREntity(100);
public FOR_MOTOREntity DM1LSF01 => new FOR_MOTOREntity(102);
public FOR_MOTOREntity DM1MSF01 => new FOR_MOTOREntity(104);
public FOR_MOTOREntity DM1NSF01 => new FOR_MOTOREntity(106);
private byte[] _bytes;
public FOR_MOTOR_VFDEntity _24T11A_D => new FOR_MOTOR_VFDEntity(108);
public FOR_MOTOR_VFDEntity _64T01G_J => new FOR_MOTOR_VFDEntity(122);
public FOR_MOTOR_VFDEntity _64T61E_F => new FOR_MOTOR_VFDEntity(136);
public FOR_MOTOR_VFDEntity DM1K_NSF01 => new FOR_MOTOR_VFDEntity(150);
public FOR_MOTOR_VFDEntity DM1OSF01 => new FOR_MOTOR_VFDEntity(164);
public FOR_MOTOR_VFDEntity DM2ASF01 => new FOR_MOTOR_VFDEntity(178);
public FOR_MOTOR_VFDEntity DM2BSF01 => new FOR_MOTOR_VFDEntity(192);
public FOR_MOTOR_VFDEntity DM2CSF01 => new FOR_MOTOR_VFDEntity(206);
public FOR_MOTOR_VFDEntity DM2DSF01 => new FOR_MOTOR_VFDEntity(220);
public FOR_MOTOR_VFDEntity DM1DRY1 => new FOR_MOTOR_VFDEntity(234);
public FOR_MOTOR_VFDEntity DM1DRY2 => new FOR_MOTOR_VFDEntity(248);
public FOR_MOTOR_VFDEntity DM1DRY3 => new FOR_MOTOR_VFDEntity(262);
public FOR_MOTOR_VFDEntity DM1DRY4 => new FOR_MOTOR_VFDEntity(276);
public FOR_MOTOR_VFDEntity DM1GEM => new FOR_MOTOR_VFDEntity(290);
public FOR_MOTOR_VFDEntity DM2GEM => new FOR_MOTOR_VFDEntity(304);
public FOR_MOTOR_VFDEntity DM3GEM => new FOR_MOTOR_VFDEntity(318);
public FOR_MOTOR_VFDEntity DM4GEM => new FOR_MOTOR_VFDEntity(332);
public FOR_MOTOR_VFDEntity DM5GEM => new FOR_MOTOR_VFDEntity(346);
public FOR_MOTOR_VFDEntity DM6GEM => new FOR_MOTOR_VFDEntity(360);
public FOR_MOTOR_VFDEntity DM7GEM => new FOR_MOTOR_VFDEntity(374);
public FOR_MOTOR_VFDEntity DM8GEM => new FOR_MOTOR_VFDEntity(388);
public DB2103Helper(byte[] bytes)
{
_bytes = bytes;
}
public FOR_MOTOREntity DMWETER1 => new FOR_MOTOREntity(402);
public FOR_MOTOREntity DMWETER2 => new FOR_MOTOREntity(404);
public FOR_MOTOREntity DMWETER3 => new FOR_MOTOREntity(406);
public FOR_MOTOREntity DMWETER4 => new FOR_MOTOREntity(408);
public FOR_MOTOREntity DMWETER5 => new FOR_MOTOREntity(410);
public FOR_MOTOREntity DMWETER6 => new FOR_MOTOREntity(412);
public FOR_MOTOREntity DMWETER7 => new FOR_MOTOREntity(414);
public FOR_MOTOREntity DMWETER8 => new FOR_MOTOREntity(416);
// public OperateResult<byte[]> GetAll=>PlcConnect.Instance.Read("DB2103.0.0", 418,_bytes);
public FOR_MOTOREntity DM1ASI01 => new FOR_MOTOREntity(0,_bytes);
public FOR_MOTOREntity DM1BSI01 => new FOR_MOTOREntity(2,_bytes);
public FOR_MOTOREntity DM1CSI01 => new FOR_MOTOREntity(4,_bytes);
public FOR_MOTOREntity DM1DSI01 => new FOR_MOTOREntity(6,_bytes);
public FOR_MOTOREntity DM1ESI01 => new FOR_MOTOREntity(8,_bytes);
public FOR_MOTOREntity DM1FSI01 => new FOR_MOTOREntity(10,_bytes);
public FOR_MOTOREntity DM1GSI01 => new FOR_MOTOREntity(12,_bytes);
public FOR_MOTOREntity DM1HSI01 => new FOR_MOTOREntity(14,_bytes);
public FOR_MOTOREntity DM1ISI01 => new FOR_MOTOREntity(16,_bytes);
public FOR_MOTOREntity DM1JSI01 => new FOR_MOTOREntity(18,_bytes);
public FOR_MOTOREntity DM1KSI01 => new FOR_MOTOREntity(20,_bytes);
public FOR_MOTOREntity DM1LSI01 => new FOR_MOTOREntity(22,_bytes);
public FOR_MOTOREntity DM1MSI01 => new FOR_MOTOREntity(24,_bytes);
public FOR_MOTOREntity DM1NSI01 => new FOR_MOTOREntity(26,_bytes);
public FOR_MOTOREntity DM1OSI01 => new FOR_MOTOREntity(28,_bytes);
public FOR_MOTOREntity DM1ADB01 => new FOR_MOTOREntity(30,_bytes);
public FOR_MOTOREntity DM1BDB01 => new FOR_MOTOREntity(32,_bytes);
public FOR_MOTOREntity DM1CDB01 => new FOR_MOTOREntity(34,_bytes);
public FOR_MOTOREntity DM1DDB01 => new FOR_MOTOREntity(36,_bytes);
public FOR_MOTOREntity DM1EDB01 => new FOR_MOTOREntity(38,_bytes);
public FOR_MOTOREntity DM1FDB01 => new FOR_MOTOREntity(40,_bytes);
public FOR_MOTOREntity DM1GDB01 => new FOR_MOTOREntity(42,_bytes);
public FOR_MOTOREntity DM1HDB01 => new FOR_MOTOREntity(44,_bytes);
public FOR_MOTOREntity DM1IDB01 => new FOR_MOTOREntity(46,_bytes);
public FOR_MOTOREntity DM1JDB01 => new FOR_MOTOREntity(48,_bytes);
public FOR_MOTOREntity DM1KDB01 => new FOR_MOTOREntity(50,_bytes);
public FOR_MOTOREntity DM1LDB01 => new FOR_MOTOREntity(52,_bytes);
public FOR_MOTOREntity DM1ADF01 => new FOR_MOTOREntity(54,_bytes);
public FOR_MOTOREntity DM1BDF01 => new FOR_MOTOREntity(56,_bytes);
public FOR_MOTOREntity DM1CDF01 => new FOR_MOTOREntity(58,_bytes);
public FOR_MOTOREntity DM1DDF01 => new FOR_MOTOREntity(60,_bytes);
public FOR_MOTOREntity DM1EDF01 => new FOR_MOTOREntity(62,_bytes);
public FOR_MOTOREntity DM1FDF01 => new FOR_MOTOREntity(64,_bytes);
public FOR_MOTOREntity DM1GDF01 => new FOR_MOTOREntity(66,_bytes);
public FOR_MOTOREntity DM1HDF01 => new FOR_MOTOREntity(68,_bytes);
public FOR_MOTOREntity DM1IDF01 => new FOR_MOTOREntity(70,_bytes);
public FOR_MOTOREntity DM1JDF01 => new FOR_MOTOREntity(72,_bytes);
public FOR_MOTOREntity DM1KDF01 => new FOR_MOTOREntity(74,_bytes);
public FOR_MOTOREntity DM1LDF01 => new FOR_MOTOREntity(76,_bytes);
public FOR_MOTOREntity DMFILTER => new FOR_MOTOREntity(78,_bytes);
public FOR_MOTOREntity DM1ASF01 => new FOR_MOTOREntity(80,_bytes);
public FOR_MOTOREntity DM1BSF01 => new FOR_MOTOREntity(82,_bytes);
public FOR_MOTOREntity DM1CSF01 => new FOR_MOTOREntity(84,_bytes);
public FOR_MOTOREntity DM1DSF01 => new FOR_MOTOREntity(86,_bytes);
public FOR_MOTOREntity DM1ESF01 => new FOR_MOTOREntity(88,_bytes);
public FOR_MOTOREntity DM1FSF01 => new FOR_MOTOREntity(90,_bytes);
public FOR_MOTOREntity DM1GSF01 => new FOR_MOTOREntity(92,_bytes);
public FOR_MOTOREntity DM1HSF01 => new FOR_MOTOREntity(94,_bytes);
public FOR_MOTOREntity DM1ISF01 => new FOR_MOTOREntity(96,_bytes);
public FOR_MOTOREntity DM1JSF01 => new FOR_MOTOREntity(98,_bytes);
public FOR_MOTOREntity DM1KSF01 => new FOR_MOTOREntity(100,_bytes);
public FOR_MOTOREntity DM1LSF01 => new FOR_MOTOREntity(102,_bytes);
public FOR_MOTOREntity DM1MSF01 => new FOR_MOTOREntity(104,_bytes);
public FOR_MOTOREntity DM1NSF01 => new FOR_MOTOREntity(106,_bytes);
public FOR_MOTOR_VFDEntity _24T11A_D => new FOR_MOTOR_VFDEntity(108,_bytes);
public FOR_MOTOR_VFDEntity _64T01G_J => new FOR_MOTOR_VFDEntity(122,_bytes);
public FOR_MOTOR_VFDEntity _64T61E_F => new FOR_MOTOR_VFDEntity(136,_bytes);
public FOR_MOTOR_VFDEntity DM1K_NSF01 => new FOR_MOTOR_VFDEntity(150,_bytes);
public FOR_MOTOR_VFDEntity DM1OSF01 => new FOR_MOTOR_VFDEntity(164,_bytes);
public FOR_MOTOR_VFDEntity DM2ASF01 => new FOR_MOTOR_VFDEntity(178,_bytes);
public FOR_MOTOR_VFDEntity DM2BSF01 => new FOR_MOTOR_VFDEntity(192,_bytes);
public FOR_MOTOR_VFDEntity DM2CSF01 => new FOR_MOTOR_VFDEntity(206,_bytes);
public FOR_MOTOR_VFDEntity DM2DSF01 => new FOR_MOTOR_VFDEntity(220,_bytes);
public FOR_MOTOR_VFDEntity DM1DRY1 => new FOR_MOTOR_VFDEntity(234,_bytes);
public FOR_MOTOR_VFDEntity DM1DRY2 => new FOR_MOTOR_VFDEntity(248,_bytes);
public FOR_MOTOR_VFDEntity DM1DRY3 => new FOR_MOTOR_VFDEntity(262,_bytes);
public FOR_MOTOR_VFDEntity DM1DRY4 => new FOR_MOTOR_VFDEntity(276,_bytes);
public FOR_MOTOR_VFDEntity DM1GEM => new FOR_MOTOR_VFDEntity(290,_bytes);
public FOR_MOTOR_VFDEntity DM2GEM => new FOR_MOTOR_VFDEntity(304,_bytes);
public FOR_MOTOR_VFDEntity DM3GEM => new FOR_MOTOR_VFDEntity(318,_bytes);
public FOR_MOTOR_VFDEntity DM4GEM => new FOR_MOTOR_VFDEntity(332,_bytes);
public FOR_MOTOR_VFDEntity DM5GEM => new FOR_MOTOR_VFDEntity(346,_bytes);
public FOR_MOTOR_VFDEntity DM6GEM => new FOR_MOTOR_VFDEntity(360,_bytes);
public FOR_MOTOR_VFDEntity DM7GEM => new FOR_MOTOR_VFDEntity(374,_bytes);
public FOR_MOTOR_VFDEntity DM8GEM => new FOR_MOTOR_VFDEntity(388,_bytes);
public FOR_MOTOREntity DMWETER1 => new FOR_MOTOREntity(402,_bytes);
public FOR_MOTOREntity DMWETER2 => new FOR_MOTOREntity(404,_bytes);
public FOR_MOTOREntity DMWETER3 => new FOR_MOTOREntity(406,_bytes);
public FOR_MOTOREntity DMWETER4 => new FOR_MOTOREntity(408,_bytes);
public FOR_MOTOREntity DMWETER5 => new FOR_MOTOREntity(410,_bytes);
public FOR_MOTOREntity DMWETER6 => new FOR_MOTOREntity(412,_bytes);
public FOR_MOTOREntity DMWETER7 => new FOR_MOTOREntity(414,_bytes);
public FOR_MOTOREntity DMWETER8 => new FOR_MOTOREntity(416,_bytes);
}
}

@ -4,11 +4,17 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HslCommunication;
namespace DataBlockHelper.DBHelpers
{
public class DB2107Helper
{
// public OperateResult<byte[]> GetAll=>PlcConnect.Instance.Read("DB2107.0.0", 2057);
public NormalStatusEntity NormalStatus => NormalS();
private NormalStatusEntity NormalS()

@ -1,15 +1,16 @@
using HslCommunication;
using System.Linq;
using HslCommunication;
namespace DataBlockHelper.Entity.DB2102Entity
{
public class FOR_VALVE_DoubleEntity
{
public FOR_VALVE_DoubleEntity(ushort startSet)
public FOR_VALVE_DoubleEntity(ushort startSet,byte [] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2102." + startSet + ".0", 2);
// OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2102." + startSet + ".0", 2);
var content = read.Content;
byte[] content = { bytes[startSet], bytes[startSet + 1] };
byte byt = content[0];

@ -5,11 +5,11 @@ namespace DataBlockHelper.Entity.DB2102Entity
{
public class FOR_VALVE_SingleEntity
{
public FOR_VALVE_SingleEntity(ushort startSet)
public FOR_VALVE_SingleEntity(ushort startSet,byte [] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2102." + startSet + ".0", 2);
// OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2102." + startSet + ".0", 2);
var content = read.Content;
byte[] content = { bytes[startSet], bytes[startSet + 1] };
byte byt = content[0];

@ -5,11 +5,14 @@ namespace DataBlockHelper.Entity.DB2103Entity
{
public class FOR_MOTOREntity
{
public FOR_MOTOREntity(ushort startSet)
public FOR_MOTOREntity(ushort startSet,byte [] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2103." + startSet + ".0", 2);
// OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2103." + startSet + ".0", 2);
var content = read.Content;
byte[] content = { bytes[startSet], bytes[startSet + 1] };
//var content = read.Content;
byte byt = content[0];

@ -1,15 +1,19 @@
using HslCommunication;
using System.Linq;
using HslCommunication;
namespace DataBlockHelper.Entity.DB2103Entity
{
public class FOR_MOTOR_VFDEntity
{
public FOR_MOTOR_VFDEntity(ushort startSet)
public FOR_MOTOR_VFDEntity(ushort startSet,byte [] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2103." + startSet + ".0", 14);
var content = read.Content;
byte[] content = new byte[14];
for (int i = 0; i < 14; i++)
{
content[i] = bytes[startSet + i];
}
byte byt = content[0];
@ -29,10 +33,13 @@ namespace DataBlockHelper.Entity.DB2103Entity
Error = byt.GetBit(2);
Enable = byt.GetBit(3);
Polarity = byt.GetBit(4);
SetSpeed_A = PlcConnect.Instance.ByteTransform.TransSingle(content, 2);
SetSpeed_M = PlcConnect.Instance.ByteTransform.TransSingle(content, 6);
ACT_Speed = PlcConnect.Instance.ByteTransform.TransSingle(content, 10);
// bt.Skip(2).Take(4).ToArray()
var con = content.Skip(2).Take(12).ToArray();
SetSpeed_A = PlcConnect.Instance.ByteTransform.TransSingle(con, 0);
SetSpeed_M = PlcConnect.Instance.ByteTransform.TransSingle(con, 4);
ACT_Speed = PlcConnect.Instance.ByteTransform.TransSingle(con, 8);
}

Loading…
Cancel
Save