smarts.sstudio.sstypes.traffic module

class smarts.sstudio.sstypes.traffic.Flow(route: ~smarts.sstudio.sstypes.route.RandomRoute | ~smarts.sstudio.sstypes.route.Route, rate: float, begin: float = 0, end: float = 3600, actors: ~typing.Dict[~smarts.sstudio.sstypes.actor.traffic_actor.TrafficActor, float] = <factory>, randomly_spaced: bool = False, repeat_route: bool = False)[source]

A route with an actor type emitted at a given rate.

actors: Dict[TrafficActor, float]

An actor to weight mapping associated as { actor -> weight }.

Parameters:
  • actor – The traffic actors that are provided.

  • weight – The chance of this actor appearing as a ratio over total weight.

begin: float = 0

Start time in seconds.

end: float = 3600

End time in seconds.

property id: str

The unique id of this flow.

randomly_spaced: bool = False

Determines if the flow should have randomly spaced traffic. Defaults to False.

rate: float

Vehicles per hour.

repeat_route: bool = False

If True, vehicles that finish their route will be restarted at the beginning. Defaults to False.

route: RandomRoute | Route

The route for the actor to attempt to follow.

class smarts.sstudio.sstypes.traffic.Traffic(flows: Sequence[Flow], trips: Sequence[Trip] | None = None, engine: str = 'SUMO')[source]

The descriptor for traffic.

engine: str = 'SUMO'

Traffic-generation engine to use. Supported values include “SUMO” and “SMARTS”. “SUMO” requires using a SumoRoadNetwork for the RoadMap.

flows: Sequence[Flow]

Flows are used to define a steady supply of vehicles.

trips: Sequence[Trip] | None = None

Trips are used to define a series of single vehicle trip.

class smarts.sstudio.sstypes.traffic.Trip(vehicle_name: str, route: RandomRoute | Route, vehicle_type: str = 'passenger', depart: float = 0, actor: TrafficActor | None = None)[source]

A route with a single actor type with name and unique id.

actor: TrafficActor | None = None

The traffic actor model (usually vehicle) that will be used for the trip.

depart: float = 0

Start time in seconds.

property id: str

The unique id of this trip.

route: RandomRoute | Route

The route for the actor to attempt to follow.

vehicle_name: str

The name of the vehicle. It must be unique.

vehicle_type: str = 'passenger'

The type of the vehicle