package com.mes.common;
|
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("\\.");
|
int addressLength=this.addressLength;
|
if (addressLength < 2 ){
|
return null;
|
}
|
|
if (addressLength == 2 ) {
|
int wordindex = index;
|
|
return stringdatas[0] + "." + wordindex;
|
}
|
if (addressLength == 14 ) {
|
int wordindex = index;
|
//int newIndex = wordindex + 13;
|
return stringdatas[0] + "." + wordindex ;
|
}
|
return null;
|
}
|
|
public int getPlcAddress() {
|
|
return addressIndex;
|
}
|
public String getAddress() {
|
return getAddress(this.addressIndex);
|
}
|
}
|