public class ArrivalsHeadwayGenerator extends Object implements Generator<Duration>
Arrivals
.
Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Class and Description |
---|---|
static interface |
ArrivalsHeadwayGenerator.HeadwayDistribution
Headway distribution.
|
Constructor and Description |
---|
ArrivalsHeadwayGenerator(Arrivals arrivals,
SimulatorInterface.TimeDoubleUnit simulator,
StreamInterface stream,
ArrivalsHeadwayGenerator.HeadwayDistribution distribution) |
Modifier and Type | Method and Description |
---|---|
Duration |
draw()
Returns a new headway
h assuming that the previous vehicle arrived at the current time t0 . |
public ArrivalsHeadwayGenerator(Arrivals arrivals, SimulatorInterface.TimeDoubleUnit simulator, StreamInterface stream, ArrivalsHeadwayGenerator.HeadwayDistribution distribution)
arrivals
- Arrivals; arrivalssimulator
- SimulatorInterface.TimeDoubleUnit; simulatorstream
- StreamInterface; random stream to draw headwaydistribution
- HeadwayDistribution; random headway distributionpublic Duration draw() throws ProbabilityException, ParameterException
h
assuming that the previous vehicle arrived at the current time t0
. The vehicle
thus arrives at t1 = t0 + h
. This method guarantees that no vehicle arrives during periods where demand is zero,
while maintaining random headways based on average demand over a certain time period.h
such that the integral of the demand pattern D
from t0
until
t1
equals r
: ΣD(t0 > t1) = r
. One can think of r
as being 1 and representing an
additional vehicle to arrive. The headway h
that results correlates directly to the mean demand between
t0
and t1
.r
always has a mean of 1, but may vary between specific vehicle arrivals depending on the headway
distribution. When assuming constant headways for any given demand level, r
always equals 1. For exponentially
distributed headways r
may range anywhere between 0 and infinity.r
guarantees that no vehicles arrive during periods with 0 demand. For example:
r
< 0.5 (stepwise demand) or 0.25
(linear demand), a vehicle will simply arrive between 299s and 300s.draw
in interface Generator<Duration>
ProbabilityException
- if the stored collection is emptyParameterException
- in case of a parameter exceptionCopyright © 2014–2018 Delft University of Technology. All rights reserved.