1 package org.opentrafficsim.road.gtu.lane.tactical.following;
2
3 import org.djunits.unit.AccelerationUnit;
4 import org.djunits.value.vdouble.scalar.Acceleration;
5 import org.djunits.value.vdouble.scalar.Length;
6 import org.djunits.value.vdouble.scalar.Speed;
7 import org.opentrafficsim.base.parameters.ParameterException;
8 import org.opentrafficsim.base.parameters.Parameters;
9 import org.opentrafficsim.road.gtu.lane.perception.PerceptionIterable;
10 import org.opentrafficsim.road.gtu.lane.perception.headway.Headway;
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 public class IDMPlus extends AbstractIDM
28 {
29
30
31
32
33 public IDMPlus()
34 {
35 super(HEADWAY, DESIRED_SPEED);
36 }
37
38
39
40
41
42
43 public IDMPlus(final DesiredHeadwayModel desiredHeadwayModel, final DesiredSpeedModel desiredSpeedModel)
44 {
45 super(desiredHeadwayModel, desiredSpeedModel);
46 }
47
48
49 @Override
50 public final String getName()
51 {
52 return "IDM+";
53 }
54
55
56 @Override
57 public final String getLongName()
58 {
59 return "Intelligent Driver Model+";
60 }
61
62
63 @Override
64 protected final Acceleration combineInteractionTerm(final Acceleration aFree, final Parameters parameters,
65 final Speed speed, final Speed desiredSpeed, final Length desiredHeadway,
66 final PerceptionIterable<? extends Headway> leaders) throws ParameterException
67 {
68 Acceleration a = parameters.getParameter(A);
69 Headway leader = leaders.first();
70 double sRatio =
71 dynamicDesiredHeadway(parameters, speed, desiredHeadway, leader.getSpeed()).si / leader.getDistance().si;
72 double aInt = a.si * (1 - sRatio * sRatio);
73 return new Acceleration(aInt < aFree.si ? aInt : aFree.si, AccelerationUnit.SI);
74 }
75
76 }