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

This commit is contained in:
walker-sheng 2021-04-23 15:23:34 +08:00
commit a261c9e3e9
15 changed files with 268 additions and 126 deletions

View File

@ -41,10 +41,4 @@ public class RtSimulationController {
this.rtSimulationService.init(id);
}
@ApiOperation(value = "清除仿真")
@DeleteMapping("/{group}/clear")
public void clearSimulation(@PathVariable String group, @ApiIgnore @RequestAttribute UserVO user) {
this.rtSimulationService.clearSimulation(group, user);
}
}

View File

@ -170,12 +170,14 @@ public class MapSystemService implements IMapSystemService {
@Override
public void updateMapSystem(Long id, MapSystemVO mapSystemVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(mapSystemVO.getName(), "名称不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(mapSystemVO.getNewApi(), "是否使用新版接口不能为空");
MapSystem mapSystem = getEntity(id);
if (StringUtils.hasText(mapSystemVO.getName()) && !Objects.equals(mapSystem.getName(), mapSystemVO.getName())) {
mapSystem.setName(mapSystemVO.getName());
mapSystem.setNewApi(mapSystemVO.getNewApi());
mapSystemDAO.updateByPrimaryKey(mapSystem);
}
if (Objects.equals(mapSystemVO.getName(), mapSystem.getName()) && Objects.equals(mapSystemVO.getNewApi(), mapSystem.getNewApi()))
return;
mapSystem.setName(mapSystemVO.getName());
mapSystem.setNewApi(mapSystemVO.getNewApi());
mapSystemDAO.updateByPrimaryKey(mapSystem);
}
@Override

View File

@ -18,6 +18,7 @@ public class CilApiService {
/**
* 转动道岔
*
* @param simulation
* @param id
*/
@ -27,6 +28,7 @@ public class CilApiService {
/**
* 定操
*
* @param simulation
* @param id
*/
@ -36,6 +38,7 @@ public class CilApiService {
/**
* 反操
*
* @param simulation
* @param id
*/
@ -43,9 +46,13 @@ public class CilApiService {
this.cilSwitchLogicService.turn(simulation, id, CilSwitch.REVERSE);
}
public void setRoute(RtSimulation simulation, String id) {
public boolean setRoute(RtSimulation simulation, String id) {
CilRepository repository = simulation.getRepository(CilRepository.NAME, CilRepository.class);
CilRoute cilRoute = repository.getRouteById(id);
cilRouteLogicService.setRoute(simulation, cilRoute);
return cilRouteLogicService.setRoute(simulation, cilRoute);
}
public boolean cancelRoute(RtSimulation simulation, String id) {
return cilRouteLogicService.cancelRoute(simulation, id);
}
}

View File

@ -3,7 +3,7 @@ package club.joylink.rtss.simulation.rt.CIL;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.rt.CIL.bo.*;
import club.joylink.rtss.simulation.rt.RtSimulation;
import club.joylink.rtss.simulation.rt.SRD.SrdApiService;
import club.joylink.rtss.simulation.rt.SRD.bo.SrSignal;
import club.joylink.rtss.simulation.rt.repo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -14,9 +14,6 @@ import java.util.List;
@Component
public class CilRouteLogicService {
@Autowired
private SrdApiService srdApiService;
@Autowired
private CilSwitchLogicService cilSwitchLogicService;
@ -46,9 +43,12 @@ public class CilRouteLogicService {
* @return 是否办理
*/
public boolean setRoute(RtSimulation rtSimulation, CilRoute cilRoute) {
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
if (cilRepository.isSupervised(cilRoute.getId())) {
return false;
}
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
CommonRoute commonRoute = commonRepository.getRouteById(cilRoute.getId());
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
// 检查
// 延续保护选择
this.selectRouteOverlap(cilRepository, commonRoute, cilRoute);
@ -80,8 +80,38 @@ public class CilRouteLogicService {
return true;
}
public boolean cancelRoute(RtSimulation rtSimulation, CilRoute cilRoute) {
return false;
public boolean cancelRoute(RtSimulation rtSimulation, String routeId) {
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
if (!cilRepository.isSupervised(routeId)) {
return false;
}
CilRoute cilRoute = cilRepository.removeSupervisedRoute(routeId);
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
CommonRoute commonRoute = commonRepository.getRouteById(routeId);
// 关灯
CommonSignal commonSignal = commonRoute.getStart();
CilSignal cilSignal = cilRepository.getSignalById(commonSignal.getId());
cilSignalLogicService.UpdateSignalDisplay(rtSimulation, cilSignal, SrSignal.RED, true);
/* 取消进路相关所有设备的锁闭状态 */
// 延续保护解锁
if (cilRoute.getOverlap() != null) {
cilRoute.getOverlap().unlock(cilRepository);
}
cilRoute.setOl(false);
// 侧防解锁
for (CommonFls commonFls : commonRoute.getFlsList()) {
List<CommonFls.FlsElement> firstLevel = commonFls.getFirstLevelList();
if (firstLevel != null) {
for (CommonFls.FlsElement flsElement : firstLevel) {
flsElement.unLock(cilRepository);
}
}
}
cilRoute.setFl(false);
// 进路解锁
cancelRouteLock(cilRepository, commonRoute);
cilRoute.setLock(false);
return true;
}
private void routeUse(CilRepository cilRepository, SwitchPosition switchPosition) {
@ -174,9 +204,9 @@ public class CilRouteLogicService {
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
CommonRoute commonRoute = commonRepository.getRouteById(cilRoute.getId());
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
if (config.isLockFirst()) {
this.lockFirst(cilRepository, commonRoute, cilRoute);
}
// if (config.isLockFirst()) {
// this.lockFirst(cilRepository, commonRoute, cilRoute);
// }
TrackWay pathElement = commonRoute.getPathElement();
CommonSignal commonSignal = commonRoute.getStart();
CilSignal cilSignal = cilRepository.getSignalById(commonSignal.getId());
@ -185,28 +215,33 @@ public class CilRouteLogicService {
cilSwitchLogicService.tryTurn(rtSimulation, pathElement.getSpList()); // 转动道岔
boolean allLock = try2RouteLockSwitches(cilRepository, cilRoute, pathElement.getSpList()); // 锁闭道岔
if (allLock) {
if (!config.isLockFirst()) {
// if (!config.isLockFirst()) {
routeLockSections(cilRepository, commonRoute, pathElement.getSectionList());
}
// }
cilRoute.setLock(true);
}
}
// 侧防设备转动锁闭
if (!cilRoute.isFl()) {
if (!cilRoute.isFl()) { //进路未侧防锁闭
List<CommonFls> flsList = pathElement.getFlsList();
if (!CollectionUtils.isEmpty(flsList)) {
if (!CollectionUtils.isEmpty(flsList)) { //进路侧防不为空
boolean allSwitchLocked = true;
for (CommonFls commonFls : flsList) {
List<CommonFls.FlsElement> firstLevelList = commonFls.getFirstLevelList();
for (CommonFls.FlsElement commonFlsElement : firstLevelList) {
//侧防道岔转动
cilSwitchLogicService.tryTurn(rtSimulation, cilRepository, commonFlsElement.getPp().getCommonSwitch(), commonFlsElement.getPp().getPosition());
cilSwitchLogicService.tryTurn(rtSimulation, cilRepository, commonFlsElement.getPae().getCommonSwitch(), commonFlsElement.getPae().getPosition());
//侧防设备锁闭
// this.lock(cilRepository, commonFlsElement);
boolean allLock = commonFlsElement.lock(cilRepository);
if (!allLock) {
allSwitchLocked = false;
SwitchPosition target = commonFls.getTarget();
if (commonRoute.getPathElement().isContainSwitchPosition(target.getCommonSwitch().getId(), target.isNormal())) { //进路包含侧防所防护的道岔位置
List<CommonFls.FlsElement> firstLevelList = commonFls.getFirstLevelList();
for (CommonFls.FlsElement commonFlsElement : firstLevelList) {
//侧防信号机关闭并锁闭
CilSignal flsSignal = cilRepository.getSignalById(commonFlsElement.getPs().getId());
cilSignalLogicService.try2UpdateSignalDisplay(rtSimulation, flsSignal, CilSignal.RED, true);
//侧防道岔转动
cilSwitchLogicService.tryTurn(rtSimulation, cilRepository, commonFlsElement.getPp().getCommonSwitch(), commonFlsElement.getPp().getPosition());
cilSwitchLogicService.tryTurn(rtSimulation, cilRepository, commonFlsElement.getPae().getCommonSwitch(), commonFlsElement.getPae().getPosition());
//侧防设备锁闭
boolean allLock = commonFlsElement.lock(cilRepository);
if (!allLock) {
allSwitchLocked = false;
}
}
}
}
@ -217,6 +252,7 @@ public class CilRouteLogicService {
}
// 延续保护设备转动锁闭
if (!cilRoute.isOl()) {
CommonOverlap commonOverlap = commonRoute.getOverlap();
CilOverlap overlap = cilRoute.getOverlap();
if (overlap != null) {
TrackWay selectedPath = overlap.getSelectedPath();
@ -224,9 +260,9 @@ public class CilRouteLogicService {
cilSwitchLogicService.tryTurn(rtSimulation, selectedPath.getSpList());
boolean allSwitchesLocked = try2OverlapLockSwitches(cilRepository, overlap, pathElement.getSpList()); // 锁闭道岔
if (allSwitchesLocked) {
if (!config.isLockFirst()) {
overlapLockSections(cilRepository, overlap, overlap.getSelectedPath().getSectionList());
}
// if (!config.isLockFirst()) {
overlapLockSections(cilRepository, commonOverlap.getStart().isRight(), overlap.getSelectedPath().getSectionList());
// }
}
}
}
@ -244,7 +280,8 @@ public class CilRouteLogicService {
cilSignal.updateLevel(CilSignal.LEVEL_2);
}
}
boolean routeCtcMode = cilRoute.getCilServer().isCtcMode();
// boolean routeCtcMode = cilRoute.getCilServer().isCtcMode();
boolean routeCtcMode = true;
if (cilRoute.isCanAutoOpen()) {
if (cilSignal.getSignalAspect() == commonRoute.getSignalAspect()) { //信号机已开启进路指定的信号
cilRoute.setCanAutoOpen(false);
@ -335,6 +372,18 @@ public class CilRouteLogicService {
return flag;
}
private void cancelRouteLock(CilRepository cilRepository, CommonRoute commonRoute) {
TrackWay pathElement = commonRoute.getPathElement();
for (SwitchPosition switchPosition : pathElement.getSpList()) {
CilSwitch cilSwitch = cilRepository.getSwitchById(switchPosition.getCommonSwitch().getId());
cilSwitch.cancelRouteLock();
}
for (CommonSection commonSection : pathElement.getSectionList()) {
CilSection cilSection = cilRepository.getSectionById(commonSection.getId());
cilSection.cancelRouteLock();
}
}
/**
* 预先锁闭锁闭进路内和延续保护的区段
*/
@ -345,11 +394,12 @@ public class CilRouteLogicService {
routeLockSections(cilRepository, commonRoute, pathElement.getSectionList());
}
// 延续保护区段锁闭
CommonOverlap commonOverlap = commonRoute.getOverlap();
CilOverlap overlap = cilRoute.getOverlap();
if (overlap != null) {
TrackWay selectedPath = overlap.getSelectedPath();
if (selectedPath != null) {
overlapLockSections(cilRepository, overlap, selectedPath.getSectionList());
overlapLockSections(cilRepository, commonOverlap.getStart().isRight(), selectedPath.getSectionList());
}
}
}
@ -510,13 +560,13 @@ public class CilRouteLogicService {
// return level;
// }
/**
* 进路征用并转换道岔
*
* @param rtSimulation
* @param cilRoute
* @return 是否所有道岔已经转换到位
*/
// /**
// * 进路征用并转换道岔
// *
// * @param rtSimulation
// * @param cilRoute
// * @return 是否所有道岔已经转换到位
// */
// private void turnSwitch(RtSimulation rtSimulation, CilRoute cilRoute) {
// // 进路内道岔
// CilRoutePathElement pathElement = cilRoute.getPathElement();
@ -544,23 +594,7 @@ public class CilRouteLogicService {
// // 延续保护侧防道岔
// }
/**
* @param rtSimulation
* @param cilSwitchPosition
* @return 是否转换命令已经发出
*/
private boolean turnSwitch(RtSimulation rtSimulation, CilSwitchPosition cilSwitchPosition) {
CilSwitch cilSwitch = cilSwitchPosition.getCilSwitch();
if (!cilSwitchPosition.isOnPosition()) {
if (cilSwitch.isRl() || cilSwitch.isSl() || cilSwitch.isOccupy()) { // 道岔进路锁闭/单锁/占用不转换道岔
return false;
}
this.srdApiService.turnSwitch(rtSimulation, cilSwitch.getId(), cilSwitchPosition.getPosition());
}
return true;
}
// private void lockRouteDevices(CilRoute cilRoute) {
// private void lockRouteDevices(CilRoute cilRoute) {
// CilRoutePathElement pathElement = cilRoute.getPathElement();
// this.routeLockPathDevices(cilRoute, pathElement);
// // 延续保护锁闭
@ -626,7 +660,7 @@ public class CilRouteLogicService {
// overlapLockSections(overlap, sectionList);
// }
private void overlapLockSections(CilRepository cilRepository, CilOverlap overlap, List<CommonSection> sectionList) {
private void overlapLockSections(CilRepository cilRepository, boolean right, List<CommonSection> sectionList) {
for (CommonSection commonSection : sectionList) {
CommonSwitch belongSwitch = commonSection.getBelongSwitch();
if (belongSwitch != null) {
@ -634,23 +668,13 @@ public class CilRouteLogicService {
}
List<CommonSection> relateList = commonSection.getRelateList();
if (relateList.isEmpty()) {
cilRepository.getSectionById(commonSection.getId()).lockByOverlap(overlap);
cilRepository.getSectionById(commonSection.getId()).lockByOverlap(right);
} else {
for (CommonSection section : relateList) {
cilRepository.getSectionById(section.getId()).lockByOverlap(overlap);
cilRepository.getSectionById(section.getId()).lockByOverlap(right);
}
}
}
}
/**
* 进路监控
*
* @param cilRoute
*/
private void watchRoute(CilRoute cilRoute) {
// if (cilRoute.isOpenAspect()) {
//
// }
}
}

View File

@ -34,27 +34,33 @@ public class CilSignalLogicService {
// }
}
/**
* 尝试更新信号机显示
*/
public void try2UpdateSignalDisplay(RtSimulation rtSimulation, CilSignal signal, boolean logic, int aspect) {
if (logic) {
srdApiService.changeSignalLight(rtSimulation, signal.getId(), SrSignal.OFF);
signal.setAspect(aspect);
} else {
public void try2UpdateSignalDisplay(RtSimulation rtSimulation, CilSignal signal, int aspect, boolean ctcMode) {
// TODO: 2021/4/20 因信号机缺少表示虚拟信号机的字段故缺少对虚拟信号机的检查
// boolean logic = !signal.isUta() && ctcMode && !signal.isForceLight();
// if (signal.sufficientLevel(aspect, logic)) {
// if (logic) {
// signal.setAspect(aspect);
// } else {
// srdApiService.changeSignalLight(rtSimulation, signal.getId(), aspect);
// }
// }
if (signal.sufficientLevel(aspect, false)) {
srdApiService.changeSignalLight(rtSimulation, signal.getId(), aspect);
}
}
public void try2UpdateSignalDisplay(RtSimulation rtSimulation, CilSignal signal, int aspect, boolean ctcMode) {
public void UpdateSignalDisplay(RtSimulation rtSimulation, CilSignal signal, int aspect, boolean ctcMode) {
// TODO: 2021/4/20 因信号机缺少表示虚拟信号机的字段故缺少对虚拟信号机的检查
boolean logic = !signal.isUta() && ctcMode && !signal.isForceLight();
if (signal.sufficientLevel(aspect, logic)) {
if (logic) {
signal.setAspect(aspect);
} else {
srdApiService.changeSignalLight(rtSimulation, signal.getId(), aspect);
}
// boolean logic = !signal.isUta() && ctcMode && !signal.isForceLight();
// if (signal.sufficientLevel(aspect, logic)) {
// if (logic) {
// signal.setAspect(aspect);
// } else {
// srdApiService.changeSignalLight(rtSimulation, signal.getId(), aspect);
// }
// }
if (signal.sufficientLevel(aspect, false)) {
srdApiService.changeSignalLight(rtSimulation, signal.getId(), aspect);
}
}
}

View File

@ -1,17 +1,20 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
import club.joylink.rtss.simulation.rt.repo.CommonSection;
import club.joylink.rtss.simulation.rt.repo.SwitchPosition;
import club.joylink.rtss.simulation.rt.repo.TrackWay;
import lombok.Getter;
import org.springframework.util.CollectionUtils;
import java.util.List;
@Getter
public class CilOverlap extends CilDevice {
boolean right;
CilSignal start;
CilSection releaseSection;
List<CilRoutePathElement> pathElementList;
// boolean right;
// CilSignal start;
// CilSection releaseSection;
// List<CilRoutePathElement> pathElementList;
int releaseTime; // 延续保护解锁时间
// CilRoutePathElement selectedPath; // 选择出所需办理的路径
@ -28,4 +31,26 @@ public class CilOverlap extends CilDevice {
public void updateSelectedPath(TrackWay path) {
this.selectedPath = path;
}
/**
* 解锁道岔和区段
*/
public void unlock(CilRepository cilRepository) {
if (selectedPath == null)
return;
List<SwitchPosition> spList = selectedPath.getSpList();
if (CollectionUtils.isEmpty(spList))
return;
for (SwitchPosition switchPosition : spList) {
CilSwitch cilSwitch = cilRepository.getSwitchById(switchPosition.getCommonSwitch().getId());
cilSwitch.cancelOverlapLock();
}
List<CommonSection> sectionList = selectedPath.getSectionList();
if (CollectionUtils.isEmpty(sectionList))
return;
for (CommonSection commonSection : sectionList) {
CilSection cilSection = cilRepository.getSectionById(commonSection.getId());
cilSection.cancelOverlapLock();
}
}
}

View File

@ -112,4 +112,12 @@ public class CilRepository extends SimulationRepository {
public void addSupervisedRoute(CilRoute cilRoute) {
this.supervisedRouteMap.put(cilRoute.getId(), cilRoute);
}
public boolean isSupervised(String routeId) {
return this.supervisedRouteMap.containsKey(routeId);
}
public CilRoute removeSupervisedRoute(String routeId) {
return this.supervisedRouteMap.remove(routeId);
}
}

View File

@ -205,13 +205,13 @@ public class CilRepositoryBuilder {
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(cilSection,
String.format("不存在id为[%s]的区段", overlapVO.getUnlockSectionCode()));
CilSignal cilSignal = signalMap.get(overlapVO.getSignalCode());
cilOverlap.releaseSection = cilSection;
cilOverlap.start = cilSignal;
cilOverlap.right = cilSignal.isRight();
// cilOverlap.releaseSection = cilSection;
// cilOverlap.start = cilSignal;
// cilOverlap.right = cilSignal.isRight();
cilOverlap.releaseTime = overlapVO.getUnlockTime();
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(cilSignal,
String.format("不存在id为[%s]的信号机", overlapVO.getSignalCode()));
cilOverlap.pathElementList = buildPathElementList(cilSignal, overlapVO.getPathList(), sectionMap, switchMap, flsMap);
// cilOverlap.pathElementList = buildPathElementList(cilSignal, overlapVO.getPathList(), sectionMap, switchMap, flsMap);
}
}

View File

@ -44,13 +44,21 @@ public class CilSection extends CilDevice {
}
}
public void lockByOverlap(CilOverlap overlap) {
public void cancelRouteLock() {
this.rl = false;
}
public void lockByOverlap(boolean right) {
if (!this.ol) {
this.ol = true;
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(this.rl && this.lr != overlap.isRight());
if (this.lr != overlap.isRight()) {
this.lr = overlap.isRight();
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(this.rl && this.lr != right);
if (this.lr != right) {
this.lr = right;
}
}
}
public void cancelOverlapLock() {
this.ol = false;
}
}

View File

@ -18,6 +18,14 @@ public class CilSignal extends CilDevice {
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 L = 10; //
public static final int B = 11; //
public static final int HS = 12; // 红闪
boolean logic;
boolean forceLight; // 强制点灯
boolean bl; // 封锁
@ -31,6 +39,8 @@ public class CilSignal extends CilDevice {
public static final int LEVEL_3 = 3; //ATP级
public static final int LEVEL_4 = 4; //主信号级
boolean fl; //侧防锁闭侧防锁闭后不能排列任何以此为始端信号机的进路
public CilSignal(String id, String name) {
super(id, name);
}
@ -62,20 +72,29 @@ public class CilSignal extends CilDevice {
* 信号机有足够的级别以{aspect}显示
*/
public boolean sufficientLevel(int aspect, boolean logic) {
switch (aspect) {
case RED:
return true;
case GUIDE:
return level == LEVEL_2 || level == LEVEL_3 || level == LEVEL_4;
case GREEN:
case YELLOW:
if (logic) {
return level == LEVEL_3 || level == LEVEL_4;
} else {
return level == LEVEL_4;
}
default:
throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("未知的显示状态");
}
// switch (aspect) {
// case RED:
// return true;
// case GUIDE:
// return level == LEVEL_2 || level == LEVEL_3 || level == LEVEL_4;
// case GREEN:
// case YELLOW:
// if (logic) {
// return level == LEVEL_3 || level == LEVEL_4;
// } else {
// return level == LEVEL_4;
// }
// default:
// throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception(String.format("未知的显示状态[%s]", aspect));
// }
return level == LEVEL_4;
}
public void flankLock() {
this.fl = true;
}
public void cancelFlankLock() {
this.fl = false;
}
}

View File

@ -68,18 +68,30 @@ public class CilSwitch extends CilDevice {
}
}
public void cancelRouteLock() {
this.rl = false;
}
public void lockByOverlap(CilOverlap overlap) {
if (!this.ol) {
this.ol = true;
}
}
public void cancelOverlapLock() {
this.ol = false;
}
public void flankLock() {
if (!this.fl) {
this.fl = true;
}
}
public void cancelFlankLock() {
this.fl = false;
}
public boolean isLocked() {
return sl || rl || ol || fl;
}

View File

@ -69,6 +69,9 @@ public class SrdApiService {
boolean change = false;
if (srSignal.getState() != aspect) {
LocalDateTime systemTime = rtSimulation.getSystemTime();
if (aspect >= 5 && aspect <= 12) { //2021-04-23 10:41:52 临时
srSignal.open(systemTime, aspect);
}
switch (aspect) {
case SrSignal.OFF:{
srSignal.close(systemTime);

View File

@ -28,6 +28,14 @@ public class SrSignal extends SrDevice {
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 L = 10; //
public static final int B = 11; //
public static final int HS = 12; // 红闪
AtomicInteger command = new AtomicInteger(NONE);
public static final int NONE = 0;
@ -97,4 +105,8 @@ public class SrSignal extends SrDevice {
throw new IllegalArgumentException(String.format("无效的道岔状态:[%s]", state));
}
}
public void open(LocalDateTime systemTime, int aspect) {
this.startTurn(systemTime, aspect);
}
}

View File

@ -13,13 +13,11 @@ public class SignalOperationHandler {
@SimulationOperationMapping("Signal_Set_Route")
public boolean setRoute(RtSimulation simulation, String id) {
this.cilApiService.setRoute(simulation, id);
return true;
return this.cilApiService.setRoute(simulation, id);
}
@SimulationOperationMapping("Signal_Cancel_Route")
public boolean cancelRoute(RtSimulation simulation, String id) {
this.cilApiService.turnSwitch(simulation, id);
return true;
return this.cilApiService.cancelRoute(simulation, id);
}
}

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.simulation.rt.repo;
import club.joylink.rtss.simulation.rt.CIL.bo.CilRepository;
import club.joylink.rtss.simulation.rt.CIL.bo.CilSignal;
import club.joylink.rtss.simulation.rt.CIL.bo.CilSwitch;
import lombok.Getter;
@ -47,6 +48,14 @@ public class CommonFls extends CommonDevice {
flag = false;
}
}
if (this.ps != null) {
CilSignal cilSignal = cilRepository.getSignalById(this.ps.getId());
if (cilSignal.isForbidAspect()) {
cilSignal.flankLock();
} else {
flag = false;
}
}
if (this.pae != null) {
CilSwitch cilSwitch = cilRepository.getSwitchById(pae.getCommonSwitch().getId());
if (pae.getPosition() == cilSwitch.getPosition()) {
@ -57,5 +66,20 @@ public class CommonFls extends CommonDevice {
}
return flag;
}
public void unLock(CilRepository cilRepository) {
if (this.pp != null) {
CilSwitch cilSwitch = cilRepository.getSwitchById(this.pp.getCommonSwitch().getId());
cilSwitch.cancelFlankLock();
}
if (this.ps != null) {
CilSignal cilSignal = cilRepository.getSignalById(this.ps.getId());
cilSignal.cancelFlankLock();
}
if (this.pae != null) {
CilSwitch cilSwitch = cilRepository.getSwitchById(this.pae.getCommonSwitch().getId());
cilSwitch.cancelFlankLock();
}
}
}
}