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 public class IdmPlus extends AbstractIdm
26 {
27
28
29
30
31 public IdmPlus()
32 {
33 super(HEADWAY, DESIRED_SPEED);
34 }
35
36
37
38
39
40
41 public IdmPlus(final DesiredHeadwayModel desiredHeadwayModel, final DesiredSpeedModel desiredSpeedModel)
42 {
43 super(desiredHeadwayModel, desiredSpeedModel);
44 }
45
46
47 @Override
48 public final String getName()
49 {
50 return "IDM+";
51 }
52
53
54 @Override
55 public final String getLongName()
56 {
57 return "Intelligent Driver Model+";
58 }
59
60
61 @Override
62 protected final Acceleration combineInteractionTerm(final Acceleration aFree, final Parameters parameters,
63 final Speed speed, final Speed desiredSpeed, final Length desiredHeadway,
64 final PerceptionIterable<? extends Headway> leaders) throws ParameterException
65 {
66 Acceleration a = parameters.getParameter(A);
67 Headway leader = leaders.first();
68 double sRatio =
69 dynamicDesiredHeadway(parameters, speed, desiredHeadway, leader.getSpeed()).si / leader.getDistance().si;
70 double aInt = a.si * (1 - sRatio * sRatio);
71 return new Acceleration(aInt < aFree.si ? aInt : aFree.si, AccelerationUnit.SI);
72 }
73
74 }