using HslCommunication; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.UI.WebControls; using System.Web.UI; using DataBlockHelper.Entity.DB2107Entity; namespace DataBlockHelper.DBHelpers { public class DB2108HelperNew: DBHelper { public DB2108HelperNew() { OperateResult db = PlcConnect.Instance.Read("DB2108.0.0", 108); bytes = db.Content; } public MainFan Main => new MainFan(0, bytes); public MainFan CoolWaterA => new MainFan(2, bytes); public MainFan CoolWaterB => new MainFan(4, bytes); public MainFan HotWaterA => new MainFan(6, bytes); public MainFan HotWaterB => new MainFan(8, bytes); public MainFan Daybin1 => new MainFan(10, bytes); public MainFan Daybin2 => new MainFan(12, bytes); public MainFan Daybin3 => new MainFan(14, bytes); public MainFan Daybin4 => new MainFan(16, bytes); public MainFan Daybin5 => new MainFan(18, bytes); public MainFan Daybin6 => new MainFan(20, bytes); public MainFan Daybin7 => new MainFan(22, bytes); public MainFan Daybin8 => new MainFan(24, bytes); public Time2108 Time=>new Time2108(26,bytes); public Pressure_HMI PR2PCP04=>new Pressure_HMI(50,bytes); } public class MainFan { public MainFan(ushort startSet, byte[] bytes) { var content = bytes.Skip(startSet).Take(1).First(); var trans = PlcConnect.Instance.ByteTransform; enable= content.GetBit(0); pause = content.GetBit(1); ready = content.GetBit(2); } public bool enable { get; set; } public bool pause { get; set; } public bool ready { get; set; } } public class Time2108 { public Time2108() { } /// /// /// /// public Time2108(ushort startSet, byte[] bytes) { var content = bytes.Skip(startSet).Take(24).ToArray(); var trans = PlcConnect.Instance.ByteTransform; VibSiloOn = trans.TransUInt16(content, 0); VibSiloOff = trans.TransUInt16(content, 2); VibDaybinOn = trans.TransUInt16(content, 4); VibDaybinOff = trans.TransUInt16(content, 6); VibHopperOn = trans.TransUInt16(content, 8); VibHopperOff = trans.TransUInt16(content, 10); PlsSiloOn = trans.TransUInt16(content, 12); PlsSiloOff = trans.TransUInt16(content, 14); PlsDaybinOn = trans.TransUInt16(content, 16); PlsDaybinOff = trans.TransUInt16(content, 18); PlsHopperOn = trans.TransUInt16(content, 20); PlsHopperOff = trans.TransUInt16(content, 22); } public ushort VibSiloOn { get; set; } public ushort VibSiloOff { get; set; } public ushort VibDaybinOn { get; set; } public ushort VibDaybinOff { get; set; } public ushort VibHopperOn { get; set; } public ushort VibHopperOff { get; set; } public ushort PlsSiloOn { get; set; } public ushort PlsSiloOff { get; set; } public ushort PlsDaybinOn { get; set; } public ushort PlsDaybinOff { get; set; } public ushort PlsHopperOn { get; set; } public ushort PlsHopperOff { get; set; } } }