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
  • Method Details

    • draw

      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

      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 separately
      stream - 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 separately
      stream - StreamInterface; stream for random numbers
      biases - 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 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

      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 separately
      stream - StreamInterface; stream for random numbers
      laneBiases - LaneBiases; lane biases for GTU types
      linkWeights - Map<CrossSectionLink, Double>; weight per link
      viaNodes - Map<CrossSectionLink, Node>; nodes connectors feed to for each link where GTU's will be generated
      Returns:
      GeneratorPositions; object to draw positions from