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-2018 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/node/13">OpenTrafficSim License</a>.
12 * <p>
13 * @version $Revision$, $LastChangedDate$, by $Author$, initial version 13 dec. 2017 <br>
14 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
15 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
16 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
17 */
18 public interface Arrivals
19 {
20
21 /**
22 * Returns the demand at given time, which may be the sum of child objects. The input {@code sliceStart} is used to resolve
23 * the value at a time slice boundary in case of a stepwise (discontinuous) demand pattern. If {@code sliceStart = true} and
24 * {@code time} is a slice boundary, the demand value for <i>after</i> the slice boundary should be returned. In that case,
25 * the caller is processing a time slice after {@code time}, hence it's the slice start. If {@code sliceStart = false} the
26 * demand value of before the slice boundary should be returned. For continuous demand patterns, {@code sliceStart} can be
27 * ignored.
28 * @param time Time; simulation time
29 * @param sliceStart boolean; whether the time is at the start of an arbitrary time slice
30 * @return Frequency; returns the total demand for branching nodes, or the demand at a leaf node, at the given time
31 */
32 Frequency getFrequency(Time time, boolean sliceStart);
33
34 /**
35 * Returns the start time of the next time slice after the given time or {@code null} if no such slice exists. The next time
36 * slice starts as soon as the current slice ends, where each slice has it's own linear (or constant) demand. Thus, any
37 * change of slope in the demand pattern initiates a new slice. If {@code time} is equal to a time slice boundary, the next
38 * value should be returned.
39 * @param time Time; time after which the first slice start time is requested
40 * @return start time of the next time slice after the given time or {@code null} if no such slice exists
41 */
42 Time nextTimeSlice(Time time);
43
44 }