MATSIM
NetworkCalcLanes.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * NetworkCalcLanes.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2007 by the members listed in the COPYING, *
8  * LICENSE and WARRANTY file. *
9  * email : info at matsim dot org *
10  * *
11  * *********************************************************************** *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * See also COPYING, LICENSE and WARRANTY file *
18  * *
19  * *********************************************************************** */
20 
21 package org.matsim.core.network.algorithms;
22 
26 
30 public final class NetworkCalcLanes implements NetworkRunnable {
31 
32  @Override
33  public void run(Network network) {
34  double capDivider = network.getCapacityPeriod();
35  for (Link link : network.getLinks().values()) {
36  double capacity = link.getCapacity();
37  double cap1h = capacity * 3600.0 / capDivider;
38 
39  int lanes;
40  if (cap1h <= 1400) lanes = 1;
41  else if (cap1h <= 3000) lanes = 2;
42  else if (cap1h <= 6000) lanes = 3;
43  else if (cap1h <= 8500) lanes = 4;
44  else lanes = 5;
45  link.setNumberOfLanes(lanes);
46  }
47  }
48 }
Map< Id< Link >, ? extends Link > getLinks()