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/DB90Entity/ForValveDoubleEntity.cs

53 lines
1.9 KiB
C#

using HslCommunication;
using System.Linq;
namespace DataBlockHelper.Entity.DB90Entity
{
public class ForValveDoubleEntity
{
public ForValveDoubleEntity(ushort startSet, byte[] bytes)
{
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB90." + startSet + ".0", 2);
var content = bytes.Skip(startSet).Take(2).ToArray();
byte byt = content[0];
ManualMode = byt.GetBit(0);
AutoMode = byt.GetBit(1);
SetLeftManual = byt.GetBit(2);
SetRightManual = byt.GetBit(3);
SetLeftAuto = byt.GetBit(4);
SetRightAuto = byt.GetBit(5);
AlarmReset = byt.GetBit(6);
LeftPosition = byt.GetBit(7);
byt = content[1];
RightPosition = byt.GetBit(0);
SetLeft = byt.GetBit(1);
SetRight = byt.GetBit(2);
AlarmLeftPosition = byt.GetBit(3);
AlarmRightPosition = byt.GetBit(4);
AlarmPosition = byt.GetBit(4);
Alarm = byt.GetBit(4);
}
public bool ManualMode { get; private set; }
public bool AutoMode { get; private set; }
public bool SetLeftManual { get; private set; }
public bool SetRightManual { get; private set; }
public bool SetLeftAuto { get; private set; }
public bool SetRightAuto { get; private set; }
public bool AlarmReset { get; private set; }
public bool LeftPosition { get; private set; }
public bool RightPosition { get; private set; }
public bool SetLeft { get; private set; }
public bool SetRight { get; private set; }
public bool AlarmLeftPosition { get; private set; }
public bool AlarmRightPosition { get; private set; }
public bool AlarmPosition { get; private set; }
public bool Alarm { get; private set; }
}
}