添加道岔计轴预复位的状态及处理逻辑
This commit is contained in:
parent
4e85d158e4
commit
39af42d875
@ -235,6 +235,7 @@ public class SwitchOperateHandler {
|
||||
/**道岔计轴预复位*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Switch_Axle_Pre_Reset)
|
||||
public void axlePreReset(Simulation simulation, String switchCode) {
|
||||
ciApiService.switchAxlePreReset(simulation, switchCode);
|
||||
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
|
||||
ciApiService.axlePreReset(simulation, aSwitch.getA().getParent().getCode());
|
||||
}
|
||||
|
@ -266,6 +266,13 @@ public class CILogicLoop {
|
||||
section.axleCounterClear();
|
||||
}
|
||||
section.judgeAsValid();
|
||||
//预复位
|
||||
if (!virtualAxleCounter.isPreReset()) {
|
||||
List<Switch> switchList = section.getRelSwitchList();
|
||||
if (!CollectionUtils.isEmpty(switchList)) {
|
||||
switchList.forEach(aSwitch -> aSwitch.setPreReset(false));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -324,4 +324,9 @@ public interface CiApiService {
|
||||
* 计轴预复位
|
||||
*/
|
||||
void axlePreReset(Simulation simulation, String sectionCode);
|
||||
|
||||
/**
|
||||
* 道岔计轴预复位
|
||||
*/
|
||||
void switchAxlePreReset(Simulation simulation, String switchCode);
|
||||
}
|
||||
|
@ -502,4 +502,10 @@ public class CiApiServiceImpl implements CiApiService {
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(virtualAxleCounter.isOccupy(), chooseSection + "计轴未占用,无需预复位");
|
||||
virtualAxleCounter.preReset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchAxlePreReset(Simulation simulation, String switchCode) {
|
||||
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
|
||||
aSwitch.setPreReset(true);
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +257,13 @@ public class RouteService {
|
||||
List<Section> sectionList = route.getSectionList();
|
||||
for (Section section : sectionList) {
|
||||
if (section.isOccupied() && !section.isPreReset()) {
|
||||
return new Route.CheckFailMessage(Route.CheckFailReason.SectionNotFree, section);
|
||||
if (section.isSwitchTrack()) {
|
||||
if (!section.getRelSwitch().isPreReset()) {
|
||||
return new Route.CheckFailMessage(Route.CheckFailReason.SectionNotFree, section);
|
||||
}
|
||||
} else {
|
||||
return new Route.CheckFailMessage(Route.CheckFailReason.SectionNotFree, section);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 延续保护检查
|
||||
@ -751,6 +757,7 @@ public class RouteService {
|
||||
// 设置延时
|
||||
route.getStart().setDelayTime(route.getDelayReleaseTime() * 1000);
|
||||
route.setDelayUnlocking(true);
|
||||
route.getLogicSections().forEach(section -> section.setDelayUnlock(true));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -770,6 +777,7 @@ public class RouteService {
|
||||
// 进路解锁完成
|
||||
route.setDelayUnlocking(false);
|
||||
start.setDelayTime(0);
|
||||
route.getLogicSections().forEach(section -> section.setDelayUnlock(false));
|
||||
} else {
|
||||
start.setDelayTime(delayTime);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package club.joylink.rtss.simulation.cbtc.command;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
|
||||
@ -165,9 +166,11 @@ public class CommandBO {
|
||||
}
|
||||
} else {
|
||||
SectionPosition nextStopPosition = train.calculateNextStandStopPosition();
|
||||
if (nextStopPosition == null) {
|
||||
if (nextStopPosition == null && train.getTarget() != null) {
|
||||
nextStopPosition = new SectionPosition(train.getTarget(), train.getTarget().getStopPointByDirection(right));
|
||||
}
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(nextStopPosition,
|
||||
train.debugStr() + "找不到下一个停车点");
|
||||
stepList.add(buildDriveStep(nextStopPosition));
|
||||
}
|
||||
stepList.add(buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.CM));
|
||||
|
@ -493,6 +493,21 @@ public class Route extends MapNamedElement {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取进路的所有子区段
|
||||
*/
|
||||
public List<Section> getLogicSections() {
|
||||
List<Section> sections = new ArrayList<>();
|
||||
for (Section section : sectionList) {
|
||||
if (CollectionUtils.isEmpty(section.getLogicList())) {
|
||||
sections.add(section);
|
||||
} else {
|
||||
sections.addAll(section.getLogicList());
|
||||
}
|
||||
}
|
||||
return sections;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进路检查失败原因
|
||||
*/
|
||||
|
@ -219,6 +219,11 @@ public class Section extends MayOutOfOrderDevice {
|
||||
*/
|
||||
private boolean noStatus;
|
||||
|
||||
/**
|
||||
* 延时解锁
|
||||
*/
|
||||
private boolean delayUnlock;
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
@ -234,6 +239,7 @@ public class Section extends MayOutOfOrderDevice {
|
||||
this.speedUpLimit = -1;
|
||||
this.delayTime = 0;
|
||||
this.noStatus = false;
|
||||
this.delayUnlock = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -919,6 +925,9 @@ public class Section extends MayOutOfOrderDevice {
|
||||
* 是否预复位
|
||||
*/
|
||||
public boolean isPreReset() {
|
||||
if (switchTrack) {
|
||||
return false;
|
||||
}
|
||||
if (virtualAxleCounter == null) {
|
||||
if (parent != null)
|
||||
return parent.isPreReset();
|
||||
|
@ -99,6 +99,11 @@ public class Switch extends MayOutOfOrderDevice {
|
||||
*/
|
||||
private boolean noStatus;
|
||||
|
||||
/**
|
||||
* 预复位
|
||||
*/
|
||||
private boolean preReset;
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
|
@ -87,6 +87,9 @@ public class SectionStatus extends DeviceStatus {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean preReset;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean delayUnlock;
|
||||
|
||||
private String fault;
|
||||
|
||||
public SectionStatus(Section section) {
|
||||
@ -103,6 +106,7 @@ public class SectionStatus extends DeviceStatus {
|
||||
this.speedUpLimit = section.getSpeedUpLimit();
|
||||
this.noStatus = section.isNoStatus();
|
||||
this.preReset = section.isPreReset();
|
||||
this.delayUnlock = section.isDelayUnlock();
|
||||
this.fault = section.getFault() == null ? null : section.getFault().toString();
|
||||
}
|
||||
|
||||
@ -171,6 +175,11 @@ public class SectionStatus extends DeviceStatus {
|
||||
status.setPreReset(this.preReset);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.delayUnlock, section.isDelayUnlock())) {
|
||||
this.delayUnlock = section.isDelayUnlock();
|
||||
status.setDelayUnlock(this.delayUnlock);
|
||||
change = true;
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@ -188,6 +197,7 @@ public class SectionStatus extends DeviceStatus {
|
||||
statusVO.setBlockade(blockade);
|
||||
statusVO.setNoStatus(noStatus);
|
||||
statusVO.setPreReset(preReset);
|
||||
statusVO.setDelayUnlock(delayUnlock);
|
||||
return statusVO;
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,9 @@ public class SwitchStatus extends DeviceStatus {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean noStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private boolean preReset;
|
||||
|
||||
/**
|
||||
* 故障
|
||||
*/
|
||||
@ -79,6 +82,7 @@ public class SwitchStatus extends DeviceStatus {
|
||||
this.reversePosition = aSwitch.isReversePosition();
|
||||
this.delayTime = aSwitch.getDelayTime() / 1000;
|
||||
this.noStatus = aSwitch.isNoStatus();
|
||||
this.preReset = aSwitch.isPreReset();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -132,6 +136,11 @@ public class SwitchStatus extends DeviceStatus {
|
||||
status.setNoStatus(this.noStatus);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.preReset, aSwitch.isPreReset())) {
|
||||
this.preReset = aSwitch.isPreReset();
|
||||
status.setPreReset(this.preReset);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.fault, aSwitch.getFault())) {
|
||||
this.fault = (Switch.SwitchFault) aSwitch.getFault();
|
||||
status.setFault(this.fault != null ? this.fault.name() : null);
|
||||
@ -151,6 +160,7 @@ public class SwitchStatus extends DeviceStatus {
|
||||
statusVO.setBlockade(blockade);
|
||||
statusVO.setSingleLock(singleLock);
|
||||
statusVO.setNoStatus(noStatus);
|
||||
statusVO.setPreReset(preReset);
|
||||
statusVO.setFault(this.fault != null ? this.fault.name() : null);
|
||||
return statusVO;
|
||||
}
|
||||
|
@ -58,6 +58,9 @@ public class SectionStatusVO extends DeviceStatusVO {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean preReset;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean delayUnlock;
|
||||
|
||||
private String fault;
|
||||
|
||||
public SectionStatusVO(Section section) {
|
||||
|
@ -52,6 +52,9 @@ public class SwitchStatusVO extends DeviceStatusVO {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean noStatus;
|
||||
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean preReset;
|
||||
|
||||
@JsonInclude
|
||||
private String fault;
|
||||
|
||||
|
@ -68,6 +68,8 @@ public class VirtualRealitySectionAxleCounter extends VirtualRealityDevice {
|
||||
public void preReset() {
|
||||
if (occupy) {
|
||||
this.preReset = true;
|
||||
this.leftCount = 0;
|
||||
this.rightCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,6 +85,7 @@ public class VirtualRealitySectionAxleCounter extends VirtualRealityDevice {
|
||||
* @param trainRight 列车运行方向
|
||||
*/
|
||||
public void trainIn(boolean trainRight) {
|
||||
System.out.println("列车进入计轴区段");
|
||||
if (trainRight) {
|
||||
leftCount++;
|
||||
} else {
|
||||
@ -97,6 +100,7 @@ public class VirtualRealitySectionAxleCounter extends VirtualRealityDevice {
|
||||
* @param trainRight 列车运行方向
|
||||
*/
|
||||
public void trainOut(boolean trainRight) {
|
||||
System.out.println("列车离开计轴区段");
|
||||
if (trainRight) {
|
||||
leftCount--;
|
||||
} else {
|
||||
@ -112,6 +116,7 @@ public class VirtualRealitySectionAxleCounter extends VirtualRealityDevice {
|
||||
public void judgePreResetSuccess() {
|
||||
if (preReset) {
|
||||
if (leftCount == 0 && rightCount == 0) {
|
||||
preReset = false;
|
||||
if (Fault.FAULT.equals(this.fault)) {
|
||||
this.fault = null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user