update 解析0x17参数配置帧

This commit is contained in:
Lemon
2024-11-20 14:26:16 +08:00
parent 17e646811b
commit 86023c9e29
2 changed files with 245 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.Objects;
/**
@@ -65,23 +66,28 @@ public class ParameterConfigurationHandler extends AbstractYkcHandler {
startIndex += length;
length = 2;
byte[] BMSMaxVoltageByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String BMSMaxVoltage = String.valueOf(BytesUtil.bytesToIntLittle(BMSMaxVoltageByteArr) * 0.01);
// BMS 最高允许充电电流 0.1 A/位, -400A 偏移量
startIndex += length;
byte[] BMSMaxCurrentByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String BMSMaxCurrent = String.valueOf(BytesUtil.bytesToIntLittle(BMSMaxCurrentByteArr) * 0.1 - 400);
// BMS 动力蓄电池标称总能量 0.1 kWh/位, 0 kWh 偏移量; 数据范围: 0~1000 kWh
startIndex += length;
byte[] BMSSumEnergyByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String BMSSumEnergy = String.valueOf(BytesUtil.bytesToIntLittle(BMSSumEnergyByteArr) * 0.1);
// BMS 最高允许充电总电压 0.1 V/位, 0 V 偏移量
startIndex += length;
byte[] BMSMaxChargingVoltageByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String BMSMaxChargingVoltage = String.valueOf(BytesUtil.bytesToIntLittle(BMSMaxChargingVoltageByteArr) * 0.1);
// BMS 最高允许温度 1ºC/位, -50 ºC 偏移量;数据范 围: -50 ºC ~+200 ºC
startIndex += length;
length = 1;
byte[] BMSMaxTemperatureByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String BMSMaxTemperature = String.valueOf(BytesUtil.bytesToIntLittle(BMSMaxTemperatureByteArr) - 50);
// BMS 整车动力 蓄电池荷电状态(soc) 0.1%/位, 0%偏移量;数据范围: 0~100%
startIndex += length;
@@ -89,26 +95,30 @@ public class ParameterConfigurationHandler extends AbstractYkcHandler {
byte[] BMSSocByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String soc = YKCUtils.convertVoltageCurrent(BMSSocByteArr);
// BMS 整车动力蓄电池当前电池电压 整车动力蓄电池总电压
startIndex += length;
byte[] BMSRealTimeVoltageByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String BMSRealTimeVoltage = String.valueOf(BytesUtil.bytesToIntLittle(BMSRealTimeVoltageByteArr) * 0.1);
// 电桩最高输出电压 0.1 V /位, 0 V 偏移量
startIndex += length;
byte[] pileMaxOutputVoltageByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String pileMaxOutputVoltage = String.valueOf(BytesUtil.bytesToIntLittle(pileMaxOutputVoltageByteArr) * 0.1);
// 电桩最低输出电压 0.1 V /位, 0 V 偏移量
startIndex += length;
byte[] pileMinOutputVoltageByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String pileMinOutputVoltage = String.valueOf(BytesUtil.bytesToIntLittle(pileMinOutputVoltageByteArr) * 0.1);
// 电桩最大输出电流 0.1 A/位, -400 A 偏移量
startIndex += length;
byte[] pileMaxOutputCurrentByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String pileMaxOutputCurrent = String.valueOf(BytesUtil.bytesToIntLittle(pileMaxOutputCurrentByteArr) * 0.1 - 400);
// 电桩最小输出电流 0.1 A/位, -400 A 偏移量
startIndex += length;
byte[] pileMinOutputCurrentByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String pileMinOutputCurrent = String.valueOf(BytesUtil.bytesToIntLittle(pileMinOutputCurrentByteArr) * 0.1 - 400);
// 查询该订单下信息将起始soc传入
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);