From f2d3e2f0d25a44b60c02925362f035258a7d67f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=8F=AB=E9=94=84=E5=A4=B4?= Date: Mon, 18 Dec 2023 18:17:09 +0800 Subject: [PATCH] DB120Help --- .../Test/TestAction.cs | 8 +- DataBlockHelper/DBHelpers/DB120Help.cs | 174 +++++++++++++++++- 2 files changed, 175 insertions(+), 7 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs index 0bc3ef9..bb11e7c 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs @@ -80,12 +80,10 @@ namespace Mesnac.Action.ChemicalWeighing.Test private void MCButton_Click(object sender, EventArgs e) { - DB137WriterHelper.AddSpeed(new List() - { - 1,2,3 - }); + var s= new DB120Help().SiloO; + - new DB137Helper(); + s = new DB120Help().SiloJ; DB120WriteHelp.AddABCDEF(new Uhd() { diff --git a/DataBlockHelper/DBHelpers/DB120Help.cs b/DataBlockHelper/DBHelpers/DB120Help.cs index e3f4c49..bf4cad9 100644 --- a/DataBlockHelper/DBHelpers/DB120Help.cs +++ b/DataBlockHelper/DBHelpers/DB120Help.cs @@ -13,13 +13,159 @@ namespace DataBlockHelper.DBHelpers public DB120Help() { - OperateResult db120 = PlcConnect.Instance.Read("DB120.0.0", 66); + OperateResult db120 = PlcConnect.Instance.Read("DB120.0.0", 154); bytes = db120.Content; } public Uhd GetUhd => new Uhd(bytes); - + + + 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); + } + } } @@ -84,4 +230,28 @@ namespace DataBlockHelper.DBHelpers public ushort Delay3 { get; set; } } + + + + 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; } + + } }