列车停站时间计算修改,不再缩减停站时间

仿真数据构建添加运行等级、停站时间、站台区段可到达的临近站台区段等数据构建(未完)
配置:ATS是否自动处理人工设置的站前折返自动更新车次构建未添加bug修改
This commit is contained in:
walker-sheng 2021-05-19 15:07:41 +08:00
parent c31d38dc66
commit 9cb57676b0
17 changed files with 321 additions and 74 deletions

View File

@ -244,17 +244,16 @@ public class MapService implements IMapService {
MapDataVO mapDataVO = this.getMapData(mapVO.getId(), mapVO.getVersion());
mapVO.setMapData(mapDataVO);
// mapVO.setMap3dData(this.findMap3dDataByMapId(mapVO.getId()));
// todo 后面可以设置为永不过期缓存
this.iCacheService.put(BusinessConsts.CachePrefix.Map + mapVO.getId(), mapVO);
}
}
if (Objects.nonNull(mapVO)) {
// 查询线路数据,保证每次都获取最新的线路配置
RealLineVO realLineVO = this.iRealLineService.getLineDetailByCode(mapVO.getLineCode());
mapVO.setConfigVO(realLineVO.getConfigVO());
realLineVO.setConfigVO(null);
mapVO.getGraphDataNew().setSkinVO(realLineVO);
}
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(mapVO,
String.format("不存在id为[%s]的地图数据", id));
// 查询线路数据,保证每次都获取最新的线路配置
RealLineVO realLineVO = this.iRealLineService.getLineDetailByCode(mapVO.getLineCode());
mapVO.setConfigVO(realLineVO.getConfigVO());
realLineVO.setConfigVO(null);
mapVO.getGraphDataNew().setSkinVO(realLineVO);
return mapVO;
}

View File

