using HslCommunication; namespace DataBlockHelper.Entity.DB2107Entity { public class WeightEntity { public Silo_HMI Hopper_1 => new Silo_HMI(432); public Silo_HMI Hopper_2 => new Silo_HMI(446); public Silo_HMI Hopper_3 => new Silo_HMI(460); public Silo_HMI Hopper_4 => new Silo_HMI(474); public Silo_HMI Vessel_1 => new Silo_HMI(488); public Silo_HMI Vessel_2 => new Silo_HMI(502); public Silo_HMI Vessel_3 => new Silo_HMI(516); public Silo_HMI Vessel_4 => new Silo_HMI(530); public Silo_HMI Vessel_5 => new Silo_HMI(544); public Silo_HMI WScale_1 => new Silo_HMI(558); public Silo_HMI WScale_2 => new Silo_HMI(572); public Silo_HMI WScale_3 => new Silo_HMI(586); public Silo_HMI WScale_4 => new Silo_HMI(600); } public class Silo_HMI { public Silo_HMI(ushort startSet) { OperateResult read = PlcConnect.Instance.Read("DB2107." + startSet + ".0", 14); var content = read.Content; ActWeight = PlcConnect.Instance.ByteTransform.TransSingle(content, 0); HighWeight = PlcConnect.Instance.ByteTransform.TransSingle(content, 4); LowWeight = PlcConnect.Instance.ByteTransform.TransSingle(content, 8); byte byt = content[12]; HighLevel = byt.GetBit(0); Lowlevel = byt.GetBit(1); } public float ActWeight { get; private set; } public float HighWeight { get; private set; } public float LowWeight { get; private set; } public bool HighLevel { get; private set; } public bool Lowlevel { get; private set; } } }