新仿真逻辑——CI联锁系统逻辑开发

This commit is contained in:
walker-sheng 2021-03-31 14:22:43 +08:00
parent e7099f59af
commit 9c62b15593
9 changed files with 114 additions and 13 deletions

View File

@ -4,6 +4,7 @@ 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.SrAXC;
import club.joylink.rtss.simulation.rt.srd.bo.SrPSD;
import club.joylink.rtss.simulation.rt.srd.bo.SrSignal;
import club.joylink.rtss.simulation.rt.srd.bo.SrSwitch;
import club.joylink.rtss.vo.client.map.MapVO;
@ -23,6 +24,9 @@ public class CilLogicService {
@Autowired
private SrdApiService srdApiService;
@Autowired
private CilRouteLogicService cilRouteLogicService;
public void buildRepository(RtSimulation rtSimulation, MapVO mapVO) {
CilRepository cilRepository = CilRepositoryBuilder.buildFrom(mapVO);
rtSimulation.addRepository(cilRepository);
@ -57,9 +61,15 @@ public class CilLogicService {
CilSignal cilSignal = repository.getSignalById(srSignal.getId());
cilSignal.updateByDeviceState(srSignal.getState());
}
// 屏蔽门
List<SrPSD> psdList = this.srdApiService.queryAllPsd(rtSimulation);
for (SrPSD srPSD : psdList) {
CilPsd cilPsd = repository.getPsdById(srPSD.getId());
cilPsd.updateState(srPSD.getState());
}
}
private void mainLogic(CilRepository cilRepository) {
this.cilRouteLogicService.routeLogic(cilRepository);
}
}

View File

@ -0,0 +1,38 @@
package club.joylink.rtss.simulation.rt.CIL;
import club.joylink.rtss.simulation.rt.CIL.bo.CilRepository;
import club.joylink.rtss.simulation.rt.CIL.bo.CilRoute;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class CilRouteLogicService {
public void routeLogic(CilRepository cilRepository) {
List<CilRoute> supervisedRouteList = cilRepository.getSupervisedRouteList();
for (CilRoute cilRoute : supervisedRouteList) {
switch (cilRoute.getStage()) {
case CilRoute.STAGE_SETTING:
this.settingProgress(cilRoute);
break;
case CilRoute.STAGE_WATCH:
this.watchRoute(cilRoute);
break;
}
}
}
private void settingProgress(CilRoute cilRoute) {
}
/**
* 进路监控
* @param cilRoute
*/
private void watchRoute(CilRoute cilRoute) {
if (cilRoute.isOpen()) {
}
}
}

View File

@ -1,8 +1,14 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
public class CilPsd extends CilDevice {
int state;
boolean cut;
public CilPsd(String id, String name) {
super(id, name);
}
public void updateState(int state) {
this.state = state;
}
}

View File

