1 package org.opentrafficsim.road.gtu.lane.control;
2
3 import org.djunits.value.vdouble.scalar.Acceleration;
4 import org.opentrafficsim.base.parameters.ParameterException;
5 import org.opentrafficsim.base.parameters.ParameterTypeDouble;
6 import org.opentrafficsim.base.parameters.Parameters;
7 import org.opentrafficsim.road.gtu.lane.LaneBasedGtu;
8 import org.opentrafficsim.road.gtu.lane.perception.PerceptionCollectable;
9 import org.opentrafficsim.road.gtu.lane.perception.headway.HeadwayGtu;
10
11
12
13
14
15
16
17
18
19
20
21 public class PloegCacc extends PloegAcc
22 {
23
24
25 public static final ParameterTypeDouble KA = LinearCacc.KA;
26
27
28
29
30
31 public PloegCacc(final DelayedActuation delayedActuation)
32 {
33 super(delayedActuation);
34 }
35
36
37 @Override
38 public Acceleration getFollowingAcceleration(final LaneBasedGtu gtu,
39 final PerceptionCollectable<HeadwayGtu, LaneBasedGtu> leaders, final Parameters settings) throws ParameterException
40 {
41 HeadwayGtu leader = leaders.first();
42 if (leader.getAcceleration() == null)
43 {
44 return super.getFollowingAcceleration(gtu, leaders, settings);
45 }
46 double es =
47 leader.getDistance().si - gtu.getSpeed().si * settings.getParameter(TDCACC).si - settings.getParameter(X0).si;
48 double esd = leader.getSpeed().si - gtu.getSpeed().si - gtu.getAcceleration().si * settings.getParameter(TDCACC).si;
49 double kaui = settings.getParameter(KA) * leader.getAcceleration().si;
50 return Acceleration.instantiateSI(settings.getParameter(KS) * es + settings.getParameter(KD) * esd + kaui);
51 }
52
53 }