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.base.parameters.constraint.NumericConstraint;
8 import org.opentrafficsim.road.gtu.lane.LaneBasedGtu;
9 import org.opentrafficsim.road.gtu.lane.perception.PerceptionCollectable;
10 import org.opentrafficsim.road.gtu.lane.perception.headway.HeadwayGtu;
11
12
13
14
15
16
17
18
19
20
21 public class LinearAcc extends AbstractLinearFreeControl
22 {
23
24
25 public static final ParameterTypeDouble KS =
26 new ParameterTypeDouble("ks", "Gap error gain", 0.2, NumericConstraint.POSITIVE);
27
28
29 public static final ParameterTypeDouble KV =
30 new ParameterTypeDouble("kv", "Speed error gain", 0.4, NumericConstraint.POSITIVE);
31
32
33
34
35
36 public LinearAcc(final DelayedActuation delayedActuation)
37 {
38 super(delayedActuation);
39 }
40
41
42 @Override
43 public Acceleration getFollowingAcceleration(final LaneBasedGtu gtu,
44 final PerceptionCollectable<HeadwayGtu, LaneBasedGtu> leaders, final Parameters settings) throws ParameterException
45 {
46 HeadwayGtu leader = leaders.first();
47 double es =
48 leader.getDistance().si - gtu.getSpeed().si * settings.getParameter(TDACC).si - settings.getParameter(X0).si;
49 double ev = leader.getSpeed().si - gtu.getSpeed().si;
50 return Acceleration.instantiateSI(settings.getParameter(KS) * es + settings.getParameter(KV) * ev);
51 }
52
53 }