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.
lj_plc/DataBlockHelper/Entity/DB2107Entity/PressureEntity.cs

68 lines
2.9 KiB
C#

using HslCommunication;
namespace DataBlockHelper.Entity.DB2107Entity
{
public class PressureEntity
{
public Pressure_HMI MainPress_V1 => new Pressure_HMI(12);
public Pressure_HMI TopPressure_V1 => new Pressure_HMI(26);
public Pressure_HMI LinePressure_V1 => new Pressure_HMI(40);
public Pressure_HMI MainPress_V2 => new Pressure_HMI(54);
public Pressure_HMI TopPressure_V2 => new Pressure_HMI(68);
public Pressure_HMI LinePressure_V2 => new Pressure_HMI(82);
public Pressure_HMI MainPress_V3 => new Pressure_HMI(96);
public Pressure_HMI TopPressure_V3 => new Pressure_HMI(110);
public Pressure_HMI LinePressure_V3 => new Pressure_HMI(124);
public Pressure_HMI MainPress_V4 => new Pressure_HMI(138);
public Pressure_HMI TopPressure_V4 => new Pressure_HMI(152);
public Pressure_HMI LinePressure_V4 => new Pressure_HMI(166);
public Pressure_HMI MainPress_V5 => new Pressure_HMI(180);
public Pressure_HMI TopPressure_V5 => new Pressure_HMI(194);
public Pressure_HMI LinePressure_V5 => new Pressure_HMI(208);
public Pressure_HMI PressDaybin_B1 => new Pressure_HMI(222);
public Pressure_HMI PressDaybin_B2 => new Pressure_HMI(236);
public Pressure_HMI PressDaybin_B3 => new Pressure_HMI(250);
public Pressure_HMI PressDaybin_B4 => new Pressure_HMI(264);
public Pressure_HMI PressDaybin_B5 => new Pressure_HMI(278);
public Pressure_HMI PressDaybin_B6 => new Pressure_HMI(292);
public Pressure_HMI PressDaybin_B7 => new Pressure_HMI(306);
public Pressure_HMI PressDaybin_B8 => new Pressure_HMI(320);
public Pressure_HMI PressDaybin_B9 => new Pressure_HMI(334);
public Pressure_HMI PressDaybin_B10 => new Pressure_HMI(348);
public Pressure_HMI PressDaybin_B11 => new Pressure_HMI(362);
public Pressure_HMI PressDaybin_B12 => new Pressure_HMI(376);
public Pressure_HMI PR2PCP01 => new Pressure_HMI(390);
public Pressure_HMI PR2PCP02 => new Pressure_HMI(404);
public Pressure_HMI PR2PCP03 => new Pressure_HMI(418);
}
public class Pressure_HMI
{
public Pressure_HMI(ushort startSet)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107." + startSet + ".0", 14);
var content = read.Content;
ActualValue = PlcConnect.Instance.ByteTransform.TransSingle(content, 0);
LowLimit = PlcConnect.Instance.ByteTransform.TransSingle(content, 4);
HighLimit = PlcConnect.Instance.ByteTransform.TransSingle(content, 8);
byte byt = content[12];
Alarm = byt.GetBit(0);
}
public float ActualValue { get; private set; }
public float LowLimit { get; private set; }
public float HighLimit { get; private set; }
public bool Alarm { get; private set; }
}
}