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