package com.example.springboot.entity.device;
|
public class PlcParameterInfo {
|
public PlcParameterInfo(String startAddress) {
|
this.startAddress = startAddress;
|
}
|
private String startAddress;
|
// 参数标识
|
private String codeId;
|
|
// 参数名称
|
private String name;
|
|
// 读取 参数值
|
private String value;
|
|
// // 写入 参数值
|
// private String writeValue;
|
|
// 参数单位
|
private String unit;
|
|
// 参数值转换系数
|
private int ratio;
|
|
// 参数地址
|
private int addressIndex;
|
|
// 参数地址位长度
|
private int addressLength;
|
|
public String getCodeId() {
|
return this.codeId;
|
}
|
|
public void setCodeId(String codeId) {
|
this.codeId = codeId;
|
}
|
|
public String getName() {
|
return this.name;
|
}
|
|
public void setName(String name) {
|
this.name = name;
|
}
|
|
public String getValue() {
|
return this.value;
|
}
|
|
public void setValue(String value) {
|
this.value = value;
|
}
|
|
// public String getWriteValue() {
|
// return this.writeValue;
|
// }
|
|
// public void setWriteValue(String writeValue) {
|
// this.writeValue = writeValue;
|
// }
|
|
public String getUnit() {
|
return this.unit;
|
}
|
|
public void setUnit(String unit) {
|
this.unit = unit;
|
}
|
|
public int getAddressIndex() {
|
return this.addressIndex;
|
}
|
|
public void setAddressIndex(int addressindex) {
|
this.addressIndex = addressindex;
|
}
|
|
public int getAddressLength() {
|
return this.addressLength;
|
}
|
|
public void setAddressLength(int addresslength) {
|
this.addressLength = addresslength;
|
}
|
|
public int getRatio() {
|
return this.ratio;
|
}
|
|
public void setRatio(int ratio) {
|
this.ratio = ratio;
|
}
|
|
/**
|
* 获取地址
|
*
|
* @param index 索引地址
|
*/
|
public String getAddress(int index) {
|
String[] stringdatas = this.startAddress.trim().split("\\.");
|
if (stringdatas.length < 2 )
|
return null;
|
int dbwindex = 0;
|
int bitindex = 0;
|
if (stringdatas.length == 2) {
|
dbwindex = Integer.parseInt(stringdatas[1]);
|
} else
|
return null;
|
return stringdatas[0]+"."+dbwindex+bitindex;
|
}
|
}
|