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.

67 lines
3.2 KiB

using BatCharging.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BatCharging.Service
{
/// <summary>
/// 解析4.1.8 充放电机上送充电停止帧
/// </summary>
public class MsgChaStopFraDecoder
{
/// <summary>
/// 解析4.1.8 充放电机上送充电停止帧
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public ChargeStopFrame GetMsgChargeStopFrame(byte[] data)
{
ChargeStopFrame chargeStopFrame = null;
if (data.Count() >= 76)
{
chargeStopFrame = new ChargeStopFrame();
chargeStopFrame.SuccessMark = data[25];
chargeStopFrame.causeFailure = data[26];
chargeStopFrame.BMSStopChaRea = data[27];
chargeStopFrame.BMSChaFauCau = ByteUtils.ToUInt16(data, 28);
chargeStopFrame.BMSAboErrCau = data[30];
chargeStopFrame.SusSOCChargeState = data[31];
chargeStopFrame.MinVolPowBat = ByteUtils.ToUInt16(data, 32);
chargeStopFrame.MaxCellVoltage = ByteUtils.ToUInt16(data,34);
chargeStopFrame.MinTemPowerBat = data[36];
chargeStopFrame.MaxTemPowerBat = data[37];
chargeStopFrame.IdeMesTimeout00 = ByteUtils.ToUInt16(data, 38);
chargeStopFrame.IdeMesTimeoutAA = ByteUtils.ToUInt16(data, 40);
chargeStopFrame.MaxOutCapPacTim = ByteUtils.ToUInt16(data, 42);
chargeStopFrame.TimPreMes = data[44];
chargeStopFrame.chaStaMesTimeOut = ByteUtils.ToUInt16(data, 45);
chargeStopFrame.stopChaMesTimeOut = ByteUtils.ToUInt16(data, 47);
chargeStopFrame.chaStaPacketTimeOut = ByteUtils.ToUInt16(data, 49);
chargeStopFrame.OtherErrorsBMS1 = data[50];
chargeStopFrame.OtherErrorsBMS2 = data[51];
chargeStopFrame.OtherErrorsBMS3 = data[52];
chargeStopFrame.OtherErrorsBMS4 = data[53];
chargeStopFrame.OtherErrorsBMS5 = data[54];
chargeStopFrame.OtherErrorsBMS6 = data[55];
chargeStopFrame.IdeMesTimeout = ByteUtils.ToUInt16(data, 56);
chargeStopFrame.ChaParMesTimeOut = ByteUtils.ToUInt16(data, 58); ;
chargeStopFrame.stopChaMesTimeOutBMS = ByteUtils.ToUInt16(data, 60);
chargeStopFrame.ReqMesTimeout = ByteUtils.ToUInt16(data, 62);
chargeStopFrame.totalStatusMesTimeOut = ByteUtils.ToUInt16(data, 64);
chargeStopFrame.BMSstopChaMesTimeOut = ByteUtils.ToUInt16(data, 66);
chargeStopFrame.stopchaMesTimeOut = ByteUtils.ToUInt16(data, 68);
chargeStopFrame.OthErrDetCha1 = data[70];
chargeStopFrame.OthErrDetCha2 = data[71];
chargeStopFrame.OthErrDetCha3 = data[72];
chargeStopFrame.OthErrDetCha4 = data[73];
chargeStopFrame.OthErrDetCha5 = data[74];
chargeStopFrame.OthErrDetCha6 = data[75];
}
return chargeStopFrame;
}
}
}