|
@@ -1,10 +1,17 @@
|
|
|
package com.zhili.zkstationserver.dto;
|
|
|
|
|
|
+import com.zhili.zkstationserver.entity.BmsAlarmDict;
|
|
|
+import com.zhili.zkstationserver.init.DataInit;
|
|
|
import com.zhili.zkstationserver.util.BytesUtil;
|
|
|
import lombok.Data;
|
|
|
import lombok.NoArgsConstructor;
|
|
|
import org.apache.commons.lang.ArrayUtils;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
+
|
|
|
/**
|
|
|
* @author :HuangBin
|
|
|
* @description:TODO
|
|
@@ -21,14 +28,16 @@ public class ChargerState {
|
|
|
String chargerCode;
|
|
|
//枪号
|
|
|
Integer gunNo;
|
|
|
+ // 序列号
|
|
|
+ String serialNo;
|
|
|
//需求电压
|
|
|
- Float demandVoltage;
|
|
|
+ Integer demandVoltage;
|
|
|
//需求电流
|
|
|
- Float demandCurrent;
|
|
|
+ Integer demandCurrent;
|
|
|
//直流充电电压
|
|
|
- Float chargeVoltage;
|
|
|
+ Integer chargeVoltage;
|
|
|
//直流充电电流
|
|
|
- Float chargeCurrent;
|
|
|
+ Integer chargeCurrent;
|
|
|
//充电机状态
|
|
|
Integer chargerState;
|
|
|
//本次累积充电电量
|
|
@@ -40,12 +49,12 @@ public class ChargerState {
|
|
|
//电池sn
|
|
|
String sn;
|
|
|
//电池soc
|
|
|
- Integer soc;
|
|
|
+ Float soc;
|
|
|
//电池soh
|
|
|
- Integer soh;
|
|
|
+ Float soh;
|
|
|
//电池包总电流
|
|
|
Float current;
|
|
|
- //电池包总电压
|
|
|
+ //电池端高压
|
|
|
Float innerV;
|
|
|
//电芯温度最大值
|
|
|
Integer maxCellTemp;
|
|
@@ -79,13 +88,77 @@ public class ChargerState {
|
|
|
Boolean connected;
|
|
|
//额定总容量
|
|
|
Float ratedEnergy;
|
|
|
+ // 充电机告警信息
|
|
|
+ Map<String,Integer> chargerAlarmMap = new HashMap<>();
|
|
|
+ // bms告警位信息
|
|
|
+ Map<String,Integer> bmsAlarmMap = new HashMap<>();
|
|
|
+ // 时间
|
|
|
+ String time;
|
|
|
+
|
|
|
+ public ChargerState(String stationCode, byte[] data) {
|
|
|
|
|
|
- public ChargerState(String stationCode, byte[] data){
|
|
|
this.stationCode = stationCode;
|
|
|
- this.chargerId = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data,0,1));
|
|
|
- this.chargerCode = BytesUtil.parseString(ArrayUtils.subarray(data, 1,33));
|
|
|
- this.gunNo = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data,33,1));
|
|
|
- this.chargerState = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 42,43));
|
|
|
- this.soc = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 80,81));
|
|
|
+ this.chargerId = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 0, 1));
|
|
|
+ this.chargerCode = BytesUtil.parseString(ArrayUtils.subarray(data, 1, 33));
|
|
|
+ this.gunNo = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 33, 34));
|
|
|
+ this.serialNo = BytesUtil.parseString(ArrayUtils.subarray(data, 34, 66));
|
|
|
+ this.demandVoltage = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 66, 68));
|
|
|
+ this.demandCurrent = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 68, 70));
|
|
|
+ this.chargeVoltage = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 70, 72));
|
|
|
+ this.chargeCurrent = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 72, 74));
|
|
|
+ this.chargerState = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 74, 75));
|
|
|
+ this.curAccCapacity = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 75, 4)) * 0.1f;
|
|
|
+ this.chargerComm = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 79, 80));
|
|
|
+ this.estimateTime = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 80, 84));
|
|
|
+ this.sn = BytesUtil.parseString(ArrayUtils.subarray(data, 84, 111));
|
|
|
+ this.soc = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 111, 112)) * 0.4f;
|
|
|
+ this.soh = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 112, 113)) * 0.4f;
|
|
|
+ this.current = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 113, 115)) * 0.1f - 1000;
|
|
|
+ this.innerV = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 115, 117)) * 0.1f;
|
|
|
+ this.maxCellTemp = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 117, 118)) - 50;
|
|
|
+ this.minCellTemp = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 118, 119)) - 50;
|
|
|
+ this.avgCellTemp = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data,119,120)) - 50;
|
|
|
+ this.maxTCSC = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data,120,121));
|
|
|
+ this.minTCSC = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data,121,122));
|
|
|
+ this.maxTCSCProbe = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data,122,123));
|
|
|
+ this.minTCSCProbe = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data,123,124));
|
|
|
+ this.maxCellVoltage = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data,124,126)) * 0.001f;
|
|
|
+ this.maxVCSC = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data,126,127));
|
|
|
+ this.maxVSingle = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data,127,128));
|
|
|
+ this.avgCellVoltage = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data,128,130)) * 0.001f;
|
|
|
+ this.minCellVoltage = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 130,132)) * 0.001f;
|
|
|
+ this.minVCSC = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 132,133));
|
|
|
+ this.minVSingle = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data,133,134));
|
|
|
+ this.connected = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data, 134, 135)) == 1;
|
|
|
+ this.ratedEnergy = BytesUtil.toIntWithLowerFirst(ArrayUtils.subarray(data,135,137)) * 0.1f;
|
|
|
+ // 充电机告警位信息
|
|
|
+ Map<Integer, String> alarmMsgMap = DataInit.getChargerAlarmMap();
|
|
|
+ List<Integer> faultList = BytesUtil.getFault(ArrayUtils.subarray(data, 137, 169));
|
|
|
+ for (Integer k : alarmMsgMap.keySet()) {
|
|
|
+ this.chargerAlarmMap.put(k.toString(),faultList.contains(k) ? 1 : 0);
|
|
|
+ }
|
|
|
+ // bms告警位信息
|
|
|
+ Map<String, List<BmsAlarmDict>> bmsAlarmMsgMap = DataInit.getBmsAlarmMsgMap();
|
|
|
+ byte[] bmsAlarm1 = ArrayUtils.subarray(data, 169, 177);
|
|
|
+ List<BmsAlarmDict> bmsAlarmMsgList1 = bmsAlarmMsgMap.get("0x1880D0F3");
|
|
|
+ for (BmsAlarmDict bmsAlarmDict : bmsAlarmMsgList1) {
|
|
|
+ Integer byteSeq = bmsAlarmDict.getByteSeq();
|
|
|
+ byte frameMsgByte = bmsAlarm1[byteSeq];
|
|
|
+ Integer startBit = bmsAlarmDict.getStartBit();
|
|
|
+ Integer endBit = bmsAlarmDict.getEndBit();
|
|
|
+ int bits = BytesUtil.parseBits(frameMsgByte, startBit, endBit);
|
|
|
+ this.bmsAlarmMap.put(String.valueOf(bmsAlarmDict.getAlarmCode()), bits);
|
|
|
+ }
|
|
|
+ byte[] bmsAlarm2 = ArrayUtils.subarray(data, 177, 184);
|
|
|
+ List<BmsAlarmDict> bmsAlarmMsgList2 = bmsAlarmMsgMap.get("0x1881D0F3");
|
|
|
+ for (BmsAlarmDict bmsAlarmDict : bmsAlarmMsgList2) {
|
|
|
+ Integer byteSeq = bmsAlarmDict.getByteSeq();
|
|
|
+ byte frameMsgByte = bmsAlarm2[byteSeq - 1];
|
|
|
+ Integer startBit = bmsAlarmDict.getStartBit();
|
|
|
+ Integer endBit = bmsAlarmDict.getEndBit();
|
|
|
+ int bits = BytesUtil.parseBits(frameMsgByte, startBit, endBit);
|
|
|
+ this.bmsAlarmMap.put(String.valueOf(bmsAlarmDict.getAlarmCode()), bits);
|
|
|
+ }
|
|
|
+ this.time = BytesUtil.composeTimeString(ArrayUtils.subarray(data, 184, 192));
|
|
|
}
|
|
|
}
|