充电测试
This commit is contained in:
parent
3553cb17ec
commit
8170db9822
@ -167,7 +167,9 @@ public class LoopbackCommunicationAdapter
|
|||||||
private final DispatcherService dispatcherService;
|
private final DispatcherService dispatcherService;
|
||||||
|
|
||||||
//标记是否开启自动回休息点:true=开启,false=关闭
|
//标记是否开启自动回休息点:true=开启,false=关闭
|
||||||
private final Boolean IS_AUTOMATIC_BREAKS = true;
|
private final Boolean IS_AUTOMATIC_CHARGER = true;
|
||||||
|
//标记是否开启自动充电:true=开启,false=关闭
|
||||||
|
private final Boolean IS_AUTOMATIC_BREAKS = false;
|
||||||
//连接状态
|
//连接状态
|
||||||
private final Boolean CONNECT_STATUS = true;
|
private final Boolean CONNECT_STATUS = true;
|
||||||
//AGV模式:待机 = 0,手动 = 1,半自动 = 2,自动 = 3,示教 = 4,服务 = 5(升级程序中的工作,状态),维修 = 6
|
//AGV模式:待机 = 0,手动 = 1,半自动 = 2,自动 = 3,示教 = 4,服务 = 5(升级程序中的工作,状态),维修 = 6
|
||||||
@ -225,14 +227,17 @@ public class LoopbackCommunicationAdapter
|
|||||||
}
|
}
|
||||||
super.initialize();
|
super.initialize();
|
||||||
|
|
||||||
if (IS_AUTOMATIC_BREAKS) {
|
// 注册属性变化监听器
|
||||||
// 注册属性变化监听器
|
getProcessModel().addPropertyChangeListener(evt -> {
|
||||||
getProcessModel().addPropertyChangeListener(evt -> {
|
if (IS_AUTOMATIC_CHARGER) {
|
||||||
if (evt.getPropertyName().equals(VehicleProcessModel.Attribute.ENERGY_LEVEL.name())) {
|
if (evt.getPropertyName().equals(VehicleProcessModel.Attribute.ENERGY_LEVEL.name())) {
|
||||||
LOG.info("Vehicle energy level changed to: {}", evt.getNewValue());
|
LOG.info("Vehicle energy level changed to: {}", evt.getNewValue());
|
||||||
checkChargingNeed();
|
checkChargingNeed();
|
||||||
}
|
}
|
||||||
// 直接检查命令队列状态,不依赖特定属性名
|
}
|
||||||
|
|
||||||
|
// 直接检查命令队列状态,不依赖特定属性名
|
||||||
|
if (IS_AUTOMATIC_BREAKS) {
|
||||||
if (getSentCommands().isEmpty() && getUnsentCommands().isEmpty()) {
|
if (getSentCommands().isEmpty() && getUnsentCommands().isEmpty()) {
|
||||||
LOG.debug("All commands executed, checking for parking position...");
|
LOG.debug("All commands executed, checking for parking position...");
|
||||||
LOG.info("Found parking positions: {}", findAllParkingPositions().stream()
|
LOG.info("Found parking positions: {}", findAllParkingPositions().stream()
|
||||||
@ -240,8 +245,8 @@ public class LoopbackCommunicationAdapter
|
|||||||
.collect(Collectors.joining(", ")));
|
.collect(Collectors.joining(", ")));
|
||||||
checkAndMoveToParkingPosition();
|
checkAndMoveToParkingPosition();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
String initialPos
|
String initialPos
|
||||||
= vehicle.getProperties().get(LoopbackAdapterConstants.PROPKEY_INITIAL_POSITION);
|
= vehicle.getProperties().get(LoopbackAdapterConstants.PROPKEY_INITIAL_POSITION);
|
||||||
@ -1237,7 +1242,7 @@ public class LoopbackCommunicationAdapter
|
|||||||
// ֻ只有当车辆不在执行任务且不在充电状态时才检查充电需求
|
// ֻ只有当车辆不在执行任务且不在充电状态时才检查充电需求
|
||||||
if (processModel.getState() == Vehicle.State.IDLE &&
|
if (processModel.getState() == Vehicle.State.IDLE &&
|
||||||
processModel.getState() != Vehicle.State.CHARGING &&
|
processModel.getState() != Vehicle.State.CHARGING &&
|
||||||
getSentCommands().isEmpty()) {
|
getUnsentCommands().isEmpty()) {
|
||||||
|
|
||||||
if (chargingStrategyManager.needToCharge(processModel)) {
|
if (chargingStrategyManager.needToCharge(processModel)) {
|
||||||
LOG.info("Charging strategy {} triggered, starting charging process",
|
LOG.info("Charging strategy {} triggered, starting charging process",
|
||||||
@ -1261,7 +1266,7 @@ public class LoopbackCommunicationAdapter
|
|||||||
// 创建前往充电位置的运输订单
|
// 创建前往充电位置的运输订单
|
||||||
createChargingTransportOrder(chargingLocation.get());
|
createChargingTransportOrder(chargingLocation.get());
|
||||||
} else {
|
} else {
|
||||||
LOG.warn("No charging locations found, cannot start charging process");
|
LOG.warn("找不到充电位置,无法开始充电过程");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public class ChargingStrategyManager {
|
|||||||
public ChargingStrategyManager() {
|
public ChargingStrategyManager() {
|
||||||
// 初始化支持的充电策略
|
// 初始化支持的充电策略
|
||||||
strategies = Arrays.asList(
|
strategies = Arrays.asList(
|
||||||
new ThresholdChargingStrategy(60, 95)
|
new ThresholdChargingStrategy(70, 95)
|
||||||
);
|
);
|
||||||
// 默认使用阈值充电策略
|
// 默认使用阈值充电策略
|
||||||
currentStrategy = strategies.get(0);
|
currentStrategy = strategies.get(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user