@Inject public QSimFreeSpeedTravelTime(QSimConfigGroup qsimCfg) { this.timeStepSize = qsimCfg.getTimeStepSize(); }
@StringGetter(TIME_STEP_SIZE) private String getTimeStepSizeAsString() { return Time.writeTime(getTimeStepSize()); }
private void updateFastFlowAccumulation(){ double now = context.getSimTimer().getTimeOfDay() ; if( this.flowcap_accumulate.getTimeStep() < now && this.flowcap_accumulate.getValue() < flowCapacityPerTimeStep && isNotOfferingVehicle() ){ double timeSteps = (now - flowcap_accumulate.getTimeStep()) / context.qsimConfig.getTimeStepSize(); double accumulateFlowCap = timeSteps * flowCapacityPerTimeStep; double newFlowCap = Math.min(flowcap_accumulate.getValue() + accumulateFlowCap, flowCapacityPerTimeStep); flowcap_accumulate.setValue(newFlowCap); flowcap_accumulate.setTimeStep( now ); } }
if ( context.qsimConfig.getTimeStepSize() < 1. ) { throw new RuntimeException("yyyy This will produce weird results because in at least one place " + "(addFromUpstream(...)) everything is pulled to integer values. Aborting ... "
flowCapacityPerTimeStep = flowCapacityPerTimeStep * context.qsimConfig.getTimeStepSize() * context.qsimConfig.getFlowCapFactor() ; inverseFlowCapacityPerTimeStep = 1.0 / flowCapacityPerTimeStep; wrnCnt++ ; log.warn( "max flow from fdiag < requested flow cap; linkId=" + qLink.getId() + "; req flow cap/h=" + 3600.*flowCapacityPerTimeStep/context.qsimConfig.getTimeStepSize() + "; max flow from fdiag/h=" + 3600*maxFlowFromFdiag/context.qsimConfig.getTimeStepSize() ) ; if ( wrnCnt==10 ) { log.warn( Gbl.FUTURE_SUPPRESSED ) ;
@Override public void checkConsistency(Config config) { new BeanValidationConfigConsistencyChecker().checkConsistency(config); if (config.qsim().getStartTime() != 0 && !Time.isUndefinedTime(config.qsim().getStartTime())) { // If properly handled this should not be a concern log.warn("QSim.startTime should be 0:00:00 (or 0). This is what typically DynAgents assume"); } if (config.qsim().getTimeStepSize() != 1) { // If properly handled this should not be a concern log.warn("QSim.timeStepSize should be 1. This is what typically DynAgents assume"); } if (config.qsim().getSimStarttimeInterpretation() != StarttimeInterpretation.onlyUseStarttime) { throw new RuntimeException("DynAgents require simulation to start from the very beginning" + " Set 'QSim.simStarttimeInterpretation' to " + StarttimeInterpretation.onlyUseStarttime); } } }
/** * Constructs an instance of this simulation which does not do anything by itself, but accepts handlers for Activities and Legs. * Use this constructor if you want to plug together your very own simulation, i.e. you are writing some of the simulation * logic yourself. * * If you wish to use QSim as a product and run a simulation based on a Config file, rather use QSimFactory as your entry point. * */ @Inject private QSim( final Scenario sc, EventsManager events, Injector childInjector ) { this.scenario = sc; if ( sc.getConfig().qsim().getNumberOfThreads() > 1) { this.events = EventsUtils.getParallelFeedableInstance( events ); } else { this.events = events; } this.listenerManager = new MobsimListenerManager( this ); this.agentCounter = new org.matsim.core.mobsim.qsim.AgentCounter(); this.simTimer = new MobsimTimer( sc.getConfig().qsim().getTimeStepSize()); this.childInjector = childInjector ; // this.qVehicleFactory = qVehicleFactory; }
linkTravelTime = context.qsimConfig.getTimeStepSize() * Math.floor( linkTravelTime / context.qsimConfig.getTimeStepSize() );