View Javadoc
1   package org.opentrafficsim.road.gtu.generator;
2   
3   import org.djunits.value.vdouble.scalar.Length;
4   import org.djunits.value.vdouble.scalar.Speed;
5   
6   /**
7    * Extends car-following placement with a first-order bounded acceleration (BA) principle. This principle comes down to
8    * reduction of efficiency by increasing headways, as the generated GTU speed is lower than the desired speed. The increased
9    * headways allow for acceleration to occur, allowing faster flow recovery over time.
10   * <p>
11   * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
12   * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
13   * <p>
14   * @version $Revision$, $LastChangedDate$, by $Author$, initial version 13 jan. 2018 <br>
15   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
16   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
17   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
18   */
19  public class CFBARoomChecker extends CFRoomChecker
20  {
21  
22      /** {@inheritDoc} */
23      @Override
24      protected double headwayFactor(final Speed desiredSpeed, final Length desiredHeadway, final Speed generationSpeed,
25              final Length generationHeadway, final Length leaderLength)
26      {
27          if (desiredSpeed.eq(generationSpeed))
28          {
29              return 1.0;
30          }
31          // following state at desired speed (capacity)
32          double k0 = 1.0 / (desiredHeadway.si + leaderLength.si);
33          double q0 = k0 * desiredSpeed.si;
34          // actual state
35          double k = 1.0 / (generationHeadway.si + leaderLength.si);
36          double q = k * generationSpeed.si;
37          // recovery flow qr
38          double qr = q; // if already on free flow branch
39          if (k > k0) // on congestion branch
40          {
41              // recovery wave speed assuming theta = 1 / q0 (theoretically sound and tested to be robust)
42              double rho = generationSpeed.si - q0 / k;
43              // recovery free flow state
44              double kr = (q - rho * k) / (desiredSpeed.si - rho);
45              qr = kr * desiredSpeed.si;
46          }
47          // efficiency factor, > 1 is larger headway, so less efficient
48          return q0 / qr;
49      }
50  
51  }