修改
This commit is contained in:
@@ -82,12 +82,12 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
public int error1 = 0;
|
||||
public int material = 0;
|
||||
public int consumption = 0;
|
||||
public int voltageA = 0;
|
||||
public int voltageB = 0;
|
||||
public int voltageC = 0;
|
||||
public int currentA = 0;
|
||||
public int currentB = 0;
|
||||
public int currentC = 0;
|
||||
public float voltageA = 0;
|
||||
public float voltageB = 0;
|
||||
public float voltageC = 0;
|
||||
public float currentA = 0;
|
||||
public float currentB = 0;
|
||||
public float currentC = 0;
|
||||
|
||||
public int last_heartbeat = 0;
|
||||
public int last_mode = 0;
|
||||
@@ -104,12 +104,12 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
public int last_error1 = 0;
|
||||
public int last_material = 0;
|
||||
public int last_consumption = 0;
|
||||
public int last_voltageA = 0;
|
||||
public int last_voltageB = 0;
|
||||
public int last_voltageC = 0;
|
||||
public int last_currentA = 0;
|
||||
public int last_currentB = 0;
|
||||
public int last_currentC = 0;
|
||||
public float last_voltageA = 0;
|
||||
public float last_voltageB = 0;
|
||||
public float last_voltageC = 0;
|
||||
public float last_currentA = 0;
|
||||
public float last_currentB = 0;
|
||||
public float last_currentC = 0;
|
||||
|
||||
Boolean isonline = true;
|
||||
|
||||
@@ -133,6 +133,9 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
String message = null;
|
||||
|
||||
device_code = this.getDeviceCode();
|
||||
if (device_code.equals("A1_HK_05_1")){
|
||||
System.out.println("1");
|
||||
}
|
||||
heartbeat = this.itemProtocol.getItem_heartbeat();
|
||||
mode = this.itemProtocol.getItem_mode();
|
||||
move = this.itemProtocol.getItem_move();
|
||||
|
||||
@@ -99,23 +99,23 @@ public class ItemProtocol {
|
||||
public int getItem_consumption(){
|
||||
return this.getOpcIntegerValue(item_consumption);
|
||||
} ;
|
||||
public int getItem_voltageA(){
|
||||
return this.getOpcIntegerValue(item_voltageA);
|
||||
public float getItem_voltageA(){
|
||||
return this.getOpcFloatValue(item_voltageA);
|
||||
} ;
|
||||
public int getItem_voltageB(){
|
||||
return this.getOpcIntegerValue(item_voltageB);
|
||||
public float getItem_voltageB(){
|
||||
return this.getOpcFloatValue(item_voltageB);
|
||||
} ;
|
||||
public int getItem_voltageC(){
|
||||
return this.getOpcIntegerValue(item_voltageC);
|
||||
public float getItem_voltageC(){
|
||||
return this.getOpcFloatValue(item_voltageC);
|
||||
} ;
|
||||
public int getItem_currentA(){
|
||||
return this.getOpcIntegerValue(item_currentA);
|
||||
public float getItem_currentA(){
|
||||
return this.getOpcFloatValue(item_currentA);
|
||||
} ;
|
||||
public int getItem_currentB(){
|
||||
return this.getOpcIntegerValue(item_currentB);
|
||||
public float getItem_currentB(){
|
||||
return this.getOpcFloatValue(item_currentB);
|
||||
} ;
|
||||
public int getItem_currentC(){
|
||||
return this.getOpcIntegerValue(item_currentC);
|
||||
public float getItem_currentC(){
|
||||
return this.getOpcFloatValue(item_currentC);
|
||||
} ;
|
||||
|
||||
Boolean isonline;
|
||||
@@ -132,6 +132,18 @@ public class ItemProtocol {
|
||||
|
||||
}
|
||||
|
||||
public float getOpcFloatValue(String protocol) {
|
||||
Float value = this.driver.getDoubleValue(protocol);
|
||||
if (value == null) {
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "251"));
|
||||
|
||||
@@ -61,6 +61,10 @@ public interface OpcDeviceDriver extends DeviceDriver {
|
||||
return (Integer) this.getValue(protocol);
|
||||
}
|
||||
|
||||
default Float getDoubleValue(String protocol) {
|
||||
return (Float) this.getValue(protocol);
|
||||
}
|
||||
|
||||
default int[] getIntegeregerArrayValue(String protocol) {
|
||||
return (int[]) this.getOpcValueAccessor().getValue(this.getItem(protocol));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user