NCC列车延误报警逻辑修改;修改列车最大制动力计算逻辑
This commit is contained in:
parent
d354ed9fd7
commit
720154f53a
@ -6,7 +6,6 @@ import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.plan.StationPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
||||
import club.joylink.rtss.util.Tuple;
|
||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
|
||||
import club.joylink.rtss.websocket.StompMessageService;
|
||||
@ -37,27 +36,22 @@ public class NccAlarmService {
|
||||
*/
|
||||
public void delayMonitoring(Simulation simulation) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
Map<TrainInfo, Tuple<StationPlan, Integer>> delayMonitoring = repository.getTrainDelayMonitoring();
|
||||
Map<String, Integer> trainDelayMonitoring = repository.getTrainDelayMonitoring();
|
||||
LocalDateTime correctSystemDateTime = simulation.getCorrectSystemTime();
|
||||
LocalTime systemTime = simulation.getSystemTime().toLocalTime();
|
||||
for (TrainInfo trainInfo : repository.getSuperviseTrainList()) {
|
||||
if (!trainInfo.isPlanTrain())
|
||||
continue;
|
||||
//查找车次计划的一个未完成车站计划
|
||||
Tuple<StationPlan, Integer> tuple = delayMonitoring.computeIfAbsent(trainInfo, K -> new Tuple<>());
|
||||
String groupNumber = trainInfo.getGroupNumber();
|
||||
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
|
||||
Optional<StationPlan> stationPlanOptional = tripPlan.queryFirstUnfinishedStationPlan();
|
||||
//如果未完成车站计划存在,则根据与当前
|
||||
stationPlanOptional.ifPresent(stationPlan -> {
|
||||
if (!stationPlan.equals(tuple.a)) {
|
||||
tuple.a = stationPlan;
|
||||
tuple.b = 2;
|
||||
}
|
||||
});
|
||||
StationPlan stationPlan = tuple.a;
|
||||
Integer delay = tuple.b;
|
||||
StationPlan stationPlan = stationPlanOptional.orElse(null);
|
||||
//满足条件则无需监测
|
||||
if (stationPlan == null || delay == null)
|
||||
if (stationPlan == null)
|
||||
continue;
|
||||
int delay = trainDelayMonitoring.computeIfAbsent(groupNumber, k -> 2);
|
||||
if (delay == -1)
|
||||
continue;
|
||||
//延误监测
|
||||
if (systemTime.isAfter(stationPlan.getArriveTime())) {
|
||||
@ -66,15 +60,15 @@ public class NccAlarmService {
|
||||
switch (delay) {
|
||||
case 2:
|
||||
level = "蓝色";
|
||||
tuple.b = 5;
|
||||
trainDelayMonitoring.put(groupNumber, 5);
|
||||
break;
|
||||
case 5:
|
||||
level = "黄色";
|
||||
tuple.b = 10;
|
||||
trainDelayMonitoring.put(groupNumber, 10);
|
||||
break;
|
||||
case 10:
|
||||
level = "红色";
|
||||
tuple.b = null;
|
||||
trainDelayMonitoring.put(groupNumber, -1);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + delay);
|
||||
@ -82,7 +76,6 @@ public class NccAlarmService {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
String groupNumber = trainInfo.getGroupNumber();
|
||||
String description = String.format("列车[%s]按照计划[%s-%s]应在[%s]抵达[%s],现已晚点%s分钟",
|
||||
groupNumber, trainInfo.getServiceNumber(), trainInfo.getTripNumber(),
|
||||
stationPlan.getCorrectArriveTime(), stationPlan.getStation().getName(), delay);
|
||||
|
@ -9,7 +9,6 @@ import club.joylink.rtss.simulation.cbtc.data.iscs.Audio;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
import club.joylink.rtss.simulation.cbtc.data.plan.RealRun;
|
||||
import club.joylink.rtss.simulation.cbtc.data.plan.SchedulingTrainPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.plan.StationPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.status.DeviceStatus;
|
||||
import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus;
|
||||
@ -24,7 +23,6 @@ import club.joylink.rtss.simulation.cbtc.depot.DepotService;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import club.joylink.rtss.util.StrUtils;
|
||||
import club.joylink.rtss.util.Tuple;
|
||||
import club.joylink.rtss.vo.client.iscs.device.IscsDeviceVO;
|
||||
import club.joylink.rtss.vo.client.psl.PslStatus;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
|
||||
@ -120,9 +118,9 @@ public class SimulationDataRepository {
|
||||
|
||||
/**
|
||||
* 列车延误监测
|
||||
* val-b:延误超过此时间时报警
|
||||
* val:延误超过此时间时报警(-1表示所有监测都完成)
|
||||
*/
|
||||
private Map<TrainInfo, Tuple<StationPlan, Integer>> trainDelayMonitoring = new ConcurrentHashMap<>();
|
||||
private Map<String, Integer> trainDelayMonitoring = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 列车实际运行数据记录
|
||||
@ -678,8 +676,8 @@ public class SimulationDataRepository {
|
||||
}
|
||||
|
||||
public void deleteSuperviseTrain(String groupNumber) {
|
||||
TrainInfo trainInfo = this.trainInfoMap.remove(groupNumber);
|
||||
this.trainDelayMonitoring.remove(trainInfo);
|
||||
this.trainInfoMap.remove(groupNumber);
|
||||
this.trainDelayMonitoring.remove(groupNumber);
|
||||
}
|
||||
|
||||
public List<Stand> queryPreviousStand(Stand stand) {
|
||||
|
@ -761,8 +761,9 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
}
|
||||
|
||||
public float getCurrentFbMax() {
|
||||
float speed = this.getSpeedKmPh();
|
||||
return speed >= 45 ? 8900 / speed : 200;
|
||||
// float speed = this.getSpeedKmPh();
|
||||
// return speed >= 45 ? 8900 / speed : 200;
|
||||
return 200; //大铁列车速度上限比地铁高很多,上面的逻辑会导致大铁列车高速行驶时制动力远低于预期,从而导致停车出问题
|
||||
}
|
||||
|
||||
public float getCurrentFkMax() {
|
||||
@ -1132,6 +1133,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
this.setDriveMode(DriveMode.RM);
|
||||
this.setRunLevel(RunLevel.IL);
|
||||
this.setAtoOn(false);
|
||||
this.setGear(Handwheel.MANUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,62 +87,6 @@ public class ATOService {
|
||||
this.doControlBySpeedCurve(train, speedCurve, speedCurve.getTotalDistance());
|
||||
}
|
||||
|
||||
/**
|
||||
* ATO运算逻辑
|
||||
*/
|
||||
public void ATO(VirtualRealityTrain train) {
|
||||
// if (!train.isPowerOn() || !train.isAtoOn()) {
|
||||
// return;
|
||||
// }
|
||||
// //下令停车
|
||||
// if (train.isOrderStop()) {
|
||||
// this.doBreakMax(train);
|
||||
// return;
|
||||
// }
|
||||
// if (train.getTarget() == null)
|
||||
// return;
|
||||
// // 计算到目标/授权终点剩余距离,根据距离计算速度,根据速度,控制牵引/制动输出
|
||||
// MovementAuthority ma = train.getMa();
|
||||
// if (Objects.isNull(ma)) {
|
||||
// // 移动授权不存在,制动返回
|
||||
// log.info(String.format("列车[%s-%s|%s|%s]ATO没有移动授权,不执行ATO控制",
|
||||
// train.getGroupNumber(), train.getServiceNumber(), train.getTripNumber(), train.getDestinationCode()));
|
||||
// doBreakMax(train);
|
||||
// return;
|
||||
// }
|
||||
//// boolean right = train.isRight();
|
||||
// // ATP安全防护最远可达到位置
|
||||
//// float trainLen = train.getLen();
|
||||
//// SectionPosition headPosition = train.getHeadPosition();
|
||||
//// SectionPosition tailPosition = CalculateService.calculateNextPositionByStartAndLen(headPosition, !right, trainLen);
|
||||
//// float targetDistance = this.calculateTargetRemainDistance(train, ma);
|
||||
//// float speedMax = train.getAtpSpeedMax();
|
||||
//// float speedMax = Math.min(train.getAtoSpeedMax(), train.getSpeedLimit() * 0.9f);
|
||||
//// SpeedCurve speedCurve = SpeedCurve
|
||||
//// .buildTargetSpeedCurve(headPosition, tailPosition, right,
|
||||
//// targetDistance, train.getSpeed(), speedMax);
|
||||
//// // 更新目标距离和建议速度
|
||||
//// train.setTargetDistance(targetDistance);
|
||||
//// train.setAtoSpeed(speedCurve.getSpeedOf(speedCurve.getTotalDistance()));
|
||||
//
|
||||
// if (!train.isAtoOn()) { // ATO未启用,不控制
|
||||
// return;
|
||||
// }
|
||||
// // 是否EB
|
||||
// if (train.isEB()) { // EB中,不控制
|
||||
// return;
|
||||
// }
|
||||
// // 是否停车制动
|
||||
// if (train.isBreaking()) { // 站台持续停车制动中,输出持续制动
|
||||
// doBreakMax(train);
|
||||
// return;
|
||||
// }
|
||||
// SpeedCurve speedCurve = train.getSpeedCurve();
|
||||
// if (speedCurve != null) {
|
||||
// this.doControlBySpeedCurve(train, speedCurve, speedCurve.getTotalDistance());
|
||||
// }
|
||||
}
|
||||
|
||||
public static Float calculateDistanceOfMa(SectionPosition headPosition, boolean right, MovementAuthority ma) {
|
||||
Objects.requireNonNull(ma);
|
||||
// ATP安全防护最远可达到位置
|
||||
@ -150,72 +94,6 @@ public class ATOService {
|
||||
return CalculateService.calculateDistance(headPosition, endPosition, right, false);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 计算到目标位置剩余距离
|
||||
// */
|
||||
// public static float calculateTargetRemainDistance(VirtualRealityTrain train, MovementAuthority ma) {
|
||||
// if (train.getTarget() == null)
|
||||
// return 0;
|
||||
// SectionPosition headPosition = train.getHeadPosition();
|
||||
// boolean right = train.isRight();
|
||||
// Float distance = calculateDistanceOfMa(headPosition, right, ma);
|
||||
// if (Objects.isNull(distance)) {
|
||||
// return 0;
|
||||
// }
|
||||
// // 下一计划到站存在
|
||||
//// int count = 0;
|
||||
//// Section nextStopStandSection = null;
|
||||
//// Section base = headPosition.getSection();
|
||||
//// while (true) {
|
||||
//// if ((base.isNormalStandTrack() || base.isTransferTrack())) {
|
||||
//// nextStopStandSection = base;
|
||||
//// break;
|
||||
//// }
|
||||
//// Section section = base.getNextRunningSectionOf(right);
|
||||
//// if (Objects.isNull(section)) {
|
||||
//// // 未找到
|
||||
//// break;
|
||||
//// } else {
|
||||
//// base = section;
|
||||
//// }
|
||||
//// if (count > 20) {
|
||||
//// break;
|
||||
//// }
|
||||
//// ++count;
|
||||
//// }
|
||||
// Section target = train.getTarget();
|
||||
// if (Objects.nonNull(target)) {
|
||||
// // 下一计划到站台轨存在
|
||||
//// log.debug(String.format("列车[%s-%s|%s|%s]下一计划到站[%s(%s)],实际可达站台轨为[%s(%s)]",
|
||||
//// train.getGroupNumber(), train.getServiceNumber(),
|
||||
//// train.getTripNumber(), train.getDestinationCode(),
|
||||
//// nextStation.getName(), nextStation.getCode(),
|
||||
//// nextStopStandSection.getName(), nextStopStandSection.getCode()));
|
||||
// boolean parking = true;
|
||||
// Signal signal = target.getSignalOf(right);
|
||||
// if (!train.isHold() && (train.isJump() && (Objects.isNull(signal) || signal.isMainAspect()) || !train.isNextParking())) {
|
||||
// parking = false;
|
||||
// }
|
||||
// if (parking) {
|
||||
// // 列车停站,计算距离
|
||||
// SectionPosition targetStopPoint = new SectionPosition(target,
|
||||
// target.getStopPointByDirection(right));
|
||||
// Float targetDistance = CalculateService.calculateDistance(headPosition, targetStopPoint, right);
|
||||
// if (Objects.nonNull(targetDistance) && targetDistance >= 0 && targetDistance < distance) {
|
||||
// return targetDistance;
|
||||
// }
|
||||
// } else {
|
||||
//// log.debug(String.format("列车[%s]下一计划到站[%s(%s)]不停车",
|
||||
//// train.getGroupNumber(),
|
||||
//// nextStation.getName(), nextStation.getCode()));
|
||||
// }
|
||||
// }
|
||||
// // 若不存在下一计划站台轨,列车应该在安全防护距离前一段距离停车
|
||||
// distance -= 10;
|
||||
//// log.debug(String.format("列车[%s]剩余目标距离:[%s]", train.getGroupNumber(), distance));
|
||||
// return distance;
|
||||
// }
|
||||
|
||||
public void doControlBySpeedCurve(VirtualRealityTrain train, SpeedCurve speedCurve, float remainDistance) {
|
||||
doControlBySpeedCurve(train, speedCurve, remainDistance, train.getAtoSpeed());
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService {
|
||||
joylink3DMessageService.addJobs(simulation);
|
||||
faultGenerator.addJobs(simulation);
|
||||
atsMessageCollectAndDispatcher.addJobs(simulation);
|
||||
// nccAlarmService.addJobs(simulation);
|
||||
nccAlarmService.addJobs(simulation);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user