You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
2.4 KiB

using BatCharging.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BatCharging.Service
{
/// <summary>
/// 解析充放电机上传BMS设备状态
/// </summary>
public class MsgBatCycUpBMSDecoder
{
/// <summary>
/// 解析充放电机上传BMS设备状态
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public BatterCycleUpBMS GetMsgBatterCycleUpBMS(byte[] data)
{
BatterCycleUpBMS batterCycleUpBMS = null;
if (data.Count() >= 108)
{
batterCycleUpBMS = new BatterCycleUpBMS();
batterCycleUpBMS.PNG1 = data[25];
batterCycleUpBMS.PNG2 = data[26];
batterCycleUpBMS.PNG3 = data[27];
batterCycleUpBMS.dischargeState = ByteUtils.ToUInt32(data, 28);
batterCycleUpBMS.DischargeState = ByteUtils.ToUInt32(data, 32);
batterCycleUpBMS.posRelayStatu = ByteUtils.ToUInt32(data, 36);
batterCycleUpBMS.NegRelayState = ByteUtils.ToUInt32(data, 40);
batterCycleUpBMS.PreCondition = ByteUtils.ToUInt32(data, 44);
batterCycleUpBMS.stateEqu = ByteUtils.ToUInt32(data, 48);
batterCycleUpBMS.BatteryPermit = ByteUtils.ToUInt32(data, 52);
batterCycleUpBMS.stateInsulation = ByteUtils.ToUInt32(data, 56);
batterCycleUpBMS.runState = ByteUtils.ToUInt32(data, 60);
batterCycleUpBMS.BatHealthExa = ByteUtils.ToUInt32(data, 64);
batterCycleUpBMS.BatTheMan = ByteUtils.ToUInt32(data, 68);
batterCycleUpBMS.batAllCha = ByteUtils.ToUInt32(data, 72);
batterCycleUpBMS.TheRunAlaSta = ByteUtils.ToUInt32(data, 76);
batterCycleUpBMS.CooInlTem = ByteUtils.ToUInt32(data, 80);
batterCycleUpBMS.CooOutTem = ByteUtils.ToUInt32(data, 84);
batterCycleUpBMS.DCIntRes = ByteUtils.ToUInt32(data, 88);
batterCycleUpBMS.TemRearBatPack = ByteUtils.ToUInt32(data, 92);
batterCycleUpBMS.TemFrontBatPack = ByteUtils.ToUInt32(data, 96);
batterCycleUpBMS.MiddleLefTem = ByteUtils.ToUInt32(data, 100);
batterCycleUpBMS.MiddleRigTem = ByteUtils.ToUInt32(data, 104);
}
return batterCycleUpBMS;
}
}
}