package com.zy.acs.conveyor.core.constant;
|
|
public enum SafeSignalField {
|
|
SAFE_SIGNAL_TO_CONVEYOR("DB7", 4, 4, 8),
|
SAFE_SIGNAL_FROM_CONVEYOR("DB7", 40, 4, 8),
|
|
;
|
|
private final String addressPattern;
|
private final int offset;
|
private final int byteLength;
|
private final int arrLength;
|
|
SafeSignalField(String addressPattern, int offset, int byteLength, int arrLength) {
|
this.addressPattern = addressPattern;
|
this.offset = offset;
|
this.byteLength = byteLength;
|
this.arrLength = arrLength;
|
}
|
|
public String getAddressPattern() {
|
return addressPattern;
|
}
|
|
public int getOffset() {
|
return offset;
|
}
|
|
public int getByteLength() {
|
return byteLength;
|
}
|
|
public int getArrLength() {
|
return arrLength;
|
}
|
|
/**
|
* 根据 DB 块编号和站点偏移生成具体地址
|
*
|
* @return PLC4X 地址字符串,如 "DB100.DBD0"
|
*/
|
public String buildAddress() {
|
return addressPattern + PlcConstant.ADDRESS_CONCATENATION + offset;
|
}
|
}
|