Class ConstantSpawningMode
- java.lang.Object
-
- org.eclipse.mosaic.fed.mapping.ambassador.spawning.flow.AbstractSpawningMode
-
- org.eclipse.mosaic.fed.mapping.ambassador.spawning.flow.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.mosaic.fed.mapping.ambassador.spawning.flow.AbstractSpawningMode
AbstractSpawningMode.DecreaseExponential, AbstractSpawningMode.DecreaseLinear, AbstractSpawningMode.IncreaseExponential, AbstractSpawningMode.IncreaseLinear
-
-
Constructor Summary
Constructors Constructor Description ConstantSpawningMode(RandomNumberGenerator rng, long start, double spawnsPerHour, Long end)
Constructor forConstantSpawningMode
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getNextSpawningTime(long currentTime)
Returns the next spawning time.boolean
isSpawningActive(long currentTime)
Determines whether the spawning for the given simulation time is still active.String
toString()
-
Methods inherited from class org.eclipse.mosaic.fed.mapping.ambassador.spawning.flow.AbstractSpawningMode
noise
-
-
-
-
Constructor Detail
-
ConstantSpawningMode
public ConstantSpawningMode(RandomNumberGenerator rng, long start, double spawnsPerHour, Long end)
Constructor forConstantSpawningMode
.- Parameters:
rng
- theRandomNumberGenerator
for the spawnerstart
- 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 interfaceSpawningMode
- Overrides:
isSpawningActive
in classAbstractSpawningMode
- 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 interfaceSpawningMode
- Overrides:
getNextSpawningTime
in classAbstractSpawningMode
- Parameters:
currentTime
- the current simulation time (ns)- Returns:
- the next time (ns) a vehicle should be spawned
-
-