@Override public void configure(QSimComponentsConfig components) { if (config.network().isTimeVariantNetwork()) { components.addNamedComponent(NETWORK_CHANGE_EVENTS_ENGINE_NAME); } } }
public static Network createNetwork(NetworkConfigGroup networkConfigGroup) { Network network = new NetworkImpl(); if (networkConfigGroup.isTimeVariantNetwork()) { network.getFactory().setLinkFactory(new VariableIntervalTimeVariantLinkFactory()); } return network; }
@Override public void checkConsistency(Config config) { new DvrpConfigConsistencyChecker().checkConsistency(config); if (config.network().isTimeVariantNetwork() && config.network().getChangeEventsInputFile() == null) { log.warn("No change events provided for the time variant network"); } if (!config.network().isTimeVariantNetwork() && config.network().getChangeEventsInputFile() != null) { log.warn("Change events ignored, because the network is not time variant"); } if (config.qsim().getFlowCapFactor() < 100) { log.warn("FlowCapFactor should be large enough (e.g. 100) to obtain deterministic (fixed) travel times"); } if (config.qsim().getStorageCapFactor() < 100) { log.warn("StorageCapFactor should be large enough (e.g. 100) to obtain deterministic (fixed) travel times"); } if (config.network().isTimeVariantNetwork() && DvrpConfigGroup.get(config).getNetworkMode() != null) { throw new RuntimeException("The current version of RunTaxiBenchmark does not support this case: " + "@Named(DvrpModule.DVRP_ROUTING) Network would consist of links having " + "VariableIntervalTimeVariantAttributes instead of FixedIntervalTimeVariantAttributes."); } } }
private void dumpNetworkChangeEvents() { if (config.network().isTimeVariantNetwork()) { new NetworkChangeEventsWriter().write(controlerIO.getOutputFilename(Controler.OUTPUT_PREFIX + Controler.FILENAME_CHANGE_EVENTS_XML), NetworkUtils.getNetworkChangeEvents(network)); } }
/** * Loads the network into the scenario of this class */ private void loadNetwork() { if ((this.config.network() != null) && (this.config.network().getInputFile() != null)) { URL networkUrl = this.config.network().getInputFileURL(this.config.getContext()); log.info("loading network from " + networkUrl); String inputCRS = config.network().getInputCRS(); MatsimNetworkReader reader = new MatsimNetworkReader( inputCRS, config.global().getCoordinateSystem(), this.scenario.getNetwork()); reader.putAttributeConverters( attributeConverters ); reader.parse(networkUrl); if ((this.config.network().getChangeEventsInputFile()!= null) && this.config.network().isTimeVariantNetwork()) { log.info("loading network change events from " + this.config.network().getChangeEventsInputFileUrl(this.config.getContext()).getFile()); Network network = this.scenario.getNetwork(); List<NetworkChangeEvent> changeEvents = new ArrayList<>() ; NetworkChangeEventsParser parser = new NetworkChangeEventsParser(network,changeEvents); parser.parse(this.config.network().getChangeEventsInputFileUrl(config.getContext())); NetworkUtils.setNetworkChangeEvents(network,changeEvents); } } }