客流策略计算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 leaveTime = stationPlan.getLeaveTime();
// 列车到站乘客上车更新列车上人数
StandPassenger standPassenger = data.getStandPassengerByStand(stationPlan.getSection().getStandList().get(0));
int wait = standPassenger.getWait(); // 站台等待乘客数
int normal = (parkTime - Config.INVALID_BOARD_TIME) * Config.PASSENGER_BOARD_SPEED; // 根据停站预测的可上车人数
int remain = Config.TRAIN_CAPACITY - trainPassenger.getNum(); // 列车上剩余可载人数
// 大客流站计算指标
if (Objects.equals(stationPlan.getSection(), stand.getSection())) {
// 时刻表偏差
parkTime = strategy.getTime();
leaveTime = arriveTime.plusSeconds(parkTime);
List<Stand> standList = stationPlan.getSection().getStandList();
if (!CollectionUtils.isEmpty(standList)) {
StandPassenger standPassenger = data.getStandPassengerByStand(standList.get(0));
int wait = standPassenger.getWait(); // 站台等待乘客数
int normal = (parkTime - Config.INVALID_BOARD_TIME) * Config.PASSENGER_BOARD_SPEED; // 根据停站预测的可上车人数
int remain = Config.TRAIN_CAPACITY - trainPassenger.getNum(); // 列车上剩余可载人数
// 大客流站计算指标
if (Objects.equals(stationPlan.getSection(), stand.getSection())) {
// 时刻表偏差
parkTime = strategy.getTime();
leaveTime = arriveTime.plusSeconds(parkTime);
// strategy.addTarget1(parkTime - stationPlan.getParkTime());
// // 乘客等待时间(按人数统计不考虑时间)
// strategy.addTarget2(standPassenger.getWait());
//
strategy.addEffectTrain(trainPassenger.getGroupNumber());
int extraTime = strategy.getTime() - stationPlan.getParkTime();
strategy.addOffset(extraTime);
int extraNum = extraTime * Config.PASSENGER_BOARD_SPEED;
int extra = extraNum;
if (normal + extraNum > remain) {
if (normal < remain) {
extra = remain - normal;
} else {
extra = 0;
//
strategy.addEffectTrain(trainPassenger.getGroupNumber());
int extraTime = strategy.getTime() - stationPlan.getParkTime();
strategy.addOffset(extraTime);
int extraNum = extraTime * Config.PASSENGER_BOARD_SPEED;
int extra = extraNum;
if (normal + extraNum > remain) {
if (normal < remain) {
extra = remain - normal;
} else {
extra = 0;
}
}
strategy.addExtraNum(extra);
normal += extraNum;
}
strategy.addExtraNum(extra);
normal += extraNum;
float min = Math.min(Math.min(wait, normal), remain); // 实际上车人数
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());
data.addRealRun(leave);