@ -3,7 +3,9 @@ package club.joylink.rtss.simulation.rt.CIL.bo;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.SimulationRepository;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CilRepository extends SimulationRepository {
@ -16,6 +18,7 @@ public class CilRepository extends SimulationRepository {
Map<String, CilPsd> psdMap;
Map<String, CilEsp> espMap;
Map<String, CilRoute> routeMap;
Map<String, CilRoute> supervisedRouteMap; // 监控中的进路
Map<String, CilAutoSignal> autoSignalMap;
/**
* key-id
@ -61,4 +64,18 @@ public class CilRepository extends SimulationRepository {
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(cilSignal);
return cilSignal;
}
public CilPsd getPsdById(String id) {
CilPsd cilPsd = this.psdMap.get(id);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(cilPsd);
return cilPsd;
}
public List<CilRoute> getRouteList() {
return new ArrayList<>(this.routeMap.values());
}
public List<CilRoute> getSupervisedRouteList() {
return new ArrayList<>(this.supervisedRouteMap.values());
}
}

View File

@ -1,7 +1,10 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
import lombok.Getter;
import java.util.List;
@Getter
public class CilRoute extends CilDevice {
int type; // 进路类型
@ -24,8 +27,15 @@ public class CilRoute extends CilDevice {
public static final int SA_RED = 1;
public static final int SA_GREEN = 2;
public static final int SA_YELLOW = 3;
public static final int SA_GUIDE = 4;//引导信号黄红灯显示
public static final int SA_GUIDE = 4; //引导信号黄红灯显示
int stage; // 进路当前所处逻辑阶段
public static final int STAGE_NONE = 0; //
public static final int STAGE_SETTING = 1; // 建立阶段
public static final int STAGE_WATCH = 2; // 信号正常开发后监视
public static final int STAGE_UL = 3; // 正常解锁
public static final int STAGE_DUL = 4; // 延时解锁
public static final int STAGE_FUL = 5; // 故障解锁
int signalState;// 进路信号状态(当前实际状态)
@ -33,4 +43,14 @@ public class CilRoute extends CilDevice {
public CilRoute(String id, String name) {
super(id, name);
}
public boolean isOpen() {
return this.start.getSignalAspect() == CilSignal.GREEN
||
this.start.getSignalAspect() == CilSignal.YELLOW;
}
public boolean isGuide() {
return this.start.getSignalAspect() == CilSignal.GUIDE;
}
}

View File

@ -1,22 +1,26 @@
package club.joylink.rtss.simulation.rt.CIL.bo;
import club.joylink.rtss.simulation.rt.srd.bo.SrSignal;
import lombok.Getter;
import java.util.List;
@Getter
public class CilSignal extends CilDevice {
boolean right;
List<CilSection> approachList;
List<CilSection> ctcApproachList;
int signalAspect; //信号显示
int signalAspect; //当前显示的信号
public static final int RED = 1; // 红灯信号(禁止信号)
public static final int GREEN = 2; // 绿灯信号(直向通行)
public static final int YELLOW = 3; // 黄灯信号(侧向通行)
public static final int GUIDE = 4; // 引导信号(正线为黄红)
boolean logic;
int blockade;
boolean bl; // 封锁
boolean rbl; // 重复封锁
int forceLight;
int level;
public static final int LEVEL_1 = 1; //关闭/非监控级

View File

@ -8,11 +8,11 @@ public class CilSwitch extends CilDevice {
public static final int REVERSE = 2; // 反位
public static final int SQUEEZING = 4; // 挤叉
int singleLock;
int blockade;
int routeLock;
int overlapLock;
int fpLock;
boolean bl; // 封锁
boolean sl; // 单锁
boolean rl; // 进路锁闭
boolean ol; // 延续保护锁闭
boolean fl; // 侧防锁闭
public CilSwitch(String id, String name) {
super(id, name);

View File

@ -1,10 +1,7 @@
package club.joylink.rtss.simulation.rt.srd;
import club.joylink.rtss.simulation.rt.RtSimulation;
import club.joylink.rtss.simulation.rt.srd.bo.SrAXC;
import club.joylink.rtss.simulation.rt.srd.bo.SrSignal;
import club.joylink.rtss.simulation.rt.srd.bo.SrSwitch;
import club.joylink.rtss.simulation.rt.srd.bo.SrdRepository;
import club.joylink.rtss.simulation.rt.srd.bo.*;
import org.springframework.stereotype.Component;
import java.util.List;
@ -25,4 +22,9 @@ public class SrdApiService {
SrdRepository repository = rtSimulation.getRepository(SrdRepository.NAME, SrdRepository.class);
return repository.getSignalList();
}
public List<SrPSD> queryAllPsd(RtSimulation rtSimulation) {
SrdRepository repository = rtSimulation.getRepository(SrdRepository.NAME, SrdRepository.class);
return repository.getPsdList();
}
}

View File

@ -27,6 +27,10 @@ public class SrPSD extends SrDevice {
super(id, DeviceType.PSD);
}
public int getState() {
return state;
}
public boolean isTurning() {
return NONE != this.command.get();
}