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", 80); 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 MainFan Daybin9 => new MainFan(64, bytes); public MainFan Daybin10 => new MainFan(66, bytes); public MainFan Daybin11 => new MainFan(68, bytes); public MainFan Daybin12 => new MainFan(70, bytes); public MainFan DryA => new MainFan(72, bytes); public MainFan DryB => new MainFan(74, bytes); public MainFan DryC => new MainFan(76, bytes); public MainFan DryD => new MainFan(78, 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; } } public class Db2108PlcSetTime: DBHelper { public Db2108PlcSetTime() { OperateResult db = PlcConnect.Instance.Read("DB2108.0.0", 1268); bytes = db.Content; var fm= PlcConnect.Instance.ByteTransform; int startSet = 0; var content = bytes.Skip(1208).Take(60).ToArray(); OpenA= fm.TransInt16(content, startSet); startSet += 2; OpenB = fm.TransInt16(content, startSet); startSet += 2; OpenC = fm.TransInt16(content, startSet); startSet += 2; OpenD = fm.TransInt16(content, startSet); startSet += 2; OpenE = fm.TransInt16(content, startSet); startSet += 2; OpenF = fm.TransInt16(content, startSet); startSet += 2; OpenG = fm.TransInt16(content, startSet); startSet += 2; OpenH = fm.TransInt16(content, startSet); startSet += 2; OpenI = fm.TransInt16(content, startSet); startSet += 2; OpenJ = fm.TransInt16(content, startSet); startSet += 2; OpenK = fm.TransInt16(content, startSet); startSet += 2; OpenL = fm.TransInt16(content, startSet); startSet += 2; OpenM = fm.TransInt16(content, startSet); startSet += 2; OpenN = fm.TransInt16(content, startSet); startSet += 2; OpenO = fm.TransInt16(content, startSet); startSet += 2; CloseA = fm.TransInt16(content, startSet); startSet += 2; CloseB = fm.TransInt16(content, startSet); startSet += 2; CloseC = fm.TransInt16(content, startSet); startSet += 2; CloseD = fm.TransInt16(content, startSet); startSet += 2; CloseE = fm.TransInt16(content, startSet); startSet += 2; CloseF = fm.TransInt16(content, startSet); startSet += 2; CloseG = fm.TransInt16(content, startSet); startSet += 2; CloseH = fm.TransInt16(content, startSet); startSet += 2; CloseI = fm.TransInt16(content, startSet); startSet += 2; CloseJ = fm.TransInt16(content, startSet); startSet += 2; CloseK = fm.TransInt16(content, startSet); startSet += 2; CloseL = fm.TransInt16(content, startSet); startSet += 2; CloseM = fm.TransInt16(content, startSet); startSet += 2; CloseN = fm.TransInt16(content, startSet); startSet += 2; CloseO = fm.TransInt16(content, startSet); } public short OpenA { get; set; } public short OpenB { get; set; } public short OpenC { get; set; } public short OpenD { get; set; } public short OpenE { get; set; } public short OpenF { get; set; } public short OpenG { get; set; } public short OpenH { get; set; } public short OpenI { get; set; } public short OpenJ { get; set; } public short OpenK { get; set; } public short OpenL { get; set; } public short OpenM { get; set; } public short OpenN { get; set; } public short OpenO { get; set; } public short CloseA { get; set; } public short CloseB { get; set; } public short CloseC { get; set; } public short CloseD { get; set; } public short CloseE { get; set; } public short CloseF { get; set; } public short CloseG { get; set; } public short CloseH { get; set; } public short CloseI { get; set; } public short CloseJ { get; set; } public short CloseK { get; set; } public short CloseL { get; set; } public short CloseM { get; set; } public short CloseN { get; set; } public short CloseO { get; set; } } }