@Override public void checkConsistency(Config config) { new DynQSimConfigConsistencyChecker().checkConsistency(config); if (!config.qsim().isInsertingWaitingVehiclesBeforeDrivingVehicles()) { // Typically, vrp paths are calculated from startLink to endLink // (not from startNode to endNode). That requires making some assumptions // on how much time travelling on the first and last links takes. // The current implementation assumes: // (a) free-flow travelling on the last link, which is actually the case in QSim, and // (b) a 1-second stay on the first link (spent on moving over the first node). // The latter expectation is assumes that departing vehicles must be inserted before driving ones // (though that still does not guarantee 1-second stay since the vehicle may need to wait if the next // link is fully congested) log.warn(" 'QSim.insertingWaitingVehiclesBeforeDrivingVehicles' should be true in order to get" + " more precise travel time estimates. See comments in DvrpConfigConsistencyChecker"); } if (config.qsim().isRemoveStuckVehicles()) { throw new RuntimeException("Stuck DynAgents cannot be removed from simulation"); } } }
@Override public boolean doSimStep() { double now = context.getSimTimer().getTimeOfDay() ; boolean lanesActive = false; boolean movedWaitToRoad = false; if ( context.qsimConfig.isInsertingWaitingVehiclesBeforeDrivingVehicles() ) { //TODO //Because moveBufferToNextLane() (called from moveLanes()) is kind of "moveInternalNodes()", //it should be executed before moveWaitToRoad() to keep the sequence fully consistent. //The sequence is broken only if isInsertingWaitingVehiclesBeforeDrivingVehicles==true. //Currently, the buffer of the accepting lane gets emptied after moveWaitToRoad(), //which gives preference to already driving vehicles //michalm, jan'17 this.moveWaitToRoad(now); this.getTransitQLink().handleTransitVehiclesInStopQueue(now); lanesActive = this.moveLanes(); } else { this.getTransitQLink().handleTransitVehiclesInStopQueue(now); lanesActive = this.moveLanes(); movedWaitToRoad = this.moveWaitToRoad(now); } this.setActive(lanesActive || movedWaitToRoad || (!this.getWaitingList().isEmpty()) || !this.getTransitQLink().getTransitVehicleStopQueue().isEmpty()); return this.isActive(); }
@Override public boolean doSimStep() { double now = context.getSimTimer().getTimeOfDay() ; qlane.initBeforeSimStep(); if ( context.qsimConfig.isInsertingWaitingVehiclesBeforeDrivingVehicles() ) { this.moveWaitToRoad(); this.getTransitQLink().handleTransitVehiclesInStopQueue(now); qlane.doSimStep(); } else { this.getTransitQLink().handleTransitVehiclesInStopQueue(now); qlane.doSimStep(); this.moveWaitToRoad(); } this.setActive(this.checkForActivity()); return isActive(); // yy seems to me that for symmetry there should be something like // netElementActivationRegistry.registerLinkAsActive(this); // and may be a qlink.deactivateLink(...) around it (analogous to qlink.activateLink). // That is, do NOT pass the deactivation of the link rather implicitly via returning a false here. // kai, mar'16 }