1 package org.opentrafficsim.road.gtu.lane.tactical.following;
2
3 import org.djunits.value.vdouble.scalar.Acceleration;
4 import org.djunits.value.vdouble.scalar.Time;
5
6 /**
7 * Storage for the result of a GTU following model. <br>
8 * Currently the result is restricted to a constant acceleration during the period of validity (the time slot) of the result.
9 * <p>
10 * Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
11 * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
12 * <p>
13 * @version $Revision: 1378 $, $LastChangedDate: 2015-09-03 13:38:01 +0200 (Thu, 03 Sep 2015) $, by $Author: averbraeck $,
14 * initial version 6 feb. 2015 <br>
15 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
16 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
17 */
18 public class AccelerationStep
19 {
20 /** Acceleration that will be maintained during the current time slot. */
21 private final Acceleration acceleration;
22
23 /** Time when the current time slot ends. */
24 private final Time.Abs validUntil;
25
26 /** Duration of the time step. */
27 final Time.Rel duration;
28
29 /**
30 * Create a new GTUFollowingModelResult.
31 * @param acceleration DoubleScalarAbs<AccelerationUnit>; computed acceleration
32 * @param validUntil Time.Abs; time when this result expires
33 * @param duration Time.Rel; duration of the time step
34 */
35 public AccelerationStep(final Acceleration acceleration, final Time.Abs validUntil, final Time.Rel duration)
36 {
37 this.acceleration = acceleration;
38 this.validUntil = validUntil;
39 this.duration = duration;
40 }
41
42 /**
43 * @return acceleration.
44 */
45 public final Acceleration getAcceleration()
46 {
47 return this.acceleration;
48 }
49
50 /**
51 * @return validUntil.
52 */
53 public final Time.Abs getValidUntil()
54 {
55 return this.validUntil;
56 }
57
58 /**
59 * @return duration.
60 */
61 public final Time.Rel getDuration()
62 {
63 return this.duration;
64 }
65
66 /**
67 * {@inheritDoc}
68 */
69 public final String toString()
70 {
71 return String.format("a=%s, valid until %s", this.acceleration, this.validUntil);
72 }
73
74 }