Class GeneratorPositions
- java.lang.Object
-
- org.opentrafficsim.road.gtu.generator.GeneratorPositions
-
- All Implemented Interfaces:
Locatable
public final class GeneratorPositions extends Object implements Locatable
Helper class for vehicle generation which can draw the next GTU position to try to place a GTU. If the GTU can not be placed, it should be included in a queue. This class requires the number of unplaced GTU's per lane, in order to appropriately divide traffic over the lanes.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 dec. 2017
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GeneratorPositions.GeneratorLanePosition
Class representing a vehicle generation lane, providing elementary information for randomly drawing links and lanes.static class
GeneratorPositions.GeneratorLinkPosition
Class representing a vehicle generation link to provide individual generation positions.static class
GeneratorPositions.LaneBias
Vehicle generation lateral bias.static class
GeneratorPositions.LaneBiasDefaults
Set of lane biases per GTU type enum, based on the GTU Types that are defined by default.static class
GeneratorPositions.LaneBiases
Set of lane biases per GTU type.static interface
GeneratorPositions.RoadPosition
Interface for preferred road position for a lane bias.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GeneratorPositions
create(Set<DirectedLanePosition> positions, StreamInterface stream)
Create a GeneratorPositions object to draw positions from.static GeneratorPositions
create(Set<DirectedLanePosition> positions, StreamInterface stream, Map<CrossSectionLink,Double> linkWeights, Map<CrossSectionLink,Node> viaNodes)
Create a GeneratorPositions object to draw positions from.static GeneratorPositions
create(Set<DirectedLanePosition> positions, StreamInterface stream, GeneratorPositions.LaneBiases biases)
Create a GeneratorPositions object to draw positions from.static GeneratorPositions
create(Set<DirectedLanePosition> positions, StreamInterface stream, GeneratorPositions.LaneBiases laneBiases, Map<CrossSectionLink,Double> linkWeights, Map<CrossSectionLink,Node> viaNodes)
Create a GeneratorPositions object to draw positions from.GeneratorPositions.GeneratorLinkPosition
draw(GTUType gtuType, Node destination, Route route)
Draw a new position to generate a GTU.Set<GeneratorPositions.GeneratorLanePosition>
getAllPositions()
Returns all underlying positions.javax.media.j3d.Bounds
getBounds()
DirectedPoint
getLocation()
Speed
speedLimit(GTUType gtuType)
Returns the speed limit for the given GTU type, prior to the GTU position being determined.
-
-
-
Method Detail
-
create
public static GeneratorPositions create(Set<DirectedLanePosition> positions, StreamInterface stream)
Create a GeneratorPositions object to draw positions from. The given positions are grouped per link. Lanes are drawn without bias. Each link receives a weight equal to the number of lanes.- Parameters:
positions
- Set<DirectedLanePosition>; all considered positions, each lane is considered separatelystream
- StreamInterface; stream for random numbers- Returns:
- GeneratorPositions; object to draw positions from
-
create
public static GeneratorPositions create(Set<DirectedLanePosition> positions, StreamInterface stream, GeneratorPositions.LaneBiases biases)
Create a GeneratorPositions object to draw positions from. The given positions are grouped per link. Each link receives a weight equal to the number of lanes.- Parameters:
positions
- Set<DirectedLanePosition>; all considered positions, each lane is considered separatelystream
- StreamInterface; stream for random numbersbiases
- LaneBiases; lane biases for GTU types- Returns:
- GeneratorPositions; object to draw positions from
-
create
public static GeneratorPositions create(Set<DirectedLanePosition> positions, StreamInterface stream, Map<CrossSectionLink,Double> linkWeights, Map<CrossSectionLink,Node> viaNodes)
Create a GeneratorPositions object to draw positions from. The given positions are grouped per link. Lanes are drawn without bias.- Parameters:
positions
- Set<DirectedLanePosition>; all considered positions, each lane is considered separatelystream
- StreamInterface; stream for random numberslinkWeights
- Map<CrossSectionLink, Double>; weight per link directionviaNodes
- Map<CrossSectionLink, Node>; nodes connectors feed to for each link where GTU's will be generated- Returns:
- GeneratorPositions; object to draw positions from
-
create
public static GeneratorPositions create(Set<DirectedLanePosition> positions, StreamInterface stream, GeneratorPositions.LaneBiases laneBiases, Map<CrossSectionLink,Double> linkWeights, Map<CrossSectionLink,Node> viaNodes)
Create a GeneratorPositions object to draw positions from. The given positions are grouped per link.- Parameters:
positions
- Set<DirectedLanePosition>; all considered positions, each lane is considered separatelystream
- StreamInterface; stream for random numberslaneBiases
- LaneBiases; lane biases for GTU typeslinkWeights
- Map<CrossSectionLink, Double>; weight per link directionviaNodes
- Map<CrossSectionLink, Node>; nodes connectors feed to for each link where GTU's will be generated- Returns:
- GeneratorPositions; object to draw positions from
-
draw
public GeneratorPositions.GeneratorLinkPosition draw(GTUType gtuType, Node destination, Route route)
Draw a new position to generate a GTU. The link is drawn by giving each link a weight equal to the number of accessible lanes for the GTU type. Next, a lane is drawn using (optionally biased) weights.- Parameters:
gtuType
- GTUType; GTU typedestination
- Node; destination noderoute
- Route; route, may benull
- Returns:
- GeneratorLanePosition; new position to generate a GTU
-
getLocation
public DirectedPoint getLocation() throws RemoteException
- Specified by:
getLocation
in interfaceLocatable
- Throws:
RemoteException
-
getBounds
public javax.media.j3d.Bounds getBounds() throws RemoteException
- Specified by:
getBounds
in interfaceLocatable
- Throws:
RemoteException
-
getAllPositions
public Set<GeneratorPositions.GeneratorLanePosition> getAllPositions()
Returns all underlying positions.- Returns:
- all underlying positions
-
-