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/DB2108HelperNew.cs

144 lines
3.9 KiB
C#

using HslCommunication;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using System.Web.UI;
using DataBlockHelper.Entity.DB2107Entity;
namespace DataBlockHelper.DBHelpers
{
public class DB2108HelperNew: DBHelper
{
public DB2108HelperNew()
{
OperateResult<byte[]> db = PlcConnect.Instance.Read("DB2108.0.0", 80);
bytes = db.Content;
}
public MainFan Main => new MainFan(0, bytes);
public MainFan CoolWaterA => new MainFan(2, bytes);
public MainFan CoolWaterB => new MainFan(4, bytes);
public MainFan HotWaterA => new MainFan(6, bytes);
public MainFan HotWaterB => new MainFan(8, bytes);
public MainFan Daybin1 => new MainFan(10, bytes);
public MainFan Daybin2 => new MainFan(12, bytes);
public MainFan Daybin3 => new MainFan(14, bytes);
public MainFan Daybin4 => new MainFan(16, bytes);
public MainFan Daybin5 => new MainFan(18, bytes);
public MainFan Daybin6 => new MainFan(20, bytes);
public MainFan Daybin7 => new MainFan(22, bytes);
public MainFan Daybin8 => new MainFan(24, bytes);
public MainFan Daybin9 => new MainFan(64, bytes);
public MainFan Daybin10 => new MainFan(66, bytes);
public MainFan Daybin11 => new MainFan(68, bytes);
public MainFan Daybin12 => new MainFan(70, bytes);
public MainFan DryA => new MainFan(72, bytes);
public MainFan DryB => new MainFan(74, bytes);
public MainFan DryC => new MainFan(76, bytes);
public MainFan DryD => new MainFan(78, bytes);
public Time2108 Time=>new Time2108(26,bytes);
public Pressure_HMI PR2PCP04=>new Pressure_HMI(50,bytes);
}
public class MainFan
{
public MainFan(ushort startSet, byte[] bytes)
{
var content = bytes.Skip(startSet).Take(1).First();
var trans = PlcConnect.Instance.ByteTransform;
enable= content.GetBit(0);
pause = content.GetBit(1);
ready = content.GetBit(2);
}
public bool enable { get; set; }
public bool pause { get; set; }
public bool ready { get; set; }
}
public class Time2108
{
public Time2108() { }
/// <summary>
/// </summary>
/// <param name="startSet"></param>
/// <param name="bytes"></param>
public Time2108(ushort startSet, byte[] bytes)
{
var content = bytes.Skip(startSet).Take(24).ToArray();
var trans = PlcConnect.Instance.ByteTransform;
VibSiloOn = trans.TransUInt16(content, 0);
VibSiloOff = trans.TransUInt16(content, 2);
VibDaybinOn = trans.TransUInt16(content, 4);
VibDaybinOff = trans.TransUInt16(content, 6);
VibHopperOn = trans.TransUInt16(content, 8);
VibHopperOff = trans.TransUInt16(content, 10);
PlsSiloOn = trans.TransUInt16(content, 12);
PlsSiloOff = trans.TransUInt16(content, 14);
PlsDaybinOn = trans.TransUInt16(content, 16);
PlsDaybinOff = trans.TransUInt16(content, 18);
PlsHopperOn = trans.TransUInt16(content, 20);
PlsHopperOff = trans.TransUInt16(content, 22);
}
public ushort VibSiloOn { get; set; }
public ushort VibSiloOff { get; set; }
public ushort VibDaybinOn { get; set; }
public ushort VibDaybinOff { get; set; }
public ushort VibHopperOn { get; set; }
public ushort VibHopperOff { get; set; }
public ushort PlsSiloOn { get; set; }
public ushort PlsSiloOff { get; set; }
public ushort PlsDaybinOn { get; set; }
public ushort PlsDaybinOff { get; set; }
public ushort PlsHopperOn { get; set; }
public ushort PlsHopperOff { get; set; }
}
}