add 桁架 x y 轴信号

This commit is contained in:
张江玮
2023-10-09 18:13:09 +08:00
parent c5a061454f
commit 740d859f34
5 changed files with 95 additions and 32 deletions

View File

@@ -26,8 +26,10 @@ public class ItemProtocol {
public static String item_task = "task";
//报警
public static String item_error = "error";
//行走行
public static String item_walk_x = "walk_x";
//x轴坐标
public static String item_x_position = "x_position";
//y轴坐标
public static String item_y_position = "y_position";
//下发命令
public static String item_to_command = "to_command";
@@ -89,8 +91,12 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_onset);
}
public int getWalk_x() {
return this.getOpcIntegerValue(item_walk_x);
public float getX_position() {
return this.getOpcFloatValue(item_x_position);
}
public float getY_position() {
return this.getOpcFloatValue(item_y_position);
}
@@ -119,6 +125,19 @@ public class ItemProtocol {
return "0";
}
public float getOpcFloatValue(String protocol) {
Float value = this.driver.getDoubleValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList<ItemDto> list = new ArrayList<>();
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
@@ -128,7 +147,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
list.add(new ItemDto(item_walk_x, "行走行", "DB1.B10"));
list.add(new ItemDto(item_x_position, "x坐标", "DB1.REAL10"));
list.add(new ItemDto(item_y_position, "y坐标", "DB1.REAL14"));
return list;
}

View File

@@ -88,9 +88,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
//任务号
int task = 0;
int last_task = 0;
//行走行
int walk_x = 0;
int last_walk_x = 0;
// x坐标
float x_position = 0;
float last_x_position = 0;
// y坐标
float y_position = 0;
float last_y_position = 0;
int heartbeat = 0;
int last_heartbeat = 0;
@@ -166,7 +169,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
to_target = this.itemProtocol.getTo_target();
to_task = this.itemProtocol.getTo_task();
to_onset = this.itemProtocol.getTo_onset();
// walk_x = this.itemProtocol.getWalk_x();
x_position = this.itemProtocol.getX_position();
y_position = this.itemProtocol.getY_position();
// if(heartbeat != last_heartbeat){
// logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat" + last_heartbeat + "->" + heartbeat);
// }
@@ -248,10 +252,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
// if (walk_x != last_walk_x) {
// logServer.deviceItemValue(this.device_code, "walk_x", String.valueOf(walk_x));
// logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_x" + last_walk_x + "->" + walk_x);
// }
if (x_position != last_x_position) {
logServer.deviceItemValue(this.device_code, "x_position", String.valueOf(x_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号x_position" + last_x_position + "->" + x_position);
}
if (y_position != last_y_position) {
logServer.deviceItemValue(this.device_code, "y_position", String.valueOf(y_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号y_position" + last_y_position + "->" + y_position);
}
update_instruction_status();
@@ -328,7 +336,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
last_to_command = to_command;
last_to_target = to_target;
last_to_onset = to_onset;
// last_walk_x = walk_x;
last_x_position = x_position;
last_y_position = y_position;
}
@@ -789,6 +798,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
jo.put("feedMessage", feedMessage);
jo.put("driver_type", "siemens_conveyor");
jo.put("is_click", true);
jo.put("x", x_position);
jo.put("y", y_position);
return jo;
}

View File

@@ -36,8 +36,10 @@ public class ItemProtocol {
public static String item_task1 = "task1";
//后工位任务号
public static String item_task2 = "task2";
//行走行
public static String item_walk_x = "walk_x";
//x坐标
public static String item_x_position = "x_position";
//y坐标
public static String item_y_position = "y_position";
//前工位下发命令
@@ -146,8 +148,12 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_onset2);
}
public int getWalk_x() {
return this.getOpcIntegerValue(item_walk_x);
public float getX_position() {
return this.getOpcFloatValue(item_x_position);
}
public float getY_position() {
return this.getOpcFloatValue(item_y_position);
}
@@ -181,6 +187,20 @@ public class ItemProtocol {
return "0";
}
public float getOpcFloatValue(String protocol) {
Float value = this.driver.getDoubleValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList<ItemDto> list = new ArrayList<>();
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
@@ -195,7 +215,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_type, "任务类型", "DB1.B9"));
list.add(new ItemDto(item_task1, "前工位任务号", "DB1.D10"));
list.add(new ItemDto(item_task2, "后工位任务号", "DB1.D14"));
list.add(new ItemDto(item_walk_x, "行走列", "DB1.B18"));
list.add(new ItemDto(item_x_position, "x坐标", "DB1.REAL20"));
list.add(new ItemDto(item_y_position, "y坐标", "DB1.REAL24"));
return list;
}

View File

@@ -104,9 +104,12 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
int last_task1 = 0;
int task2 = 0;
int last_task2 = 0;
//行走行
int walk_x = 0;
int last_walk_x = 0;
//x坐标
float x_position = 0;
float last_x_position = 0;
//y坐标
float y_position = 0;
float last_y_position = 0;
int to_command1 = 0;
int last_to_command1 = 0;
@@ -198,7 +201,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
type = this.itemProtocol.getType();
task1 = this.itemProtocol.getTask1();
task2 = this.itemProtocol.getTask2();
// walk_x = this.itemProtocol.getWalk_x();
x_position = this.itemProtocol.getX_position();
y_position = this.itemProtocol.getY_position();
to_command1 = this.itemProtocol.getTo_command1();
to_command2 = this.itemProtocol.getTo_command2();
heartbeat = this.itemProtocol.getHeartbeat();
@@ -317,10 +321,14 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
logServer.deviceItemValue(this.device_code, "task2", String.valueOf(task2));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task2" + last_task2 + "->" + task2);
}
// if (walk_x != last_walk_x) {
// logServer.deviceItemValue(this.device_code, "walk_x", String.valueOf(walk_x));
// logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_x" + last_walk_x + "->" + walk_x);
// }
if (x_position != last_x_position) {
logServer.deviceItemValue(this.device_code, "x_position", String.valueOf(x_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号x_position" + last_x_position + "->" + x_position);
}
if (y_position != last_y_position) {
logServer.deviceItemValue(this.device_code, "y_position", String.valueOf(y_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号y_position" + last_y_position + "->" + y_position);
}
update_instruction_status();
@@ -406,7 +414,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
last_to_task2 = to_task2;
last_to_onset2 = to_onset2;
last_to_target2 = to_target2;
// last_walk_x = walk_x;
last_x_position = x_position;
last_y_position = y_position;
}
public synchronized boolean task_check() {
@@ -1174,6 +1183,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
jo.put("notCreateTaskMessage", notCreateTaskMessage);
jo.put("notCreateInstMessage", notCreateInstMessage);
jo.put("feedMessage", feedMessage);
jo.put("x", x_position);
jo.put("y", y_position);
return jo;
}

View File

@@ -341,8 +341,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("device_code", driver.getDevice().getDevice_code());
jo.put("device_name", driver.getDevice().getDevice_name());
jo.put("status", Math.min(3, driver.getMode()));
jo.put("x", driver.getWalk_x());
jo.put("y", driver.getWalk_y());
jo.put("x", driver.getX_position());
jo.put("y", driver.getY_position());
jo.put("error", driver.getError());
jo.put("error_msg", driver.getError() == 0 ? "" : ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(driver.getError())));
} else if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) {
@@ -350,8 +350,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("device_code", driver.getDevice().getDevice_code());
jo.put("device_name", driver.getDevice().getDevice_name());
jo.put("status", Math.min(3, driver.getMode()));
jo.put("x", driver.getWalk_x());
jo.put("y", driver.getWalk_y());
jo.put("x", driver.getX_position());
jo.put("y", driver.getY_position());
jo.put("error", driver.getError());
jo.put("error_msg", driver.getError() == 0 ? "" : ErrorUtil.getDictDetail("fqhj_error_type", String.valueOf(driver.getError())));
} else if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {