pybtls.traffic.traffic_loader.TrafficLoader#

class TrafficLoader(no_lane)[source]#

Bases: object

The TrafficLoader instance stores the information for creating CTrafficLoader instances for each lane.

Parameters:

no_lane (int) – The number of lanes on the bridge.

Methods

add_traffic

Add a recorded traffic from either a .txt file or a vehicle list.

Attributes

no_dir

no_lane

no_lane_dir_1

no_lane_dir_2

sim_day

tag

vehicle_classifier

add_traffic(traffic, traffic_format=None, use_average_speed=False, use_const_speed=False, const_speed_value=0.0, **kwargs)[source]#

Add a recorded traffic from either a .txt file or a vehicle list.

Parameters:
  • traffic (Union[Path,list[_Vehicle]]) – The path to the traffic file, or a list of vehicles.

  • traffic_format (Literal[1, 2, 3, 4], optional) –

    The format of the .txt traffic file.

    1: CASTOR format.

    2: BEDIT format.

    3: DITIS format.

    4: MON format.

  • use_average_speed (bool, optional) –

    Whether to use the average speed of the vehicle.

    The default is False.

  • use_const_speed (bool, optional) –

    Whether to use a constant speed for all vehicles.

    The default is False.

  • const_speed_value (float, optional) –

    The constant speed value (in km/h). This will be an essential input if use_const_speed is True.

    The default is 0.0.

Keyword Arguments:

classifier_type (str, optional) – The vehicle classifier type. The default is “pattern”.

Return type:

None.