客流策略计算bug修改

This commit is contained in:
walker-sheng 2021-03-19 18:26:55 +08:00
parent f56f08f0a3
commit 0553287cdb

View File

@ -169,37 +169,40 @@ public class ParkTimeStrategyServiceImpl implements StrategyService<ParkTimeStra
LocalTime arriveTime = stationPlan.getArriveTime(); LocalTime arriveTime = stationPlan.getArriveTime();
LocalTime leaveTime = stationPlan.getLeaveTime(); LocalTime leaveTime = stationPlan.getLeaveTime();
// 列车到站乘客上车更新列车上人数 // 列车到站乘客上车更新列车上人数
StandPassenger standPassenger = data.getStandPassengerByStand(stationPlan.getSection().getStandList().get(0)); List<Stand> standList = stationPlan.getSection().getStandList();
int wait = standPassenger.getWait(); // 站台等待乘客数 if (!CollectionUtils.isEmpty(standList)) {
int normal = (parkTime - Config.INVALID_BOARD_TIME) * Config.PASSENGER_BOARD_SPEED; // 根据停站预测的可上车人数 StandPassenger standPassenger = data.getStandPassengerByStand(standList.get(0));
int remain = Config.TRAIN_CAPACITY - trainPassenger.getNum(); // 列车上剩余可载人数 int wait = standPassenger.getWait(); // 站台等待乘客数
// 大客流站计算指标 int normal = (parkTime - Config.INVALID_BOARD_TIME) * Config.PASSENGER_BOARD_SPEED; // 根据停站预测的可上车人数
if (Objects.equals(stationPlan.getSection(), stand.getSection())) { int remain = Config.TRAIN_CAPACITY - trainPassenger.getNum(); // 列车上剩余可载人数
// 时刻表偏差 // 大客流站计算指标
parkTime = strategy.getTime(); if (Objects.equals(stationPlan.getSection(), stand.getSection())) {
leaveTime = arriveTime.plusSeconds(parkTime); // 时刻表偏差
parkTime = strategy.getTime();
leaveTime = arriveTime.plusSeconds(parkTime);
// strategy.addTarget1(parkTime - stationPlan.getParkTime()); // strategy.addTarget1(parkTime - stationPlan.getParkTime());
// // 乘客等待时间(按人数统计不考虑时间) // // 乘客等待时间(按人数统计不考虑时间)
// strategy.addTarget2(standPassenger.getWait()); // strategy.addTarget2(standPassenger.getWait());
// //
strategy.addEffectTrain(trainPassenger.getGroupNumber()); strategy.addEffectTrain(trainPassenger.getGroupNumber());
int extraTime = strategy.getTime() - stationPlan.getParkTime(); int extraTime = strategy.getTime() - stationPlan.getParkTime();
strategy.addOffset(extraTime); strategy.addOffset(extraTime);
int extraNum = extraTime * Config.PASSENGER_BOARD_SPEED; int extraNum = extraTime * Config.PASSENGER_BOARD_SPEED;
int extra = extraNum; int extra = extraNum;
if (normal + extraNum > remain) { if (normal + extraNum > remain) {
if (normal < remain) { if (normal < remain) {
extra = remain - normal; extra = remain - normal;
} else { } else {
extra = 0; extra = 0;
}
} }
strategy.addExtraNum(extra);
normal += extraNum;
} }
strategy.addExtraNum(extra); float min = Math.min(Math.min(wait, normal), remain); // 实际上车人数
normal += extraNum; standPassenger.minus(min);
trainPassenger.plus(min);
} }
float min = Math.min(Math.min(wait, normal), remain); // 实际上车人数
standPassenger.minus(min);
trainPassenger.plus(min);
// 生成预测实际运行图 // 生成预测实际运行图
RealRun leave = this.buildRealRun(trainPassenger.getGroupNumber(), tripPlan, stationPlan, false, leaveTime, offsetTime, data.getSystemTime()); RealRun leave = this.buildRealRun(trainPassenger.getGroupNumber(), tripPlan, stationPlan, false, leaveTime, offsetTime, data.getSystemTime());
data.addRealRun(leave); data.addRealRun(leave);