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