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.

38 lines
1.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>
/// 解析充放电机上传电压电流SOC数据
/// </summary>
public class MsgBatCycUpSocDecoder
{
/// <summary>
/// 解析充放电机上传电压电流SOC数据
/// </summary>
/// <returns></returns>
public BatteryCycleUpSoc GetMsgBatteryCycleUpSoc(byte[] data)
{
BatteryCycleUpSoc batteryCycleUpSoc = null;
if (data.Count() >= 35)
{
batteryCycleUpSoc = new BatteryCycleUpSoc();
batteryCycleUpSoc.PNG1 = data[25];
batteryCycleUpSoc.PNG2 = data[26];
batteryCycleUpSoc.PNG3 = data[27];
batteryCycleUpSoc.VolMea = ByteUtils.ToUInt16(data, 28);
batteryCycleUpSoc.CurrentMea = ByteUtils.ToUInt16(data, 30);
batteryCycleUpSoc.nowSOC = ByteUtils.ToUInt16(data, 32);
batteryCycleUpSoc.nowSOH = data[33];
batteryCycleUpSoc.retain = data[34];
}
return batteryCycleUpSoc;
}
}
}