@ -17,7 +17,7 @@ import java.util.stream.Collectors;
public class RoutingGenerator {
/**
* 生成所有交路此处生成的交为一个方向能到达的且路径中只包含同向站台不能包含反向站台或其他非正常站台轨
* 生成所有交路此处生成的交为一个方向能到达的且路径中只包含同向站台不能包含反向站台或其他非正常站台轨
* 生成逻辑
* 1首先构建每一个站台轨折返轨转换轨能到达的最近的站台轨折返轨转换轨站台轨和转换轨为查找的终点
* 2遍历车站取折返轨转换轨开始生成外循环从前往后遍历车站内循环从后往前遍历车站

View File

@ -663,29 +663,34 @@ public class AtsPlanService {
LocalTime systemTime = simulation.getSystemTime().toLocalTime();
int parkTime = this.atsStandService.trainParkingAndGetParkTime(simulation, section);
train.updateArriveInfo(systemTime, station, section);
if (train.isPlanTrain()) {
SimulationDataRepository repository = simulation.getRepository();
TripPlan tripPlan = repository.getTripPlan(train.getServiceNumber(), train.getTripNumber());
// 更新追踪列车到站状态
StationPlan stationPlan = tripPlan.queryStationPlanByStation(station);
if (parkTime < 0) {
if (parkTime < 0) {
if (train.isPlanTrain()) {
SimulationDataRepository repository = simulation.getRepository();
TripPlan tripPlan = repository.getTripPlan(train.getServiceNumber(), train.getTripNumber());
// 更新追踪列车到站状态
StationPlan stationPlan = tripPlan.queryStationPlanByStation(station);
parkTime = stationPlan.getParkTime();
if (tripPlan.isFirstPlan(stationPlan)) { // 第一个计划
parkTime = stationPlan.getLeaveTime().toSecondOfDay() - systemTime.toSecondOfDay();
int actualParkTime = stationPlan.getLeaveTime().toSecondOfDay() - systemTime.toSecondOfDay();
if (actualParkTime > parkTime) {
parkTime = actualParkTime;
}
}
if (this.checkIfFrontTurnBack(simulation, train, section, tripPlan, stationPlan)) {
//是站台折返车
//如果停车时间为0 ,则取后一个车次计划的首站发车时间
TripPlan nextTripPlan = repository.queryServiceNextTripPlan(tripPlan.getServiceNumber(), tripPlan.getTripNumber());
StationPlan nextFirstStationPlan = nextTripPlan.queryStationPlanByStation(station);
parkTime = nextFirstStationPlan.getLeaveTime().toSecondOfDay() - systemTime.toSecondOfDay();
int actual = nextFirstStationPlan.getLeaveTime().toSecondOfDay() - systemTime.toSecondOfDay();
if (actual > parkTime) {
parkTime = actual;
}
}
} else {
// 头码车和人工车,取默认站台停站时间
parkTime = 30;
}
}
if (parkTime < 10) {
// 头码车和人工车默认给25s
parkTime = 25;
}
LocalTime leaveTime = systemTime.plusSeconds(parkTime);
train.updateEstimatedLeaveInfo(section, leaveTime);
this.atsStandService.updateStandParkTime(section, parkTime);

View File

@ -10,6 +10,8 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.*;
import club.joylink.rtss.services.org.IOrgService;
import club.joylink.rtss.services.org.IOrgUserService;
import club.joylink.rtss.services.runplan.IRunPlanParktimeService;
import club.joylink.rtss.services.runplan.IRunPlanRunlevelService;
import club.joylink.rtss.services.script.IScriptService;
import club.joylink.rtss.services.script.IScriptSimulationService;
import club.joylink.rtss.services.simulation.SchedulingService;
@ -54,6 +56,8 @@ import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
import club.joylink.rtss.vo.client.runplan.*;
import club.joylink.rtss.vo.client.runplan.user.RunPlanParkingTimeVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunlevelVO;
import club.joylink.rtss.vo.client.schedulingNew.SchedulingPlanNewVO;
import club.joylink.rtss.vo.client.script.ScriptVO;
import club.joylink.rtss.vo.client.simulationv1.*;
@ -80,82 +84,60 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
@Autowired
private ApplicationContext applicationContext;
@Autowired
private IMapService iMapService;
@Autowired
private ICommandService iCommandService;
@Autowired
private ILoadPlanService iLoadPlanService;
@Autowired
private IRunPlanTemplateService iRunPlanTemplateService;
@Autowired
private SchedulingService schedulingService;
@Autowired
private GroupSimulationCache groupSimulationCache;
@Autowired
private SimulationLifeCycleService simulationLifeCycleService;
@Autowired
private AtsOperationDispatcher atsOperationDispatcher;
@Autowired
private AtsTrainLoadService atsTrainLoadService;
@Autowired
private ATSMessageCollectAndDispatcher atsMessageCollectAndDispatcher;
@Autowired
private MemberManager memberManager;
@Autowired
private ITrainingV1Service iTrainingV1Service;
@Autowired
private IExamService iExamService;
@Autowired
private ILessonService iLessonService;
@Autowired
private StompMessageService stompMessageService;
@Autowired
private IScriptService iScriptService;
@Autowired
private OtherConfig otherConfig;
@Autowired
private WeChatConfig weChatConfig;
@Autowired
private IScriptSimulationService iScriptSimulationService;
@Autowired
private SimulationRealDeviceConnectManager simulationRealDeviceConnectManager;
@Autowired
private PassengerFlowSimulateService passengerFlowSimulateService;
@Autowired
private IOrgUserService iOrgUserService;
@Autowired
private IUserPermissionService iUserPermissionService;
@Autowired
private IOrgService iOrgService;
@Autowired
private SimulationManager simulationManager;
@Autowired
private IRunPlanRunlevelService iRunPlanRunlevelService;
@Autowired
private IRunPlanParktimeService iRunPlanParktimeService;
// /**
// * 创建仿真并进行缓存
// *
@ -223,8 +205,26 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
Simulation.FunctionalType functionalType) {
Objects.requireNonNull(mapId, "地图id不能为空");
Objects.requireNonNull(functionalType, "仿真功能类型不能为空");
SimulationBuildParams params = this.prepareSimulationParams(loginUserInfoVO, mapId,
prdType, functionalType);
String group = SimulationIdGenerator.generateGroup(loginUserInfoVO.getUserVO().getId(), mapId);
Simulation simulation = this.simulationLifeCycleService.create(params, group);
// 添加仿真成员
SimulationUser simulationUser = new SimulationUser(simulation, loginUserInfoVO);
simulation.addSimulationUser(simulationUser);
// 根据仿真产品类型设置用户扮演角色
memberManager.playRoleBySimulationType(simulation, loginUserInfoVO.getUserVO().getId());
// 仿真开始运行
this.simulationManager.start(simulation.getId());
return simulation;
}
private SimulationBuildParams prepareSimulationParams(LoginUserInfoVO loginUserInfoVO, Long mapId,
MapPrdTypeEnum prdType, Simulation.FunctionalType functionalType) {
// 获取地图数据
MapVO mapVO = this.iMapService.getMapDetail(mapId);
List<RunPlanRunlevelVO> runLevelList = this.prepareRunLevelData(mapVO, loginUserInfoVO, mapId);
List<RunPlanParkingTimeVO> parkTimeList = this.prepareParkTimeData(mapVO, loginUserInfoVO, mapId);
// 获取操作定义数据
List<CommandDefinitionVO> operationDefinitionList = this.iCommandService
.queryDefinitionsByLineCode(mapVO.getLineCode());
@ -233,6 +233,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
builder.loginUserInfo(loginUserInfoVO)
.createTime(LocalDateTime.now())
.map(mapVO)
.userRunLevelList(runLevelList)
.userParkTimeList(parkTimeList)
.operationDefinitionList(operationDefinitionList)
.prodType(prdType)
.functionalType(functionalType);
@ -252,16 +254,27 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
builder.schedulingPlan(schedulingPlanNewVO);
}
SimulationBuildParams params = builder.build();
String group = SimulationIdGenerator.generateGroup(loginUserInfoVO.getUserVO().getId(), mapId);
Simulation simulation = this.simulationLifeCycleService.create(params, group);
// 添加仿真成员
SimulationUser simulationUser = new SimulationUser(simulation, loginUserInfoVO);
simulation.addSimulationUser(simulationUser);
// 根据仿真产品类型设置用户扮演角色
memberManager.playRoleBySimulationType(simulation, loginUserInfoVO.getUserVO().getId());
// 仿真开始运行
this.simulationManager.start(simulation.getId());
return simulation;
return params;
}
private List<RunPlanParkingTimeVO> prepareParkTimeData(MapVO mapVO, LoginUserInfoVO loginUserInfoVO, Long mapId) {
List<RunPlanParkingTimeVO> runPlanParkingTimeVOList = this.iRunPlanParktimeService.queryUserParktimes(loginUserInfoVO.getUserVO().getId(), mapId);
return runPlanParkingTimeVOList;
}
private List<RunPlanRunlevelVO> prepareRunLevelData(MapVO mapVO, LoginUserInfoVO loginUserInfoVO, Long mapId) {
List<RunPlanRunlevelVO> runLevelList = this.iRunPlanRunlevelService.queryUserRunLevels(loginUserInfoVO.getUserVO().getId(), mapId);
return runLevelList;
// List<MapStationRunLevelVO> stationRunLevelVOList = RunPlanRunlevelVO.convert2StationRunPlanVOList(runLevelList);
// List<MapStationRunLevelVO> defaultRunLevelList = mapVO.getLogicDataNew().getRunLevelList();
// Map<String, MapStationRunLevelVO> runLevelVOMap = new HashMap<>();
// for (MapStationRunLevelVO vo : stationRunLevelVOList) {
// runLevelVOMap.put(vo.buildCode(), vo);
// }
// for (MapStationRunLevelVO vo : defaultRunLevelList) {
// runLevelVOMap.putIfAbsent(vo.buildCode(), vo);
// }
// mapVO.getLogicDataNew().setRunLevelList(new ArrayList<>(runLevelVOMap.values()));
}
@Override

View File

@ -10,6 +10,7 @@ import club.joylink.rtss.vo.client.map.MapTrainModelVO;
import club.joylink.rtss.vo.client.map.MapTrainVO;
import club.joylink.rtss.vo.client.map.MapZcVO;
import club.joylink.rtss.vo.client.map.newmap.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@ -20,6 +21,7 @@ import java.util.stream.Collectors;
/**
* 地图设备校验/构建器
*/
@Slf4j
public class MapDeviceBuilder {
/**
@ -744,6 +746,119 @@ public class MapDeviceBuilder {
buildCatenary(graphData, elementMap, errMsgList, mapDataBuildResult.getCatenaryMap());
//应答器
buildResponderDataRef(graphData, elementMap, errMsgList, mapDataBuildResult.getSectionRespondersMap());
if (mapDataBuildResult.getErrMsgList().isEmpty()) {
Map<String, Set<Section>> sectionArriveMap = buildNormalStandTrackAdjoinSections(mapDataBuildResult.getDeviceMap());
mapDataBuildResult.setSectionArriveNearMap(sectionArriveMap);
}
}
public static Map<String, Set<Section>> buildNormalStandTrackAdjoinSections(Map<String, MapElement> deviceMap) {
List<Section> standTrackList = deviceMap.values().stream()
.filter(mapElement -> mapElement.getDeviceType().equals(MapElement.DeviceType.SECTION))
.map(mapElement -> ((Section) mapElement))
.filter(section -> section.isNormalStandTrack() || section.isTransferTrack() || section.isTurnBackTrack())
.collect(Collectors.toList());
Map<String, Set<Section>> sectionDirectionSectionsMap = new HashMap<>();
for (Section section : standTrackList) {
Set<Section> rightDirectionList = new HashSet<>();
sectionDirectionSectionsMap.put(buildSectionDirectionKey(section, true), rightDirectionList);
queryAdjoinSections(section, true, rightDirectionList);
Set<Section> leftDirectionList = new HashSet<>();
sectionDirectionSectionsMap.put(buildSectionDirectionKey(section, false), leftDirectionList);
queryAdjoinSections(section, false, leftDirectionList);
log.debug(String.format("区段[%s][右向]邻接区段为[%s],[左向]邻接区段为[%s]",
section.debugStr(),
String.join(",",rightDirectionList.stream().map(Section::debugStr).collect(Collectors.toList())),
String.join(",", leftDirectionList.stream().map(Section::debugStr).collect(Collectors.toList()))));
}
return sectionDirectionSectionsMap;
}
private static String buildSectionDirectionKey(Section section, boolean right) {
return String.format("%s-%s", section.getCode(), right?"R":"L");
}
/**
* 查找区段临近的功能区段站台轨转换轨折返轨
* @param section
* @param right
* @param rightDirectionList
*/
private static void queryAdjoinSections(Section section, boolean right, Set<Section> rightDirectionList) {
Signal signal = section.getSignalOf(right);
if (signal == null) {
Section base = section;
for (int i = 0; i < 10; i++) {
Section next = base.getSectionOf(right);
if (next == null) { // 可能到尽头了
return;
}
if (checkAdjoinSectionAndAdd(next, rightDirectionList)) {
return;
}
signal = next.getSignalOf(right);
if (signal != null) {
break;
}
base = next;
}
}
if (signal == null) {
return;
}
queryAdjoinSections(signal, rightDirectionList);
}
private static void queryAdjoinSections(Signal signal, Set<Section> rightDirectionList) {
boolean right = signal.isRight();
List<Route> routeList = signal.getRouteList();
if (CollectionUtils.isEmpty(routeList)) { // 没有进路找自动信号
AutoSignal autoSignal = signal.getAutoSignal();
if (autoSignal == null) {
return;
}
List<Section> sectionList = autoSignal.getSectionList();
for (Section temp : sectionList) {
if (checkAdjoinSectionAndAdd(temp, rightDirectionList)) {
return;
}
signal = temp.getSignalOf(right);
if (signal != null) {
queryAdjoinSections(signal, rightDirectionList);
}
}
} else {
Set<Signal> queryList = new HashSet<>();
for (Route route : routeList) {
if (route.isAtp() || route.isGuide()) {
continue;
}
List<Section> sectionList = route.getSectionList();
boolean finish = false;
for (Section section : sectionList) {
if (checkAdjoinSectionAndAdd(section, rightDirectionList)) {
finish = true;
break;
}
}
if (!finish) {
queryList.add(route.getDestination());
}
}
for (Signal next : queryList) {
queryAdjoinSections(next, rightDirectionList);
}
}
}
private static boolean checkAdjoinSectionAndAdd(Section temp, Set<Section> rightDirectionList) {
if (temp.isStandTrack() || temp.isTransferTrack()) {
rightDirectionList.add(temp);
return true;
} else if (temp.isTurnBackTrack()) {
rightDirectionList.add(temp);
}
return false;
}
private static void checkSectionFunctionType(Map<String, MapElement> deviceMap, List<String> errMsgList) {

View File

@ -1,15 +1,17 @@
package club.joylink.rtss.simulation.cbtc.build;
import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.CommandDefinitionVO;
import club.joylink.rtss.vo.client.LessonVO;
import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanParkingTimeVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunlevelVO;
import club.joylink.rtss.vo.client.schedulingNew.SchedulingPlanNewVO;
import lombok.Builder;
import lombok.Getter;
@ -34,7 +36,8 @@ public class SimulationBuildParams {
/** 地图数据 */
private MapVO map;
private List<RunPlanRunlevelVO> userRunLevelList;
private List<RunPlanParkingTimeVO> userParkTimeList;
/** 仿真产品类型 */
private MapPrdTypeEnum prodType;

View File

@ -52,14 +52,17 @@ public class SimulationBuilder {
simulation.addDataErrMsgs(mapDataBuildResult.getErrMsgList());
}
simulation.getRepository().setDeviceMap(mapDataBuildResult.getDeviceMap());
simulation.getRepository().setSectionArriveNearMap(mapDataBuildResult.sectionArriveNearMap);
simulation.getRepository().setVrDeviceMap(mapDataBuildResult.getVrDeviceMap());
// simulation.getRepository().setRouteUnitMap(mapDataBuildResult.getRouteUnitMap());
simulation.getRepository().setRoutePathMap(mapDataBuildResult.getRoutePathMap());
simulation.getRepository().setDestinationMap(mapDataBuildResult.getDestinationMap());
simulation.getRepository().setRoutingList(mapDataBuildResult.getRoutingList());
simulation.getRepository().setRunLevelList(mapDataBuildResult.getRunLevelList());
// simulation.getRepository().setRunLevelList(mapDataBuildResult.getRunLevelList());
simulation.getRepository().getCatenaryMap().putAll(mapDataBuildResult.getCatenaryMap());
simulation.getRepository().getSectionRespondersMap().putAll(mapDataBuildResult.getSectionRespondersMap());
UserConfigDataBuilder.buildUserRunLevel(simulation.getRepository(), buildParams.getUserRunLevelList());
UserConfigDataBuilder.buildUserParkTime(simulation.getRepository(), buildParams.getUserParkTimeList());
// 加载运行图
checkAndLoadRunPlan(simulation, buildParams.getRunPlan());
// 加载派班计划
@ -348,6 +351,8 @@ public class SimulationBuilder {
private Map<Section,List<Responder>> sectionRespondersMap;
@Setter
Map<String, Set<Section>> sectionArriveNearMap;
/**
* 数据错误信息列表
*/

View File

@ -0,0 +1,44 @@
package club.joylink.rtss.simulation.cbtc.build;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.map.Station;
import club.joylink.rtss.simulation.cbtc.data.map.StationParkTime;
import club.joylink.rtss.simulation.cbtc.data.map.StationRunLevel;
import club.joylink.rtss.vo.client.runplan.user.RunPlanParkingTimeVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunlevelVO;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class UserConfigDataBuilder {
public static void buildUserRunLevel(SimulationDataRepository repository, List<RunPlanRunlevelVO> userRunLevelList) {
Map<String, StationRunLevel> runLevelMap = new HashMap<>();
for (RunPlanRunlevelVO vo : userRunLevelList) {
Station startStation = repository.getByCode(vo.getStartStationCode(), Station.class);
Section startSection = repository.getByCode(vo.getStartSectionCode(), Section.class);
Station endStation = repository.getByCode(vo.getEndStationCode(), Station.class);
Section endSection = repository.getByCode(vo.getEndSectionCode(), Section.class);
StationRunLevel stationRunLevel = new StationRunLevel();
stationRunLevel.setStartStation(startStation);
stationRunLevel.setStartSection(startSection);
stationRunLevel.setEndStation(endStation);
stationRunLevel.setEndSection(endSection);
stationRunLevel.setRight(vo.getRight());
stationRunLevel.setDistance(vo.getDistance());
stationRunLevel.setL1(vo.getL1());
stationRunLevel.setL2(vo.getL2());
stationRunLevel.setL3(vo.getL3());
stationRunLevel.setL4(vo.getL4());
stationRunLevel.setL5(vo.getL5());
runLevelMap.putIfAbsent(stationRunLevel.buildKey(), stationRunLevel);
}
repository.setRunLevelMap(runLevelMap);
}
public static void buildUserParkTime(SimulationDataRepository repository, List<RunPlanParkingTimeVO> userParkTimeList) {
Map<String, StationParkTime> parkTimeMap = new HashMap<>();
}
}

View File

@ -139,8 +139,18 @@ public class SimulationDataRepository {
/**
* 站间运行等级列表
* key-startSectionCode-endSectionCode
* val-runLevel
*/
private List<StationRunLevel> runLevelList;
private Map<String, StationRunLevel> runLevelMap;
/**
* key-sectionCode
*/
private Map<String, StationParkTime> parkTimeMap;
/**
* key-sectionCode-(R/L) R:右向L:左向
*/
Map<String, Set<Section>> sectionArriveNearMap;
/**
* 终端/折返车站-终端发车计划map

View File

@ -231,6 +231,7 @@ public class MapConfig {
setRouteSettingNoFail(configVO.isRouteSettingNoFail());
setSignalOpenAfterParking(configVO.isSignalOpenAfterParking());
this.setStandHoldCloseLogicLight(configVO.isStandHoldCloseLogicLight());
this.setAtsAutoHandleManualFrontTurnBack(configVO.isAtsAutoHandleManualFrontTurnBack());
setCtcOverlapOnlyTurnBackStationLock(configVO.isCtcOverlapOnlyTurnBackStationLock());
this.setGuideNeedRouteSettingFirst(configVO.isGuideNeedRouteSettingFirst());
setSwitchSingleHandle(configVO.getSwitchSingleHandle());

View File

@ -0,0 +1,7 @@
package club.joylink.rtss.simulation.cbtc.data.map;
import lombok.Getter;
@Getter
public class StationParkTime {
}

View File

@ -50,4 +50,8 @@ public class StationRunLevel {
startStation.getName(), startSection.getName(),
endStation.getName(), endSection.getName());
}
public String buildKey() {
return String.format("%s-%s", this.startSection.getCode(), this.endSection.getCode());
}
}

View File

@ -19,7 +19,7 @@ public final class SimulationFixedJob extends SimulationScheduledJob {
LocalDateTime systemTime = simulation.getSystemTime();
// 实际运行间隔单位ns
long runPeriod = TimeUnit.MILLISECONDS.toNanos(this.rate) * simulation.getSpeed();
// 弥补非整数倍的情况
// 弥补非整数倍的情况.PS:只能弥补运行频率大于仿真基础运行频率的情况
long l = Duration.between(this.runtime, systemTime).toNanos();
long l1 = l % runPeriod;
long add = runPeriod - l1;

View File

@ -39,7 +39,7 @@ public class SimulationScheduledJob extends SimulationJob {
LocalDateTime systemTime = simulation.getSystemTime();
// 实际运行间隔单位ns
long runPeriod = TimeUnit.MILLISECONDS.toNanos(this.rate);
// 弥补非整数倍的情况
// 弥补非整数倍的情况.PS:只能弥补运行频率大于仿真基础运行频率的情况
long l = Duration.between(this.runtime, systemTime).toNanos();
long l1 = l % runPeriod;
long add = runPeriod - l1;

View File

@ -1,10 +1,15 @@
package club.joylink.rtss.vo.client.map.newmap;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.runplan.user.RunPlanParkingTimeVO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@Getter
@ -26,6 +31,12 @@ public class MapLogicDataNewVO {
@ApiModelProperty(value = "站间运行等级列表")
private List<MapStationRunLevelVO> runLevelList;
/**
* 停站时间列表
*/
private List<RunPlanParkingTimeVO> parkTimeList;
@Deprecated
@ApiModelProperty(value = "车站区段停站时间列表")
private List<MapStationParkingTimeVO> parkingTimeList;
@ -53,4 +64,12 @@ public class MapLogicDataNewVO {
this.overlapList = new ArrayList<>();
this.autoReentryList = new ArrayList<>();
}
@JsonIgnore
public MapRoutingDataVO getLongestRouting() {
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionNotEmpty(this.routingList);
this.routingList.sort(Comparator.comparing(routingVO -> routingVO.getParkSectionCodeList().size()));
Collections.reverse(this.routingList);
return routingList.get(0);
}
}

View File

@ -1,11 +1,12 @@
package club.joylink.rtss.vo.client.map.newmap;
import com.fasterxml.jackson.annotation.JsonIgnore;
import club.joylink.rtss.entity.DraftMapRunLevel;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.map.newmap.validate.RunLevelCreateCheck;
import club.joylink.rtss.vo.client.map.newmap.validate.RunLevelGenerateCheck;
import club.joylink.rtss.vo.client.map.newmap.validate.RunLevelUpdateCheck;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunlevelVO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@ -80,6 +81,21 @@ public class MapStationRunLevelVO {
@PositiveOrZero
private Integer l5;
public MapStationRunLevelVO(RunPlanRunlevelVO runPlanRunlevelVO) {
this.mapId = runPlanRunlevelVO.getMapId();
this.startStationCode = runPlanRunlevelVO.getStartStationCode();
this.startSectionCode = runPlanRunlevelVO.getStartSectionCode();
this.endStationCode = runPlanRunlevelVO.getEndStationCode();
this.endSectionCode = runPlanRunlevelVO.getEndSectionCode();
this.right = runPlanRunlevelVO.getRight();
this.distance = runPlanRunlevelVO.getDistance();
this.l1 = runPlanRunlevelVO.getL1();
this.l2 = runPlanRunlevelVO.getL2();
this.l3 = runPlanRunlevelVO.getL3();
this.l4 = runPlanRunlevelVO.getL4();
this.l5 = runPlanRunlevelVO.getL5();
}
public static List<MapStationRunLevelVO> convert2VOList(List<DraftMapRunLevel> list) {
List<MapStationRunLevelVO> voList = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
@ -134,11 +150,11 @@ public class MapStationRunLevelVO {
public void generateDefaultRunLevel() {
Objects.requireNonNull(this.distance, "站间距离不能为空");
this.l1 = Math.round(this.distance / 12f);
this.l2 = Math.round(this.distance / 10.5f);
this.l3 = Math.round(this.distance / 9f);
this.l4 = Math.round(this.distance / 7.5f);
this.l5 = Math.round(this.distance / 6f);
this.l1 = Math.round(this.distance / 18f);
this.l2 = Math.round(this.distance / 16f);
this.l3 = Math.round(this.distance / 13.5f);
this.l4 = Math.round(this.distance / 12f);
this.l5 = Math.round(this.distance / 10f);
}
@Override

View File

@ -1,10 +1,7 @@
package club.joylink.rtss.vo.client.runplan.user;
import club.joylink.rtss.entity.RunPlanRunlevel;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.vo.client.map.newmap.MapRoutingDataVO;
import club.joylink.rtss.vo.client.map.newmap.MapRoutingSectionNewVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
import club.joylink.rtss.vo.client.map.newmap.validate.RunLevelCreateCheck;
import club.joylink.rtss.vo.client.map.newmap.validate.RunLevelGenerateCheck;
import club.joylink.rtss.vo.client.map.newmap.validate.RunLevelUpdateCheck;
@ -21,7 +18,6 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.PositiveOrZero;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@ApiModel(value = "运行计划站间运行等级")
@ -119,6 +115,16 @@ public class RunPlanRunlevelVO {
return runLevelVO;
}
public static List<MapStationRunLevelVO> convert2StationRunPlanVOList(List<RunPlanRunlevelVO> runLevelList) {
List<MapStationRunLevelVO> voList = new ArrayList<>();
if (!CollectionUtils.isEmpty(runLevelList)) {
for (RunPlanRunlevelVO runPlanRunlevelVO : runLevelList) {
voList.add(new MapStationRunLevelVO(runPlanRunlevelVO));
}
}
return voList;
}
public RunPlanRunlevel convert2Entity() {
RunPlanRunlevel runLevel = new RunPlanRunlevel();
runLevel.setId(id);