AlarmData.java
5.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
package com.bsth.entity;
import com.bsth.socket.protocol.Message0207;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @author Hill
* 报警数据
*/
public class AlarmData extends Data {
/**
* 最高警报等级 0-3(亦可自定义)
* 0 无故障
* 1 级故障,不影响车辆行驶的故障
* 2 级故障,影响车辆性能,需驾驶员限制行驶的故障
* 3 级故障,停车待援
* 0xfe 异常
* 0xff 无效
*/
private short maxAlarmLevel;
/**
* 通用报警标志
* 0位 0正常 1温度差异 1位 电池高温 2位 车载储能装置类型过压 3位 车载储能装置类型欠压
* 4位 SOC低 5位 单体电池过压 6位 单体电池欠压 7位 SOC过高
* 8位 SOC跳变 9位 可充电储能系统不匹配 10位 电池单体一致性差 11位 绝缘
* 12位 DC-DC温度 13位 制动系统 14位 DC-DC状态 15位 驱动电机控制器温度
* 16位 高压互锁状态 17位 驱动电机温度 18位 车载储能装置类型过充
* 19-31位 保留
*/
private int commonAlarmFlag;
/**
* 储能装置数量 0-252
* N1
* 0xfe 异常
* 0xff 无效
*/
private short energyStorageDeviceQuantity;
/**
* 储能装置报警情况(自定义)
* N1 * 4
*/
private int[] esdAlarms;
/**
* 驱动电机数量 0-252
* N2
* 0xfe 异常
* 0xff 无效
*/
private short electricMotorQuantity;
/**
* 驱动电机报警情况(自定义)
* N2 * 4
*/
private int[] emAlarms;
/**
* 发动机数量 0-252
* N3
* 0xfe 异常
* 0xff 无效
*/
private short engineQuantity;
/**
* 发动机报警情况(自定义)
* N3 * 4
*/
private int[] engineAlarms;
/**
* 其它故障 0-252
* N4
* 0xfe 异常
* 0xff 无效
*/
private short otherQuantity;
/**
* 扩展故障详细
*/
private List<String> troubles = new ArrayList<>();
public AlarmData() {
}
public AlarmData(Message0207 message0207) {
BeanUtils.copyProperties(message0207, this);
this.maxAlarmLevel &= (short) 0xFF;
this.energyStorageDeviceQuantity &= (short) 0xFF;
this.electricMotorQuantity &= (short) 0xFF;
this.engineQuantity &= (short) 0xFF;
this.otherQuantity &= (short) 0xFF;
for (Message0207.Trouble trouble : message0207.getTroubleList()) {
troubles.add(trouble.toString());
}
}
public short getMaxAlarmLevel() {
return maxAlarmLevel;
}
public void setMaxAlarmLevel(short maxAlarmLevel) {
this.maxAlarmLevel = maxAlarmLevel;
}
public int getCommonAlarmFlag() {
return commonAlarmFlag;
}
public void setCommonAlarmFlag(int commonAlarmFlag) {
this.commonAlarmFlag = commonAlarmFlag;
}
public short getEnergyStorageDeviceQuantity() {
return energyStorageDeviceQuantity;
}
public void setEnergyStorageDeviceQuantity(short energyStorageDeviceQuantity) {
this.energyStorageDeviceQuantity = energyStorageDeviceQuantity;
}
public int[] getEsdAlarms() {
return esdAlarms;
}
public void setEsdAlarms(int[] esdAlarms) {
this.esdAlarms = esdAlarms;
}
public short getElectricMotorQuantity() {
return electricMotorQuantity;
}
public void setElectricMotorQuantity(short electricMotorQuantity) {
this.electricMotorQuantity = electricMotorQuantity;
}
public int[] getEmAlarms() {
return emAlarms;
}
public void setEmAlarms(int[] emAlarms) {
this.emAlarms = emAlarms;
}
public short getEngineQuantity() {
return engineQuantity;
}
public void setEngineQuantity(short engineQuantity) {
this.engineQuantity = engineQuantity;
}
public int[] getEngineAlarms() {
return engineAlarms;
}
public void setEngineAlarms(int[] engineAlarms) {
this.engineAlarms = engineAlarms;
}
public short getOtherQuantity() {
return otherQuantity;
}
public void setOtherQuantity(short otherQuantity) {
this.otherQuantity = otherQuantity;
}
public List<String> getTroubles() {
return troubles;
}
public void setTroubles(List<String> troubles) {
this.troubles = troubles;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(" 最大报警级别: ").append(maxAlarmLevel)
.append(" 通用报警标志: ").append(commonAlarmFlag)
.append(" 储能设备报警数: ").append(energyStorageDeviceQuantity)
.append(" 电机报警数: ").append(electricMotorQuantity)
.append(" 发动机报警数: ").append(engineQuantity)
.append(" 其它报警数: ").append(otherQuantity)
.append(" 自定义报警详情: ");
for (String trouble : troubles) {
sb.append(trouble);
}
return sb.toString();
}
@Override
public String getType() {
return "alarm_data";
}
}