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

78 lines
3.3 KiB
C#

using HslCommunication;
using System.Linq;
namespace DataBlockHelper.Entity.DB2107Entity
{
public class PressureEntity
{
byte[] bytes;
public PressureEntity(byte[] bytes)
{
this.bytes = bytes;
}
public Pressure_HMI MainPress_V1 => new Pressure_HMI(12, bytes);
public Pressure_HMI TopPressure_V1 => new Pressure_HMI(26, bytes);
public Pressure_HMI LinePressure_V1 => new Pressure_HMI(40, bytes);
public Pressure_HMI MainPress_V2 => new Pressure_HMI(54, bytes);
public Pressure_HMI TopPressure_V2 => new Pressure_HMI(68, bytes);
public Pressure_HMI LinePressure_V2 => new Pressure_HMI(82, bytes);
public Pressure_HMI MainPress_V3 => new Pressure_HMI(96, bytes);
public Pressure_HMI TopPressure_V3 => new Pressure_HMI(110, bytes);
public Pressure_HMI LinePressure_V3 => new Pressure_HMI(124, bytes);
public Pressure_HMI MainPress_V4 => new Pressure_HMI(138, bytes);
public Pressure_HMI TopPressure_V4 => new Pressure_HMI(152, bytes);
public Pressure_HMI LinePressure_V4 => new Pressure_HMI(166, bytes);
public Pressure_HMI MainPress_V5 => new Pressure_HMI(180, bytes);
public Pressure_HMI TopPressure_V5 => new Pressure_HMI(194, bytes);
public Pressure_HMI LinePressure_V5 => new Pressure_HMI(208, bytes);
public Pressure_HMI PressDaybin_B1 => new Pressure_HMI(222, bytes);
public Pressure_HMI PressDaybin_B2 => new Pressure_HMI(236, bytes);
public Pressure_HMI PressDaybin_B3 => new Pressure_HMI(250, bytes);
public Pressure_HMI PressDaybin_B4 => new Pressure_HMI(264, bytes);
public Pressure_HMI PressDaybin_B5 => new Pressure_HMI(278, bytes);
public Pressure_HMI PressDaybin_B6 => new Pressure_HMI(292, bytes);
public Pressure_HMI PressDaybin_B7 => new Pressure_HMI(306, bytes);
public Pressure_HMI PressDaybin_B8 => new Pressure_HMI(320, bytes);
public Pressure_HMI PressDaybin_B9 => new Pressure_HMI(334, bytes);
public Pressure_HMI PressDaybin_B10 => new Pressure_HMI(348, bytes);
public Pressure_HMI PressDaybin_B11 => new Pressure_HMI(362, bytes);
public Pressure_HMI PressDaybin_B12 => new Pressure_HMI(376, bytes);
public Pressure_HMI PR2PCP01 => new Pressure_HMI(390, bytes);
public Pressure_HMI PR2PCP02 => new Pressure_HMI(404, bytes);
public Pressure_HMI PR2PCP03 => new Pressure_HMI(418, bytes);
}
public class Pressure_HMI
{
public Pressure_HMI(ushort startSet, byte[] bytes)
{
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107." + startSet + ".0", 14);
var content = bytes.Skip(startSet).Take(14).ToArray();
ActualValue = PlcConnect.Instance.ByteTransform.TransSingle(content, 0);
LowLimit = PlcConnect.Instance.ByteTransform.TransSingle(content, 4);
HighLimit = PlcConnect.Instance.ByteTransform.TransSingle(content, 8);
var operateResult = PlcConnect.Instance.ReadFloat("Db2107.20.0");
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; }
}
}