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.
164 lines
4.4 KiB
C#
164 lines
4.4 KiB
C#
using DataBlockHelper.Entity.DB191Entity;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DataBlockHelper.DBHelpers
|
|
{
|
|
public class DB191Helper : DBHelper
|
|
{
|
|
public DB191Helper()
|
|
{
|
|
bytes = PlcConnect.Instance.Read("DB191.0.0", 33).Content;
|
|
}
|
|
|
|
public ControlPanelEntity ControlPanel_A => new ControlPanelEntity(0, bytes);
|
|
public ControlPanelEntity ControlPanel_B => new ControlPanelEntity(4, bytes);
|
|
public ControlPanelEntity ControlPanel_C => new ControlPanelEntity(8, bytes);
|
|
|
|
public ForConveyorStep ConveyStep_A => new ForConveyorStep(12, bytes);
|
|
public ForConveyorStep ConveyStep_B => new ForConveyorStep(16, bytes);
|
|
public ForConveyorStep ConveyStep_C => new ForConveyorStep(20, bytes);
|
|
|
|
|
|
|
|
|
|
|
|
public bool[] GetVesselMode()
|
|
{
|
|
var content = bytes.Skip(24).Take(6).ToArray();
|
|
bool[] bools = new bool[6];
|
|
byte byt = content[0];
|
|
|
|
bools[0] = byt.GetBit(0);
|
|
bools[1] = byt.GetBit(1);
|
|
|
|
byt = content[2];
|
|
|
|
bools[2] = byt.GetBit(0);
|
|
bools[3] = byt.GetBit(1);
|
|
|
|
byt = content[4];
|
|
|
|
bools[4] = byt.GetBit(0);
|
|
bools[5] = byt.GetBit(1);
|
|
|
|
return bools;
|
|
}
|
|
|
|
public bool[] GetPanelOnOff()
|
|
{
|
|
var content = bytes.Skip(30).Take(1).ToArray();
|
|
|
|
byte byt = content[0];
|
|
|
|
bool[] bools = new bool[3];
|
|
|
|
bools[0] = byt.GetBit(0);
|
|
bools[1] = byt.GetBit(1);
|
|
bools[2] = byt.GetBit(2);
|
|
|
|
return bools;
|
|
}
|
|
|
|
|
|
public Dictionary<int, bool> GetDianJi
|
|
{
|
|
get
|
|
{
|
|
DmAm dmAm = new DmAm(bytes);
|
|
Dictionary<int, bool> keys = new Dictionary<int, bool>();
|
|
|
|
keys.Add(0, dmAm.DM1GDP01);
|
|
keys.Add(1, dmAm.DM1ASIG01);
|
|
keys.Add(2, dmAm.DM1BSIG01);
|
|
keys.Add(3, dmAm.DM1CSIG01);
|
|
keys.Add(4, dmAm.DM1DSIG01);
|
|
keys.Add(5, dmAm.DM1ESIG01);
|
|
keys.Add(6, dmAm.DM1GDS01);
|
|
keys.Add(7, dmAm.DM1GDS02);
|
|
keys.Add(8, dmAm.DM1GDS03);
|
|
keys.Add(9, dmAm.DM1GDS04);
|
|
keys.Add(10, dmAm.DM1GDS05);
|
|
keys.Add(11, dmAm.DM1GDS06);
|
|
keys.Add(12, dmAm.DM1GDS09);
|
|
keys.Add(13, dmAm.DM1DSM01);
|
|
keys.Add(14, dmAm.DM2DSM01);
|
|
keys.Add(15, dmAm.DM3DSM01);
|
|
keys.Add(16, dmAm.DM1GDS12);
|
|
return keys;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
public class DmAm
|
|
{
|
|
|
|
public DmAm(byte[] bytes) {
|
|
|
|
var content = bytes.Skip(30).Take(3).ToArray();
|
|
|
|
byte byt = content[0];
|
|
DM1GDP01=byt.GetBit(3);
|
|
DM1ASIG01 = byt.GetBit(4);
|
|
DM1BSIG01 = byt.GetBit(5);
|
|
DM1CSIG01=byt.GetBit(6);
|
|
DM1DSIG01 = byt.GetBit(7);
|
|
|
|
byt = content[1];
|
|
DM1ESIG01= byt.GetBit(0);
|
|
|
|
DM1GDS01 = byt.GetBit(1);
|
|
DM1GDS02 = byt.GetBit(2);
|
|
DM1GDS03 = byt.GetBit(3);
|
|
DM1GDS04 = byt.GetBit(4);
|
|
DM1GDS05 = byt.GetBit(5);
|
|
DM1GDS06 = byt.GetBit(6);
|
|
DM1GDS09 = byt.GetBit(7);
|
|
|
|
byt = content[2];
|
|
DM1DSM01 = byt.GetBit(0);
|
|
DM2DSM01 = byt.GetBit(1);
|
|
DM3DSM01=byt.GetBit(2);
|
|
DM1GDS12 = byt.GetBit(3);
|
|
}
|
|
//3
|
|
public bool DM1GDP01 { get; set; }
|
|
//4
|
|
public bool DM1ASIG01 { get; set; }
|
|
//5
|
|
public bool DM1BSIG01 { get; set; }
|
|
//6
|
|
public bool DM1CSIG01 { get; set; }
|
|
//7
|
|
public bool DM1DSIG01 { get; set; }
|
|
|
|
//0
|
|
public bool DM1ESIG01 { get; set; }
|
|
|
|
public bool DM1GDS01 { get; set; }
|
|
public bool DM1GDS02 { get; set; }
|
|
public bool DM1GDS03 { get; set; }
|
|
public bool DM1GDS04 { get; set; }
|
|
public bool DM1GDS05 { get; set; }
|
|
public bool DM1GDS06 { get; set; }
|
|
//7
|
|
public bool DM1GDS09 { get; set; }
|
|
|
|
|
|
|
|
public bool DM1DSM01 { get; set; }
|
|
|
|
public bool DM2DSM01 { get; set; }
|
|
public bool DM3DSM01 { get; set; }
|
|
|
|
public bool DM1GDS12 { get; set; }
|
|
}
|
|
}
|