Class DemandPattern
- java.lang.Object
-
- org.opentrafficsim.road.gtu.generator.headway.DemandPattern
-
- All Implemented Interfaces:
Arrivals
public class DemandPattern extends Object implements Arrivals
Demand pattern defined by a frequency vector, time vector and interpolation.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 22 mrt. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Constructor Summary
Constructors Constructor Description DemandPattern(FrequencyVector demandVector, TimeVector timeVector, Interpolation interpolation)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)FrequencyVectorgetDemandVector()Returns the demand vector.FrequencygetFrequency(Time time, boolean sliceStart)Returns the demand at given time, which may be the sum of child objects.InterpolationgetInterpolation()Returns the interpolation.TimeVectorgetTimeVector()Returns the time vector.inthashCode()TimenextTimeSlice(Time time)Returns the start time of the next time slice after the given time ornullif no such slice exists.StringtoString()
-
-
-
Constructor Detail
-
DemandPattern
public DemandPattern(FrequencyVector demandVector, TimeVector timeVector, Interpolation interpolation)
Constructor.- Parameters:
demandVector- FrequencyVector; demand vectortimeVector- TimeVector; time vectorinterpolation- Interpolation; interpolation
-
-
Method Detail
-
getDemandVector
public final FrequencyVector getDemandVector()
Returns the demand vector.- Returns:
- FrequencyVector; returns the demand vector
-
getTimeVector
public final TimeVector getTimeVector()
Returns the time vector.- Returns:
- TimeVector; returns the time vector
-
getInterpolation
public final Interpolation getInterpolation()
Returns the interpolation.- Returns:
- Interpolation; returns the interpolation
-
getFrequency
public Frequency getFrequency(Time time, boolean sliceStart)
Returns the demand at given time, which may be the sum of child objects. The inputsliceStartis used to resolve the value at a time slice boundary in case of a stepwise (discontinuous) demand pattern. IfsliceStart = trueandtimeis a slice boundary, the demand value for after the slice boundary should be returned. In that case, the caller is processing a time slice aftertime, hence it's the slice start. IfsliceStart = falsethe demand value of before the slice boundary should be returned. For continuous demand patterns,sliceStartcan be ignored.- Specified by:
getFrequencyin interfaceArrivals- Parameters:
time- Time; simulation timesliceStart- boolean; whether the time is at the start of an arbitrary time slice- Returns:
- Frequency; returns the total demand for branching nodes, or the demand at a leaf node, at the given time
-
nextTimeSlice
public Time nextTimeSlice(Time time)
Returns the start time of the next time slice after the given time ornullif no such slice exists. The next time slice starts as soon as the current slice ends, where each slice has it's own linear (or constant) demand. Thus, any change of slope in the demand pattern initiates a new slice. Iftimeis equal to a time slice boundary, the next value should be returned.- Specified by:
nextTimeSlicein interfaceArrivals- Parameters:
time- Time; time after which the first slice start time is requested- Returns:
- start time of the next time slice after the given time or
nullif no such slice exists
-
-