mirror of
https://gitee.com/san-bing/JChargePointProtocol
synced 2026-05-08 20:10:01 +08:00
!12 充电过程BMS信息
* Merge branch 'master' into Feat_BMS_Charging_Info * 修改实体名称 * Merge branch 'master' into Feat_BMS_Charging_Info * 充电过程BMS信息 * 充电过程BMS信息 * 充电过程BMS信息
This commit is contained in:
@@ -88,4 +88,9 @@ public interface PileProtocolService {
|
|||||||
* 充电桩与 BMS 参数配置阶段报文
|
* 充电桩与 BMS 参数配置阶段报文
|
||||||
*/
|
*/
|
||||||
void onBmsParamConfigReport(UplinkQueueMessage uplinkQueueMsg, Callback callback);
|
void onBmsParamConfigReport(UplinkQueueMessage uplinkQueueMsg, Callback callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电过程BMS信息
|
||||||
|
*/
|
||||||
|
void onBmsCharingInfo(UplinkQueueMessage uplinkQueueMessage, Callback callback);
|
||||||
}
|
}
|
||||||
@@ -331,6 +331,19 @@ public class DefaultPileProtocolService implements PileProtocolService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBmsCharingInfo(UplinkQueueMessage uplinkQueueMessage, Callback callback) {
|
||||||
|
log.info("接收到充电桩上报BMS充电信息 {}", uplinkQueueMessage);
|
||||||
|
BmsChargingInfoProto bmsCharingInfoProto = uplinkQueueMessage.getBmsChargingInfoProto();
|
||||||
|
String tradeNo = bmsCharingInfoProto.getTradeNo();
|
||||||
|
String pileCode = bmsCharingInfoProto.getPileCode();
|
||||||
|
String gunCode = bmsCharingInfoProto.getGunCode();
|
||||||
|
String additionalInfo = bmsCharingInfoProto.getAdditionalInfo();
|
||||||
|
log.info("BMS充电信息: 交易流水号: {}, 桩编码: {}, 枪号: {}, 附加信息: {}", tradeNo, pileCode, gunCode, additionalInfo);
|
||||||
|
// TODO 处理相关业务逻辑
|
||||||
|
callback.onSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
private static Period createPeriod(int sn, LocalTime beginTime, LocalTime endTime, PricingModelFlag flag) {
|
private static Period createPeriod(int sn, LocalTime beginTime, LocalTime endTime, PricingModelFlag flag) {
|
||||||
Period period = new Period();
|
Period period = new Period();
|
||||||
period.setSn(sn);
|
period.setSn(sn);
|
||||||
|
|||||||
@@ -200,6 +200,10 @@ public class ProtocolUplinkConsumerService extends AbstractConsumerService imple
|
|||||||
|
|
||||||
pileProtocolService.onBmsParamConfigReport(uplinkQueueMsg, callback);
|
pileProtocolService.onBmsParamConfigReport(uplinkQueueMsg, callback);
|
||||||
|
|
||||||
|
} else if (uplinkQueueMsg.hasBmsChargingInfoProto()) {
|
||||||
|
|
||||||
|
pileProtocolService.onBmsCharingInfo(uplinkQueueMsg, callback);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
callback.onSuccess();
|
callback.onSuccess();
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ message UplinkQueueMessage {
|
|||||||
TransactionRecord transactionRecord = 30;
|
TransactionRecord transactionRecord = 30;
|
||||||
BmsChargingErrorProto bmsChargingErrorProto = 31;
|
BmsChargingErrorProto bmsChargingErrorProto = 31;
|
||||||
BmsParamConfigReport bmsParamConfigReport = 33;
|
BmsParamConfigReport bmsParamConfigReport = 33;
|
||||||
|
BmsChargingInfoProto bmsChargingInfoProto = 34;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DownlinkRequestMessage {
|
message DownlinkRequestMessage {
|
||||||
@@ -317,3 +318,10 @@ message BmsParamConfigReport {
|
|||||||
string pileMaxOutputCurrent = 14; // 电桩最大输出电流 (A)
|
string pileMaxOutputCurrent = 14; // 电桩最大输出电流 (A)
|
||||||
string pileMinOutputCurrent = 15; // 电桩最小输出电流 (A)
|
string pileMinOutputCurrent = 15; // 电桩最小输出电流 (A)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message BmsChargingInfoProto {
|
||||||
|
string pileCode = 1;
|
||||||
|
string gunCode = 2;
|
||||||
|
string tradeNo = 3;
|
||||||
|
optional string additionalInfo = 4;
|
||||||
|
}
|
||||||
@@ -57,9 +57,12 @@
|
|||||||
### 0x17 上行BMS参数配置
|
### 0x17 上行BMS参数配置
|
||||||
`68 31 00 16 00 17 32 01 02 00 00 00 00 11 15 11 16 15 55 35 02 60 20 23 12 12 00 00 10 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 BB 78`
|
`68 31 00 16 00 17 32 01 02 00 00 00 00 11 15 11 16 15 55 35 02 60 20 23 12 12 00 00 10 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 BB 78`
|
||||||
|
|
||||||
|
---
|
||||||
---
|
---
|
||||||
|
|
||||||
#### 0x1B 充电桩与 BMS 充电错误报文
|
#### 0x1B 充电桩与 BMS 充电错误报文
|
||||||
`68 24 00 17 00 1B 32 01 02 00 00 00 00 11 15 11 16 15 55 35 02 06 20 23 12 12 00 00 10 01 00 00 00 00 00 00 00 00 79 00`
|
`68 24 00 17 00 1B 32 01 02 00 00 00 00 11 15 11 16 15 55 35 02 06 20 23 12 12 00 00 10 01 00 00 00 00 00 00 00 00 79 00`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
#### 0x25 充电过程BMS信息
|
||||||
|
`68 31 01 00 00 25 32 01 02 00 00 00 00 11 15 11 16 15 55 35 02 60 20 23 12 12 00 00 10 01 01 01 01 01 01 01 00 01 00 01 00 01 00 01 00 01 00 01 00 00 00 BE C8`
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package sanbing.jcpp.protocol.yunkuaichong.v150.cmd;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import sanbing.jcpp.infrastructure.util.codec.BCDUtil;
|
||||||
|
import sanbing.jcpp.infrastructure.util.jackson.JacksonUtil;
|
||||||
|
import sanbing.jcpp.proto.gen.ProtocolProto.BmsChargingInfoProto;
|
||||||
|
import sanbing.jcpp.proto.gen.ProtocolProto.UplinkQueueMessage;
|
||||||
|
import sanbing.jcpp.protocol.ProtocolContext;
|
||||||
|
import sanbing.jcpp.protocol.listener.tcp.TcpSession;
|
||||||
|
import sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongUplinkCmdExe;
|
||||||
|
import sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongUplinkMessage;
|
||||||
|
import sanbing.jcpp.protocol.yunkuaichong.annotation.YunKuaiChongCmd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电过程BMS信息
|
||||||
|
*
|
||||||
|
* @author facai
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@YunKuaiChongCmd(0x25)
|
||||||
|
public class YunKuaiChongV150BmsChargingInfoULCmd extends YunKuaiChongUplinkCmdExe {
|
||||||
|
@Override
|
||||||
|
public void execute(TcpSession tcpSession, YunKuaiChongUplinkMessage yunKuaiChongUplinkMessage, ProtocolContext ctx) {
|
||||||
|
log.debug("{} 云快充1.5.0充电过程BMS信息", tcpSession);
|
||||||
|
ByteBuf byteBuf = Unpooled.wrappedBuffer(yunKuaiChongUplinkMessage.getMsgBody());
|
||||||
|
ObjectNode additionalInfo = JacksonUtil.newObjectNode();
|
||||||
|
// 1.交易流水号
|
||||||
|
byte[] tradeNoBytes = new byte[16];
|
||||||
|
byteBuf.readBytes(tradeNoBytes);
|
||||||
|
String tradeNo = BCDUtil.toString(tradeNoBytes);
|
||||||
|
// 2.桩编号
|
||||||
|
byte[] pileCodeBytes = new byte[7];
|
||||||
|
byteBuf.readBytes(pileCodeBytes);
|
||||||
|
String pileCode = BCDUtil.toString(pileCodeBytes);
|
||||||
|
// 3.枪号
|
||||||
|
byte[] gunCodeBytes = new byte[1];
|
||||||
|
byteBuf.readBytes(gunCodeBytes);
|
||||||
|
String gunCode = BCDUtil.toString(gunCodeBytes);
|
||||||
|
// 4.BMS最高单体动力蓄电池电压所在编号
|
||||||
|
additionalInfo.put("BMS最高单体动力蓄电池电压所在编号", byteBuf.readByte());
|
||||||
|
// 5.BMS最高动力蓄电池温度
|
||||||
|
additionalInfo.put("BMS最高动力蓄电池温度", byteBuf.readByte());
|
||||||
|
// 6.最高温度检测点编号
|
||||||
|
additionalInfo.put("最高温度检测点编号", byteBuf.readByte());
|
||||||
|
// 7.最低动力蓄电池温度
|
||||||
|
additionalInfo.put("最低动力蓄电池温度", byteBuf.readByte());
|
||||||
|
// 8.最低动力蓄电池温度检测点编号
|
||||||
|
additionalInfo.put("最低动力蓄电池温度检测点编号", byteBuf.readByte());
|
||||||
|
// 9.BMS单体动力蓄电池电压过高/过低 00:正常 01:过高 10:过低
|
||||||
|
additionalInfo.put("BMS单体动力蓄电池电压过高/过低", stateToStr(byteBuf.readShortLE()));
|
||||||
|
// 10.BMS整车动力蓄电池荷电状态SOC 过高/过低 00:正常 01:过高 10:过低
|
||||||
|
additionalInfo.put("BMS整车动力蓄电池荷电状态SOC", stateToStr(byteBuf.readShortLE()));
|
||||||
|
// 11.BMS动力蓄电池充电过电流 00:正常 01:过流 10:不可信状态
|
||||||
|
additionalInfo.put("BMS动力蓄电池充电过电流", stateToStr1(byteBuf.readShortLE()));
|
||||||
|
// 12.BMS动力蓄电池温度过高 00:正常 01:过流 10:不可信状态
|
||||||
|
additionalInfo.put("BMS动力蓄电池温度过高", stateToStr1(byteBuf.readShortLE()));
|
||||||
|
// 13.BMS动力蓄电池绝缘状态 00:正常 01:过流 10:不可信状态
|
||||||
|
additionalInfo.put("BMS动力蓄电池绝缘状态", stateToStr1(byteBuf.readShortLE()));
|
||||||
|
// 14.BMS动力蓄电池组输出连接器连接状态 00:正常 01:过流 10:不可信状态
|
||||||
|
additionalInfo.put("BMS动力蓄电池组输出连接器连接状态", stateToStr1(byteBuf.readShortLE()));
|
||||||
|
// 15.充电禁止 00:禁止 01:允许
|
||||||
|
additionalInfo.put("BMS动力蓄电池组输出连接器连接状态", byteBuf.readShortLE() == 0 ? "禁止" : "允许");
|
||||||
|
// 16.预留位
|
||||||
|
byteBuf.skipBytes(2);
|
||||||
|
|
||||||
|
BmsChargingInfoProto bmsCharingInfoProto = BmsChargingInfoProto.newBuilder()
|
||||||
|
.setPileCode(pileCode)
|
||||||
|
.setTradeNo(tradeNo)
|
||||||
|
.setGunCode(gunCode)
|
||||||
|
.setAdditionalInfo(additionalInfo.toString())
|
||||||
|
.build();
|
||||||
|
UplinkQueueMessage uplinkQueueMessage = uplinkMessageBuilder(bmsCharingInfoProto.getPileCode(), tcpSession, yunKuaiChongUplinkMessage)
|
||||||
|
.setBmsChargingInfoProto(bmsCharingInfoProto)
|
||||||
|
.build();
|
||||||
|
tcpSession.getForwarder().sendMessage(uplinkQueueMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String stateToStr(short state) {
|
||||||
|
return switch (state) {
|
||||||
|
case 0 -> "正常";
|
||||||
|
case 1 -> "过高";
|
||||||
|
default -> "过低";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private String stateToStr1(short state) {
|
||||||
|
return switch (state) {
|
||||||
|
case 0 -> "正常";
|
||||||
|
case 1 -> "过高";
|
||||||
|
default -> "不可信状态";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user