private static void checkEventsFormatLanesSignals(final Config c) { if (c.qsim().isUseLanes()) { if (!c.controler().getEventsFileFormats().contains(EventsFileFormat.xml)){ log.error("Xml events are not enabled, but lanes and possibly signal systems" + "are enalbed. Events from this features will only be written to the xml format, consider" + "to add xml events in the controler config module"); } } }
@Override public final boolean isActive() { if( context.qsimConfig.isUsingFastCapacityUpdate() ){ return (!this.vehQueue.isEmpty()) || (!this.isNotOfferingVehicle() && context.qsimConfig.isUseLanes()) // if lanes, the buffer needs to be active in order to move vehicles over an internal node || ( !this.holes.isEmpty() ) ; } else { return (this.flowcap_accumulate.getValue() < flowCapacityPerTimeStep) // still accumulating, thus active || (!this.vehQueue.isEmpty()) // vehicles are on link, thus active || (!this.isNotOfferingVehicle() && context.qsimConfig.isUseLanes()) // if lanes, the buffer needs to be active in order to move vehicles over an internal node || ( !this.holes.isEmpty() ); // need to process arrival of holes } }
private static void checkLaneDefinitionRoutingConfiguration(final Config config) { if ((config.qsim().isUseLanes()) && !config.controler().isLinkToLinkRoutingEnabled()){ log.warn("Using lanes without enabling linktolinkrouting might not lead to expected simulation results"); } }
@Inject public QSignalsNetworkFactory(Scenario scenario, EventsManager events) { this.scenario = scenario; this.events = events; if (scenario.getConfig().qsim().isUseLanes()) { delegate = new QLanesNetworkFactory(events, scenario); } else { delegate = new DefaultQNetworkFactory(events, scenario); } }
@Override protected void configureQSim() { bind(QNetsimEngine.class).asEagerSingleton(); bind(VehicularDepartureHandler.class).toProvider(QNetsimEngineDepartureHandlerProvider.class).asEagerSingleton(); if ( this.getConfig().qsim().isUseLanes() ) { bind(QNetworkFactory.class).to( QLanesNetworkFactory.class ) ; } else { bind(QNetworkFactory.class).to( DefaultQNetworkFactory.class ) ; } addNamedComponent(VehicularDepartureHandler.class, COMPONENT_NAME); addNamedComponent(QNetsimEngine.class, COMPONENT_NAME); } }
@Inject public LinkSensorManager(Scenario scenario, EventsManager events){ this.network = scenario.getNetwork(); if (scenario.getConfig().network().getLaneDefinitionsFile() != null || scenario.getConfig().qsim().isUseLanes()) { laneDefinitions = scenario.getLanes(); } events.addHandler(this); }
@Override public Map<Id<Link>, List<TurnInfo>> createAllowedTurnInfos(){ Map<Id<Link>, List<TurnInfo>> allowedInLinkTurnInfoMap = new HashMap<>(); createAndAddTurnInfo(TransportMode.car, allowedInLinkTurnInfoMap); if ( scenario.getConfig().network().getLaneDefinitionsFile()!=null || // scenario.getConfig().qsim().isUseLanes()) { Lanes ld = scenario.getLanes(); Map<Id<Link>, List<TurnInfo>> lanesTurnInfoMap = createTurnInfos(ld); mergeTurnInfoMaps(allowedInLinkTurnInfoMap, lanesTurnInfoMap); } return allowedInLinkTurnInfoMap; }
@Override public final QVehicle popFirstVehicle() { double now = context.getSimTimer().getTimeOfDay() ; QVehicle veh = removeFirstVehicle(); if (this.context.qsimConfig.isUseLanes() ) { if ( hasMoreThanOneLane() ) { this.context.getEventsManager().processEvent(new LaneLeaveEvent( now, veh.getId(), this.qLink.getId(), this.getId() )); } } return veh; }
double now = context.getSimTimer().getTimeOfDay() ; if (this.context.qsimConfig.isUseLanes() ) { if ( hasMoreThanOneLane() ) { this.context.getEventsManager().processEvent(new LaneEnterEvent( now, veh.getId(), this.qLink.getId(), this.getId() ));
if ( (config.qsim().isUseLanes() || config.network().getLaneDefinitionsFile()!=null ) && (!(boolean) ConfigUtils.addOrGetModule(config, SignalSystemsConfigGroup.GROUP_NAME, SignalSystemsConfigGroup.class).isUseSignalSystems())) { ConfigUtils.addOrGetModule(config, OTFVisConfigGroup.GROUP_NAME, OTFVisConfigGroup.class).setScaleQuadTreeRect(true);
if ( (config.qsim().isUseLanes()) && (!ConfigUtils.addOrGetModule(config, SignalSystemsConfigGroup.GROUP_NAME, SignalSystemsConfigGroup.class).isUseSignalSystems())) { connectionManager.connectWriterToReader(OTFLaneWriter.class, OTFLaneReader.class);