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

View File

@ -105,7 +105,8 @@ public class MaService {
public float calculateDistanceOfEbTriggerEnd() { public float calculateDistanceOfEbTriggerEnd() {
if (this.type.equals(MaType.ITC_Signal)) { if (this.type.equals(MaType.ITC_Signal)) {
boolean right = this.train.isRight(); 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) { if (distance == null) {
distance = 0f; distance = 0f;
} }

View File

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

View File

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

View File

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

View File

@ -1317,14 +1317,14 @@ public class MapDeviceBuilder {
elementMap.put(station.getCode(), station); elementMap.put(station.getCode(), station);
station.setCentralized(stationVO.isCentralized()); station.setCentralized(stationVO.isCentralized());
station.setDepot(stationVO.isDepot()); station.setDepot(stationVO.isDepot());
if (station.isCentralized() && !station.isDepot()) { // if (station.isCentralized() && !station.isDepot()) {
ZC zc = (ZC) elementMap.get(stationVO.getZcCode()); // ZC zc = (ZC) elementMap.get(stationVO.getZcCode());
if (Objects.isNull(zc)) { // if (Objects.isNull(zc)) {
errMsgList.add(String.format("车站[%s(%s)]未关联ZC或ZC不存在请在ZC设备处选择管理的集中站列表", station.getName(), station.getCode())); // errMsgList.add(String.format("车站[%s(%s)]未关联ZC或ZC不存在请在ZC设备处选择管理的集中站列表", station.getName(), station.getCode()));
} else { // } else {
station.setZc(zc); // station.setZc(zc);
} // }
} // }
if (Objects.isNull(stationVO.getKmRange())) { if (Objects.isNull(stationVO.getKmRange())) {
errMsgList.add(String.format("车站[%s(%s)]未设置距离", stationVO.getName(), stationVO.getCode())); errMsgList.add(String.format("车站[%s(%s)]未设置距离", stationVO.getName(), stationVO.getCode()));
} else { } else {
@ -1361,7 +1361,7 @@ public class MapDeviceBuilder {
station.getName(), station.getCode(), code)); station.getName(), station.getCode(), code));
} else { } else {
normal.setDeviceStation(station); 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) { private static Float recursiveCalculate(Section startSection, Section endSection, boolean isRight, byte frequency) {
if (startSection.equals(endSection)) { if (startSection.equals(endSection)) {
@ -1234,6 +1234,35 @@ public class CalculateService {
return routes; 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) { private void robotOpenATO(Simulation simulation, VirtualRealityTrain train) {
StandParkedTrainActivity activity = train.getStandParkedTrainActivity(); StandParkedTrainActivity activity = train.getStandParkedTrainActivity();
if (activity == null) if (activity != null) {
return;
switch (activity) { switch (activity) {
case OPEN_DOOR: case OPEN_DOOR:
if (!train.isAutoOpenDoor()) { if (!train.isAutoOpenDoor()) {
@ -84,12 +83,17 @@ public class RobotLogicLoop {
case START: case START:
if (train.isAtoCanOpen()) { if (train.isAtoCanOpen()) {
atpService.openATO(train); atpService.openATO(train);
} else if (train.isITC()) {
atpService.confirmMessage(train, Confirm_Release_Speed);
} }
break; 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控制屏蔽门 * 使用psl控制屏蔽门