Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
walker-sheng 2021-04-28 17:29:02 +08:00
commit ecdd948079
5 changed files with 45 additions and 31 deletions

View File

@ -41,7 +41,7 @@ public class CilRouteLogicService {
if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) { //进路首区段占用
cilSignal.initGuideTime();
}
cilSignalLogicService.UpdateSignalDisplay(simulation, cilSignal, CilSignal.GUIDE, false);
cilSignalLogicService.update2GuideAspect(simulation, cilSignal);
}
public void masterUnlock(RtSimulation simulation, boolean right) {
@ -99,7 +99,7 @@ public class CilRouteLogicService {
//进路锁闭但因为区段占用导致无法开放信号
if (cilRoute.isLock()) {
if (cilSignal.isForbidAspect(commonSignal.isShunting())) {
cilSignalLogicService.UpdateSignalDisplay(simulation, cilSignal, CilSignal.GUIDE, false);
cilSignalLogicService.update2GuideAspect(simulation, cilSignal);
if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) { //进路首区段占用
cilSignal.initGuideTime();
}
@ -404,7 +404,7 @@ public class CilRouteLogicService {
//信号开放条件检查不通过时关闭信号
if (!cilSignal.isForbidAspect(commonSignal.isShunting())) {
if (!canOpenSignal(rtSimulation, cilRoute.getId())) {
cilSignalLogicService.try2UpdateSignalDisplay(rtSimulation, cilSignal, CilSignal.RED, false);
cilSignalLogicService.update2ForbiddenAspect(rtSimulation, cilSignal.getId());
}
}
}
@ -740,7 +740,7 @@ public class CilRouteLogicService {
this.try2RouteLockSwitches(cilRepository, route.getId(), route.getPathElement().getSpList()); //道岔锁闭应该不会失败
this.routeLockSections(cilRepository, route); //区段锁闭
CilSignal cilSignal = cilRepository.getSignalById(route.getStart().getId());//修改信号机信号级别
cilSignalLogicService.UpdateSignalDisplay(simulation, cilSignal, CilSignal.GUIDE, false); //开放引导信号
cilSignalLogicService.update2GuideAspect(simulation, cilSignal); //开放引导信号
// route.getPathElement().getAllSectionList().forEach(cs->{
// CilSection cilSection = cilRepository.getSectionById(cs.getId());
//// if (!cilSection.isAxcOccupy()) {
@ -765,10 +765,10 @@ public class CilRouteLogicService {
if (cilSignal.getGuideTime() == 0) {
cilSignalLogicService.update2ForbiddenAspect(rtSimulation, cilSignal.getId());
}
} else {
if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) {
cilSignalLogicService.update2ForbiddenAspect(rtSimulation, cilSignal.getId());
}
} else { //列车进入进路不能这么判断
// if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) {
// cilSignalLogicService.update2ForbiddenAspect(rtSimulation, cilSignal.getId());
// }
}
}
}

View File

@ -28,12 +28,22 @@ public class CilSignalLogicService {
CommonSignal commonSignal = commonRepository.getSignalById(signalId);
CilSignal cilSignal = cilRepository.getSignalById(signalId);
if (commonSignal.isShunting()) {
UpdateSignalDisplay(simulation, cilSignal, CilSignal.A, false);
UpdateSignalDisplay(simulation, cilSignal, SrSignal.A, false);
} else {
UpdateSignalDisplay(simulation, cilSignal, CilSignal.RED, false);
UpdateSignalDisplay(simulation, cilSignal, SrSignal.H, false);
}
}
public void update2GuideAspect(RtSimulation simulation, String signalId) {
CilRepository cilRepository = simulation.getRepository(CilRepository.NAME, CilRepository.class);
CilSignal cilSignal = cilRepository.getSignalById(signalId);
UpdateSignalDisplay(simulation, cilSignal, SrSignal.BH, false);
}
public void update2GuideAspect(RtSimulation simulation, CilSignal cilSignal) {
UpdateSignalDisplay(simulation, cilSignal, SrSignal.BH, false);
}
/**
* 信号机接近区段占用
*/

View File

@ -35,7 +35,7 @@ public class CilRoute extends CilDevice {
@Setter
private boolean delayUnlocking; //延时解锁中
@Setter
boolean gl;
boolean gl; //引导锁闭
public CilRoute(String id, String name) {
super(id, name);
@ -43,7 +43,21 @@ public class CilRoute extends CilDevice {
@Override
public void init() {
overlap = null;
ars = false;
arc = false;
flt = false;
waitTurnMap.clear();
waitOnPositionMap.clear();
stageStartTime = null;
signalState = 0;
lock = false;
ol = false;
fl = false;
canAutoOpen = true;
trainIn = false;
delayUnlocking = false;
gl = false;
}
// public boolean isOpenAspect() {

View File

@ -10,19 +10,7 @@ public class CilSignal extends CilDevice {
public static final int DEFAULT_DELAY_TIME = 30 * 1000; //进路延时解锁默认时长
public static final int DEFAULT_GUIDE_TIME = 15 * 1000; //引导信号有效时长
int signalAspect = RED; //当前显示的信号
public static final int RED = 1; // 红灯信号(禁止信号)
public static final int GREEN = 2; // 绿灯信号(直向通行)
public static final int YELLOW = 3; // 黄灯信号(侧向通行)
public static final int GUIDE = 4; // 引导信号(正线为黄红)
public static final int LL = 5; // 绿绿
public static final int LH = 6; // 绿黄
public static final int HH = 7; // 黄黄
public static final int HSH = 8; // 黄闪黄
public static final int BH = 9; // 白红
public static final int A = 10; //
public static final int B = 11; //
public static final int HS = 12; // 红闪
int signalAspect = SrSignal.H; //当前显示的信号
boolean logic;
boolean forceLight; // 强制点灯
@Setter
@ -56,7 +44,7 @@ public class CilSignal extends CilDevice {
@Override
public void init() {
signalAspect = RED;
signalAspect = SrSignal.H;
logic = false;
forceLight = false;
bl = false;
@ -80,9 +68,9 @@ public class CilSignal extends CilDevice {
public boolean isForbidAspect(boolean shunting) {
if (shunting) {
return this.signalAspect == A;
return this.signalAspect == SrSignal.A;
} else {
return this.signalAspect == RED;
return this.signalAspect == SrSignal.H;
}
}
@ -115,10 +103,10 @@ public class CilSignal extends CilDevice {
// default:
// throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception(String.format("未知的显示状态[%s]", aspect));
// }
if (aspect == RED) {
if (aspect == SrSignal.H) {
return true;
}
if (aspect == GUIDE) {
if (aspect == SrSignal.BH) {
return level == LEVEL_2 || level == LEVEL_3 || level == LEVEL_4;
}
return level == LEVEL_4;
@ -185,6 +173,6 @@ public class CilSignal extends CilDevice {
}
public boolean isGuideAspect() {
return this.signalAspect == GUIDE;
return this.signalAspect == SrSignal.BH;
}
}

View File

@ -132,6 +132,8 @@ public class SrdRepositoryBuilder {
for (MapSignalNewVO signalVO : signalList) {
SrSignal srSignal = new SrSignal(signalVO.getCode());
srSignal.shunting = Signal.SignalType.SHUNTING.equals(signalVO.getType());
if (srSignal.shunting)
srSignal.state = SrSignal.A;
signalMap.put(srSignal.getId(), srSignal);
}
}