添加<区段开放/关闭>操作

This commit is contained in:
joylink_zhangsai 2021-02-24 15:40:47 +08:00
parent aa7e69f7dd
commit f289618709
6 changed files with 110 additions and 2 deletions

View File

@ -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<MovementAuthority.End> 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<Stand> standList = tailSection.getStandList();

View File

@ -113,6 +113,14 @@ public class Operation {
Section_Details(),
/**强解*/
Section_Force_Unlock(),
/** 初始化开放 */
Section_Initialize_Open,
/** 开放 */
Section_Open,
/** 初始化关闭 */
Section_Initialize_Close,
/** 关闭 */
Section_Close,
//--------------------------- 信号机 ---------------------------
/** 封锁 */

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}
/**

View File

@ -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,
}
}