1
zhang
3 天以前 36485d6d285438c2ccfa5c8352ab8b3fd831bed0
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
package com.zy.core.constant;
 
/**
 * PLC 报警定义(对应 §2.3)
 */
public enum PlcAlarmDefinition {
    ALL("DB25", 0, 4, "所有报警"),
    EMERGENCY_STOP("DB25", 1, 4, "急停"),
    LOWER_BREAKER_TRIP("DB25", 2, 4, "低位断路器断开"),
    LOWER_INVERTER_FAULT("DB25", 3, 4, "低位变频器故障"),
    CONVEYOR_TIMEOUT("DB25", 4, 4, "输送运行超时"),
    LIFT_TIMEOUT("DB25", 5, 4, "顶升运行超时"),
    TASK_REQUEST_TIMEOUT("DB25", 6, 4, "申请任务超时"),
    PALLET_PROTRUSION("DB25", 7, 4, "托盘突出报警"),
    TASK_DUPLICATE("DB25", 8, 4, "任务重复报警"),
    PRECONDITION_ERROR("DB25", 9, 4, "入站过程中前置条件异常");
 
    private final String addressPattern;
    private final int index;          // 报警序号(1-based)
    private final int byteLength;
    private final String description;
 
    PlcAlarmDefinition(String addressPattern, int index, int byteLength, String description) {
        this.addressPattern = addressPattern;
        this.index = index;
        this.byteLength = byteLength;
        this.description = description;
    }
 
 
    public String buildAddress() {
        return addressPattern + PlcConstant.ADDRESS_CONCATENATION + index;
    }
 
    public String getAddressPattern() {
        return addressPattern;
    }
 
    public int getIndex() {
        return index;
    }
 
    public int getByteLength() {
        return byteLength;
    }
 
    public String getDescription() {
        return description;
    }
}