解析0x25充电过程 BMS 信息

This commit is contained in:
Guoqs
2024-12-16 14:44:23 +08:00
parent 2a45ce83aa
commit 645016d579

View File

@@ -1,14 +1,198 @@
package com.jsowell.common.core.domain.ykc.device2platform;
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
import com.jsowell.common.util.BytesUtil;
import lombok.Data;
/**
* 计费模板验证请求数据
* 充电过程 BMS 信息
*/
@Data
public class Data0x25 extends YKCBaseMessage {
/**
* 交易流水号 BCD 码 16 见名词解释
*/
private String transactionCode;
/**
* 桩编号 BCD 码 7 不足 7 位补 0
*/
private String pileSn;
/**
* 枪号 BCD 码 1
*/
private String connectorCode;
/**
* BMS 最高单体动力蓄电池电压所在编号 1/位, 1 偏移量; 数据范围: 1~256
*/
private String bmsMaxVoltageNum;
/**
* BMS 最高动力蓄电池温度 1ºC/位, -50 ºC 偏移量;数据范 围: -50 ºC ~+200 ºC
*/
private String bmsMaxBatteryTemperature;
/**
* 最高温度检测点编号 1/位, 1 偏移量; 数据范围: 1~128
*/
private String maxTemperatureDetectionNum;
/**
* 最低动力蓄电池温度
*/
private String minBatteryTemperature;
/**
* 最低动力蓄电池温度检测点编号
*/
private String minTemperatureDetectionNum;
/**
* BMS 单体动力蓄电池电压过高 /过低
* @param messageBytes
*/
private String singleBMSVoltageStatus;
/**
* BMS 整车动力蓄电池荷电状态 SOC 过高/过低 (<00> =正常 ; <01> =过高 ; <10> =过低)
*/
private String carBMSSocStatus;
/**
* BMS 动力蓄电池充电过电流 (<00> =正常 ; <01> =过流 ; <10> =不可信状态)
*/
private String bmsBatteryChargeCurrentStatus;
/**
* BMS 动力蓄电池温度过高 (<00> =正常 ; <01> =过流 ; <10> =不可信状态)
*/
private String bmsBatteryTemperature;
/**
* BMS 动力蓄电池绝缘状态 (<00> =正常 ; <01> =过流 ; <10> =不可信状态)
*/
private String bmsBatteryInsulationStatus;
/**
* BMS 动力蓄电池组输出连接器连接状态 (<00> =正常 ; <01> =过流 ; <10> =不可信状态)
*/
private String bmsBatteryOutputStatus;
/**
* 充电禁止 (<00> =禁止; <01> =允许)
*/
private String chargeProhibit;
/**
* 预留位
*/
private String reservedBit;
public Data0x25(byte[] messageBytes) {
super(messageBytes);
// 初始startIndex为6, 跳过消息头等6个字节
int startIndex = 6;
// 交易流水号
int length = 16;
byte[] orderCodeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.transactionCode = BytesUtil.bcd2Str(orderCodeByteArr);
// 桩编码
startIndex += length;
length = 7;
byte[] pileSnByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 枪号
startIndex += length;
length = 1;
byte[] connectorCodeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.connectorCode = BytesUtil.bcd2Str(connectorCodeByteArr);
// BMS 最高单体动力蓄电池电压 所在编号
startIndex += length;
length = 1;
byte[] bmsMaxVoltageNumByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.bmsMaxVoltageNum = String.valueOf(BytesUtil.bytesToIntLittle(bmsMaxVoltageNumByteArr));
// BMS 最高动力蓄电池温度
startIndex += length;
length = 1;
byte[] BMSMaxBatteryTemperatureByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.bmsMaxBatteryTemperature = String.valueOf(BytesUtil.bytesToIntLittle(BMSMaxBatteryTemperatureByteArr) - 50);
// 最高温度检测点编号
startIndex += length;
length = 1;
byte[] maxTemperatureDetectionNumByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.maxTemperatureDetectionNum = String.valueOf(BytesUtil.bytesToIntLittle(maxTemperatureDetectionNumByteArr) + 1);
// 最低动力蓄电池温度
startIndex += length;
length = 1;
byte[] minBatteryTemperatureByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.minBatteryTemperature = String.valueOf(BytesUtil.bytesToIntLittle(minBatteryTemperatureByteArr) - 50);
// 最低动力蓄电池温度检测点 编号
startIndex += length;
length = 1;
byte[] minTemperatureDetectionNumByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.minTemperatureDetectionNum = String.valueOf(BytesUtil.bytesToIntLittle(minTemperatureDetectionNumByteArr) + 1);
// BMS 单体动力蓄电池电压过高 /过低
startIndex += length;
length = 2;
byte[] singleBMSVoltageStatusByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.singleBMSVoltageStatus = BytesUtil.bcd2Str(singleBMSVoltageStatusByteArr);
// BMS 整车动力蓄电池荷电状态 SOC 过高/过低
startIndex += length;
length = 2;
byte[] carBMSSocStatusByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.carBMSSocStatus = BytesUtil.bcd2Str(carBMSSocStatusByteArr);
// BMS 动力蓄电池充电过电流
startIndex += length;
length = 2;
byte[] BMSBatteryChargeCurrentStatusByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.bmsBatteryChargeCurrentStatus = BytesUtil.bcd2Str(BMSBatteryChargeCurrentStatusByteArr);
// BMS 动力蓄电池温度过高
startIndex += length;
length = 2;
byte[] BMSBatteryTemperatureByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.bmsBatteryTemperature = BytesUtil.bcd2Str(BMSBatteryTemperatureByteArr);
// BMS 动力蓄电池绝缘状态
startIndex += length;
length = 2;
byte[] BMSBatteryInsulationStatusByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.bmsBatteryInsulationStatus = BytesUtil.bcd2Str(BMSBatteryInsulationStatusByteArr);
// BMS 动力蓄电池组输出连接器 连接状态
startIndex += length;
length = 2;
byte[] BMSBatteryOutputStatusByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.bmsBatteryOutputStatus = BytesUtil.bcd2Str(BMSBatteryOutputStatusByteArr);
// 充电禁止
startIndex += length;
length = 2;
byte[] chargeProhibitByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.chargeProhibit = BytesUtil.bcd2Str(chargeProhibitByteArr);
// 预留位
startIndex += length;
length = 2;
byte[] reservedBitByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
this.reservedBit = BytesUtil.bcd2Str(reservedBitByteArr);
}
}