Merge remote-tracking branch 'origin/test' into dev
This commit is contained in:
commit
f681f3a20f
@ -838,7 +838,7 @@ public class AtsTrainLoadService {
|
|||||||
*/
|
*/
|
||||||
public void loadSpareTrain(Simulation simulation, String groupNumber, String sectionCode, boolean right) {
|
public void loadSpareTrain(Simulation simulation, String groupNumber, String sectionCode, boolean right) {
|
||||||
SimulationDataRepository repository = simulation.getRepository();
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
if (repository.isVrTrainOnline(groupNumber)) {
|
if (!simulation.getRepository().getConfig().isHandleDepot() && repository.isVrTrainOnline(groupNumber)) {
|
||||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,
|
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,
|
||||||
String.format("车组号[%s]的列车已经在运行中", groupNumber));
|
String.format("车组号[%s]的列车已经在运行中", groupNumber));
|
||||||
} else {
|
} else {
|
||||||
@ -877,9 +877,11 @@ public class AtsTrainLoadService {
|
|||||||
train.initAsRM();
|
train.initAsRM();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!repository.getConfig().isHandleDepot()) {
|
||||||
TrainInfo trainInfo = TrainInfo.constructManualTrain(train);
|
TrainInfo trainInfo = TrainInfo.constructManualTrain(train);
|
||||||
trainInfo.tracking(train);
|
trainInfo.tracking(train);
|
||||||
repository.addOnlineTrain(train);
|
repository.addOnlineTrain(train);
|
||||||
repository.addTrainInfo(trainInfo);
|
repository.addTrainInfo(trainInfo);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ public class SimulationBuilder {
|
|||||||
// 停车轨到转换轨
|
// 停车轨到转换轨
|
||||||
secs.forEach(parkSec -> {
|
secs.forEach(parkSec -> {
|
||||||
final String rpKey = RoutePath.buildKey(parkSec, transSec);
|
final String rpKey = RoutePath.buildKey(parkSec, transSec);
|
||||||
List<RoutePath> nrp = tryFindRoutePathForOutByDirection(parkSec, transSec, 20);
|
List<RoutePath> nrp = tryFindRoutePathForOutByDirection(parkSec, transSec, 5);
|
||||||
List<RoutePath> srp = srps.get(rpKey);
|
List<RoutePath> srp = srps.get(rpKey);
|
||||||
if (null == srp) {
|
if (null == srp) {
|
||||||
srp = new ArrayList<RoutePath>();
|
srp = new ArrayList<RoutePath>();
|
||||||
@ -113,7 +113,7 @@ public class SimulationBuilder {
|
|||||||
// 转换轨到停车轨
|
// 转换轨到停车轨
|
||||||
secs.forEach(parkSec -> {
|
secs.forEach(parkSec -> {
|
||||||
final String rpKey = RoutePath.buildKey(transSec, parkSec);
|
final String rpKey = RoutePath.buildKey(transSec, parkSec);
|
||||||
List<RoutePath> nrp = tryFindRoutePathByDirection(transSec, parkSec, 20);
|
List<RoutePath> nrp = tryFindRoutePathByDirection(transSec, parkSec, 1);
|
||||||
List<RoutePath> srp = srps.get(rpKey);
|
List<RoutePath> srp = srps.get(rpKey);
|
||||||
if (null == srp) {
|
if (null == srp) {
|
||||||
srp = new ArrayList<RoutePath>();
|
srp = new ArrayList<RoutePath>();
|
||||||
|
@ -229,7 +229,7 @@ public class SimulationDataRepository {
|
|||||||
|
|
||||||
private List<SchedulingTrainPlan> outboundPlanList = new ArrayList<>();
|
private List<SchedulingTrainPlan> outboundPlanList = new ArrayList<>();
|
||||||
|
|
||||||
private List<SchedulingTrainPlan> inboundPlanList = new ArrayList<>();
|
private List<VirtualRealityTrain> inboundTrainList = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 间隔时间/s
|
* 间隔时间/s
|
||||||
|
@ -115,28 +115,30 @@ public class DepotService {
|
|||||||
* @param simulation
|
* @param simulation
|
||||||
*/
|
*/
|
||||||
private void backToParking(Simulation simulation) {
|
private void backToParking(Simulation simulation) {
|
||||||
for (VirtualRealityTrain train : simulation.getRepository().getOnlineTrainList()) {
|
for (TrainInfo trainInfo : simulation.getRepository().getTrainInfoMap().values()) {
|
||||||
if (!train.isParkingAt()) {
|
if (trainInfo.isInbound() && trainInfo.isParking()) {
|
||||||
continue;
|
VirtualRealityTrain train = simulation.getRepository().getVRByCode(trainInfo.getGroupNumber(), VirtualRealityTrain.class);
|
||||||
}
|
if (train.getHeadPosition().getSection().isTransferTrack() && train.getTailPosition().getSection().isTransferTrack()) {
|
||||||
Section section = train.getHeadPosition().getSection();
|
simulation.getRepository().getInboundTrainList().add(train);
|
||||||
if (!section.isTransferTrack()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (SchedulingTrainPlan schedulingTrainPlan : simulation.getRepository().getSchedulingTrainPlanList()) {
|
|
||||||
if (!schedulingTrainPlan.getInDepotTrip().getEndSection().equals(section)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!train.getGroupNumber().equals(schedulingTrainPlan.getGroupNumber())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!schedulingTrainPlan.getInDepotTrip().getEndTime().minusMinutes(10)
|
|
||||||
.isBefore(simulation.getSystemTime().toLocalTime())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!simulation.getRepository().getInboundPlanList().contains(schedulingTrainPlan)) {
|
|
||||||
train.initAsRM();
|
train.initAsRM();
|
||||||
simulation.getRepository().getInboundPlanList().add(schedulingTrainPlan);
|
Section startSection = train.getHeadPosition().getSection();
|
||||||
|
Section endSection = null;
|
||||||
|
for (Section section : simulation.getRepository().getParkingTracksMap().get(startSection.getStation())) {
|
||||||
|
if (section.isOccupied()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (section.getLeftSection() == null || section.getRightSection() == null) {
|
||||||
|
endSection = section;
|
||||||
|
} else if (section.getLeftSection().isParkingTrack() && !section.getLeftSection().isOccupied()) {
|
||||||
|
endSection = section.getLeftSection();
|
||||||
|
} else if (section.getRightSection().isParkingTrack() && !section.getRightSection().isOccupied()) {
|
||||||
|
endSection = section.getRightSection();
|
||||||
|
} else {
|
||||||
|
endSection = section;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
train.setTarget(endSection);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,38 +151,23 @@ public class DepotService {
|
|||||||
*/
|
*/
|
||||||
private void settingRouteAndMoving(Simulation simulation) {
|
private void settingRouteAndMoving(Simulation simulation) {
|
||||||
for (SchedulingTrainPlan schedulingTrainPlan : simulation.getRepository().getOutboundPlanList()) {
|
for (SchedulingTrainPlan schedulingTrainPlan : simulation.getRepository().getOutboundPlanList()) {
|
||||||
moving(simulation, schedulingTrainPlan.getGroupNumber(), schedulingTrainPlan.getOutDepotTrip().getStartSection());
|
VirtualRealityTrain train = simulation.getRepository().getVRByCode(schedulingTrainPlan.getGroupNumber(), VirtualRealityTrain.class);
|
||||||
}
|
moving(simulation, train, schedulingTrainPlan.getOutDepotTrip().getStartSection());
|
||||||
for (SchedulingTrainPlan schedulingTrainPlan : simulation.getRepository().getInboundPlanList()) {
|
|
||||||
Section endSection = schedulingTrainPlan.getInDepotTrip().getEndSection();
|
|
||||||
for (Section section : simulation.getRepository().getParkingTracksMap().get(endSection.getStation())) {
|
|
||||||
if (section.isOccupied()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (section.getLeftSection() == null || section.getRightSection() == null) {
|
|
||||||
moving(simulation, schedulingTrainPlan.getGroupNumber(), section);
|
|
||||||
} else if (section.getLeftSection().isParkingTrack() && !section.getLeftSection().isOccupied()) {
|
|
||||||
moving(simulation, schedulingTrainPlan.getGroupNumber(), section.getLeftSection());
|
|
||||||
} else if (section.getRightSection().isParkingTrack() && !section.getRightSection().isOccupied()) {
|
|
||||||
moving(simulation, schedulingTrainPlan.getGroupNumber(), section.getRightSection());
|
|
||||||
} else {
|
|
||||||
moving(simulation, schedulingTrainPlan.getGroupNumber(), section);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
for (VirtualRealityTrain train : simulation.getRepository().getInboundTrainList()) {
|
||||||
|
moving(simulation, train, train.getTarget());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moving(Simulation simulation, String groupNumber, Section endSection) {
|
private void moving(Simulation simulation, VirtualRealityTrain train, Section endSection) {
|
||||||
VirtualRealityTrain train = simulation.getRepository().getVRByCode(groupNumber, VirtualRealityTrain.class);
|
|
||||||
Section startSection = train.getHeadPosition().getSection();
|
Section startSection = train.getHeadPosition().getSection();
|
||||||
List<RoutePath> routePaths = simulation.getRepository().queryRoutePaths(startSection, endSection);
|
List<RoutePath> routePaths = simulation.getRepository().queryRoutePaths(startSection, endSection);
|
||||||
if (routePaths == null || routePaths.isEmpty()) {
|
if (routePaths == null || routePaths.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RoutePath routePath = routePaths.get(0);
|
RoutePath routePath = routePaths.get(0);
|
||||||
Section lastSection = routePath.getEnd();
|
Section pathEnd = routePath.getEnd();
|
||||||
train.setRobotTargetPosition(new SectionPosition(lastSection, lastSection.getStopPointByDirection(routePath.isRight())));
|
train.setRobotTargetPosition(new SectionPosition(pathEnd, pathEnd.getStopPointByDirection(routePath.isRight())));
|
||||||
for (Signal signal : routePath.getSignalList()) {
|
for (Signal signal : routePath.getSignalList()) {
|
||||||
for (Route route : signal.getRouteList()) {
|
for (Route route : signal.getRouteList()) {
|
||||||
if (routePath.getRouteList().contains(route)) {
|
if (routePath.getRouteList().contains(route)) {
|
||||||
@ -220,10 +207,8 @@ public class DepotService {
|
|||||||
groupSimulationService.command(simulation, commandInitiateVO, member);
|
groupSimulationService.command(simulation, commandInitiateVO, member);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Iterator<SchedulingTrainPlan> iterator = simulation.getRepository().getInboundPlanList().iterator(); iterator.hasNext(); ) {
|
for (Iterator<VirtualRealityTrain> iterator = simulation.getRepository().getInboundTrainList().iterator(); iterator.hasNext(); ) {
|
||||||
SchedulingTrainPlan schedulingTrainPlan = iterator.next();
|
VirtualRealityTrain train = iterator.next();
|
||||||
String groupNumber = schedulingTrainPlan.getGroupNumber();
|
|
||||||
VirtualRealityTrain train = simulation.getRepository().getVRByCode(groupNumber, VirtualRealityTrain.class);
|
|
||||||
if (train.getSpeed() == 0 && train.getHeadPosition().getSection().isParkingTrack()
|
if (train.getSpeed() == 0 && train.getHeadPosition().getSection().isParkingTrack()
|
||||||
&& train.getTailPosition().getSection().isParkingTrack()) {
|
&& train.getTailPosition().getSection().isParkingTrack()) {
|
||||||
// 到达
|
// 到达
|
||||||
|
Loading…
Reference in New Issue
Block a user