Class LaneSpeedLimits
java.lang.Object
org.opentrafficsim.road.network.speed.LaneSpeedLimits
Speed limits for the context of a single lane.
Copyright (c) 2026-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Wouter Schakel
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor with no speed limit.LaneSpeedLimits(Map<GtuType, org.djunits.value.vdouble.scalar.Speed> gtuTypeSpeedLimits) Constructor with only GTU type speed limits.LaneSpeedLimits(org.djunits.value.vdouble.scalar.Speed speedLimit) Constructor with only a fixed speed limit.LaneSpeedLimits(org.djunits.value.vdouble.scalar.Speed speedLimit, Map<GtuType, org.djunits.value.vdouble.scalar.Speed> gtuTypeSpeedLimits) Constructor with overall speed limit and GTU type speed limits. -
Method Summary
Modifier and TypeMethodDescriptionaddSpeedLimit(org.djunits.value.vdouble.scalar.Duration timeOfDay, org.djunits.value.vdouble.scalar.Speed speed) Add non-enforced speed limit.addSpeedLimit(org.djunits.value.vdouble.scalar.Duration timeOfDay, org.djunits.value.vdouble.scalar.Speed speed, boolean enforced, boolean enforcedGtuTypeAware) Add speed limit.addSpeedLimit(org.djunits.value.vdouble.scalar.Speed speed) Add non-enforced constant speed limit.addSpeedLimit(org.djunits.value.vdouble.scalar.Speed speed, boolean enforced, boolean enforcedGtuTypeAware) Add constant speed limit.getSpeedLimit(org.djunits.value.vdouble.scalar.Duration timeOfDay) Returns the speed limit.getSpeedLimits(GtuType gtuType, org.djunits.value.vdouble.scalar.Duration timeOfDay) Returns the applicable speed limits for the given GTU type and time-of-day.
-
Constructor Details
-
LaneSpeedLimits
public LaneSpeedLimits()Constructor with no speed limit. -
LaneSpeedLimits
public LaneSpeedLimits(org.djunits.value.vdouble.scalar.Speed speedLimit) Constructor with only a fixed speed limit.- Parameters:
speedLimit- overall speed limit
-
LaneSpeedLimits
Constructor with only GTU type speed limits.- Parameters:
gtuTypeSpeedLimits- GTU type speed limits
-
LaneSpeedLimits
public LaneSpeedLimits(org.djunits.value.vdouble.scalar.Speed speedLimit, Map<GtuType, org.djunits.value.vdouble.scalar.Speed> gtuTypeSpeedLimits) Constructor with overall speed limit and GTU type speed limits.- Parameters:
speedLimit- overall speed limitgtuTypeSpeedLimits- GTU type speed limits
-
-
Method Details
-
addSpeedLimit
Add non-enforced constant speed limit.- Parameters:
speed- speed limit- Returns:
- this object for method chaining
-
addSpeedLimit
public LaneSpeedLimits addSpeedLimit(org.djunits.value.vdouble.scalar.Speed speed, boolean enforced, boolean enforcedGtuTypeAware) Add constant speed limit.If enforcement is aware of the GTU type, any speed limit applicable to the GTU type (e.g. 80km/h for trucks) becomes an enforced speed limit.
- Parameters:
speed- speed limitenforced- whether the speed limit is enforcedenforcedGtuTypeAware- whether the speed limit enforcement is aware of GTU types- Returns:
- this object for method chaining
-
addSpeedLimit
public LaneSpeedLimits addSpeedLimit(org.djunits.value.vdouble.scalar.Duration timeOfDay, org.djunits.value.vdouble.scalar.Speed speed) Add non-enforced speed limit. Time of day will by cycled through. For example, if a speed limit of 100km/h is added at 6h and a speed limit of 130km/h is added at 19h, 100km/h applies from 06:00 till 19:00, while 130km/h applies for all other hours, including between 00:00 and 06:00.- Parameters:
timeOfDay- time-of-day when the speed limit becomes activespeed- speed of the speed limit- Returns:
- this object for method chaining
- Throws:
IllegalArgumentException- when time-of-day is not in the range [0 24) hours
-
addSpeedLimit
public LaneSpeedLimits addSpeedLimit(org.djunits.value.vdouble.scalar.Duration timeOfDay, org.djunits.value.vdouble.scalar.Speed speed, boolean enforced, boolean enforcedGtuTypeAware) Add speed limit. Time of day will by cycled through. For example, if a speed limit of 100km/h is added at 6h and a speed limit of 130km/h is added at 19h, 100km/h applies from 06:00 till 19:00, while 130km/h applies for all other hours, including between 00:00 and 06:00.If enforcement is aware of the GTU type, any speed limit applicable to the GTU type (e.g. 80km/h for trucks) becomes an enforced speed limit.
- Parameters:
timeOfDay- time-of-day when the speed limit becomes activespeed- speed of the speed limitenforced- whether the speed limit is enforcedenforcedGtuTypeAware- whether the speed limit enforcement is aware of GTU types- Returns:
- this object for method chaining
- Throws:
IllegalArgumentException- when time-of-day is not in the range [0 24) hours
-
getSpeedLimit
Returns the speed limit.- Parameters:
timeOfDay- time-of-day- Returns:
- speed limit, empty if no speed limit given
-
getSpeedLimits
public SpeedLimits getSpeedLimits(GtuType gtuType, org.djunits.value.vdouble.scalar.Duration timeOfDay) Returns the applicable speed limits for the given GTU type and time-of-day.- Parameters:
gtuType- GTU typetimeOfDay- time-of-day- Returns:
- applicable speed limits for the given GTU type and time-of-day
-