diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/ZCLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/ZCLogicLoop.java index 6f6f87697..bcc1fce0a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/ZCLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/ZCLogicLoop.java @@ -48,17 +48,22 @@ public class ZCLogicLoop { List trainList = simulation.getRepository().getOnlineTrainList(); trainList.forEach(train -> { SectionPosition headPosition = train.getHeadPosition(); + Station deviceStation = headPosition.getSection().getDeviceStation(); RunLevel defaultRunLevel = simulation.getRepository().getConfig().getRunMode(); if (RunLevel.ITC.equals(defaultRunLevel)) { //如果线路最高运行级别为ITC级别 - this.calculateMAOfITC(simulation, train, trainList); - } else if (RunLevel.CBTC.equals(defaultRunLevel)) { - //更新ITC ma - Float distance2NextSignal = train.calculateDistance2NextNormalOpenSignal(); - if (distance2NextSignal != null && distance2NextSignal <= 5) { + if (!Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) { this.calculateMAOfITC(simulation, train, trainList); } + } else if (RunLevel.CBTC.equals(defaultRunLevel)) { + //更新ITC ma + if (!Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) { + Float distance2NextSignal = train.calculateDistance2NextNormalOpenSignal(); + if (distance2NextSignal != null && distance2NextSignal <= 5) { + this.calculateMAOfITC(simulation, train, trainList); + } + } //更新CBTC ma - if (!headPosition.getSection().getDeviceStation().getZc().isFault()) { //如果列车头所在区段所属设备集中站zc未故障 + if (!deviceStation.isFault()) { //如果列车头所在区段所属设备集中站zc未故障 this.calculateMAOfCBTC(simulation, train, trainList); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java index fb556f146..ee4944691 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java @@ -225,6 +225,8 @@ public class Operation { Station_Close_AllSignal, /** 关区信号 */ Station_CIArea_Close_AllSignal, + /** 重启令解(哈尔滨) */ + Station_Restart, //--------------------------- 列车 --------------------------- /** 在指定区段加载一辆计划列车(本地开发使用) */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/FaultOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/FaultOperateHandler.java index d1dc9715c..b8c56d947 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/FaultOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/FaultOperateHandler.java @@ -6,7 +6,8 @@ import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler import club.joylink.rtss.simulation.cbtc.ATS.operation.service.*; import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.FaultParam; import club.joylink.rtss.simulation.cbtc.Simulation; -import club.joylink.rtss.simulation.cbtc.data.map.*; +import club.joylink.rtss.simulation.cbtc.data.map.MapElement; +import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import lombok.extern.slf4j.Slf4j; @@ -39,6 +40,9 @@ public class FaultOperateHandler { @Autowired private CatenaryFaultService catenaryFaultService; + @Autowired + private StationFaultService stationFaultService; + /** * 设备设置故障 * @@ -129,6 +133,12 @@ public class FaultOperateHandler { return; case STATION: + if (isSet) { + stationFaultService.setFault(simulation, mayOutOfOrderDevice, param); + return; + } + stationFaultService.fixFault(simulation, mayOutOfOrderDevice, param); + return; case TRAIN: return; case STAND: diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java index 65af411c1..b6c2257c6 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java @@ -194,4 +194,10 @@ public class StationOperateHandler { SimulationDataRepository repository = simulation.getRepository(); this.atsStationService.receiveControl(simulation, member, repository.getByCode(stationCode, Station.class)); } + + @OperateHandlerMapping(type = Operation.Type.Station_Restart) + public void restart(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + this.ciApiService.restart(simulation, repository.getByCode(stationCode, Station.class)); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/service/StationFaultService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/service/StationFaultService.java new file mode 100644 index 000000000..a4d303c1b --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/service/StationFaultService.java @@ -0,0 +1,67 @@ +package club.joylink.rtss.simulation.cbtc.ATS.operation.service; + +import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.FaultParam; +import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo; +import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; +import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; +import club.joylink.rtss.simulation.cbtc.data.map.Section; +import club.joylink.rtss.simulation.cbtc.data.map.Station; +import club.joylink.rtss.simulation.cbtc.event.SimulationDeviceFaultOverEvent; +import club.joylink.rtss.simulation.cbtc.event.SimulationDeviceFaultSetEvent; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.stream.Collectors; + +@Component +public class StationFaultService implements DeviceFaultService { + + @Autowired + private ApplicationContext applicationContext; + + @Override + public void setFault(Simulation simulation, MayOutOfOrderDevice device, FaultParam param) { + Station.Fault fault = checkAndGetFault(param); + boolean apply = fault.apply(device); + if (apply) { + this.applicationContext.publishEvent(new SimulationDeviceFaultSetEvent(this, + simulation, new DeviceFaultInfo(device.getCode(), device.getDeviceType(), fault))); + } + } + + @Override + public void fixFault(Simulation simulation, MayOutOfOrderDevice device, FaultParam param) { + Station.Fault fault = checkAndGetFault(param); + MayOutOfOrderDevice.DeviceFault deviceFault = device.getFault(); + fault.fix(device); + if (fault.equals(deviceFault) && fault.equals(Station.Fault.INTERLOCK_MACHINE_FAULT)) { + Station station = (Station) device; + if (station.getDeviceStation() != null) { + station = station.getDeviceStation(); + } + Station deviceStation = station; + SimulationDataRepository repository = simulation.getRepository(); + List
sections = repository.getSectionList().stream() + .filter(section -> section.getDeviceStation().equals(deviceStation)).collect(Collectors.toList()); + for (Section section : sections) { + if (section.isRouteLock()) { + continue; + } + section.setNctOccupied(true); + if (section.isSwitchAxleCounterSection()) { + section.getLogicList().forEach(switchSection -> switchSection.setNctOccupied(true)); + } + } + } + this.applicationContext.publishEvent(new SimulationDeviceFaultOverEvent(this, + simulation, new DeviceFaultInfo(device.getCode(), device.getDeviceType(), fault))); + } + + @Override + public Station.Fault checkAndGetFault(FaultParam param) { + return Station.Fault.valueOf(param.getFaultType()); + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CILogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CILogicLoop.java index 4ebea7d0b..f383cac05 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CILogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CILogicLoop.java @@ -91,84 +91,16 @@ public class CILogicLoop { */ public void getStatusFromVRDevice(Simulation simulation) { SimulationDataRepository repository = simulation.getRepository(); - List signalList = repository.getSignalList(); - for (Signal signal : signalList) { - if (signal.isLogicLight() || signal.isVirtual()) { - continue; - } else if (signal.isGuideOpen()) { - int guideRemain = signal.getGuideRemain(); - if (guideRemain != -1) { // 非无限开放 - guideRemain -= SimulationModule.CI.getRateMs(); - if (guideRemain <= 0) { - // 关闭引导信号 - this.signalService.close(simulation, signal); - signal.updateGuideRemain(0); - } else { - signal.updateGuideRemain(guideRemain); - } - } - } - VirtualRealitySignal virtualSignal = signal.getVirtualSignal(); - signal.apply(virtualSignal.isGreenOpen(), virtualSignal.isYellowOpen(), virtualSignal.isRedOpen()); - } - // 道岔位置状态 - List switchList = repository.getListByType(MapElement.DeviceType.SWITCH, Switch.class); - switchList.forEach(aSwitch -> { - Switch.SwitchFault fault = (Switch.SwitchFault) aSwitch.getFault(); - if (fault != null) { - aSwitch.setSplit(true); - switch (fault) { - case SPLIT: - break; - case NORMAL_SPLIT: { - VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch(); - aSwitch.apply(false, virtualSwitch.isReverse()); - break; - } - case REVERSE_SPLIT: { - VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch(); - aSwitch.apply(virtualSwitch.isNormal(), false); - break; - } - } - } else { - aSwitch.setSplit(false); - VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch(); - aSwitch.apply(virtualSwitch.isNormal(), virtualSwitch.isReverse()); - } - }); - // 区段占用 - List
axleSectionList = repository.getAxleSectionList(); - axleSectionList.forEach(section -> { -// if (section.isInvalid() && section.isFault()) { -// section.setNctOccupied(false); -// return; -// } -// if (section.isFault()) { -// section.setNctOccupied(true); -// return; -// } - if (Section.AxleFault.UNABLE_COLLECT_STATUS.equals(section.getFault())) - return; - VirtualRealitySectionAxleCounter virtualAxleCounter = section.getVirtualAxleCounter(); - if (virtualAxleCounter.isOccupy()) { - section.axleCounterOccupy(virtualAxleCounter.isRight()); - } else { - section.axleCounterClear(); - } - section.judgeAsValid(); - }); - // 站台屏蔽门开关门等状态 - List psdList = repository.getListByType(MapElement.DeviceType.PSD, PSD.class); - psdList.forEach(psd -> { - VirtualRealityScreenDoor vrScreenDoor = psd.getVirtualScreenDoor(); - psd.apply(vrScreenDoor.isClose(), vrScreenDoor.isLock(), vrScreenDoor.isInterlockRelease()); - }); + List signalList = getSignalsStatusFromVRDevice(simulation); + List switchList = getSwitchesStatusFromVRDevice(repository); + getSectionsStatusFromVRDevice(repository); + getPsdStatusFromVRDevice(repository); // 道岔状态发送ATS this.atsApiService.handleDeviceStatus(simulation, signalList); this.atsApiService.handleDeviceStatus(simulation, switchList); } + /** * 进路相关逻辑 */ @@ -176,6 +108,13 @@ public class CILogicLoop { SimulationDataRepository repository = simulation.getRepository(); List routeList = repository.getRouteList(); for (Route route : routeList) { + //联锁机故障逻辑 + Station deviceStation = route.getStart().getDeviceStation(); + if (deviceStation != null) { + if (Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) { + continue; + } + } // Route.CheckFailMessage result = this.routeService.check(simulation, route); // if (Objects.nonNull(result)) { // route.setSettable(false); @@ -192,6 +131,14 @@ public class CILogicLoop { if (!CollectionUtils.isEmpty(settingRoutes)) { // 获取所有列车方向速度位置信息用以解锁进路 for (Route route : settingRoutes) { + //联锁机故障逻辑 + Station deviceStation = route.getStart().getDeviceStation(); + if (deviceStation != null) { + if (Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) { + continue; + } + } + if (route.isNormalUnlock()) { // 进路锁闭,若进路内存在列车,执行正常解锁 this.routeService.normalUnlock(simulation, route); } @@ -230,4 +177,175 @@ public class CILogicLoop { } } + /** + * 从真实设置获取屏蔽门的状态 + */ + private void getPsdStatusFromVRDevice(SimulationDataRepository repository) { + // 站台屏蔽门开关门等状态 + List psdList = repository.getListByType(MapElement.DeviceType.PSD, PSD.class); + psdList.forEach(psd -> { + //联锁机故障 + Stand stand = psd.getStand(); + Station deviceStation = stand.getDeviceStation(); + if (deviceStation != null) { + if (Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) { + stand.setNoStatus(true); + psd.setNoStatus(true); + return; + } else { + stand.setNoStatus(false); + psd.setNoStatus(false); + } + if (deviceStation.isInterlockMachineStarting()) + return; + } else { + stand.setNoStatus(false); + psd.setNoStatus(false); + } + + VirtualRealityScreenDoor vrScreenDoor = psd.getVirtualScreenDoor(); + psd.apply(vrScreenDoor.isClose(), vrScreenDoor.isLock(), vrScreenDoor.isInterlockRelease()); + }); + } + + /** + * 更新区段逻辑 + */ + private void getSectionsStatusFromVRDevice(SimulationDataRepository repository) { + // 区段占用 + List
axleSectionList = repository.getAxleSectionList(); + axleSectionList.forEach(section -> { + //联锁机故障 + boolean interlockMachineFault = false; + boolean interlockMachineStarting = false; + Station deviceStation = section.getDeviceStation(); + if (deviceStation != null) { + if (deviceStation.isInterlockMachineStarting()) + interlockMachineStarting = true; + if (Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) + interlockMachineFault = true; + } + if (interlockMachineFault) { + section.setNoStatus(true); + if (section.isSwitchAxleCounterSection()) { + section.getLogicList().forEach(switchSection -> switchSection.setNoStatus(true)); + } + } else { + section.setNoStatus(false); + if (section.isSwitchAxleCounterSection()) { + section.getLogicList().forEach(switchSection -> switchSection.setNoStatus(false)); + } + } + if (interlockMachineStarting) + return; +// if (section.isInvalid() && section.isFault()) { +// section.setNctOccupied(false); +// return; +// } +// if (section.isFault()) { +// section.setNctOccupied(true); +// return; +// } + if (Section.AxleFault.UNABLE_COLLECT_STATUS.equals(section.getFault())) + return; + VirtualRealitySectionAxleCounter virtualAxleCounter = section.getVirtualAxleCounter(); + if (virtualAxleCounter.isOccupy()) { + section.axleCounterOccupy(virtualAxleCounter.isRight()); + } else { + section.axleCounterClear(); + } + section.judgeAsValid(); + }); + } + + /** + * 从真实设备获取道岔状态 + */ + private List getSwitchesStatusFromVRDevice(SimulationDataRepository repository) { + // 道岔位置状态 + List switchList = repository.getListByType(MapElement.DeviceType.SWITCH, Switch.class); + switchList.forEach(aSwitch -> { + //联锁机故障逻辑 + Station deviceStation = aSwitch.getDeviceStation(); + if (deviceStation != null) { + if (Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) { + aSwitch.setNoStatus(true); + return; + } else { + aSwitch.setNoStatus(false); + } + if (deviceStation.isInterlockMachineStarting()) + return; + } else { + aSwitch.setNoStatus(false); + } + + Switch.SwitchFault fault = (Switch.SwitchFault) aSwitch.getFault(); + if (fault != null) { + aSwitch.setSplit(true); + switch (fault) { + case SPLIT: + break; + case NORMAL_SPLIT: { + VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch(); + aSwitch.apply(false, virtualSwitch.isReverse()); + break; + } + case REVERSE_SPLIT: { + VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch(); + aSwitch.apply(virtualSwitch.isNormal(), false); + break; + } + } + } else { + aSwitch.setSplit(false); + VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch(); + aSwitch.apply(virtualSwitch.isNormal(), virtualSwitch.isReverse()); + } + }); + return switchList; + } + + /** + * 从真实设备获取信号机状态 + */ + private List getSignalsStatusFromVRDevice(Simulation simulation) { + SimulationDataRepository repository = simulation.getRepository(); + List signalList = repository.getSignalList(); + for (Signal signal : signalList) { + //联锁机故障逻辑 + Station deviceStation = signal.getDeviceStation(); + if (deviceStation != null) { + if (Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) { + signal.setNoStatus(true); + continue; + } else { + signal.setNoStatus(false); + } + if (deviceStation.isInterlockMachineStarting()) + continue; + } else { + signal.setNoStatus(false); + } + + if (signal.isLogicLight() || signal.isVirtual()) { + continue; + } else if (signal.isGuideOpen()) { + int guideRemain = signal.getGuideRemain(); + if (guideRemain != -1) { // 非无限开放 + guideRemain -= SimulationModule.CI.getRateMs(); + if (guideRemain <= 0) { + // 关闭引导信号 + this.signalService.close(simulation, signal); + signal.updateGuideRemain(0); + } else { + signal.updateGuideRemain(guideRemain); + } + } + } + VirtualRealitySignal virtualSignal = signal.getVirtualSignal(); + signal.apply(virtualSignal.isGreenOpen(), virtualSignal.isYellowOpen(), virtualSignal.isRedOpen()); + } + return signalList; + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java index 41b0c25e7..8a5c57a00 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java @@ -3,6 +3,7 @@ package club.joylink.rtss.simulation.cbtc.CI; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.map.ESP; import club.joylink.rtss.simulation.cbtc.data.map.Route; +import club.joylink.rtss.simulation.cbtc.data.map.Station; import club.joylink.rtss.simulation.cbtc.data.support.SignalApproachMessage; import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage; @@ -297,4 +298,9 @@ public interface CiApiService { void setEst(Simulation simulation, ESP esp); void cancelEst(Simulation simulation, ESP esp); + + /** + * 重启令解 + */ + void restart(Simulation simulation, Station station); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java index eb45ce74e..158450a6f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java @@ -1,5 +1,6 @@ package club.joylink.rtss.simulation.cbtc.CI; +import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.CI.service.*; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; @@ -16,6 +17,7 @@ import org.springframework.util.CollectionUtils; import java.util.List; import java.util.Objects; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -79,16 +81,20 @@ public class CiApiServiceImpl implements CiApiService { throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "信号机已经开启,无需重开信号机"); } - Route lockedRoute = signal.getLockedRoute(); - if (Objects.isNull(lockedRoute)) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, - "进路未锁闭,不能重开信号机"); - } - if (!this.routeService.isInterlocked(lockedRoute)) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, - String.format("进路[%s(%s)]联锁关系不满足,不能重开信号机", lockedRoute.getName(), lockedRoute.getCode())); - } - this.routeService.routeOpen(simulation, lockedRoute); + Optional routeOptional = simulation.getRepository().getSettingRoutes().stream() + .filter(route -> route.getStart().equals(signal)).limit(1).findAny(); + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(routeOptional.isPresent()); + settingRoute(simulation, routeOptional.get().getCode()); +// Route lockedRoute = signal.getLockedRoute(); +// if (Objects.isNull(lockedRoute)) { +// throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, +// "进路未锁闭,不能重开信号机"); +// } +// if (!this.routeService.isInterlocked(lockedRoute)) { +// throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, +// String.format("进路[%s(%s)]联锁关系不满足,不能重开信号机", lockedRoute.getName(), lockedRoute.getCode())); +// } +// this.routeService.routeOpen(simulation, lockedRoute); } @Override @@ -419,4 +425,20 @@ public class CiApiServiceImpl implements CiApiService { public void cancelEst(Simulation simulation, ESP esp) { esp.update(false); } + + @Override + public void restart(Simulation simulation, Station station) { + Station deviceStation; + if (station.isCentralized()) { + deviceStation = station; + } else { + deviceStation = station.getDeviceStation(); + } + SimulationDataRepository repository = simulation.getRepository(); + //信号机和进路 + List signals = repository.getSignalList().stream() + .filter(signal -> signal.getDeviceStation().equals(deviceStation)).collect(Collectors.toList()); + signals.forEach(Signal::reset); + deviceStation.setInterlockMachineStarting(false); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java index d6bd1a6a4..ba664bfd1 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java @@ -725,6 +725,9 @@ public class RouteService { if (!section.isRouteLockOn(right)) { return false; } + if (section.isNoStatus()) { + return false; + } } // 道岔位置一致检查 Set sectionRelSwitches = sectionList.stream().map(Section::getRelSwitch).collect(Collectors.toSet()); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MayOutOfOrderDevice.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MayOutOfOrderDevice.java index c8a89ab56..5a96832c5 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MayOutOfOrderDevice.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MayOutOfOrderDevice.java @@ -42,9 +42,6 @@ public abstract class MayOutOfOrderDevice extends MapNamedElement { boolean apply(MayOutOfOrderDevice device); default void fix(MayOutOfOrderDevice device) { - if (device.fault == null) { - return; - } if (this.equals(device.fault)) device.fault = null; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/PSD.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/PSD.java index 70d42d7b4..0514621b7 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/PSD.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/PSD.java @@ -36,11 +36,15 @@ public class PSD extends MapNamedElement { /** 是否互锁解除 */ private boolean interlockRelease; + /** 无状态 */ + private boolean noStatus; + @Override public void reset() { this.close = true; this.lock = true; this.interlockRelease = false; + this.noStatus = false; } public boolean isCloseAndLock() { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java index ae67ec48d..f3c14a4a9 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java @@ -408,6 +408,8 @@ public class Route extends MapNamedElement { } public synchronized void startSetting(LocalDateTime systemTime) { + if (getCode().equals("Route533")) + System.out.println(); this.setSetting(true); this.settingStartTime = systemTime; this.requisition = false; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java index dcf7ef3c9..c8c5cf373 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java @@ -209,6 +209,11 @@ public class Section extends MayOutOfOrderDevice { */ private int delayTime; + /** + * 无状态(哈尔滨灰显) + */ + private boolean noStatus; + @Override public void reset() { super.reset(); @@ -223,6 +228,7 @@ public class Section extends MayOutOfOrderDevice { this.faultLock = false; this.speedUpLimit = -1; this.delayTime = 0; + this.noStatus = false; } /** @@ -746,6 +752,8 @@ public class Section extends MayOutOfOrderDevice { } public boolean isRouteLockOn(boolean right) { + if (noStatus) + return false; return this.routeLock && Objects.equals(this.lockRight, right); } @@ -916,7 +924,7 @@ public class Section extends MayOutOfOrderDevice { }, /** - * 无法从真实设备采集状态(哈尔滨灰显) + * 无法从真实设备采集状态(哈尔滨灰显)【可能没用了】 */ UNABLE_COLLECT_STATUS { @Override diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Signal.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Signal.java index bd3e0410a..c1afc9242 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Signal.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Signal.java @@ -167,6 +167,11 @@ public class Signal extends MayOutOfOrderDevice { */ private SignalApproachMessage.ApproachMessage approachMsg; + /** + * 无状态 + */ + private boolean noStatus; + @Override public void reset() { super.reset(); @@ -179,6 +184,7 @@ public class Signal extends MayOutOfOrderDevice { this.delayTime = 0; this.guideRemain = 0; this.approachMsg = SignalApproachMessage.ApproachMessage.NULL; + this.noStatus = false; } @Override @@ -315,8 +321,6 @@ public class Signal extends MayOutOfOrderDevice { /** * 是否与轨道常规运行方向相同 - * - * @return */ public boolean isSameDirectionToSection() { return (this.isRight() && Objects.equals(this.section.getRoadType(), Section.SectionRoadType.RIGHT)) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java index d9f538826..547826d81 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java @@ -132,6 +132,11 @@ public class Stand extends MayOutOfOrderDevice { */ private TurnBackType typeStrategy; + /** + * 无状态 + */ + private boolean noStatus; + /** * 折返路径策略 */ @@ -153,6 +158,7 @@ public class Stand extends MayOutOfOrderDevice { this.runLevelTimeForever = false; this.parkingTime = -1; this.parkingAlwaysValid = false; + this.noStatus = false; } /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java index f3a0bf5ab..3346007e4 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java @@ -20,7 +20,7 @@ import java.util.stream.Collectors; @Getter @Setter -public class Station extends MapNamedElement { +public class Station extends MayOutOfOrderDevice { public Station(String code, String name) { super(code, name, DeviceType.STATION); this.transferList = new ArrayList<>(); @@ -151,8 +151,14 @@ public class Station extends MapNamedElement { */ private Integer validDuration; + /** + * 联锁机启动中 + */ + private boolean interlockMachineStarting; + @Override public void reset() { + super.reset(); if (this.vrIbp != null) { vrIbp.reset(); } @@ -167,6 +173,7 @@ public class Station extends MapNamedElement { this.applicant = null; this.apply2TheControlMode = null; this.validDuration = null; + this.interlockMachineStarting = false; } public List getStandOf(boolean right) { @@ -433,4 +440,36 @@ public class Station extends MapNamedElement { Station station = (Station) obj; return getCode().equals(station.getCode()); } + + public enum Fault implements DeviceFault { + + /** + * 联锁机故障 + */ + INTERLOCK_MACHINE_FAULT { + @Override + public boolean apply(MayOutOfOrderDevice device) { + Station station = (Station) device; + if (station.getDeviceStation() != null) { + station = station.getDeviceStation(); + } + if (Objects.equals(this, station.getFault())) + return false; + station.setFault(this); + return true; + } + + @Override + public void fix(MayOutOfOrderDevice device) { + Station station = (Station) device; + if (station.getDeviceStation() != null) { + station = station.getDeviceStation(); + } + if (!Objects.equals(this, device.getFault())) + return; + station.setInterlockMachineStarting(true); + station.setFault(null); + } + } + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java index 9a04c9383..98ad38a63 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java @@ -94,6 +94,11 @@ public class Switch extends MayOutOfOrderDevice { */ private boolean split; + /** + * 无状态 + */ + private boolean noStatus; + @Override public void reset() { super.reset(); @@ -106,6 +111,7 @@ public class Switch extends MayOutOfOrderDevice { this.reversePosition = false; this.delayTime = 0; this.split = false; + this.noStatus = false; } /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/PSDStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/PSDStatus.java index 76b6b0b8f..30b604983 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/PSDStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/PSDStatus.java @@ -1,14 +1,13 @@ package club.joylink.rtss.simulation.cbtc.data.status; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.map.PSD; -import club.joylink.rtss.simulation.cbtc.data.status.DeviceStatus; import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.PSDStatusVO; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; import java.util.Objects; @@ -34,11 +33,15 @@ public class PSDStatus extends DeviceStatus { @JsonDeserialize(using = Boolean2NumDeserializer.class) private boolean interlockRelease; + @JsonSerialize(using = Boolean2NumSerializer.class) + private boolean noStatus; + public PSDStatus(PSD psd) { super(psd.getCode(), psd.getDeviceType()); this.close = psd.isCloseAndLock(); // this.lock = psd.isLock(); this.interlockRelease = psd.isInterlockRelease(); + this.noStatus = psd.isNoStatus(); } @Override @@ -60,6 +63,11 @@ public class PSDStatus extends DeviceStatus { status.setClose(this.interlockRelease); change = true; } + if (!Objects.equals(this.noStatus, psd.isNoStatus())) { + this.noStatus = psd.isNoStatus(); + status.setNoStatus(noStatus); + change = true; + } return change; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SectionStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SectionStatus.java index 7012d68f2..81cc086e2 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SectionStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SectionStatus.java @@ -16,45 +16,71 @@ import java.util.Objects; @Getter public class SectionStatus extends DeviceStatus { - /** 是否封锁 */ + /** + * 是否封锁 + */ @JsonSerialize(using = Boolean2NumSerializer.class) private boolean blockade; - /** 是否进路锁闭 */ + /** + * 是否进路锁闭 + */ @JsonSerialize(using = Boolean2NumSerializer.class) private boolean routeLock; - /** 锁闭方向 */ + /** + * 锁闭方向 + */ @JsonSerialize(using = Boolean2NumSerializer.class) private boolean lockRight; - /** 进路延续保护锁闭 */ + /** + * 进路延续保护锁闭 + */ @JsonSerialize(using = Boolean2NumSerializer.class) private boolean overlapLock; - /** 通信车占用 */ + /** + * 通信车占用 + */ @JsonSerialize(using = Boolean2NumSerializer.class) private boolean ctOccupied; - /** 非通信车占用 */ + /** + * 非通信车占用 + */ @JsonSerialize(using = Boolean2NumSerializer.class) private boolean nctOccupied; - /**是否切除*/ + /** + * 是否切除 + */ @JsonSerialize(using = Boolean2NumSerializer.class) private boolean cutOff; - /**是否失效*/ + /** + * 是否失效 + */ @JsonSerialize(using = Boolean2NumSerializer.class) private boolean invalid; - /** 故障锁闭 */ + /** + * 故障锁闭 + */ @JsonSerialize(using = Boolean2NumSerializer.class) private boolean faultLock; - /**最高限速*/ + /** + * 最高限速 + */ private int speedUpLimit; + /** + * 无状态 + */ + @JsonSerialize(using = Boolean2NumSerializer.class) + private boolean noStatus; + private String fault; public SectionStatus(Section section) { @@ -69,6 +95,7 @@ public class SectionStatus extends DeviceStatus { this.invalid = section.isInvalid(); this.faultLock = section.isFaultLock(); this.speedUpLimit = section.getSpeedUpLimit(); + this.noStatus = section.isNoStatus(); this.fault = section.getFault() == null ? null : section.getFault().toString(); } @@ -127,6 +154,11 @@ public class SectionStatus extends DeviceStatus { status.setSpeedUpLimit(this.speedUpLimit); change = true; } + if (!Objects.equals(this.noStatus, section.isNoStatus())) { + this.noStatus = section.isNoStatus(); + status.setNoStatus(noStatus); + change = true; + } return change; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SignalStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SignalStatus.java index 81a7f45f6..ecbf37477 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SignalStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SignalStatus.java @@ -1,14 +1,14 @@ package club.joylink.rtss.simulation.cbtc.data.status; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; +import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.data.map.Signal; import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.SignalStatusVO; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; import java.util.Objects; @@ -50,6 +50,9 @@ public class SignalStatus extends DeviceStatus { /** 信号机延时解锁倒计时 */ private Integer remainTime; + @JsonSerialize(using = Boolean2NumSerializer.class) + private boolean noStatus; + /**故障*/ private String fault; @@ -62,6 +65,7 @@ public class SignalStatus extends DeviceStatus { this.yellowOpen = signal.isYellowOpen(); this.redOpen = signal.isRedOpen(); this.remainTime = signal.getDelayTime(); + this.noStatus = signal.isNoStatus(); this.fault = Objects.nonNull(signal.getFault())?((Signal.SignalFault)signal.getFault()).name():null; } @@ -110,6 +114,11 @@ public class SignalStatus extends DeviceStatus { } else { status.setRemainTime(null); } + if (!Objects.equals(this.noStatus, signal.isNoStatus())) { + this.noStatus = signal.isNoStatus(); + status.setNoStatus(noStatus); + change = true; + } MayOutOfOrderDevice.DeviceFault fault = signal.getFault(); if (!Objects.equals(this.fault, Objects.nonNull(fault) ? ((Signal.SignalFault) fault).name():null)) { if(Objects.isNull(fault)){ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java index 904a5bf46..b5c628975 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java @@ -1,12 +1,12 @@ package club.joylink.rtss.simulation.cbtc.data.status; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; +import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.data.map.Stand; import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.StandStatusVO; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; import org.springframework.util.CollectionUtils; @@ -70,6 +70,9 @@ public class StandStatus extends DeviceStatus { @JsonSerialize(using = Boolean2NumSerializer.class) private boolean parkingAlwaysValid; + @JsonSerialize(using = Boolean2NumSerializer.class) + private boolean noStatus; + /**故障*/ private String fault; @@ -96,6 +99,7 @@ public class StandStatus extends DeviceStatus { this.runLevelTimeForever = stand.isRunLevelTimeForever(); this.parkingTime = stand.getParkingTime(); this.parkingAlwaysValid = stand.isParkingAlwaysValid(); + this.noStatus = stand.isNoStatus(); this.fault = Objects.nonNull(stand.getFault())?((Stand.Fault)stand.getFault()).name():null; } @@ -176,6 +180,11 @@ public class StandStatus extends DeviceStatus { status.setParkingAlwaysValid(this.parkingAlwaysValid); change = true; } + if (!Objects.equals(this.noStatus, stand.isNoStatus())) { + this.noStatus = stand.isNoStatus(); + status.setNoStatus(noStatus); + change = true; + } MayOutOfOrderDevice.DeviceFault fault = stand.getFault(); if (!Objects.equals(this.fault, Objects.nonNull(fault)?((Stand.Fault)fault).name():null)) { if(Objects.isNull(fault)) { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SwitchStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SwitchStatus.java index 3bd693718..1764c8129 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SwitchStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SwitchStatus.java @@ -1,13 +1,13 @@ package club.joylink.rtss.simulation.cbtc.data.status; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.map.Switch; import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.SwitchStatusVO; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; import java.util.Objects; @@ -58,6 +58,9 @@ public class SwitchStatus extends DeviceStatus { */ private int delayTime; + @JsonSerialize(using = Boolean2NumSerializer.class) + private boolean noStatus; + public SwitchStatus(Switch aSwitch) { super(aSwitch.getCode(), aSwitch.getDeviceType()); this.singleLock = aSwitch.isSingleLock(); @@ -68,6 +71,7 @@ public class SwitchStatus extends DeviceStatus { this.reversePosition = aSwitch.isReversePosition(); this.split = aSwitch.isSplit(); this.delayTime = aSwitch.getDelayTime() / 1000; + this.noStatus = aSwitch.isNoStatus(); } @Override @@ -116,6 +120,11 @@ public class SwitchStatus extends DeviceStatus { status.setDelayTime(dt); change = true; } + if (!Objects.equals(this.noStatus, aSwitch.isNoStatus())) { + this.noStatus = aSwitch.isNoStatus(); + status.setNoStatus(this.noStatus); + change = true; + } return change; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StoragePSD.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StoragePSD.java index fbc18efbf..8ecf291bc 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StoragePSD.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StoragePSD.java @@ -1,13 +1,13 @@ package club.joylink.rtss.simulation.cbtc.data.storage.device; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.map.PSD; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -38,6 +38,13 @@ public class StoragePSD extends StorageDevice { @JsonDeserialize(using = Boolean2NumDeserializer.class) private Boolean interlockRelease; + /** + * 无状态 + */ + @JsonSerialize(using = Boolean2NumSerializer.class) + @JsonDeserialize(using = Boolean2NumDeserializer.class) + private Boolean noStatus; + // public StoragePSD(PSD psd) { // super(psd.getCode()); // if (!psd.isClose()) { @@ -70,6 +77,10 @@ public class StoragePSD extends StorageDevice { change = true; storagePSD.setInterlockRelease(psd.isInterlockRelease()); } + if (psd.isNoStatus()) { + change = true; + storagePSD.setNoStatus(psd.isNoStatus()); + } if (change) { return storagePSD; @@ -84,5 +95,6 @@ public class StoragePSD extends StorageDevice { psd.setClose(close != null ? close : true); psd.setLock(lock != null ? lock : true); psd.setInterlockRelease(interlockRelease != null ? interlockRelease : false); + psd.setNoStatus(noStatus != null ? noStatus : false); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSection.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSection.java index 8d29571c3..c12b39fe5 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSection.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSection.java @@ -1,14 +1,14 @@ package club.joylink.rtss.simulation.cbtc.data.storage.device; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; -import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; +import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.data.map.Section; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -90,6 +90,13 @@ public class StorageSection extends StorageMayOutOfOrderDevice { */ private Integer delayTime; + /** + * 无状态 + */ + @JsonSerialize(using = Boolean2NumSerializer.class) + @JsonDeserialize(using = Boolean2NumDeserializer.class) + private Boolean noStatus; + public StorageSection(String code, MayOutOfOrderDevice.DeviceFault fault) { super(code, fault); } @@ -158,6 +165,10 @@ public class StorageSection extends StorageMayOutOfOrderDevice { change = true; storageSection.setDelayTime(section.getDelayTime()); } + if (section.isNoStatus()) { + change = true; + storageSection.setNoStatus(section.isNoStatus()); + } if (section.isFault()) { change = true; } @@ -183,5 +194,6 @@ public class StorageSection extends StorageMayOutOfOrderDevice { section.setFaultLock(faultLock != null ? faultLock : false); section.setSpeedUpLimit(speedUpLimit != null? speedUpLimit : -1); section.setDelayTime(delayTime != null ? delayTime : 0); + section.setNoStatus(noStatus != null ? noStatus : false); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSignal.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSignal.java index 5017d0dc7..f65ee2c34 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSignal.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSignal.java @@ -1,15 +1,15 @@ package club.joylink.rtss.simulation.cbtc.data.storage.device; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; -import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; +import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.data.map.Route; import club.joylink.rtss.simulation.cbtc.data.map.Signal; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -64,6 +64,13 @@ public class StorageSignal extends StorageMayOutOfOrderDevice { */ private Integer delayTime; + /** + * 无状态 + */ + @JsonSerialize(using = Boolean2NumSerializer.class) + @JsonDeserialize(using = Boolean2NumDeserializer.class) + private Boolean noStatus; + public StorageSignal(String code, MayOutOfOrderDevice.DeviceFault fault) { super(code, fault); } @@ -102,6 +109,10 @@ public class StorageSignal extends StorageMayOutOfOrderDevice { change = true; storageSignal.setDelayTime(signal.getDelayTime()); } + if (signal.isNoStatus()) { + change = true; + storageSignal.setNoStatus(signal.isNoStatus()); + } if (signal.isFault()) { change = true; } @@ -124,5 +135,6 @@ public class StorageSignal extends StorageMayOutOfOrderDevice { signal.setYellowOpen(yellowOpen != null ? yellowOpen : false); signal.setRedOpen(redOpen != null ? redOpen : true); signal.setDelayTime(delayTime != null ? delayTime : 0); + signal.setNoStatus(noStatus != null ? noStatus : false); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageStand.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageStand.java index dcd2c8eaf..6d52f69bb 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageStand.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageStand.java @@ -1,14 +1,14 @@ package club.joylink.rtss.simulation.cbtc.data.storage.device; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; -import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; +import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.data.map.Stand; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -102,6 +102,13 @@ public class StorageStand extends StorageMayOutOfOrderDevice { @JsonDeserialize(using = Boolean2NumDeserializer.class) private Boolean parkingAlwaysValid; + /** + * 无状态 + */ + @JsonSerialize(using = Boolean2NumSerializer.class) + @JsonDeserialize(using = Boolean2NumDeserializer.class) + private Boolean noStatus; + public StorageStand(String code, MayOutOfOrderDevice.DeviceFault fault) { super(code, fault); } @@ -176,6 +183,10 @@ public class StorageStand extends StorageMayOutOfOrderDevice { change = true; storageStand.setParkingAlwaysValid(stand.isParkingAlwaysValid()); } + if (stand.isNoStatus()) { + change = true; + storageStand.setNoStatus(stand.isNoStatus()); + } if (stand.isFault()) { change = true; } @@ -203,5 +214,6 @@ public class StorageStand extends StorageMayOutOfOrderDevice { stand.setRunLevelTimeForever(runLevelTimeForever != null ? runLevelTimeForever : false); stand.setParkingTime(parkingTime != null ? parkingTime : -1); stand.setParkingAlwaysValid(parkingAlwaysValid != null ? parkingAlwaysValid : false); + stand.setNoStatus(noStatus != null ? noStatus : false); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSwitch.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSwitch.java index a302b300d..b72d207d5 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSwitch.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSwitch.java @@ -1,14 +1,14 @@ package club.joylink.rtss.simulation.cbtc.data.storage.device; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; -import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; +import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice; import club.joylink.rtss.simulation.cbtc.data.map.Switch; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -79,6 +79,10 @@ public class StorageSwitch extends StorageMayOutOfOrderDevice { @JsonDeserialize(using = Boolean2NumDeserializer.class) private Boolean split; + @JsonSerialize(using = Boolean2NumSerializer.class) + @JsonDeserialize(using = Boolean2NumDeserializer.class) + private Boolean noStatus; + public StorageSwitch(String code, MayOutOfOrderDevice.DeviceFault fault) { super(code, fault); } @@ -125,6 +129,10 @@ public class StorageSwitch extends StorageMayOutOfOrderDevice { change = true; storageSwitch.setSplit(s.isSplit()); } + if (s.isNoStatus()) { + change = true; + storageSwitch.setNoStatus(s.isNoStatus()); + } if (s.isFault()) { change = true; } @@ -148,5 +156,6 @@ public class StorageSwitch extends StorageMayOutOfOrderDevice { s.setReversePosition(reversePosition != null ? reversePosition : false); s.setDelayTime(delayTime != null ? delayTime : 0); s.setSplit(split != null ? split : false); + s.setNoStatus(noStatus != null ? noStatus : false); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/PSDStatusVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/PSDStatusVO.java index 595ac5a6f..dce11c6cf 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/PSDStatusVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/PSDStatusVO.java @@ -1,8 +1,8 @@ package club.joylink.rtss.simulation.cbtc.data.vo; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; import club.joylink.rtss.simulation.cbtc.data.map.PSD; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; import lombok.Setter; @@ -26,6 +26,9 @@ public class PSDStatusVO extends DeviceStatusVO { @JsonSerialize(using = Boolean2NumSerializer.class) private Boolean interlockRelease; + @JsonSerialize(using = Boolean2NumSerializer.class) + private Boolean noStatus; + public PSDStatusVO(PSD psd) { super(psd.getCode(), psd.getDeviceType()); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SectionStatusVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SectionStatusVO.java index f43ecc27b..289f6b501 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SectionStatusVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SectionStatusVO.java @@ -52,6 +52,9 @@ public class SectionStatusVO extends DeviceStatusVO { /**最高限速*/ private Integer speedUpLimit; + @JsonSerialize(using = Boolean2NumSerializer.class) + private Boolean noStatus; + private String fault; public SectionStatusVO(Section section) { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SignalStatusVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SignalStatusVO.java index 26feed291..9a712da30 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SignalStatusVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SignalStatusVO.java @@ -1,9 +1,9 @@ package club.joylink.rtss.simulation.cbtc.data.vo; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; import club.joylink.rtss.simulation.cbtc.data.map.Signal; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -44,6 +44,9 @@ public class SignalStatusVO extends DeviceStatusVO{ @JsonInclude(JsonInclude.Include.ALWAYS) private Integer remainTime; + @JsonSerialize(using = Boolean2NumSerializer.class) + private Boolean noStatus; + /** 信号机故障 */ @JsonInclude(JsonInclude.Include.ALWAYS) private String fault; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StandStatusVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StandStatusVO.java index 8794405aa..c2cfda7bf 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StandStatusVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StandStatusVO.java @@ -1,9 +1,9 @@ package club.joylink.rtss.simulation.cbtc.data.vo; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; import club.joylink.rtss.simulation.cbtc.data.map.Stand; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; import lombok.Setter; @@ -67,6 +67,9 @@ public class StandStatusVO extends DeviceStatusVO { @JsonSerialize(using = Boolean2NumSerializer.class) private Boolean parkingAlwaysValid; + @JsonSerialize(using = Boolean2NumSerializer.class) + private Boolean noStatus; + /**故障*/ @JsonInclude(JsonInclude.Include.ALWAYS) private String fault; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SwitchStatusVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SwitchStatusVO.java index fe9035ed1..d111eaa77 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SwitchStatusVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SwitchStatusVO.java @@ -1,9 +1,9 @@ package club.joylink.rtss.simulation.cbtc.data.vo; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; import club.joylink.rtss.simulation.cbtc.data.map.Switch; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -47,6 +47,9 @@ public class SwitchStatusVO extends DeviceStatusVO { @JsonInclude private Integer delayTime; + @JsonSerialize(using = Boolean2NumSerializer.class) + private Boolean noStatus; + public SwitchStatusVO(Switch aSwitch) { super(aSwitch.getCode(), aSwitch.getDeviceType()); }