double getCapacityPeriod() { // since the link has a back pointer to network, we can as well provide this here (????) // TimeVariantLinkImpl needs this ... but why? return network.getCapacityPeriod() ; }
@Override public double getFlowCapacityPerSec(@SuppressWarnings("unused") final double time) { return this.getCapacity(time) / network.getCapacityPeriod(); }
@Override public void startLinks(final Network network, final BufferedWriter out) throws IOException { out.write("\t<links"); if (network.getCapacityPeriod() != Integer.MIN_VALUE) { out.write(" capperiod=\"" + Time.writeTime(network.getCapacityPeriod()) + "\""); } out.write(" effectivecellsize=\"" + network.getEffectiveCellSize() + "\""); out.write(" effectivelanewidth=\"" + network.getEffectiveLaneWidth() + "\""); out.write(">\n"); }
@Override public void startLinks(final Network network, final BufferedWriter out) throws IOException { out.write("\t<links"); if (network.getCapacityPeriod() != Integer.MIN_VALUE) { out.write(" capperiod=\"" + Time.writeTime(network.getCapacityPeriod()) + "\""); } out.write(" effectivecellsize=\"" + network.getEffectiveCellSize() + "\""); out.write(" effectivelanewidth=\"" + network.getEffectiveLaneWidth() + "\""); out.write(">\n"); }
@Override public void run(Network network) { double capDivider = network.getCapacityPeriod(); for (Link link : network.getLinks().values()) { double capacity = link.getCapacity(); double cap1h = capacity * 3600.0 / capDivider; int lanes; if (cap1h <= 1400) lanes = 1; else if (cap1h <= 3000) lanes = 2; else if (cap1h <= 6000) lanes = 3; else if (cap1h <= 8500) lanes = 4; else lanes = 5; link.setNumberOfLanes(lanes); } } }
System.out.println(" capperiod = " + Time.writeTime(network.getCapacityPeriod())); System.out.println(" network_capacity = " + this.network_capacity + " cells"); System.out.println(" nodes summary:");
/** * Calculate capacity by formular from Neumann2008DA: * * Flow of a Lane is given by the flow of the link divided by the number of lanes represented by the link. * * A Lane may represent one or more lanes in reality. This is given by the attribute numberOfRepresentedLanes of * the Lane definition. The flow of a lane is scaled by this number. */ public static void calculateAndSetCapacity(Lane lane, boolean isLaneAtLinkEnd, Link link, Network network){ if (isLaneAtLinkEnd){ double noLanesLink = link.getNumberOfLanes(); double linkFlowCapPerSecondPerLane = link.getCapacity() / network.getCapacityPeriod() / noLanesLink; double laneFlowCapPerHour = lane.getNumberOfRepresentedLanes() * linkFlowCapPerSecondPerLane * 3600.0; lane.setCapacityVehiclesPerHour(laneFlowCapPerHour); } else { double capacity = link.getCapacity() / network.getCapacityPeriod() * 3600.0; lane.setCapacityVehiclesPerHour(capacity); } }
public SnapshotGenerator(final Network network, final double snapshotPeriod, final QSimConfigGroup config) { this.network = network; int initialCapacity = (int)(network.getLinks().size()*1.1); this.eventLinks = new HashMap<>(initialCapacity, 0.95f); this.linkList = new ArrayList<>(initialCapacity); this.eventAgents = new HashMap<>(1000, 0.95f); this.snapshotPeriod = snapshotPeriod; this.capCorrectionFactor = config.getFlowCapFactor() / network.getCapacityPeriod(); this.storageCapFactor = config.getStorageCapFactor(); this.snapshotStyle = config.getSnapshotStyle(); if (! Double.isNaN( config.getLinkWidthForVis() )){ this.linkWidthCalculator.setLinkWidthForVis( config.getLinkWidthForVis() ); } if (! Double.isNaN(network.getEffectiveLaneWidth())){ this.linkWidthCalculator.setLaneWidth(network.getEffectiveLaneWidth()); } reset(-1); }
@Override public void run(Network network) { double capperiod = network.getCapacityPeriod(); capperiod = capperiod / 3600; log.info("capperiod = " + capperiod);
final double capacityPeriod = this.congestionInfo.getScenario().getNetwork().getCapacityPeriod(); final double flowCapacityFactor = this.congestionInfo.getScenario().getConfig().qsim().getFlowCapFactor(); final double toleratedAvgDelay = this.congestionInfo.getDecongestionConfigGroup().getToleratedAverageDelaySec();
/** * Merges two networks into one, by copying all nodes and links from the addNetworks to the baseNetwork. * * @param baseNetwork * @param addNetwork */ public static void merge(final Network baseNetwork, final String addPrefix, final Network addNetwork) { double capacityFactor = baseNetwork.getCapacityPeriod() / addNetwork.getCapacityPeriod(); NetworkFactory factory = baseNetwork.getFactory(); for (Node node : addNetwork.getNodes().values()) { Node node2 = (Node) factory.createNode(Id.create(addPrefix + node.getId().toString(), Node.class), node.getCoord()); baseNetwork.addNode(node2); } for (Link link : addNetwork.getLinks().values()) { Id<Node> fromNodeId = Id.create(addPrefix + link.getFromNode().getId().toString(), Node.class); Id<Node> toNodeId = Id.create(addPrefix + link.getToNode().getId().toString(), Node.class); Node fromNode = baseNetwork.getNodes().get(fromNodeId); Node toNode = baseNetwork.getNodes().get(toNodeId); Link link2 = factory.createLink(Id.create(addPrefix + link.getId().toString(), Link.class), fromNode, toNode); link2.setAllowedModes(link.getAllowedModes()); link2.setCapacity(link.getCapacity() * capacityFactor); link2.setFreespeed(link.getFreespeed()); link2.setLength(link.getLength()); link2.setNumberOfLanes(link.getNumberOfLanes()); baseNetwork.addLink(link2); } }
double capacityFactor = mergedNetwork.getCapacityPeriod() / networkA.getCapacityPeriod(); NetworkFactory factory = mergedNetwork.getFactory(); for (Node node : networkA.getNodes().values()) { toNode.addInLink(link2); capacityFactor = mergedNetwork.getCapacityPeriod() / networkB.getCapacityPeriod(); for (Node node : networkB.getNodes().values()) { Node node2 = (Node) factory.createNode(Id.create(prefixB + node.getId().toString(), Node.class), node.getCoord());
/** * Tests if the default values of a network instance are the same as the defaults specified in the network_v1.dtd */ @Test public void testDefaultValues(){ Network net = new NetworkImpl(); Assert.assertEquals(7.5, net.getEffectiveCellSize(), 0.0); Assert.assertEquals(3.75, net.getEffectiveLaneWidth(), 0.0); Assert.assertEquals(3600.0, net.getCapacityPeriod(), 0.0); Node node1 = NetworkUtils.createNode(Id.create(1, Node.class), new Coord((double) 0, (double) 0)); Node node2 = NetworkUtils.createNode(Id.create(2, Node.class), new Coord((double) 1000, (double) 0)); net.addNode(node1); net.addNode(node2); final NetworkFactory nf = net.getFactory(); Gbl.assertNotNull(nf); Link link = nf.createLink(Id.create(1, Link.class), node1, node2); Assert.assertEquals(1, link.getAllowedModes().size()); Assert.assertEquals("car", link.getAllowedModes().iterator().next()); }
Network network = sc.getNetwork(); assertEquals(3600.0, network.getCapacityPeriod()); assertEquals(1.0, l1.getFreespeed()); assertEquals(1.0, l1.getNumberOfLanes()); assertEquals(1.0/3600.0, l1.getCapacity()/network.getCapacityPeriod(), MatsimTestCase.EPSILON); assertEquals(3600.0, l1.getCapacity()); assertEquals(1.0, l1.getCapacity()/network.getCapacityPeriod(), EPSILON); assertEquals(100.0, l1.getFreespeed()); assertEquals(3600.0, l1.getCapacity()); assertEquals(1.0, l1.getCapacity()/network.getCapacityPeriod(), EPSILON);