Interface GeneratorPositions
- All Known Implementing Classes:
Injections
public interface GeneratorPositions
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-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
Class representing a vehicle generation lane, providing elementary information for randomly drawing links and lanes.static final class
Class representing a vehicle generation link to provide individual generation positions.static final class
Class representing a vehicle generation zone to provide individual generation positions.static final class
Vehicle generation lateral bias.static final class
Set of lane biases per GTU type.static interface
Interface for preferred road position for a lane bias. -
Method Summary
Modifier and TypeMethodDescriptionstatic GeneratorPositions
create
(Set<LanePosition> positions, nl.tudelft.simulation.jstats.streams.StreamInterface stream) Create a GeneratorPositions object to draw positions from.static GeneratorPositions
create
(Set<LanePosition> positions, nl.tudelft.simulation.jstats.streams.StreamInterface stream, Map<CrossSectionLink, Double> linkWeights, Map<CrossSectionLink, Node> viaNodes) Create a GeneratorPositions object to draw positions from.static GeneratorPositions
create
(Set<LanePosition> positions, nl.tudelft.simulation.jstats.streams.StreamInterface stream, GeneratorPositions.LaneBiases biases) Create a GeneratorPositions object to draw positions from.static GeneratorPositions
create
(Set<LanePosition> positions, nl.tudelft.simulation.jstats.streams.StreamInterface stream, GeneratorPositions.LaneBiases laneBiases, Map<CrossSectionLink, Double> linkWeights, Map<CrossSectionLink, Node> viaNodes) Create a GeneratorPositions object to draw positions from.draw
(GtuType gtuType, LaneBasedGtuCharacteristics characteristics, Map<CrossSectionLink, Map<Integer, Integer>> unplaced) Draw a new position to generate a GTU.Returns all underlying positions.
-
Method Details
-
draw
GeneratorPositions.GeneratorLanePosition draw(GtuType gtuType, LaneBasedGtuCharacteristics characteristics, Map<CrossSectionLink, Map<Integer, throws GtuExceptionInteger>> unplaced) Draw a new position to generate a GTU.- Parameters:
gtuType
- GtuType; GTU type.characteristics
- LaneBasedGtuCharacteristics; characteristics of the generated GTU.unplaced
- Map<CrossSectionLink, Map<Integer, Integer>>; number of unplaced GTUs per lane, counting from the right and starting at 1.- Returns:
- GeneratorLanePosition; new position to generate a GTU.
- Throws:
GtuException
- when the underlying structure is inconsistent for drawing
-
getAllPositions
Set<GeneratorPositions.GeneratorLanePosition> getAllPositions()Returns all underlying positions.- Returns:
- all underlying positions.
-
create
static GeneratorPositions create(Set<LanePosition> positions, nl.tudelft.simulation.jstats.streams.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<LanePosition>; all considered positions, each lane is considered separatelystream
- StreamInterface; stream for random numbers- Returns:
- GeneratorPositions; object to draw positions from
-
create
static GeneratorPositions create(Set<LanePosition> positions, nl.tudelft.simulation.jstats.streams.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<LanePosition>; 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
static GeneratorPositions create(Set<LanePosition> positions, nl.tudelft.simulation.jstats.streams.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<LanePosition>; 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
static GeneratorPositions create(Set<LanePosition> positions, nl.tudelft.simulation.jstats.streams.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<LanePosition>; all considered positions, each lane is considered separatelystream
- StreamInterface; stream for random numberslaneBiases
- LaneBiases; lane biases for GTU typeslinkWeights
- Map<CrossSectionLink, Double>; weight per linkviaNodes
- Map<CrossSectionLink, Node>; nodes connectors feed to for each link where GTU's will be generated- Returns:
- GeneratorPositions; object to draw positions from
-