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/DB2119Entity/WaterTempEntity.cs

70 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataBlockHelper.Entity.DB2119Entity
{
public class WaterTempEntity
{
public WaterTempEntity(ushort startSet, byte[] bytes)
{
// OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2102." + startSet + ".0", 2);
if(null == bytes)
{
return;
}
byte[] content = bytes.Skip(startSet).Take(10).ToArray();
Value_Set = PlcConnect.Instance.ByteTransform.TransInt16(content, 0);
Value_Act = PlcConnect.Instance.ByteTransform.TransInt16(content, 2);
Value_Initial = PlcConnect.Instance.ByteTransform.TransInt16(content, 4);
Gela_Bin = PlcConnect.Instance.ByteTransform.TransInt16(content, 6);
byte byt = content[8];
Dos_Start = byt.GetBit(0);
Dos_Stop = byt.GetBit(1);
Dos_Status = byt.GetBit(2);
Dos_End = byt.GetBit(3);
Dis_Start = byt.GetBit(4);
Dis_Stop = byt.GetBit(5);
Dis_Status = byt.GetBit(6);
Dis_End = byt.GetBit(7);
byt = content[9];
In_Value1 = byt.GetBit(0);
In_Value2 = byt.GetBit(1);
Out_Value = byt.GetBit(2);
Out_Value1 = byt.GetBit(3);
Out_Value2 = byt.GetBit(4);
Out_Value3 = byt.GetBit(5);
Out_Value4 = byt.GetBit(6);
}
public short Value_Set { get; private set; }
public short Value_Act { get; private set; }
public short Value_Initial { get; private set; }
public short Gela_Bin { get; private set; }
public bool Dos_Start { get; private set; }
public bool Dos_Stop { get; private set; }
public bool Dos_Status { get; private set; }
public bool Dos_End { get; private set; }
public bool Dis_Start { get; private set; }
public bool Dis_Stop { get; private set; }
public bool Dis_Status { get; private set; }
public bool Dis_End { get; private set; }
public bool In_Value1 { get; private set; }
public bool In_Value2 { get; private set; }
public bool Out_Value { get; private set; }
public bool Out_Value1 { get; private set; }
public bool Out_Value2 { get; private set; }
public bool Out_Value3 { get; private set; }
public bool Out_Value4 { get; private set; }
}
}