View Javadoc
1   package org.opentrafficsim.road.gtu.lane.tactical.lmrs;
2   
3   import org.djunits.value.vdouble.scalar.Speed;
4   import org.opentrafficsim.base.parameters.ParameterException;
5   import org.opentrafficsim.base.parameters.Parameters;
6   import org.opentrafficsim.core.gtu.plan.operational.OperationalPlanException;
7   import org.opentrafficsim.road.gtu.lane.LaneBasedGTU;
8   import org.opentrafficsim.road.gtu.lane.perception.LanePerception;
9   import org.opentrafficsim.road.gtu.lane.perception.RelativeLane;
10  import org.opentrafficsim.road.gtu.lane.perception.categories.IntersectionPerception;
11  import org.opentrafficsim.road.gtu.lane.plan.operational.SimpleOperationalPlan;
12  import org.opentrafficsim.road.gtu.lane.tactical.following.CarFollowingModel;
13  import org.opentrafficsim.road.gtu.lane.tactical.util.TrafficLightUtil;
14  import org.opentrafficsim.road.network.speed.SpeedLimitInfo;
15  
16  /**
17   * <p>
18   * Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
19   * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
20   * <p>
21   * @version $Revision$, $LastChangedDate$, by $Author$, initial version 27 jan. 2017 <br>
22   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
23   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
24   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
25   */
26  public class AccelerationTrafficLights implements AccelerationIncentive
27  {
28  
29      /** {@inheritDoc} */
30      @Override
31      public final void accelerate(final SimpleOperationalPlan simplePlan, final RelativeLane lane, final LaneBasedGTU gtu,
32              final LanePerception perception, final CarFollowingModel carFollowingModel, final Speed speed,
33              final Parameters params, final SpeedLimitInfo speedLimitInfo) throws ParameterException, OperationalPlanException
34      {
35          simplePlan.minimizeAcceleration(TrafficLightUtil.respondToTrafficLights(params,
36                  perception.getPerceptionCategory(IntersectionPerception.class).getTrafficLights(lane), carFollowingModel, speed,
37                  speedLimitInfo));
38      }
39  
40      /** {@inheritDoc} */
41      @Override
42      public final String toString()
43      {
44          return "AccelerationTrafficLights";
45      }
46  
47  }