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

# Conflicts:
#	src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATO/service/ATOService.java
#	src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java
This commit is contained in:
walker-sheng 2021-08-09 14:35:23 +08:00
commit bdd35ae336
19 changed files with 81 additions and 26 deletions

View File

@ -550,6 +550,12 @@ public class DraftMapService implements IDraftMapService {
this.draftMapOverlapDAO.insert(draftMapOverlap);
});
}
if (!CollectionUtils.isEmpty(logicDataVO.getOverrunList())) {
for (MapRouteOverrunVO vo : logicDataVO.getOverrunList()) {
vo.setMapId(id);
this.draftMapOverrunService.createOverrun(id, vo);
}
}
if (!CollectionUtils.isEmpty(logicDataVO.getAutoReentryList())) {
logicDataVO.getAutoReentryList().forEach(autoReentry -> {
autoReentry.setMapId(id);
@ -564,7 +570,6 @@ public class DraftMapService implements IDraftMapService {
this.draftMapRouteFlankProtectionDAO.insert(entity);
});
}
}
private void deleteMapLogicData(Long id) {

View File

@ -650,11 +650,10 @@ public class MapService implements IMapService {
if (Objects.nonNull(map3dDataVO)) {
this.publish3DData(mapVO, map3dDataVO, user);
}
// 地图拷贝成功拷贝运行图相关
this.iRunPlanTemplateService.copyAllOfMap(id, mapNewVO.getId(), user);
//根据选项拷贝相关数据
if (copyOption.isCopyOtherData()) {
// 地图拷贝成功拷贝运行图相关
this.iRunPlanTemplateService.copyAllOfMap(id, mapNewVO.getId(), user);
//拷贝实训
Map<Long, Long> relMap = this.iTrainingService
.copyAllOfMapAndPrd(id, mapNewVO.getId());

View File

@ -21,9 +21,12 @@ import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.LoginStatusVO;
import club.joylink.rtss.vo.client.LoginUserVO;
import club.joylink.rtss.vo.client.SocketMessageVO;
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
import club.joylink.rtss.vo.client.project.RelationLoginConfigVO;
import club.joylink.rtss.vo.wx.WmUserSession;
import club.joylink.rtss.websocket.StompMessageService;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
@ -74,6 +77,9 @@ public class AuthenticateService implements IAuthenticateService {
@Autowired
private ProjectSimulationService projectSimulationService;
@Autowired
private StompMessageService stompMessageService;
@Override
public LoginStatusVO getWmLoginUrl(String clientId, String secret, Project project, String deviceCode) {
String envId = SystemEnv.getSystemEnvIdByName(this.otherConfig.getEnv());
@ -322,6 +328,8 @@ public class AuthenticateService implements IAuthenticateService {
}
}
for (LoginUserInfoVO infoVO : removeList) {
SocketMessageVO<LoginUserInfoVO> message = SocketMessageFactory.buildLoginSomewhereElseMessage(infoVO);
stompMessageService.sendToUser(infoVO.getAccountVO().getIdStr(), message);
this.logout(infoVO);
}
}

View File

@ -23,6 +23,7 @@ public class DraftMapOverrunServiceImpl implements DraftMapOverrunService {
@Override
public void createOverrun(long mapId, MapRouteOverrunVO overrunVO) {
overrunVO.setMapId(mapId);
List<DraftMapRouteOverrun> entities = findEntitiesByMapId(mapId);
String prefix_overrun = DraftMapCiDataGeneratorImpl.CodeGenerator.Prefix_Overrun;
DraftMapCiDataGeneratorImpl.CodeGenerator generator;

View File

@ -144,11 +144,11 @@ public class AtpSectionService {
*/
public void sectionARBCheck(Simulation simulation, Section section, List<Section> sectionList) {
//目前ARB故障才会导致ARB判定
if (Section.AxleFault.ARB.equals(section.getFault())) {
if (section.getVirtualAxleCounter().isOccupy() && !sectionList.contains(section)) {
if (Section.AxleFault.ARB.equals(section.getFault()) && section.getVirtualAxleCounter().isOccupy()) {
if (!sectionList.contains(section)) {
section.judgeAsARB();
} else if (Section.AxleFault.FAULT.equals(section.getFault()) && section.getVirtualAxleCounter().isOccupy()) {
section.judgeAsNctOccupied();
} else {
section.setFault(Section.AxleFault.FAULT);
}
} else if (Section.AxleFault.FAULT.equals(section.getFault()) && section.getVirtualAxleCounter().isOccupy()) {
section.judgeAsNctOccupied();
@ -174,9 +174,9 @@ public class AtpSectionService {
public List<Section> getTrainExistAxleSectionsUnderDelay(Simulation simulation, List<VirtualRealityTrain> trainList) {
List<Section> list = new ArrayList<>();
for (VirtualRealityTrain train : trainList) {
// //只统计非通信车
// if (train.isCBTC())
// continue;
//只统计非通信车
if (train.isCommunicable())
continue;
boolean right = train.isRight();
SectionPosition headPosition = train.getHeadPosition();
float offset = 50;

View File

@ -370,7 +370,7 @@ public class MaService {
Ma ma = null;
boolean front = false;
Section section = tailPosition.getSection();
for (int i = 0; i < 20 && section != null; i++) {
for (int i = 0; i < 50 && section != null; i++) {
if (section.equals(headPosition.getSection())) {
front = true;
}

View File

@ -68,6 +68,7 @@ public class ATSLogicLoop {
this.trainOutboundLoadTool.loadOutboundTrain(simulation);
this.atsStandService.countDown(simulation);
this.atsTrainMonitorService.monitor(simulation);
this.atsStationService.updateFieldThatChangeOverTime(simulation);
}
public void addJobs(Simulation simulation) {

View File

@ -284,6 +284,8 @@ public class AtsRouteService {
routeService.isApproachLock(repository, route), "进路接近锁闭,无法取消");
BusinessExceptionAssertEnum.OPERATION_FAIL.assertNotTrue(
route.getStart().isGuideOpen(), "引导进路,需要人解进路");
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(route.isFleetMode(),
String.format("进路[%s]已开启自动通过进路,无法取消", route.debugStr()));
this.ciApiService.unlockRoute(simulation, route.getCode());
}
}

View File

@ -703,7 +703,7 @@ public class AtsRouteSettingService {
++count;
Signal signal = base.getSignalOf(right);
if (Objects.isNull(signal) || !signal.isClose() ||
(!train.isCommunication() && signal.isVirtual())) {
(!train.isCommunicable() && signal.isVirtual())) {
// 指定方向信号机不存在或已经开放,或非通信车碰到虚拟信号机,继续往下找
base = base.getNextRunningSectionOf(right);
continue;

View File

@ -401,7 +401,7 @@ public class AtsStationService {
/**
* 更新车站随时间变化的属性
*/
public void updateField(Simulation simulation) {
public void updateFieldThatChangeOverTime(Simulation simulation) {
List<Station> stations = simulation.getRepository().getStationList();
for (Station station : stations) {
//更新车站控制权转换倒计时及有效性

View File

@ -66,7 +66,10 @@ public abstract class AtsRouteSelectService {
public Route queryTriggerRoutes4TurnBack(SimulationDataRepository repository, Section standSection, Section tbSection, TrainInfo trainInfo) {
Station station = standSection.getStation();
StationTurnBackStrategyOption strategy = station.getCurrentTurnBackStrategy();
StationTurnBackStrategyOption strategy = null;
if (station.getTbStrategyId() != null) {
strategy = station.getCurrentTurnBackStrategy();
}
List<Section> tbSectionList = new ArrayList<>();
if (Objects.isNull(strategy)) {
tbSectionList.add(tbSection);
@ -192,7 +195,15 @@ public abstract class AtsRouteSelectService {
continue;
}
if (route.getStart().equals(signal) && !route.isTurnBack() && !triggerList.contains(route)) {
triggerList.add(route);
if (repository.getConfig().isRouteLikeHa1()) {
if (trainInfo.isCommunicable() && route.isAtp()) {
triggerList.add(route);
} else if (!trainInfo.isCommunicable() && route.isGround()) {
triggerList.add(route);
}
} else {
triggerList.add(route);
}
}
}
//选择要触发的进路

View File

@ -213,6 +213,8 @@ public class CiApiServiceImpl implements CiApiService {
@Override
public void forceUnlockRoute(Simulation simulation, String routeCode) {
Route route = simulation.getRepository().getByCode(routeCode, Route.class);
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(route.isFleetMode(),
String.format("进路[%s]已开启自动通过进路,无法取消", route.debugStr()));
SimulationDataRepository repository = simulation.getRepository();
if (routeService.isApproachLock(repository, route)) {
routeService.humanCancel(simulation, route);

View File

@ -781,8 +781,8 @@ public class RouteService {
* @param route
*/
public void cancelWithoutCheck(Simulation simulation, Route route) {
// // 取消自动进路
// this.cancelFleet(route);
// 取消自动进路
this.cancelFleet(route);
// 关闭始端信号机
this.routeClose(simulation, route);
log.debug(String.format("取消进路,信号机[%s(%s)]关灯",

View File

@ -156,10 +156,13 @@ public class TrainHmiDisplay {
private boolean inTheStandArea;
/**
* true牵引false制动
* true牵引false制动1牵引2制动3惰行4无
*/
private int tow;
/** 牵引、制动力百分比 */
private int forcePercent;
public TrainHmiDisplay(VirtualRealityTrain train) {
this.code = train.getCode();
this.groupNumber = train.getGroupNumber();
@ -213,6 +216,17 @@ public class TrainHmiDisplay {
this.parking = train.isParkingAt();
this.inTheStandArea = train.isInTheStandArea();
this.tow = getTow(train);
this.forcePercent = getForcePercent(train);
}
private int getForcePercent(VirtualRealityTrain train) {
if (train.getFk() > 0) {
return (int) (train.getFk() / train.getCurrentFkMax() * 100);
} else if (train.getFb() > 0) {
return (int) (train.getFb() / train.getCurrentFbMax() * 100);
} else {
return 0;
}
}
private int getTow(VirtualRealityTrain train) {
@ -373,6 +387,11 @@ public class TrainHmiDisplay {
this.tow = tow;
map.put("tow", tow);
}
int forcePercent = getForcePercent(train);
if (!Objects.equals(this.forcePercent, forcePercent)) {
this.forcePercent = forcePercent;
map.put("forcePercent", forcePercent);
}
if (map.size() > 0) {
map.put("code", this.code);
return map;

View File

@ -257,7 +257,8 @@ public class TrainInfo extends MapElement {
/** ATS为此列车触发的进路 */
private Map<String, Route> atsTriggerRouteMap = new ConcurrentHashMap<>();
private boolean communication;
/** 通信是否正常 */
private boolean communicable;
public TrainInfo(String groupNumber) {
super(groupNumber, DeviceType.TRAIN);
@ -373,9 +374,10 @@ public class TrainInfo extends MapElement {
SectionPosition headPosition = train.getHeadPosition();
this.physicalSection = headPosition.getSection().getCode();
this.offsetp = headPosition.getPercent();
this.communicable = train.isCommunicable();
if (headPosition.getSection().isSwitchTrack()) {
this.section = headPosition.getSection().getParent().getCode();
} else if (this.isCommunication()) {
} else if (this.isCommunicable()) {
this.section = headPosition.getLogicSection().getCode();
} else {
this.section = headPosition.getSection().getCode();
@ -403,7 +405,6 @@ public class TrainInfo extends MapElement {
} else if (speed != 0 && this.turnBackStatus.equals(STOP)) {
this.turnBackStatus = EXIT;
}
this.communication = train.isCommunication();
}
public boolean isCtcLevel() {

View File

@ -682,8 +682,8 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
if (linkTrain != null && linkTrain.isEB()) {
return;
}
this.fk = fk;
this.fb = fb;
this.fk = Math.min(fk, getCurrentFkMax());
this.fb = Math.min(fb, getCurrentFbMax());
if (fk > 0) {
this.tbControl = TrainTBControl.TRACTION;
} else if (fb > 0) {

View File

@ -211,6 +211,7 @@ public class ATPLogicLoop {
// EB 触发速度计算
SpeedCurve ebTriggerCurve = ma.getEbTriggerCurve();
float ebTriggerRemain = ma.calculateDistanceOfEbTriggerEnd();
ma.setEbTriggerCurve(ebTriggerCurve);
float totalDistance = ebTriggerCurve.getTotalDistance();
if (totalDistance < ebTriggerRemain) {
ebTriggerRemain = totalDistance;

View File

@ -10,6 +10,7 @@ import club.joylink.rtss.simulation.cbtc.data.vo.*;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
import club.joylink.rtss.simulation.cbtc.message.websocket.SimulationSubscribeTopic;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.SocketMessageVO;
import club.joylink.rtss.vo.client.WebSocketMessageType;
import club.joylink.rtss.vo.client.passenger.PassengerFlowMessage2TD;
@ -269,6 +270,10 @@ public class SocketMessageFactory {
return build(WebSocketMessageType.STATION_PFI_NUM, group, data);
}
public static SocketMessageVO<LoginUserInfoVO> buildLoginSomewhereElseMessage(LoginUserInfoVO infoVO) {
return build(WebSocketMessageType.Be_Logged_Out, null, infoVO);
}
@Component
private static class SpringContextUtil implements ApplicationContextAware {

View File

@ -1,8 +1,8 @@
server:
port: 9010
port: 9000
modbus-tcp:
port: 19100
port: 19000
spring:
profiles: