Class ConstantSpawningMode

  • All Implemented Interfaces:
    SpawningMode

    public class ConstantSpawningMode
    extends AbstractSpawningMode
    The default mode of spawning vehicles with constant time gaps based on a given target flow.
    • Constructor Detail

      • ConstantSpawningMode

        public ConstantSpawningMode​(RandomNumberGenerator rng,
                                    long start,
                                    double spawnsPerHour,
                                    Long end)
        Constructor for ConstantSpawningMode.
        Parameters:
        rng - the RandomNumberGenerator for the spawner
        start - spawning start time [ns]
        spawnsPerHour - the target flow of vehicles to be spawned [veh/hour]
        end - spawning end time [ns]
    • Method Detail

      • isSpawningActive

        public boolean isSpawningActive​(long currentTime)
        Description copied from interface: SpawningMode
        Determines whether the spawning for the given simulation time is still active. Depending on the implementation this can be determined by different metrics.
        Specified by:
        isSpawningActive in interface SpawningMode
        Overrides:
        isSpawningActive in class AbstractSpawningMode
        Parameters:
        currentTime - the current simulation time (ns)
        Returns:
        true if this spawning mode has still vehicles to spawn
      • getNextSpawningTime

        public long getNextSpawningTime​(long currentTime)
        Description copied from interface: SpawningMode
        Returns the next spawning time. Depending on the implementation this will also set the next spawning time.
        Specified by:
        getNextSpawningTime in interface SpawningMode
        Overrides:
        getNextSpawningTime in class AbstractSpawningMode
        Parameters:
        currentTime - the current simulation time (ns)
        Returns:
        the next time (ns) a vehicle should be spawned