Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
6e6e0a9ca7
@ -100,8 +100,7 @@ public class SectionOperateHandler {
|
|||||||
//TODO
|
//TODO
|
||||||
@OperateHandlerMapping(type =Operation.Type.Section_Axis_Pre_Reset)
|
@OperateHandlerMapping(type =Operation.Type.Section_Axis_Pre_Reset)
|
||||||
public void axisPreReset(Simulation simulation, String sectionCode) {
|
public void axisPreReset(Simulation simulation, String sectionCode) {
|
||||||
//ZC 系统
|
ciApiService.axlePreReset(simulation, sectionCode);
|
||||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "功能暂未实现");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**确认计轴有效*/
|
/**确认计轴有效*/
|
||||||
|
@ -235,9 +235,8 @@ public class SwitchOperateHandler {
|
|||||||
/**道岔计轴预复位*/
|
/**道岔计轴预复位*/
|
||||||
@OperateHandlerMapping(type = Operation.Type.Switch_Axle_Pre_Reset)
|
@OperateHandlerMapping(type = Operation.Type.Switch_Axle_Pre_Reset)
|
||||||
public void axlePreReset(Simulation simulation, String switchCode) {
|
public void axlePreReset(Simulation simulation, String switchCode) {
|
||||||
// todo
|
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
|
||||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "功能暂未实现");
|
ciApiService.axlePreReset(simulation, aSwitch.getA().getParent().getCode());
|
||||||
// log.debug("仿真[{}] : 道岔[{}]计轴预复位",simulation.getGroup(),switchCode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**区故解*/
|
/**区故解*/
|
||||||
|
@ -319,4 +319,9 @@ public interface CiApiService {
|
|||||||
* 强扳道岔
|
* 强扳道岔
|
||||||
*/
|
*/
|
||||||
void switchForceTurn(Simulation simulation, String switchCode, Boolean normal);
|
void switchForceTurn(Simulation simulation, String switchCode, Boolean normal);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计轴预复位
|
||||||
|
*/
|
||||||
|
void axlePreReset(Simulation simulation, String sectionCode);
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import club.joylink.rtss.simulation.cbtc.data.map.*;
|
|||||||
import club.joylink.rtss.simulation.cbtc.data.support.SignalApproachMessage;
|
import club.joylink.rtss.simulation.cbtc.data.support.SignalApproachMessage;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage;
|
import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage;
|
||||||
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.VirtualRealitySectionAxleCounter;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||||
@ -208,6 +209,14 @@ public class CiApiServiceImpl implements CiApiService {
|
|||||||
@Override
|
@Override
|
||||||
public void sectionFaultUnlock(Simulation simulation, String sectionCode) {
|
public void sectionFaultUnlock(Simulation simulation, String sectionCode) {
|
||||||
Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
|
Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
|
||||||
|
if (section.isCross()) {
|
||||||
|
Optional<Section> crossLockedSectionOptional = section.getLogicList().stream().filter(Section::isLocked).findAny();
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(crossLockedSectionOptional.isPresent(),
|
||||||
|
section.debugStr() + "未锁闭,无需解锁");
|
||||||
|
section = crossLockedSectionOptional.get();
|
||||||
|
}
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(section.isLocked(),
|
||||||
|
section.debugStr() + "未锁闭,无需解锁");
|
||||||
List<Route> lockedRouteList = simulation.getRepository().queryAllLockedRoute();
|
List<Route> lockedRouteList = simulation.getRepository().queryAllLockedRoute();
|
||||||
Route lockedRoute = null;
|
Route lockedRoute = null;
|
||||||
for (Route route : lockedRouteList) {
|
for (Route route : lockedRouteList) {
|
||||||
@ -379,7 +388,10 @@ public class CiApiServiceImpl implements CiApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isClose(), String.format("信号机[%s]需处于关闭状态", signal.getCode()));
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isClose(), String.format("信号机[%s]需处于关闭状态", signal.getCode()));
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isApproachOccupy(), String.format("对%s开放引导操作失败,接近区段没有列车占用", signal.getName()));
|
boolean signalApproachOccupied = signal.getApproachPathList()
|
||||||
|
.stream().anyMatch(sectionPath -> sectionPath.getLogicList().stream().anyMatch(Section::isOccupied));
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signalApproachOccupied,
|
||||||
|
String.format("对%s开放引导操作失败,接近区段没有列车占用", signal.getName()));
|
||||||
//办理引导进路或开放引导信号
|
//办理引导进路或开放引导信号
|
||||||
if (config.isGuideNeedRouteSettingFirst()) {
|
if (config.isGuideNeedRouteSettingFirst()) {
|
||||||
signalService.openGuideSignal(simulation, signal);
|
signalService.openGuideSignal(simulation, signal);
|
||||||
@ -476,4 +488,18 @@ public class CiApiServiceImpl implements CiApiService {
|
|||||||
}
|
}
|
||||||
vrSwitch.startSetting(normal);
|
vrSwitch.startSetting(normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void axlePreReset(Simulation simulation, String sectionCode) {
|
||||||
|
Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
|
||||||
|
Section chooseSection = section;
|
||||||
|
if (!section.isAxleCounter()) {
|
||||||
|
section = section.getParent();
|
||||||
|
}
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(section != null && section.isAxleCounter(),
|
||||||
|
chooseSection.debugStr() + "不是计轴区段");
|
||||||
|
VirtualRealitySectionAxleCounter virtualAxleCounter = section.getVirtualAxleCounter();
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(virtualAxleCounter.isOccupy(), chooseSection + "计轴未占用,无需预复位");
|
||||||
|
virtualAxleCounter.preReset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ public class RouteService {
|
|||||||
// 进路内区段占用检查
|
// 进路内区段占用检查
|
||||||
List<Section> sectionList = route.getSectionList();
|
List<Section> sectionList = route.getSectionList();
|
||||||
for (Section section : sectionList) {
|
for (Section section : sectionList) {
|
||||||
if (section.isOccupied()) {
|
if (section.isOccupied() && !section.isPreReset()) {
|
||||||
return new Route.CheckFailMessage(Route.CheckFailReason.SectionNotFree, section);
|
return new Route.CheckFailMessage(Route.CheckFailReason.SectionNotFree, section);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import club.joylink.rtss.simulation.cbtc.Simulation;
|
|||||||
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
|
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -67,6 +68,10 @@ public class SectionService {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
route.setLock(false);
|
route.setLock(false);
|
||||||
|
Signal start = route.getStart();
|
||||||
|
if (start.getLockedRoute() == route) {
|
||||||
|
start.setLockedRoute(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
section.faultUnlock();
|
section.faultUnlock();
|
||||||
@ -96,7 +101,11 @@ public class SectionService {
|
|||||||
}
|
}
|
||||||
if (Objects.nonNull(lockedRoute)) {
|
if (Objects.nonNull(lockedRoute)) {
|
||||||
lockedRoute.setLock(false);
|
lockedRoute.setLock(false);
|
||||||
this.signalService.close(simulation, lockedRoute.getStart());
|
Signal start = lockedRoute.getStart();
|
||||||
|
this.signalService.close(simulation, start);
|
||||||
|
if (start.getLockedRoute() == lockedRoute) {
|
||||||
|
start.setLockedRoute(lockedRoute);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
section.faultUnlock();
|
section.faultUnlock();
|
||||||
section.setDelayTime(0);
|
section.setDelayTime(0);
|
||||||
|
@ -5,6 +5,7 @@ import club.joylink.rtss.simulation.cbtc.communication.vo.ControllableDevice;
|
|||||||
import club.joylink.rtss.simulation.cbtc.communication.vo.SwitchTurn;
|
import club.joylink.rtss.simulation.cbtc.communication.vo.SwitchTurn;
|
||||||
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
|
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
|
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
||||||
import club.joylink.rtss.simulation.cbtc.event.SimulationDeviceControlEvent;
|
import club.joylink.rtss.simulation.cbtc.event.SimulationDeviceControlEvent;
|
||||||
@ -141,7 +142,11 @@ public class SwitchService {
|
|||||||
aSwitch.setDelayTime(route.getDelayReleaseTime() * 1000);
|
aSwitch.setDelayTime(route.getDelayReleaseTime() * 1000);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
Signal start = route.getStart();
|
||||||
route.setLock(false);
|
route.setLock(false);
|
||||||
|
if (start.getLockedRoute() == route) {
|
||||||
|
start.setLockedRoute(route);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aSwitch.sectionFaultUnlock();
|
aSwitch.sectionFaultUnlock();
|
||||||
@ -162,6 +167,10 @@ public class SwitchService {
|
|||||||
}
|
}
|
||||||
if (Objects.nonNull(lockedRoute)) {
|
if (Objects.nonNull(lockedRoute)) {
|
||||||
lockedRoute.setLock(false);
|
lockedRoute.setLock(false);
|
||||||
|
Signal start = lockedRoute.getStart();
|
||||||
|
if (start.getLockedRoute() == lockedRoute) {
|
||||||
|
start.setLockedRoute(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
aSwitch.sectionFaultUnlock();
|
aSwitch.sectionFaultUnlock();
|
||||||
aSwitch.setDelayTime(0);
|
aSwitch.setDelayTime(0);
|
||||||
|
@ -183,6 +183,8 @@ public class CommandBO {
|
|||||||
List<Step> steps = command.getStepByType(Step.StepType.DRIVE);
|
List<Step> steps = command.getStepByType(Step.StepType.DRIVE);
|
||||||
Step driveStep = steps.get(0);
|
Step driveStep = steps.get(0);
|
||||||
if (!train.isStopAtThePosition(driveStep.getTargetPosition())) { //如果列车没停到目标位置
|
if (!train.isStopAtThePosition(driveStep.getTargetPosition())) { //如果列车没停到目标位置
|
||||||
|
if (train.isEB())
|
||||||
|
return buildReleaseEBStep(train.getGroupNumber());
|
||||||
if (!train.isStop())
|
if (!train.isStop())
|
||||||
return buildDriverForceChangeOperationStep(train.getGroupNumber(), -1);
|
return buildDriverForceChangeOperationStep(train.getGroupNumber(), -1);
|
||||||
if (!DriveMode.RM.equals(train.getDriveMode()))
|
if (!DriveMode.RM.equals(train.getDriveMode()))
|
||||||
@ -571,6 +573,13 @@ public class CommandBO {
|
|||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建取消EB的步骤
|
||||||
|
*/
|
||||||
|
public Step buildReleaseEBStep(String groupNumber) {
|
||||||
|
return buildDriverForceChangeOperationStep(groupNumber, -2);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建“改变列车运行模式操作”步骤
|
* 构建“改变列车运行模式操作”步骤
|
||||||
*/
|
*/
|
||||||
|
@ -38,7 +38,7 @@ public class Route extends MapNamedElement {
|
|||||||
/** 是否引导进路 */
|
/** 是否引导进路 */
|
||||||
private boolean atp;
|
private boolean atp;
|
||||||
|
|
||||||
/** 是否引导进路 */
|
/** 是否地面信号进路 */
|
||||||
private boolean ground;
|
private boolean ground;
|
||||||
|
|
||||||
/** 是否引导进路 */
|
/** 是否引导进路 */
|
||||||
|
@ -58,7 +58,9 @@ public class Section extends MayOutOfOrderDevice {
|
|||||||
*/
|
*/
|
||||||
private boolean physical;
|
private boolean physical;
|
||||||
|
|
||||||
/**是否岔心*/
|
/**
|
||||||
|
* 是否岔心
|
||||||
|
*/
|
||||||
private boolean cross;
|
private boolean cross;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,7 +88,7 @@ public class Section extends MayOutOfOrderDevice {
|
|||||||
private Section parent;
|
private Section parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岔心关联的道岔计轴区段;道岔计轴区段关联的道岔区段;物理区段关联的逻辑区段
|
* 岔心关联的计轴区段;道岔计轴区段关联的道岔区段;物理区段关联的逻辑区段
|
||||||
*/
|
*/
|
||||||
private List<Section> logicList;
|
private List<Section> logicList;
|
||||||
|
|
||||||
@ -395,6 +397,9 @@ public class Section extends MayOutOfOrderDevice {
|
|||||||
if (!this.isInvalid()) {
|
if (!this.isInvalid()) {
|
||||||
this.trainRight = right;
|
this.trainRight = right;
|
||||||
this.nctOccupied = true;
|
this.nctOccupied = true;
|
||||||
|
// if (!CollectionUtils.isEmpty(logicList)) {
|
||||||
|
// logicList.forEach(logic -> logic.axleCounterOccupy(right));
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,6 +449,7 @@ public class Section extends MayOutOfOrderDevice {
|
|||||||
!CollectionUtils.isEmpty(this.logicList) &&
|
!CollectionUtils.isEmpty(this.logicList) &&
|
||||||
this.logicList.get(0).isSwitchTrack();
|
this.logicList.get(0).isSwitchTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一般计轴区段
|
* 一般计轴区段
|
||||||
*
|
*
|
||||||
@ -461,6 +467,7 @@ public class Section extends MayOutOfOrderDevice {
|
|||||||
public boolean isSectionOfCross() {
|
public boolean isSectionOfCross() {
|
||||||
return this.physical && this.axleCounter && Objects.nonNull(parent) && parent.isCross();
|
return this.physical && this.axleCounter && Objects.nonNull(parent) && parent.isCross();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否通信车占用
|
* 是否通信车占用
|
||||||
*
|
*
|
||||||
@ -685,7 +692,7 @@ public class Section extends MayOutOfOrderDevice {
|
|||||||
public void judgeAsInvalid() {
|
public void judgeAsInvalid() {
|
||||||
//暂时改为判定非通信车占用(国赛用)
|
//暂时改为判定非通信车占用(国赛用)
|
||||||
if (!this.isAxleCounter()) {
|
if (!this.isAxleCounter()) {
|
||||||
throw new SimulationException(SimulationExceptionType.System_Fault);
|
return;
|
||||||
}
|
}
|
||||||
this.setNctOccupied(true);
|
this.setNctOccupied(true);
|
||||||
if (this.isSwitchAxleCounterSection()) { // 道岔计轴区段
|
if (this.isSwitchAxleCounterSection()) { // 道岔计轴区段
|
||||||
@ -694,8 +701,10 @@ public class Section extends MayOutOfOrderDevice {
|
|||||||
aSwitch.getA().setNctOccupied(true);
|
aSwitch.getA().setNctOccupied(true);
|
||||||
if (aSwitch.isNormalPosition()) {
|
if (aSwitch.isNormalPosition()) {
|
||||||
aSwitch.getB().setNctOccupied(true);
|
aSwitch.getB().setNctOccupied(true);
|
||||||
|
aSwitch.getC().setNctOccupied(false);
|
||||||
} else if (aSwitch.isReversePosition()) {
|
} else if (aSwitch.isReversePosition()) {
|
||||||
aSwitch.getC().setNctOccupied(true);
|
aSwitch.getC().setNctOccupied(true);
|
||||||
|
aSwitch.getB().setNctOccupied(false);
|
||||||
} else {
|
} else {
|
||||||
aSwitch.getB().setNctOccupied(true);
|
aSwitch.getB().setNctOccupied(true);
|
||||||
aSwitch.getC().setNctOccupied(true);
|
aSwitch.getC().setNctOccupied(true);
|
||||||
@ -906,6 +915,19 @@ public class Section extends MayOutOfOrderDevice {
|
|||||||
return this.standTrack || this.turnBackTrack || this.transferTrack;
|
return this.standTrack || this.turnBackTrack || this.transferTrack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否预复位
|
||||||
|
*/
|
||||||
|
public boolean isPreReset() {
|
||||||
|
if (virtualAxleCounter == null) {
|
||||||
|
if (parent != null)
|
||||||
|
return parent.isPreReset();
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return virtualAxleCounter.isPreReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum SectionRoadType {
|
public enum SectionRoadType {
|
||||||
/**
|
/**
|
||||||
* 左行线
|
* 左行线
|
||||||
|
@ -452,6 +452,25 @@ public class Switch extends MayOutOfOrderDevice {
|
|||||||
VirtualRealitySwitch.Fault.SQUEEZE.fix(vrSwitch);
|
VirtualRealitySwitch.Fault.SQUEEZE.fix(vrSwitch);
|
||||||
vrSwitch.startSetting(true);
|
vrSwitch.startSetting(true);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计轴故障
|
||||||
|
*/
|
||||||
|
AXLE_FAULT{
|
||||||
|
@Override
|
||||||
|
public boolean apply(MayOutOfOrderDevice device) {
|
||||||
|
Switch aSwitch = (Switch) device;
|
||||||
|
Section section = aSwitch.getA().getParent();
|
||||||
|
return Section.AxleFault.FAULT.apply(section);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fix(MayOutOfOrderDevice device) {
|
||||||
|
Switch aSwitch = (Switch) device;
|
||||||
|
Section section = aSwitch.getA().getParent();
|
||||||
|
Section.AxleFault.FAULT.fix(section);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,12 @@ public class SectionStatus extends DeviceStatus {
|
|||||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||||
private boolean noStatus;
|
private boolean noStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计轴预复位
|
||||||
|
*/
|
||||||
|
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||||
|
private boolean preReset;
|
||||||
|
|
||||||
private String fault;
|
private String fault;
|
||||||
|
|
||||||
public SectionStatus(Section section) {
|
public SectionStatus(Section section) {
|
||||||
@ -96,6 +102,7 @@ public class SectionStatus extends DeviceStatus {
|
|||||||
this.faultLock = section.isFaultLock();
|
this.faultLock = section.isFaultLock();
|
||||||
this.speedUpLimit = section.getSpeedUpLimit();
|
this.speedUpLimit = section.getSpeedUpLimit();
|
||||||
this.noStatus = section.isNoStatus();
|
this.noStatus = section.isNoStatus();
|
||||||
|
this.preReset = section.isPreReset();
|
||||||
this.fault = section.getFault() == null ? null : section.getFault().toString();
|
this.fault = section.getFault() == null ? null : section.getFault().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,6 +166,11 @@ public class SectionStatus extends DeviceStatus {
|
|||||||
status.setNoStatus(noStatus);
|
status.setNoStatus(noStatus);
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
|
if (!Objects.equals(this.preReset, section.isPreReset())) {
|
||||||
|
this.preReset = section.isPreReset();
|
||||||
|
status.setPreReset(this.preReset);
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,6 +187,7 @@ public class SectionStatus extends DeviceStatus {
|
|||||||
statusVO.setRouteLock(routeLock);
|
statusVO.setRouteLock(routeLock);
|
||||||
statusVO.setBlockade(blockade);
|
statusVO.setBlockade(blockade);
|
||||||
statusVO.setNoStatus(noStatus);
|
statusVO.setNoStatus(noStatus);
|
||||||
|
statusVO.setPreReset(preReset);
|
||||||
return statusVO;
|
return statusVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,9 @@ public class SectionStatusVO extends DeviceStatusVO {
|
|||||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||||
private Boolean noStatus;
|
private Boolean noStatus;
|
||||||
|
|
||||||
|
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||||
|
private Boolean preReset;
|
||||||
|
|
||||||
private String fault;
|
private String fault;
|
||||||
|
|
||||||
public SectionStatusVO(Section section) {
|
public SectionStatusVO(Section section) {
|
||||||
|
@ -25,6 +25,16 @@ public class VirtualRealitySectionAxleCounter extends VirtualRealityDevice {
|
|||||||
*/
|
*/
|
||||||
private boolean preReset;
|
private boolean preReset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从区段左端计轴器进入的列车计数
|
||||||
|
*/
|
||||||
|
private int leftCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从区段右端计轴器进入的列车计数
|
||||||
|
*/
|
||||||
|
private int rightCount;
|
||||||
|
|
||||||
private Fault fault;
|
private Fault fault;
|
||||||
|
|
||||||
public VirtualRealitySectionAxleCounter(String code, String name) {
|
public VirtualRealitySectionAxleCounter(String code, String name) {
|
||||||
@ -36,6 +46,8 @@ public class VirtualRealitySectionAxleCounter extends VirtualRealityDevice {
|
|||||||
this.occupy = false;
|
this.occupy = false;
|
||||||
this.preReset = false;
|
this.preReset = false;
|
||||||
this.fault = null;
|
this.fault = null;
|
||||||
|
leftCount = 0;
|
||||||
|
rightCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void occupied(boolean right) {
|
public void occupied(boolean right) {
|
||||||
@ -44,12 +56,70 @@ public class VirtualRealitySectionAxleCounter extends VirtualRealityDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
if (Fault.FAULT.equals(this.fault)) {
|
if (Fault.FAULT.equals(this.fault) && !preReset) { //故障且没有预复位
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.occupy = false;
|
this.occupy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计轴预复位
|
||||||
|
*/
|
||||||
|
public void preReset() {
|
||||||
|
if (occupy) {
|
||||||
|
this.preReset = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断计轴器的占用情况
|
||||||
|
*/
|
||||||
|
private void judgeOccupy() {
|
||||||
|
this.occupy = leftCount != 0 || rightCount != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列车车头进入该计轴区段
|
||||||
|
* @param trainRight 列车运行方向
|
||||||
|
*/
|
||||||
|
public void trainIn(boolean trainRight) {
|
||||||
|
if (trainRight) {
|
||||||
|
leftCount++;
|
||||||
|
} else {
|
||||||
|
rightCount++;
|
||||||
|
}
|
||||||
|
judgePreResetSuccess();
|
||||||
|
// judgeOccupy(); //通过计轴器数量判断计轴占用的逻辑不完整,所以暂时只用来判断预复位是否成功
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列车车尾离开该计轴区段
|
||||||
|
* @param trainRight 列车运行方向
|
||||||
|
*/
|
||||||
|
public void trainOut(boolean trainRight) {
|
||||||
|
if (trainRight) {
|
||||||
|
leftCount--;
|
||||||
|
} else {
|
||||||
|
rightCount--;
|
||||||
|
}
|
||||||
|
judgePreResetSuccess();
|
||||||
|
// judgeOccupy(); //通过计轴器数量判断计轴占用的逻辑不完整,所以暂时只用来判断预复位是否成功
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断预复位是否成功
|
||||||
|
*/
|
||||||
|
public void judgePreResetSuccess() {
|
||||||
|
if (preReset) {
|
||||||
|
if (leftCount == 0 && rightCount == 0) {
|
||||||
|
if (Fault.FAULT.equals(this.fault)) {
|
||||||
|
this.fault = null;
|
||||||
|
}
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum Fault {
|
public enum Fault {
|
||||||
FAULT {
|
FAULT {
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,10 +8,10 @@ import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
|
|||||||
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
|
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Responder;
|
import club.joylink.rtss.simulation.cbtc.data.map.Responder;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||||
import club.joylink.rtss.simulation.cbtc.onboard.ATP.ATPService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -76,8 +76,44 @@ public class VRTrainRunningService {
|
|||||||
|
|
||||||
//列车级别
|
//列车级别
|
||||||
trainRunLevelUpgrade(simulation, train);
|
trainRunLevelUpgrade(simulation, train);
|
||||||
|
//计轴器计数
|
||||||
|
axleCounterCount(simulation, train, headPosition, headPositionNew);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计轴器计数
|
||||||
|
*/
|
||||||
|
private void axleCounterCount(Simulation simulation, VirtualRealityTrain train, SectionPosition headPosition, SectionPosition headPositionNew) {
|
||||||
|
boolean trainRight = train.isRight();
|
||||||
|
Float distance = CalculateService.calculateDistance(headPosition, headPositionNew, trainRight); //列车移动的距离
|
||||||
|
if (distance == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//进入计轴区段判断
|
||||||
|
Section headAxleCounterSectionNew = headPositionNew.getSection();
|
||||||
|
if (!headAxleCounterSectionNew.isAxleCounter()) {
|
||||||
|
headAxleCounterSectionNew = headAxleCounterSectionNew.getParent();
|
||||||
|
}
|
||||||
|
if (headAxleCounterSectionNew != null && headAxleCounterSectionNew.isAxleCounter()) { //新的区段是计轴区段
|
||||||
|
Section headSectionOld = headPosition.getSection();
|
||||||
|
if (!headAxleCounterSectionNew.equals(headSectionOld) && !headAxleCounterSectionNew.equals(headSectionOld.getParent())) { //新计轴区段和老区段不一样
|
||||||
|
headAxleCounterSectionNew.getVirtualAxleCounter().trainIn(trainRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//离开计轴区段判断
|
||||||
|
SectionPosition tailPositionOld = CalculateService.calculateNextPositionByStartAndLen(headPosition, !trainRight, train.getLen());
|
||||||
|
Section tailAxleCounterSection = tailPositionOld.getSection();
|
||||||
|
if (!tailAxleCounterSection.isAxleCounter()) {
|
||||||
|
tailAxleCounterSection = tailAxleCounterSection.getParent();
|
||||||
|
}
|
||||||
|
if (tailAxleCounterSection != null && tailAxleCounterSection.isAxleCounter()) { //老的车尾区段是计轴区段
|
||||||
|
SectionPosition tailPositionNew = CalculateService.calculateNextPositionByStartAndLen(headPositionNew, !trainRight, train.getLen());
|
||||||
|
Section tailSectionNew = tailPositionNew.getSection();
|
||||||
|
if (!tailAxleCounterSection.equals(tailSectionNew) && !tailAxleCounterSection.equals(tailSectionNew.getParent())) { //老车尾计轴区段和新车尾区段不一样
|
||||||
|
tailAxleCounterSection.getVirtualAxleCounter().trainOut(trainRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user