View Javadoc
1   package org.opentrafficsim.road.gtu.lane.perception.headway;
2   
3   import org.djunits.value.vdouble.scalar.Acceleration;
4   import org.djunits.value.vdouble.scalar.Length;
5   import org.djunits.value.vdouble.scalar.Speed;
6   import org.opentrafficsim.core.gtu.GTUException;
7   import org.opentrafficsim.core.gtu.GTUType;
8   import org.opentrafficsim.core.gtu.behavioralcharacteristics.BehavioralCharacteristics;
9   import org.opentrafficsim.core.network.route.Route;
10  import org.opentrafficsim.road.gtu.lane.tactical.following.CarFollowingModel;
11  import org.opentrafficsim.road.network.speed.SpeedLimitInfo;
12  
13  /**
14   * Container for a reference to information about a (lane based) GTU and a headway. The Headway can store information about GTUs
15   * or objects ahead of the reference GTU, behind the reference GTU, or (partially) parallel to the reference GTU. In addition to
16   * the (perceived) headway, several other pieces of information can be stored, such as (perceived) speed, (perceived)
17   * acceleration, (perceived) turn indicators, and (perceived) braking lights. <br>
18   * This particular version has only limited behavioral information about the observed GTU.<br>
19   * Special care must be taken in curves when perceiving headway of a GTU or object on an adjacent lane.The question is whether
20   * we perceive the parallel or ahead/behind based on a line perpendicular to the front/back of the GTU (rectangular), or
21   * perpendicular to the center line of the lane (wedge-shaped in case of a curve). The difficulty of a wedge-shaped situation is
22   * that reciprocity might be violated: in case of a clothoid, for instance, it is not sure that the point on the center line
23   * when projected from lane 1 to lane 2 is the same as the projection from lane 2 to lane 1. The same holds for shapes with
24   * sharp bends. Therefore, algorithms implementing headway should only project the <i>reference point</i> of the reference GTU
25   * on the center line of the adjacent lane, and then calculate the forward position and backward position on the adjacent lane
26   * based on the reference point. Still, our human perception of what is parallel and what not, is not reflected by fractional
27   * positions. See examples in
28   * <a href= "http://simulation.tudelft.nl:8085/browse/OTS-113">http://simulation.tudelft.nl:8085/browse/OTS-113</a>.
29   * <p>
30   * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
31   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
32   * </p>
33   * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
34   * initial version May 27, 2016 <br>
35   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
36   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
37   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
38   */
39  public class HeadwayGTUSimple extends AbstractHeadwayGTU
40  {
41      /** */
42      private static final long serialVersionUID = 20160527L;
43  
44      /**
45       * Construct a new Headway information object, for a moving GTU ahead of us or behind us.
46       * @param id the id of the GTU for comparison purposes, can not be null.
47       * @param gtuType the perceived GTU Type, or null if unknown.
48       * @param distance the distance to the other object; if this constructor is used, distance cannot be null.
49       * @param length the length of the other object; if this constructor is used, length cannot be null.
50       * @param speed the (perceived) speed of the other object; can be null if unknown.
51       * @param acceleration the (perceived) acceleration of the other object; can be null if unknown.
52       * @param gtuStatus the observable characteristics of the GTU.
53       * @throws GTUException when id is null, objectType is null, or parameters are inconsistent
54       */
55      public HeadwayGTUSimple(final String id, final GTUType gtuType, final Length distance, final Length length,
56              final Speed speed, final Acceleration acceleration, final GTUStatus... gtuStatus) throws GTUException
57      {
58          super(id, gtuType, distance, true, length, speed, acceleration, gtuStatus);
59      }
60  
61      /**
62       * Construct a new Headway information object, for a non-moving GTU ahead of us or behind us.
63       * @param id the id of the GTU for comparison purposes, can not be null.
64       * @param gtuType the perceived GTU Type, or null if unknown.
65       * @param distance Length; the distance to the other GTU; if this constructor is used, distance cannot be null.
66       * @param length the length of the other object; if this constructor is used, length cannot be null.
67       * @param gtuStatus the observable characteristics of the GTU.
68       * @throws GTUException when id is null, or parameters are inconsistent
69       */
70      public HeadwayGTUSimple(final String id, final GTUType gtuType, final Length distance, final Length length,
71              final GTUStatus... gtuStatus) throws GTUException
72      {
73          super(id, gtuType, distance, true, length, gtuStatus);
74      }
75  
76      /**
77       * Construct a new Headway information object, for a moving GTU parallel with us.
78       * @param id the id of the GTU for comparison purposes, can not be null.
79       * @param gtuType the perceived GTU Type, or null if unknown.
80       * @param overlapFront the front-front distance to the other GTU; if this constructor is used, this value cannot be null.
81       * @param overlap the 'center' overlap with the other GTU; if this constructor is used, this value cannot be null.
82       * @param overlapRear the rear-rear distance to the other GTU; if this constructor is used, this value cannot be null.
83       * @param length the length of the other object; if this constructor is used, length cannot be null.
84       * @param speed the (perceived) speed of the other GTU; can be null if unknown.
85       * @param acceleration the (perceived) acceleration of the other GTU; can be null if unknown.
86       * @param gtuStatus the observable characteristics of the GTU.
87       * @throws GTUException when id is null, or parameters are inconsistent
88       */
89      @SuppressWarnings("checkstyle:parameternumber")
90      public HeadwayGTUSimple(final String id, final GTUType gtuType, final Length overlapFront, final Length overlap,
91              final Length overlapRear, final Length length, final Speed speed, final Acceleration acceleration,
92              final GTUStatus... gtuStatus) throws GTUException
93      {
94          super(id, gtuType, overlapFront, overlap, overlapRear, true, length, speed, acceleration, gtuStatus);
95      }
96  
97      /**
98       * Construct a new Headway information object, for a non-moving GTU parallel with us.
99       * @param id the id of the GTU for comparison purposes, can not be null.
100      * @param gtuType the perceived GTU Type, or null if unknown.
101      * @param overlapFront the front-front distance to the other GTU; if this constructor is used, this value cannot be null.
102      * @param overlap the 'center' overlap with the other GTU; if this constructor is used, this value cannot be null.
103      * @param overlapRear the rear-rear distance to the other GTU; if this constructor is used, this value cannot be null.
104      * @param length the length of the other object; if this constructor is used, length cannot be null.
105      * @param gtuStatus the observable characteristics of the GTU.
106      * @throws GTUException when id is null, or parameters are inconsistent
107      */
108     public HeadwayGTUSimple(final String id, final GTUType gtuType, final Length overlapFront, final Length overlap,
109             final Length overlapRear, final Length length, final GTUStatus... gtuStatus) throws GTUException
110     {
111         super(id, gtuType, overlapFront, overlap, overlapRear, true, length, gtuStatus);
112     }
113 
114     /** {@inheritDoc} */
115     @Override
116     public final CarFollowingModel getCarFollowingModel()
117     {
118         throw new UnsupportedOperationException("HeadwayGTUSimple does not support the getCarFollowingModel() method.");
119     }
120 
121     /** {@inheritDoc} */
122     @Override
123     public final BehavioralCharacteristics getBehavioralCharacteristics()
124     {
125         throw new UnsupportedOperationException("HeadwayGTUSimple does not support the getBehavioralCharacteristics() method.");
126     }
127 
128     /** {@inheritDoc} */
129     @Override
130     public final SpeedLimitInfo getSpeedLimitInfo()
131     {
132         throw new UnsupportedOperationException("HeadwayGTUSimple does not support the getSpeedLimitInfo() method.");
133     }
134 
135     /** {@inheritDoc} */
136     @Override
137     public final Route getRoute()
138     {
139         return null;
140     }
141     
142 }