1 package org.opentrafficsim.road.gtu.lane.perception.mental.ar;
2
3 import org.djunits.value.vdouble.scalar.Duration;
4 import org.opentrafficsim.base.parameters.ParameterException;
5 import org.opentrafficsim.core.dsol.OtsSimulatorInterface;
6 import org.opentrafficsim.road.gtu.lane.perception.LanePerception;
7
8
9
10
11
12
13
14
15
16 public class ArTaskExponential extends AbstractArTask
17 {
18
19
20 private final double initialTaskDemand;
21
22
23 private final double additionalTaskDemand;
24
25
26 private final Duration tau;
27
28
29 private final double start;
30
31
32
33
34
35
36
37
38
39 public ArTaskExponential(final String id, final double initialTaskDemand, final double finalTaskDemand, final Duration tau,
40 final OtsSimulatorInterface simulator)
41 {
42 super(id);
43 this.initialTaskDemand = initialTaskDemand;
44 this.additionalTaskDemand = finalTaskDemand - initialTaskDemand;
45 this.tau = tau;
46 this.start = simulator.getSimulatorTime().si;
47 }
48
49 @Override
50 public double calculateTaskDemand(final LanePerception perception) throws ParameterException
51 {
52 double t = perception.getGtu().getSimulator().getSimulatorTime().si - this.start;
53 return this.initialTaskDemand + this.additionalTaskDemand * (1.0 - Math.exp(-t / this.tau.si));
54 }
55
56 }