Merge remote-tracking branch 'origin/test' into dev

This commit is contained in:
joylink_zhangsai 2022-04-18 14:35:46 +08:00
commit c65998e861
8 changed files with 88 additions and 40 deletions

View File

@ -80,7 +80,7 @@ public class FoshanTramRunPlanNew implements IRunPlanStrategyNew {
tripVO.setDestinationCode("BF");
break;
case "雷岗":
if (tripVO.getServiceNumber().equals("09")) { //据观察服务号09是调试
if (tripVO.getServiceNumber().equals("02")) { //据观察服务号02是备用
tripVO.setStartSectionCode("T38"); //G2109
tripVO.setDestinationCode("AA");
} else {
@ -108,7 +108,7 @@ public class FoshanTramRunPlanNew implements IRunPlanStrategyNew {
tripVO.setDestinationCode("BF");
break;
case "雷岗":
if (tripVO.getServiceNumber().equals("09")) { //据观察服务号09是调试
if (tripVO.getServiceNumber().equals("02")) { //据观察服务号02是备用
tripVO.setEndSectionCode("T38"); //G2109
tripVO.setDestinationCode("AA");
} else {
@ -117,6 +117,9 @@ public class FoshanTramRunPlanNew implements IRunPlanStrategyNew {
}
break;
}
if (tripVO.getServiceNumber().equals("02")) {
tripVO.setIsBackUp(true);
}
}
/**
@ -133,7 +136,7 @@ public class FoshanTramRunPlanNew implements IRunPlanStrategyNew {
return;
}
if ("雷岗".equals(stationVO.getRunPlanName())) {
if (runPlanImport.getServiceNumber().equals("09")) { //据观察服务号09是调试
if (runPlanImport.getServiceNumber().equals("02")) { //据观察服务号02是备用
timeVO.setSectionCode("T38"); //G2109
} else {
timeVO.setSectionCode("T39"); //G2103

View File

@ -105,7 +105,8 @@ public class MaService {
public float calculateDistanceOfEbTriggerEnd() {
if (this.type.equals(MaType.ITC_Signal)) {
boolean right = this.train.isRight();
Float distance = CalculateService.calculateDistance(this.train.getHeadPosition(), this.eoaPosition, right);
// Float distance = CalculateService.calculateDistance(this.train.getHeadPosition(), this.eoaPosition, right);
Float distance = CalculateService.calculateDistanceIgnoreSwitch(this.train.getHeadPosition(), this.eoaPosition, right);
if (distance == null) {
distance = 0f;
}

View File

@ -163,6 +163,9 @@ public class AtsPlanTrainStageService implements AtsStageService {
return;
}
if (tripPlan.isLastPlan(stationPlan)) {
if (tripPlan.isBackup() && parkSection.equals(tripPlan.getEndSection())) {
return;
}
// 到达终点站准备折返
log.debug(String.format("列车[%s]折返初始化", trainInfo.getGroupNumber()));
List<RoutePath> routePaths = repository.getRoutePaths(parkSection, tripPlan.getEndSection());

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.simulation.cbtc.ATS.tools;
import club.joylink.rtss.simulation.cbtc.ATP.ground.MaService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
import club.joylink.rtss.simulation.cbtc.constant.TrainType;
@ -12,6 +13,7 @@ import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
@ -23,6 +25,9 @@ import java.util.Objects;
@Component
public class TrainOutboundLoadTool {
@Autowired
private MaService maService;
public void loadOutboundTrain(Simulation simulation) {
if (!simulation.isPlanRunning()) { // 未开始计划运行
return;
@ -76,7 +81,10 @@ public class TrainOutboundLoadTool {
SectionPosition headPosition = new SectionPosition(startSection, offset);
train.initManualTrain(headPosition, right);
if (Objects.equals(RunLevel.ITC, repository.getConfig().getRunMode())) {
train.setCommunication(false);
train.setNoCommunicateDevice(true);
train.setITCMode();
this.maService.calculateAndUpdateItcMa(simulation, train);
}
repository.addOnlineTrain(train);

View File

@ -120,7 +120,7 @@ public class CiRouteService {
SimulationDataRepository repository = simulation.getRepository();
List<Route> settingRoutes = repository.getSettingRoutes();
for (Route sr : settingRoutes) {
if (sr.isSettingOverlap() && !repository.isTrainParking(sr.getOverlap().getSection())) {
if (sr.isSettingOverlap() && (sr.getOverlap().isSetting() || sr.getOverlap().isLock())/*&& !repository.isTrainParking(sr.getOverlap().getSection())*/) {
SectionPath sectionPath = sr.getOverlap().selectPath();
for (SwitchElement switchElement : sectionPath.getSwitchList()) {
if (route.isConflictSwitch(switchElement)) {
@ -492,10 +492,10 @@ public class CiRouteService {
continue;
}
if (relSwitch.isLinkedSwitch(aSwitch) || relSwitch.isBConnectTo(aSwitch)) {
if (!aSwitch.getA().isRouteLock()) {
// if (!aSwitch.getA().isRouteLock()) { //当两条进路锁闭同一个道岔时一条进路解锁道岔的A区段可能仍旧被另一条进路锁闭着导致无法解锁故去掉此判断
aSwitch.routeUnlock(route);
aSwitch.overlapUnLock();
}
// aSwitch.overlapUnLock(); //应该不需要暂时注掉
// }
}
}
} else {

View File

@ -1317,14 +1317,14 @@ public class MapDeviceBuilder {
elementMap.put(station.getCode(), station);
station.setCentralized(stationVO.isCentralized());
station.setDepot(stationVO.isDepot());
if (station.isCentralized() && !station.isDepot()) {
ZC zc = (ZC) elementMap.get(stationVO.getZcCode());
if (Objects.isNull(zc)) {
errMsgList.add(String.format("车站[%s(%s)]未关联ZC或ZC不存在请在ZC设备处选择管理的集中站列表", station.getName(), station.getCode()));
} else {
station.setZc(zc);
}
}
// if (station.isCentralized() && !station.isDepot()) {
// ZC zc = (ZC) elementMap.get(stationVO.getZcCode());
// if (Objects.isNull(zc)) {
// errMsgList.add(String.format("车站[%s(%s)]未关联ZC或ZC不存在请在ZC设备处选择管理的集中站列表", station.getName(), station.getCode()));
// } else {
// station.setZc(zc);
// }
// }
if (Objects.isNull(stationVO.getKmRange())) {
errMsgList.add(String.format("车站[%s(%s)]未设置距离", stationVO.getName(), stationVO.getCode()));
} else {
@ -1361,7 +1361,7 @@ public class MapDeviceBuilder {
station.getName(), station.getCode(), code));
} else {
normal.setDeviceStation(station);
normal.setZc(station.getZc());
// normal.setZc(station.getZc());
}
});
}

View File

@ -234,7 +234,7 @@ public class CalculateService {
}
/**
* 递归计算起始区段到目标区段之间的距离
* 递归计算起始区段到目标区段之间的距离包含起始区段长度不包含终点区段长度
*/
private static Float recursiveCalculate(Section startSection, Section endSection, boolean isRight, byte frequency) {
if (startSection.equals(endSection)) {
@ -1234,6 +1234,35 @@ public class CalculateService {
return routes;
}
/**
* 无视道岔位置计算距离单向
*/
public static Float calculateDistanceIgnoreSwitch(SectionPosition startPosition, SectionPosition endPosition, boolean right) {
if (startPosition.getSection().equals(endPosition.getSection())) {
float offset;
if (right) {
offset = endPosition.getOffset() - startPosition.getOffset();
} else {
offset = startPosition.getOffset() - endPosition.getOffset();
}
if (offset > 0) {
return offset;
} else {
return null;
}
} else {
Float distance = recursiveCalculate(startPosition.getSection(), endPosition.getSection(), right, (byte) 51);
if (distance != null) {
if (right) {
distance += endPosition.getOffset();
} else {
distance += endPosition.getSection().getLen() - endPosition.getOffset();
}
}
return distance;
}
}
/**
* 计算加速段的时间
*/

View File

@ -66,8 +66,7 @@ public class RobotLogicLoop {
private void robotOpenATO(Simulation simulation, VirtualRealityTrain train) {
StandParkedTrainActivity activity = train.getStandParkedTrainActivity();
if (activity == null)
return;
if (activity != null) {
switch (activity) {
case OPEN_DOOR:
if (!train.isAutoOpenDoor()) {
@ -84,12 +83,17 @@ public class RobotLogicLoop {
case START:
if (train.isAtoCanOpen()) {
atpService.openATO(train);
} else if (train.isITC()) {
atpService.confirmMessage(train, Confirm_Release_Speed);
}
break;
}
}
if (train.isStop() && train.isITC() && train.isAtoOn()) {
Signal signal = train.getHeadPosition().getSection().getSignalOf(train.isRight());
if (signal != null && signal.isMainAspect()) {
atpService.confirmMessage(train, Confirm_Release_Speed);
}
}
}
/**
* 使用psl控制屏蔽门