MATSIM
TravelTimeCalculatorConfigGroup.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * TravelTimeCalculatorConfigGroup
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2009 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 package org.matsim.core.config.groups;
21 
22 import java.util.LinkedHashSet;
23 import java.util.Map;
24 import java.util.Set;
25 
26 import org.apache.logging.log4j.LogManager;
27 import org.apache.logging.log4j.Logger;
31 
32 
38  private static final Logger log = LogManager.getLogger( TravelTimeCalculatorConfigGroup.class ) ;
39 
40  public static final String GROUPNAME = "travelTimeCalculator";
41 
42  private static final String TRAVEL_TIME_BIN_SIZE = "travelTimeBinSize";
43  private static final String TRAVEL_TIME_AGGREGATOR = "travelTimeAggregator";
44  private static final String TRAVEL_TIME_GETTER = "travelTimeGetter";
45  private static final String MAX_TIME = "maxTime";
46 
47  private static final String CALCULATE_LINK_TRAVELTIMES = "calculateLinkTravelTimes";
48  private static final String CALCULATE_LINKTOLINK_TRAVELTIMES = "calculateLinkToLinkTravelTimes";
49 
50  private static final String ANALYZEDMODES = "analyzedModes";
51  private static final String FILTERMODES = "filterModes";
52  private static final String SEPARATEMODES = "separateModes";
53 
54  private String travelTimeAggregator = "optimistic";
55  private String travelTimeGetter = "average";
56  private double traveltimeBinSize = 15 * 60; // use a default of 15min time-bins for analyzing the travel times
57  private int maxTime = 30 * 3600;
58 
59  private boolean calculateLinkTravelTimes = true;
60  private boolean calculateLinkToLinkTravelTimes = false;
61 
62  private Set<String> analyzedModes = new LinkedHashSet<>( ) ;
63  private boolean filterModes = false;
64  private boolean separateModes = true;
65 
67  super(GROUPNAME);
68  analyzedModes.add( TransportMode.car ) ;
69  }
70 
71  @Override
72  public final Map<String, String> getComments() {
73  Map<String,String> map = super.getComments();
74  map.put(TRAVEL_TIME_BIN_SIZE, "The size of the time bin (in sec) into which the link travel times are aggregated for " +
75  "the router") ;
76  map.put(MAX_TIME, "The lenght (in sec) of the time period that is splited into time bins; an additional time bin is created " +
77  "to aggregate all travel times collected after maxTime") ;
78  map.put(TRAVEL_TIME_GETTER, "How to deal with link entry times at different positions during the time bin. Currently " +
79  "supported: average, linearinterpolation");
80  map.put(TRAVEL_TIME_AGGREGATOR, "How to deal with congested time bins that have no link entry events. `optimistic' " +
81  "assumes free speed (too optimistic); 'experimental_LastMile' is experimental and probably too pessimistic.") ;
82  map.put(ANALYZEDMODES, "(only for backwards compatibility; only used if " + SEPARATEMODES + "==false && + " + FILTERMODES + "==true) Transport modes that will be " +
83  "respected by the travel time collector. 'car' is default which includes also buses from the pt simulation module.");
84  map.put(FILTERMODES, "(only for backwards compatiblity; only used if " + SEPARATEMODES + "==false) Only modes included in analyzedModes are included." ) ;
85  map.put(SEPARATEMODES, "(only for backwards compatibility) If false, link travel times are measured and aggregated over all vehicles using the link." ) ;
86  return map;
87  }
88 
89  enum DifferentModesHandling { separateAccordingToAnalyzedModes, jointButRestrictedToAnalyzedModes, jointAndUsingAllModes }
90 
91  // ---
92  @StringSetter( TRAVEL_TIME_AGGREGATOR )
93  public void setTravelTimeAggregatorType(final String travelTimeAggregator){
94  this.travelTimeAggregator = travelTimeAggregator;
95  }
96 
98  public String getTravelTimeAggregatorType(){
99  return this.travelTimeAggregator;
100  }
101  // ---
103  public void setTravelTimeGetterType(final String travelTimeGetter){
104  this.travelTimeGetter = travelTimeGetter;
105  }
107  public String getTravelTimeGetterType(){
108  return this.travelTimeGetter;
109  }
110  // ---
118  public final void setTraveltimeBinSize(final double binSize) {
119  this.traveltimeBinSize = binSize;
120  }
127  public final double getTraveltimeBinSize() {
128  return this.traveltimeBinSize;
129  }
130  // ---
132  public void setMaxTime(int maxTime) {
133  this.maxTime = maxTime;
134  }
136  public int getMaxTime() {
137  return maxTime;
138  }
139  // ---
141  public boolean isCalculateLinkTravelTimes() {
142  return this.calculateLinkTravelTimes;
143  }
144 
148  }
149  // ---
152  return this.calculateLinkToLinkTravelTimes;
153  }
154 
158  }
159  // ---
161  public boolean isFilterModes() {
162  return this.filterModes;
163  }
164 
166  public void setFilterModes(final boolean filterModes) {
167  this.filterModes = filterModes;
168  }
169  // ---
171  public String getAnalyzedModesAsString() {
172  return CollectionUtils.setToString( this.analyzedModes ) ;
173  }
174  public Set<String> getAnalyzedModes(){
175  return analyzedModes;
176  }
177 
179  public void setAnalyzedModesAsString( final String analyzedModes ) {
180 
181 // this.analyzedModes = analyzedModes.toLowerCase(Locale.ROOT);
182  // lower case is confusing here because at other places (qsimConfigGroup, planCalcRoute), it takes mode string as it is. Amit Aug'17
184  }
185  public void setAnalyzedModes( final Set<String> analyzedModes ) {
186  this.analyzedModes = analyzedModes ;
187  }
188  // ---
190  public boolean getSeparateModes() {
191  return this.separateModes;
192  }
193 
195  public void setSeparateModes(boolean separateModes) {
197  }
198 
199 }
static Set< String > stringToSet(final String values)
static String setToString(final Set< String > values)
void setCalculateLinkToLinkTravelTimes(final boolean calculateLinkToLinkTravelTimes)