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 571cb2344..81749a6c9 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 @@ -110,6 +110,9 @@ public class ZCLogicLoop { MovementAuthority.End ecStandEnd = checkEC(tailSection); if (ecStandEnd != null) return List.of(ecStandEnd); + MovementAuthority.End closedSection = checkClosedSection(tailSection); + if (closedSection != null) + return List.of(closedSection); // 如果车尾正常,从车头开始往前查找 Section section = headPosition.getSection(); List endList = new ArrayList<>(); @@ -191,6 +194,13 @@ public class ZCLogicLoop { } break; } + //检查关闭的区段 + MovementAuthority.End cs = checkClosedSection(section); + if (cs != null) { + deviceEnd = cs; + break; + } + section = temp; } if (Objects.nonNull(deviceEnd)) { // 找到移动授权终端,结束 @@ -199,6 +209,13 @@ public class ZCLogicLoop { return endList; } + private MovementAuthority.End checkClosedSection(Section section) { + if (section.isClosed()) { + return new MovementAuthority.End(section, MovementAuthority.EndType.CLOSED_SECTION); + } + return null; + } + private MovementAuthority.End checkEC(Section tailSection) { if (tailSection.isNormalStandTrack()) { List standList = tailSection.getStandList(); 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 9ef798acd..d50946d09 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 @@ -113,6 +113,14 @@ public class Operation { Section_Details(), /**强解*/ Section_Force_Unlock(), + /** 初始化开放 */ + Section_Initialize_Open, + /** 开放 */ + Section_Open, + /** 初始化关闭 */ + Section_Initialize_Close, + /** 关闭 */ + Section_Close, //--------------------------- 信号机 --------------------------- /** 封锁 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SectionOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SectionOperateHandler.java index b7bb41aea..6a643e4c5 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SectionOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SectionOperateHandler.java @@ -117,4 +117,28 @@ public class SectionOperateHandler { this.atsSectionService.confirmAxleValid(simulation, section); } + @OperateHandlerMapping(type = Operation.Type.Section_Initialize_Open) + public void initializeOpen(Simulation simulation, String sectionCode) { + Section section = simulation.getRepository().getByCode(sectionCode, Section.class); + atsSectionService.initializeOpen(simulation, section); + } + + @OperateHandlerMapping(type = Operation.Type.Section_Open) + public void open(Simulation simulation, String sectionCode) { + Section section = simulation.getRepository().getByCode(sectionCode, Section.class); + atsSectionService.open(simulation, section); + } + + @OperateHandlerMapping(type = Operation.Type.Section_Initialize_Close) + public void initializeClose(Simulation simulation, String sectionCode) { + Section section = simulation.getRepository().getByCode(sectionCode, Section.class); + atsSectionService.initializeClose(simulation, section); + } + + @OperateHandlerMapping(type = Operation.Type.Section_Close) + public void close(Simulation simulation, String sectionCode) { + Section section = simulation.getRepository().getByCode(sectionCode, Section.class); + atsSectionService.close(simulation, section); + } + } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsSectionService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsSectionService.java index feb1cb1fb..1baced6cd 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsSectionService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsSectionService.java @@ -1,5 +1,6 @@ package club.joylink.rtss.simulation.cbtc.ATS.service; +import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.map.Section; import lombok.extern.slf4j.Slf4j; @@ -51,4 +52,39 @@ public class AtsSectionService { section.confirmValid(); } + /** + * 初始化开放操作 + */ + public void initializeOpen(Simulation simulation, Section section) { + section.setOpenInit(true); + } + + /** + * 开放区段 + */ + public void open(Simulation simulation, Section section) { + if (simulation.getRepository().getConfig().isSomeCommandNeedInit()) { + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(section.isOpenInit(), section.debugStr() + "没有初始化开放操作"); + } + section.setOpenInit(false); + section.setClosed(false); + } + + /** + * 初始化关闭操作 + */ + public void initializeClose(Simulation simulation, Section section) { + section.setCloseInit(true); + } + + /** + * 关闭区段 + */ + public void close(Simulation simulation, Section section) { + if (simulation.getRepository().getConfig().isSomeCommandNeedInit()) { + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(section.isCloseInit(), section.debugStr() + "没有初始化开放操作"); + } + section.setCloseInit(false); + section.setClosed(true); + } } 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 e074cd8c2..beb921716 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 @@ -155,7 +155,7 @@ public class Section extends MayOutOfOrderDevice { // ------------------状态属性--------------------- /** - * 是否封锁 + * 是否封锁(封锁后,包含区段的进路不能排列) */ private boolean blockade; @@ -224,6 +224,21 @@ public class Section extends MayOutOfOrderDevice { */ private boolean delayUnlock; + /** + * 关闭操作初始化(初始化后才能使用关闭操作) + */ + private boolean closeInit; + + /** + * 开放操作初始化(初始化后才能使用开放操作) + */ + private boolean openInit; + + /** + * 关闭(关闭后列车不能进入该区段,已在该区段的紧急制动) + */ + private boolean closed; + @Override public void reset() { super.reset(); @@ -240,6 +255,9 @@ public class Section extends MayOutOfOrderDevice { this.delayTime = 0; this.noStatus = false; this.delayUnlock = false; + this.closeInit = false; + this.openInit = false; + this.closed = false; } /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/support/MovementAuthority.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/support/MovementAuthority.java index 26797dcd7..69a615ab8 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/support/MovementAuthority.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/support/MovementAuthority.java @@ -132,7 +132,8 @@ public class MovementAuthority { case FAULT_SWITCH: case UNLOCK_SECTION: case NCT_OCCUPIED_IN_FRONT_OF_SECTION: - case FAULT_SECTION: { + case FAULT_SECTION: + case CLOSED_SECTION: { Section section = (Section) this.device; float offset = right ? 0 : section.getLen(); return new SectionPosition(section, offset); @@ -205,6 +206,10 @@ public class MovementAuthority { * 紧急关闭的站台 */ EC_STAND, + /** + * 关闭的区段 + */ + CLOSED_SECTION, } }