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/DBHelpers/DB120Help.cs

258 lines
6.2 KiB
C#

12 months ago
using HslCommunication;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataBlockHelper.DBHelpers
{
public class DB120Help: DBHelper
{
public DB120Help() {
12 months ago
OperateResult<byte[]> db120 = PlcConnect.Instance.Read("DB120.0.0", 154);
12 months ago
bytes = db120.Content;
}
12 months ago
public Uhd GetUhd => new Uhd(bytes);
12 months ago
public DustfanEntity Dustfan => new DustfanEntity(78, bytes);
public DustfanEntity DustfanLineA => new DustfanEntity(80, bytes);
public DustfanEntity DustfanLineB => new DustfanEntity(82, bytes);
public DustfanEntity DustfanLineC => new DustfanEntity(84, bytes);
public float SiloA
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 94);
}
}
public float SiloB
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 98);
}
}
public float SiloC
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 102);
}
}
public float SiloD
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 106);
}
}
public float SiloE
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 110);
}
}
public float SiloF
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 114);
}
}
public float SiloG
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 118);
}
}
public float SiloH
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 122);
}
}
public float SiloI
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 126);
}
}
public float SiloJ
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 130);
}
}
public float SiloK
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 134);
}
}
public float SiloL
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 138);
}
}
public float SiloM
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 142);
}
}
public float SiloN
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 146);
}
}
public float SiloO
{
get
{
var trans = PlcConnect.Instance.ByteTransform;
return trans.TransSingle(bytes, 150);
}
}
12 months ago
}
public class Uhd
{
public Uhd()
{
}
public Uhd(byte[] content)
{
var trans = PlcConnect.Instance.ByteTransform;
A= trans.TransSingle(content, 0);
B = trans.TransSingle(content, 4);
C = trans.TransSingle(content, 8);
D = trans.TransSingle(content, 12);
E = trans.TransSingle(content, 16);
F = trans.TransSingle(content, 20);
G = trans.TransSingle(content, 24);
H = trans.TransSingle(content, 28);
I = trans.TransSingle(content, 32);
J = trans.TransSingle(content, 36);
K = trans.TransSingle(content, 40);
L = trans.TransSingle(content, 44);
M = trans.TransSingle(content, 48);
N = trans.TransSingle(content, 52);
O= trans.TransSingle(content, 56);
Delay1 = trans.TransUInt16(content, 60);
Delay2 = trans.TransUInt16(content, 62);
Delay3 = trans.TransUInt16(content, 64);
}
public float A { get; set; }
public float B { get; set; }
public float C { get; set; }
public float D { get; set; }
public float E { get; set; }
public float F { get; set; }
public float G { get; set; }
public float H { get; set; }
public float I { get; set; }
public float J { get; set; }
public float K { get; set; }
public float L { get; set; }
public float M { get; set; }
public float N { get; set; }
public float O { get; set; }
public ushort Delay1 { get; set; }
public ushort Delay2 { get; set; }
public ushort Delay3 { get; set; }
}
12 months ago
public class DustfanEntity
{
public DustfanEntity(ushort startSet, byte[] bytes) {
byte[] content = bytes.Skip(startSet).Take(2).ToArray();
byte byt = content[0];
SilogroupA = byt.GetBit(0);
SilogroupB = byt.GetBit(1);
SilogroupC = byt.GetBit(2);
SilogroupD = byt.GetBit(3);
SilogroupE = byt.GetBit(4);
}
public bool SilogroupA { get; set; }
public bool SilogroupB { get; set; }
public bool SilogroupC { get; set; }
public bool SilogroupD { get; set; }
public bool SilogroupE { get; set; }
}
12 months ago
}