Merge branch 'test' into test-training2

This commit is contained in:
weizhihong 2022-08-16 10:28:46 +08:00
commit 8bf5a4b807
16 changed files with 4067 additions and 3978 deletions

View File

@ -732,6 +732,10 @@ public class Operation {
/**
* 托管
*/
Train_Drive(Operation.CLIENT),
/**
* TODO 托管,由于之前剧本中已包含Train_Trust暂时留下后续删除
*/
Train_Trust(Operation.CLIENT),
/**
* 连挂

View File

@ -277,6 +277,15 @@ public class TrainOperateHandler {
/**
* 列车托管使用司机的驾驶指令
*/
@OperateHandlerMapping(type = Operation.Type.Train_Drive)
public void drive(Simulation simulation, String groupNumber, DriveParamVO param) {
atsTrainService.trust(simulation, groupNumber, param);
}
/**
* 列车托管使用司机的驾驶指令
* TODO 后续同Train_Trust一起删除
*/
@OperateHandlerMapping(type = Operation.Type.Train_Trust)
public void trust(Simulation simulation, String groupNumber, DriveParamVO param) {
atsTrainService.trust(simulation, groupNumber, param);

View File

@ -146,7 +146,7 @@ public class AtsRouteService {
collect = fltRoutes;
}
Route route = collect.get(0);
Route.CheckFailMessage message = routeService.setRoute(simulation, route);
Route.CheckFailMessage message = routeService.setRoute(simulation, route,route.getAspect());
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNull(message, route.debugStr() + "无法办理");
route.setFleetMode(true);
}
@ -292,6 +292,8 @@ public class AtsRouteService {
route.getStart().isGuideAspect(), "引导进路,需要人解进路");
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(route.isFleetMode(),
String.format("进路[%s]已开启自动通过进路,无法取消", route.debugStr()));
BusinessExceptionAssertEnum.OPERATION_FAIL.assertNotTrue(
Objects.nonNull(route.getDelayUnlockDevice()), String.format("进路[%s]已经开启延时取消,无法手动取消", route.debugStr()));
this.ciApiService.unlockRoute(simulation, route.getCode());
}
}

View File

