mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
109 lines
4.3 KiB
Java
109 lines
4.3 KiB
Java
|
|
package com.jsowell.netty.handler;
|
|||
|
|
|
|||
|
|
import com.alibaba.fastjson2.JSONObject;
|
|||
|
|
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
|||
|
|
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
|||
|
|
import com.jsowell.common.util.BytesUtil;
|
|||
|
|
import com.jsowell.common.util.YKCUtils;
|
|||
|
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
|||
|
|
import io.netty.channel.Channel;
|
|||
|
|
import lombok.extern.slf4j.Slf4j;
|
|||
|
|
import org.springframework.stereotype.Component;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 充电过程 BMS 需求与充电机输出 0x23
|
|||
|
|
*
|
|||
|
|
* GBT-27930 充电桩与 BMS 充电过程 BMS 需求、充电机输出
|
|||
|
|
* @author JS-ZZA
|
|||
|
|
* @date 2022/9/19 13:51
|
|||
|
|
*/
|
|||
|
|
@Slf4j
|
|||
|
|
@Component
|
|||
|
|
public class BMSDemandAndChargerOutputHandler extends AbstractHandler{
|
|||
|
|
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.CHARGING_PROCESS_BMS_DEMAND_AND_CHARGER_OUTPUT_CODE.getBytes());
|
|||
|
|
|
|||
|
|
@Override
|
|||
|
|
public void afterPropertiesSet() throws Exception {
|
|||
|
|
YKCOperateFactory.register(type, this);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@Override
|
|||
|
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
|||
|
|
log.info("[===充电过程 BMS 需求与充电机输出===] param:{}, channel:{}", JSONObject.toJSONString(ykcDataProtocol), channel.toString());
|
|||
|
|
// 获取消息体
|
|||
|
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
|||
|
|
|
|||
|
|
int startIndex = 0;
|
|||
|
|
int length = 16;
|
|||
|
|
|
|||
|
|
// 交易流水号
|
|||
|
|
byte[] serialNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
|
|||
|
|
// 桩编码
|
|||
|
|
startIndex += length;
|
|||
|
|
length = 7;
|
|||
|
|
byte[] pileSnByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
|||
|
|
|
|||
|
|
// 保存时间
|
|||
|
|
saveLastTime(pileSn);
|
|||
|
|
|
|||
|
|
// 枪号
|
|||
|
|
startIndex += length;
|
|||
|
|
length = 1;
|
|||
|
|
byte[] pileConnectorNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
|
|||
|
|
// BMS 电压需求 0.1 V/位, 0 V 偏移量
|
|||
|
|
startIndex += length;
|
|||
|
|
length = 2;
|
|||
|
|
byte[] bmsVoltageDemandByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
|
|||
|
|
// BMS 电流需求 0.1 A/位, -400 A 偏移量
|
|||
|
|
startIndex += length;
|
|||
|
|
byte[] bmsCurrentDemandByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
|
|||
|
|
// BMS 充电模式 0x01:恒压充电; 0x02:恒流充电
|
|||
|
|
startIndex += length;
|
|||
|
|
length = 1;
|
|||
|
|
byte[] bmsChargingModelByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
|
|||
|
|
// BMS 充电电压测量值 0.1 V/位, 0 V 偏移量
|
|||
|
|
startIndex += length;
|
|||
|
|
length = 2;
|
|||
|
|
byte[] bmsChargingVoltageByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
|
|||
|
|
// BMS 充电电流测量值 0.1 A/位, -400 A 偏移量
|
|||
|
|
startIndex += length;
|
|||
|
|
byte[] bmsChargingCurrentByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
|
|||
|
|
// BMS 最高单体动力蓄电池电压及组号 1-12 位:最高单体动力蓄电池电压, 数据分辨率: 0.01 V/位, 0 V 偏移量;数据范围: 0~24 V; 13-16 位: 最高单体动力蓄电池电 压所在组号,数据分辨率: 1/位, 0 偏移量;数据范围: 0~15
|
|||
|
|
startIndex += length;
|
|||
|
|
byte[] bmsMaxVoltageAndGroupNum = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
|
|||
|
|
// BMS 当前荷电状态 SOC( %) 1%/位, 0%偏移量; 数据范围: 0~100%
|
|||
|
|
startIndex += length;
|
|||
|
|
length = 1;
|
|||
|
|
byte[] socByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
|
|||
|
|
// BMS 估算剩余充电时间 1 min/位, 0 min 偏移量; 数据范围: 0~600 min
|
|||
|
|
startIndex += length;
|
|||
|
|
length = 2;
|
|||
|
|
byte[] bmsTheRestChargingTimeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
|
|||
|
|
// 电桩电压输出值 0.1 V/位, 0 V 偏移量
|
|||
|
|
startIndex += length;
|
|||
|
|
byte[] pileVoltageOutputByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
|
|||
|
|
// 电桩电流输出值 0.1 A/位, -400 A 偏移量
|
|||
|
|
startIndex += length;
|
|||
|
|
byte[] pileCurrentOutputByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
|
|||
|
|
// 累计充电时间 1 min/位, 0 min 偏移量; 数据范围: 0~600 min
|
|||
|
|
startIndex += length;
|
|||
|
|
byte[] chargingTimeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
|||
|
|
|
|||
|
|
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
}
|