ibp紧急停车按钮逻辑
This commit is contained in:
parent
f8abb9eddc
commit
2fb256cf0e
@ -82,11 +82,13 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
||||
upStands.forEach(stand -> ciApiService.standHoldTrainCancel(simulation, stand.getCode(), false));
|
||||
break;
|
||||
case JJTC:
|
||||
ibp.setJjtcLight(true);
|
||||
upStands.forEach(stand -> ciApiService.standEB(simulation, stand));
|
||||
downStands.forEach(stand -> ciApiService.standEB(simulation, stand));
|
||||
ibp.setJjtcBuzzer(true);
|
||||
break;
|
||||
case QXJJTC:
|
||||
ibp.setJjtcLight(false);
|
||||
upStands.forEach(stand -> ciApiService.cancelStandEB(simulation, stand));
|
||||
downStands.forEach(stand -> ciApiService.cancelStandEB(simulation, stand));
|
||||
break;
|
||||
case BJQC:
|
||||
ibp.setJjtcBuzzer(false);
|
||||
@ -166,6 +168,7 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
||||
//上行扣车
|
||||
vrIbp.setSxkcLight(upStands.stream().anyMatch(Stand::isStationHoldTrain));
|
||||
//紧急停车灯
|
||||
vrIbp.setJjtcLight(downStands.stream().allMatch(Stand::isEmergencyClosed) && upStands.stream().allMatch(Stand::isEmergencyClosed));
|
||||
//下行关门
|
||||
vrIbp.setXxgmLight(downStands.stream().allMatch(stand -> stand.getPsd().isCloseAndLock()));
|
||||
//下行开门
|
||||
|
@ -21,7 +21,6 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -145,9 +144,11 @@ public class ZCLogicLoop {
|
||||
SectionPosition tailPosition = train.calculateTailPosition();
|
||||
Section tailSection = tailPosition.getSection();
|
||||
MovementAuthority.End end = checkPsdOpen(tailSection);
|
||||
if (Objects.nonNull(end)) {
|
||||
return Arrays.asList(end);
|
||||
}
|
||||
if (end != null)
|
||||
return List.of(end);
|
||||
MovementAuthority.End ecStandEnd = checkEC(tailSection);
|
||||
if (ecStandEnd != null)
|
||||
return List.of(ecStandEnd);
|
||||
// 如果车尾正常,从车头开始往前查找
|
||||
Section section = headPosition.getSection();
|
||||
List<MovementAuthority.End> endList = new ArrayList<>();
|
||||
@ -223,6 +224,18 @@ public class ZCLogicLoop {
|
||||
return endList;
|
||||
}
|
||||
|
||||
private MovementAuthority.End checkEC(Section tailSection) {
|
||||
if (tailSection.isNormalStandTrack()) {
|
||||
List<Stand> standList = tailSection.getStandList();
|
||||
for (Stand stand : standList) {
|
||||
if (stand.isEmergencyClosed()) {
|
||||
new MovementAuthority.End(stand, MovementAuthority.EndType.EC_STAND, tailSection);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private MovementAuthority.End checkUnlockedOverlap(Simulation simulation, Section section, boolean right) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
// 判断是否已经办理进路的区段
|
||||
|
@ -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.Stand;
|
||||
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;
|
||||
@ -303,4 +304,14 @@ public interface CiApiService {
|
||||
* 重启令解
|
||||
*/
|
||||
void restart(Simulation simulation, Station station);
|
||||
|
||||
/**
|
||||
* 站台紧急停车
|
||||
*/
|
||||
void standEB(Simulation simulation, Stand stand);
|
||||
|
||||
/**
|
||||
* 取消站台紧急停车
|
||||
*/
|
||||
void cancelStandEB(Simulation simulation, Stand stand);
|
||||
}
|
||||
|
@ -441,4 +441,14 @@ public class CiApiServiceImpl implements CiApiService {
|
||||
signals.forEach(Signal::reset);
|
||||
deviceStation.setInterlockMachineStarting(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void standEB(Simulation simulation, Stand stand) {
|
||||
stand.getEsp().update(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelStandEB(Simulation simulation, Stand stand) {
|
||||
stand.getEsp().update(false);
|
||||
}
|
||||
}
|
||||
|
@ -729,6 +729,14 @@ public class RouteService {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 站台紧急停车
|
||||
if (!CollectionUtils.isEmpty(route.getEspList())) {
|
||||
for (ESP esp : route.getEspList()) {
|
||||
if (esp.isEffective()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 道岔位置一致检查
|
||||
Set<Switch> sectionRelSwitches = sectionList.stream().map(Section::getRelSwitch).collect(Collectors.toSet());
|
||||
for (SwitchElement element : route.getSwitchList()) {
|
||||
@ -804,14 +812,6 @@ public class RouteService {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 站台紧急停车
|
||||
if (!CollectionUtils.isEmpty(route.getEspList())) {
|
||||
for (ESP esp : route.getEspList()) {
|
||||
if (esp.isEffective()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -66,11 +66,6 @@ public class Stand extends MayOutOfOrderDevice {
|
||||
*/
|
||||
private boolean trainParking;
|
||||
|
||||
/**
|
||||
* 站台紧急关闭
|
||||
*/
|
||||
private boolean emergencyClosed;
|
||||
|
||||
/**
|
||||
* 列车停站倒计时,单位ms
|
||||
*/
|
||||
@ -146,8 +141,10 @@ public class Stand extends MayOutOfOrderDevice {
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
if (this.esp != null) {
|
||||
this.esp.reset();
|
||||
}
|
||||
this.trainParking = false;
|
||||
this.emergencyClosed = false;
|
||||
this.remainTime = 0;
|
||||
this.stationHoldTrain = false;
|
||||
this.centerHoldTrain = false;
|
||||
@ -161,6 +158,10 @@ public class Stand extends MayOutOfOrderDevice {
|
||||
this.noStatus = false;
|
||||
}
|
||||
|
||||
public boolean isEmergencyClosed() {
|
||||
return esp.isEffective();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否扣车状态
|
||||
*/
|
||||
|
@ -76,6 +76,7 @@ public class PSDStatus extends DeviceStatus {
|
||||
PSDStatusVO statusVO = new PSDStatusVO((PSD) device);
|
||||
statusVO.setClose(close);
|
||||
statusVO.setInterlockRelease(interlockRelease);
|
||||
statusVO.setNoStatus(noStatus);
|
||||
return statusVO;
|
||||
}
|
||||
|
||||
|
@ -174,6 +174,7 @@ public class SectionStatus extends DeviceStatus {
|
||||
statusVO.setOverlapLock(overlapLock);
|
||||
statusVO.setRouteLock(routeLock);
|
||||
statusVO.setBlockade(blockade);
|
||||
statusVO.setNoStatus(noStatus);
|
||||
return statusVO;
|
||||
}
|
||||
|
||||
|
@ -142,6 +142,7 @@ public class SignalStatus extends DeviceStatus {
|
||||
statusVO.setLogicLight(logicLight);
|
||||
statusVO.setBlockade(blockade);
|
||||
statusVO.setLockedRouteCode(lockedRouteCode);
|
||||
statusVO.setNoStatus(noStatus);
|
||||
statusVO.setFault(fault);
|
||||
return statusVO;
|
||||
}
|
||||
|
@ -214,6 +214,7 @@ public class StandStatus extends DeviceStatus {
|
||||
statusVO.setEmergencyClosed(emergencyClosed);
|
||||
statusVO.setTrainParking(trainParking);
|
||||
statusVO.setRemainTime(remainTime);
|
||||
statusVO.setNoStatus(noStatus);
|
||||
statusVO.setFault(fault);
|
||||
return statusVO;
|
||||
}
|
||||
|
@ -138,6 +138,7 @@ public class SwitchStatus extends DeviceStatus {
|
||||
statusVO.setRouteLock(routeLock);
|
||||
statusVO.setBlockade(blockade);
|
||||
statusVO.setSingleLock(singleLock);
|
||||
statusVO.setNoStatus(noStatus);
|
||||
return statusVO;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package club.joylink.rtss.simulation.cbtc.data.storage.device;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.ESP;
|
||||
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;
|
||||
@ -22,6 +23,8 @@ import java.util.Set;
|
||||
@NoArgsConstructor
|
||||
public class StorageStand extends StorageMayOutOfOrderDevice {
|
||||
|
||||
private StorageESP esp;
|
||||
|
||||
/**
|
||||
* 列车在站台停靠
|
||||
*/
|
||||
@ -135,6 +138,11 @@ public class StorageStand extends StorageMayOutOfOrderDevice {
|
||||
if (storageStand.isFault()) {
|
||||
change = true;
|
||||
}
|
||||
StorageESP storageESP = StorageESP.convert(stand.getEsp());
|
||||
if (storageESP != null) {
|
||||
change = true;
|
||||
storageStand.setEsp(storageESP);
|
||||
}
|
||||
if (stand.isTrainParking()) {
|
||||
change = true;
|
||||
storageStand.setTrainParking(stand.isTrainParking());
|
||||
@ -202,7 +210,6 @@ public class StorageStand extends StorageMayOutOfOrderDevice {
|
||||
super.recover2Simulation(element, simulation, repository);
|
||||
Stand stand = (Stand) element;
|
||||
stand.setTrainParking(trainParking != null ? trainParking : false);
|
||||
stand.setEmergencyClosed(emergencyClosed != null ? emergencyClosed : false);
|
||||
stand.setRemainTime(remainTime != null ? remainTime : 0);
|
||||
stand.setStationHoldTrain(stationHoldTrain != null ? stationHoldTrain : false);
|
||||
stand.setCenterHoldTrain(centerHoldTrain != null ? centerHoldTrain : false);
|
||||
@ -216,4 +223,26 @@ public class StorageStand extends StorageMayOutOfOrderDevice {
|
||||
stand.setParkingAlwaysValid(parkingAlwaysValid != null ? parkingAlwaysValid : false);
|
||||
stand.setNoStatus(noStatus != null ? noStatus : false);
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
static class StorageESP {
|
||||
|
||||
private Boolean effective;
|
||||
|
||||
public static StorageESP convert(ESP esp) {
|
||||
if (esp == null)
|
||||
return null;
|
||||
boolean change = false;
|
||||
StorageESP storageESP = new StorageESP();
|
||||
if (esp.isEffective()) {
|
||||
change = true;
|
||||
storageESP.setEffective(true);
|
||||
}
|
||||
if (change)
|
||||
return storageESP;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,6 +126,10 @@ public class MovementAuthority {
|
||||
float offset = right ? 0 : section.getLen();
|
||||
return new SectionPosition(section, offset);
|
||||
}
|
||||
case EC_STAND: {
|
||||
float offset = right ? 0 : baseSection.getLen();
|
||||
return new SectionPosition(baseSection, offset);
|
||||
}
|
||||
default: {
|
||||
throw new SimulationException(SimulationExceptionType.System_Fault,
|
||||
String.format("未知的移动授权终端类型:[%s]", this.type));
|
||||
@ -186,6 +190,10 @@ public class MovementAuthority {
|
||||
* 故障区段
|
||||
*/
|
||||
FAULT_SECTION,
|
||||
/**
|
||||
* 紧急关闭的站台
|
||||
*/
|
||||
EC_STAND,
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user