1 package org.opentrafficsim.road.gtu.lane.tactical.lmrs;
2
3 import org.opentrafficsim.base.parameters.ParameterException;
4 import org.opentrafficsim.base.parameters.ParameterTypeDouble;
5 import org.opentrafficsim.base.parameters.Parameters;
6 import org.opentrafficsim.core.gtu.plan.operational.OperationalPlanException;
7 import org.opentrafficsim.road.gtu.lane.perception.LanePerception;
8 import org.opentrafficsim.road.gtu.lane.perception.RelativeLane;
9 import org.opentrafficsim.road.gtu.lane.tactical.following.CarFollowingModel;
10 import org.opentrafficsim.road.gtu.lane.tactical.util.lmrs.Desire;
11 import org.opentrafficsim.road.gtu.lane.tactical.util.lmrs.LmrsParameters;
12 import org.opentrafficsim.road.gtu.lane.tactical.util.lmrs.VoluntaryIncentive;
13
14
15
16
17
18
19
20
21
22
23
24
25 public class IncentiveKeep implements VoluntaryIncentive
26 {
27
28
29 protected static final ParameterTypeDouble DFREE = LmrsParameters.DFREE;
30
31
32 @Override
33 public final Desire determineDesire(final Parameters parameters,
34 final LanePerception perception, final CarFollowingModel carFollowingModel, final Desire mandatoryDesire,
35 final Desire voluntaryDesire) throws ParameterException, OperationalPlanException
36 {
37 if (mandatoryDesire.getRight() < 0 || voluntaryDesire.getRight() < 0
38 || !perception.getLaneStructure().getExtendedCrossSection().contains(RelativeLane.RIGHT))
39 {
40
41 return new Desire(0, 0);
42 }
43
44 return new Desire(0, parameters.getParameter(DFREE));
45 }
46
47
48 @Override
49 public final String toString()
50 {
51 return "IncentiveKeep";
52 }
53
54 }