using BatCharging.Model; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BatCharging.Service { public class MsgTelemetryData { /// /// 解析遥测数据上报 /// /// public MTelemetryData BTelemetryData(byte[] data) { MTelemetryData mTelemetryData = null; mTelemetryData = new MTelemetryData(); mTelemetryData.SOC = data[24]; mTelemetryData.maxTemperature = data[25]; mTelemetryData.maxTemperatureNo = data[26]; mTelemetryData.minTemperature = data[27]; mTelemetryData.minTemperatureNo = data[28]; mTelemetryData.MaxBatteryVoltage = ByteUtils.ToUInt16(data, 29); mTelemetryData.MINBatteryVoltage = ByteUtils.ToUInt16(data, 31); mTelemetryData.AmbientTemCharger = data[33]; mTelemetryData.ChaGuiVoltage = ByteUtils.ToUInt16(data, 34); mTelemetryData.BMSDemandVoltage = ByteUtils.ToUInt16(data, 36); mTelemetryData.BMSDemandCurrent = ByteUtils.ToUInt16(data, 38); mTelemetryData.chargingMode = data[40]; mTelemetryData.BMSMeaChaVol = ByteUtils.ToUInt16(data, 41); mTelemetryData.BMSChaCurMea = ByteUtils.ToUInt16(data, 43); mTelemetryData.EstRemCharTime = ByteUtils.ToUInt16(data, 45); mTelemetryData.ChaIntTemProbeTem1 = data[47]; mTelemetryData.ChaIntTemProbeTem2 = data[48]; mTelemetryData.ChaIntTemProbeTem3 = data[49]; mTelemetryData.ChaIntTemProbeTem4 = data[50]; mTelemetryData.CurPowerDCMeter = ByteUtils.ToUInt32(data, 51); mTelemetryData.chargingVoltage = ByteUtils.ToUInt16(data, 55); mTelemetryData.chargeCurrent = ByteUtils.ToUInt16(data, 57); mTelemetryData.HighVoltageAcquisitionVoltage = ByteUtils.ToUInt16(data, 59); mTelemetryData.HighVoltageAcquisitionCurrent = ByteUtils.ToUInt16(data, 61); mTelemetryData.IntTemPile = data[63]; mTelemetryData.chargingTime = ByteUtils.ToUInt16(data, 64); mTelemetryData.ModuleAirIntakeTem = data[66]; mTelemetryData.ModuleAirOuttakeTem = data[67]; return mTelemetryData; } } }