1 package org.opentrafficsim.road.gtu.generator.headway;
2
3 import org.djunits.value.vdouble.scalar.Frequency;
4 import org.djunits.value.vdouble.scalar.Time;
5
6 /**
7 * Interface for arrivals in an {@code ArrivalsHeadwayGenerator}. Arrivals are defined as a piece-wise linear frequency over
8 * time.
9 * <p>
10 * Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
11 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
12 * </p>
13 * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
14 * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
15 * @author <a href="https://dittlab.tudelft.nl">Wouter Schakel</a>
16 */
17 public interface Arrivals
18 {
19
20 /**
21 * Returns the demand at given time, which may be the sum of child objects. The input {@code sliceStart} is used to resolve
22 * the value at a time slice boundary in case of a stepwise (discontinuous) demand pattern. If {@code sliceStart = true} and
23 * {@code time} is a slice boundary, the demand value for <i>after</i> the slice boundary should be returned. In that case,
24 * the caller is processing a time slice after {@code time}, hence it's the slice start. If {@code sliceStart = false} the
25 * demand value of before the slice boundary should be returned. For continuous demand patterns, {@code sliceStart} can be
26 * ignored.
27 * @param time Time; simulation time
28 * @param sliceStart boolean; whether the time is at the start of an arbitrary time slice
29 * @return Frequency; returns the total demand for branching nodes, or the demand at a leaf node, at the given time
30 */
31 Frequency getFrequency(Time time, boolean sliceStart);
32
33 /**
34 * Returns the start time of the next time slice after the given time or {@code null} if no such slice exists. The next time
35 * slice starts as soon as the current slice ends, where each slice has it's own linear (or constant) demand. Thus, any
36 * change of slope in the demand pattern initiates a new slice. If {@code time} is equal to a time slice boundary, the next
37 * value should be returned.
38 * @param time Time; time after which the first slice start time is requested
39 * @return start time of the next time slice after the given time or {@code null} if no such slice exists
40 */
41 Time nextTimeSlice(Time time);
42
43 }