@ -6,6 +6,7 @@ import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.simulation.cbtc.data.map.Route.MultiRouteAspect;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
import club.joylink.rtss.simulation.cbtc.device.virtual.VirtualRealityDeviceService;
@ -183,7 +184,9 @@ public class CiApiServiceImpl2 implements CiApiService {
@Override
public Route.CheckFailMessage settingRoute(Simulation simulation, String routeCode) {
Route route = simulation.getRepository().getByCode(routeCode, Route.class);
return this.routeService.setRoute(simulation, route);
//当为一般进路时直接获取信号显示当为组合进路时信号显示获取到办理子进路时
SignalAspect settedAspect=route.isMultiRoute()?null:route.getAspect();
return this.routeService.setRoute(simulation, route,settedAspect);
}
@Override

View File

@ -118,11 +118,11 @@ public class CiLogic {
MapConfig config = simulation.getRepository().getConfig();
if (route.isCiControl()) { // 进路联锁自动触发
if (!route.isLock() && !route.isSetting() && ciService.isCiRouteTrigger(simulation, route)) {
routeService.setRoute(simulation, route);
routeService.setRoute(simulation, route,route.getAspect());
}
} else if (route.isFleetMode()) { // 联锁自动进路
if (ciService.isCiRouteTrigger(simulation, route)) {
signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), route.getAspect());
signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), route.getSettedAspect());
}
}
if (route.isSetting() || route.isLock() || route.isNormalUnlock()) { // 监控中的进路
@ -165,7 +165,7 @@ public class CiLogic {
} else if (start.isDefaultAspect() && !start.isForbidden() && !start.isBlockade() && start.isSupportMainAspect()) {
CiLogic.log.info("进路[{}]联锁条件满足,开放信号", route.debugStr());
signalControlService.tryControlSignalAspectAccordingLevel(simulation,
start, route.getAspect());
start, route.getSettedAspect());
}
} else {
if (route.isOpenMain() && !start.isSupportMainAspect()) {//与联锁显示不同关闭信号

View File

@ -183,6 +183,8 @@ public class CiRouteService {
log.info("进路[{}]已经锁闭", route.debugStr());
return;
}
//
route.setSettedAspect(route.getStart().getGuideAspect());
// 引导进路开始办理
LocalDateTime systemTime = simulation.getSystemTime();
route.startGuideSetting(systemTime);
@ -204,13 +206,15 @@ public class CiRouteService {
* @param route
* @return
*/
public Route.CheckFailMessage setRoute(Simulation simulation, Route route) {
public Route.CheckFailMessage setRoute(Simulation simulation, Route route,SignalAspect settedAspect) {
Route.CheckFailMessage failMessage = routeSetCheck(simulation, route, false);
if (failMessage == null) {
if (route.isLock() && !route.isFleetMode()) {
log.info("进路[{}]已经锁闭", route.debugStr());
return null;
}
// 设置根据进路性质开放的信号
route.setSettedAspect(settedAspect);
// 进路开始办理
LocalDateTime systemTime = simulation.getSystemTime();
route.startSetting(systemTime);
@ -260,11 +264,11 @@ public class CiRouteService {
SignalAspect aspect = null;
boolean routeRight = route.isRight();
if (route.isGuideSetting()) {
aspect = route.getStart().getGuideAspect();
aspect = route.getSettedAspect();
} else if (route.getStart().isBlockade()) {
aspect = route.getStart().getDefaultAspect();
} else {
aspect = route.getAspect();
aspect = route.getSettedAspect();
if (config.isRailway() && route.isDepartureRoute()) {
aspect = route.getAspectOfRailway();
}
@ -275,7 +279,7 @@ public class CiRouteService {
|| !route.getStart().isDefaultAspect()) {
route.settingOver();
}
} else if ((route.getAspect().equals(route.getStart().getAspect())) ||
} else if ((route.getSettedAspect().equals(route.getStart().getAspect())) ||
(route.isGuideSetting() && route.getStart().isGuideAspect())) {
log.debug("进路[{}]信号开放,办理结束", route.debugStr());
route.settingOver();
@ -286,12 +290,12 @@ public class CiRouteService {
Route.MultiRouteAspect routeAspect = multiRouteAspects.get(i);
Route subRoute = routeAspect.getRoute();
if (!subRoute.isLock()) {
setRoute(simulation, subRoute);
setRoute(simulation, subRoute,routeAspect.getAspect());
break;
}
}
//最近的一条进路已经锁闭
if (multiRouteAspects.get(0).getRoute().isLock()) { //
if (multiRouteAspects.get(0).getRoute().isLock()) {
route.settingOver();
}
}
@ -400,7 +404,7 @@ public class CiRouteService {
}
public void delayUnlockStart(Simulation simulation, Route route, DelayUnlockDevice device) {
device.delayUnlockStart(route);
device.delayUnlockStart(route,simulation.getRepository().getConfig());
route.setDelayUnlockDevice(device);
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), route.getStart().getDefaultAspect());
}

View File

@ -10,6 +10,21 @@ public abstract class DelayUnlockDevice extends MayOutOfOrderDevice {
super(code, name, deviceType);
}
public void delayUnlockStart(Route route,MapConfig mc) {
// route.getType() == Type
int baseDelayTime = route.getDelayReleaseTime();
if(mc.isRailway()){
switch (route.getType()){
case DEPARTURE:
case RECEIVING:
baseDelayTime = 180;
break;
case SHUNTING:
baseDelayTime = 30;
}
}
this.remain = baseDelayTime * 1000;
}
public void delayUnlockStart(Route route) {
this.remain = route.getDelayReleaseTime() * 1000;
}

View File

@ -179,7 +179,12 @@ public class Route extends MapNamedElement {
* 进路是否排列中
*/
private boolean setting;
/**
* 该进路办理成功后要开放的信号
* <p>
* 注意每次开始触发办理进路时设置
*/
private SignalAspect settedAspect;
/**
* 进路开始排列时间
*/
@ -251,8 +256,14 @@ public class Route extends MapNamedElement {
this.unlockedSection = null;
this.train = null;
this.checkConflict = false;
this.settedAspect=null;
}
/**
* 是否是组合进路
*/
public boolean isMultiRoute() {
return null!=this.multiRouteAspects&&!this.multiRouteAspects.isEmpty();
}
public boolean isAllSwitchIsOnPos() {
if (!CollectionUtils.isEmpty(switchList)) {
return switchList.stream().allMatch(SwitchElement::isOnPosition);
@ -799,7 +810,8 @@ public class Route extends MapNamedElement {
}
}
}
return getAspect();
SignalAspect rt=getSettedAspect()==null?getAspect():getSettedAspect();
return rt;
}
public enum Type {

View File

@ -318,7 +318,7 @@ public class Signal extends DelayUnlockDevice {
public boolean isMainAspect() {
if (this.lockedRoute != null) {
return this.aspect.equals(this.lockedRoute.getAspect());
return this.aspect.equals(this.lockedRoute.getSettedAspect());
}
return false;
}

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.simulation.cbtc.data.storage.device;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.DelayUnlockDevice;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
@ -85,6 +86,13 @@ public class StorageRoute extends StorageDevice {
private String unlockedSection;
/**
* 该进路办理成功后要开放的信号
* <p>
* 注意每次开始触发办理进路时设置
*/
private SignalAspect settedAspect;
// public StorageRoute(Route route) {
// super(route.getCode());
// cbtcMode = route.isCbtcMode();
@ -152,6 +160,11 @@ public class StorageRoute extends StorageDevice {
change = true;
this.setUnlockedSection(route.getUnlockedSection().getCode());
}
if (Objects.nonNull(route.getSettedAspect())) {
change = true;
this.setSettedAspect(route.getSettedAspect());
}
return change;
}
@ -172,6 +185,7 @@ public class StorageRoute extends StorageDevice {
if (Objects.nonNull(this.unlockedSection)) {
route.setUnlockedSection(repository.getByCode(this.unlockedSection, Section.class));
}
route.setSettedAspect(settedAspect);
}
}

View File

@ -169,7 +169,7 @@ public class DepotService {
depotRunningInfo.getRouteList().remove(0);
}
if (!route.isSetting()) {
ciRouteService.setRoute(simulation, route);
ciRouteService.setRoute(simulation, route,route.getAspect());
}
}
}

View File

@ -530,7 +530,7 @@ public class ATPService {
public void inbound(Simulation simulation, String groupNumber) {
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
Section headSection = train.getHeadPosition().getSection();
if (headSection.isTransferTrack() && train.isStop()) { //列车停在折返轨
if (headSection.isTurnBackTrack() && train.isStop()) { //列车停在折返轨
SimulationDataRepository repository = simulation.getRepository();
TrainInfo trainInfo = repository.getSupervisedTrainByGroup(train.getGroupNumber());
List<RoutePath> routePathList = repository.queryRoutePathsByEnd(headSection);
@ -624,6 +624,7 @@ public class ATPService {
}
}
} else if (trainMode.isMatchTheDriveMode(DriveMode.AM) && !train.isAMMode()) {
train.getRobotDriveParam().setRun(false); // 关闭机器人自动驾驶
if (!train.isInTheGear(VirtualRealityTrain.Handwheel.ATO)) {
this.changeGear(train, VirtualRealityTrain.Handwheel.ATO);
}

View File

@ -11,6 +11,7 @@ import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.command.CommandBO;
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
import club.joylink.rtss.simulation.cbtc.constant.SignalModel;
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
@ -436,13 +437,31 @@ public class SimulationRobotService {
*/
private void robotDrive(Simulation simulation, VirtualRealityTrain train, SectionPosition targetPosition) {
SimulationDataRepository repository = simulation.getRepository();
if (!train.getDoor1().isCloseAndLock() || !train.getDoor2().isCloseAndLock()) { //如果车门没关
return;
}
SectionPosition headPosition = train.getHeadPosition();
boolean right = train.isRight();
float speed = train.getSpeed();
if (!train.getDoor1().isCloseAndLock() || !train.getDoor2().isCloseAndLock()) { //如果车门没关
return;
}
/**
* 添加车辆停靠车站时车门关闭后向前行驶一点的问题因为车头偏移与目标偏移大于 @seeSimulationConstants.PARK_POINT_MAX_OFFSET位置故修正逻辑如下
* 判断车辆是否停靠车站没有开发的信号没有新车命令如果有其中一项的条件那么车辆可以启动
* begin 2022-08-15
*/
boolean trainPackingForStand = train.isParkingAt();
// headPosition.getSection().getStandList().stream().anyMatch(d->d.isTrainParking());
Signal targetSignal = headPosition.getSection().getSignalOf(right);
boolean closeSignal = false;
if(Objects.nonNull(targetSignal)){
closeSignal = targetSignal.getAspect() == targetSignal.getSignalModel().getDefaultAspect();
}
boolean noCommond = Objects.isNull(train.getRobotDriveParam().getThroughSignal());
if(trainPackingForStand && closeSignal && noCommond){
return;
}
/**
* end 2022-08-15
*/
Float distance = CalculateService.calculateDistance(headPosition, targetPosition, right, true);
if (distance == null || distance <= SimulationConstants.PARK_POINT_MAX_OFFSET) { //如果列车已经抵达或越过目标位置
atoService.doBreakMax(train);

View File

@ -66,8 +66,9 @@ public class DeviceStatusModifyTool {
}
route.setNormalUnlock(false);
route.setLock(true);
route.setSettedAspect(route.getAspect());
simulation.getRepository().addSettingRoute(route);
this.openSignalDirectly(route.getStart(), route.getAspect());
this.openSignalDirectly(route.getStart(), route.getSettedAspect());
route.getStart().setLockedRoute(route);
}

View File

@ -37,6 +37,11 @@ public class MapSignalButtonVO {
*/
private DirectionLabelEnum labelEnum;
/**
* 有计数器
*/
private boolean hasCount;
public enum Type {
/**
* 接车按钮

View File

@ -95,9 +95,9 @@ springfox:
spring:
profiles: dev
datasource:
url: jdbc:mysql://localhost:3306/joylink?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
url: jdbc:mysql://192.168.3.233:3306/joylink?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: root
password: root
password: joylink0503
tencent-cloud:
allow-send: false