Class 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-2022 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
    • 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 separately
        stream - 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 separately
        stream - StreamInterface; stream for random numbers
        biases - 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 separately
        stream - StreamInterface; stream for random numbers
        linkWeights - Map<CrossSectionLink, Double>; weight per link direction
        viaNodes - 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 separately
        stream - StreamInterface; stream for random numbers
        laneBiases - LaneBiases; lane biases for GTU types
        linkWeights - Map<CrossSectionLink, Double>; weight per link direction
        viaNodes - 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 type
        destination - Node; destination node
        route - Route; route, may be null
        Returns:
        GeneratorLanePosition; new position to generate a GTU
      • speedLimit

        public Speed speedLimit​(GTUType gtuType)
        Returns the speed limit for the given GTU type, prior to the GTU position being determined.
        Parameters:
        gtuType - GTUType; GTU type
        Returns:
        speed limit for the given GTU type, prior to the GTU position being determined