sumolib.vehicletype
index
/home/delphi/gcc/sumo/tools/sumolib/vehicletype.py

# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
# Copyright (C) 2008-2024 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the Eclipse
# Public License 2.0 are satisfied: GNU General Public License, version 2
# or later which is available at
https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later

 
Modules
       
os
random
re
sys
xml

 
Classes
       
builtins.object
CreateVehTypeDistribution
CreateMultiVehTypeDistributions
VehAttribute

 
class CreateMultiVehTypeDistributions(CreateVehTypeDistribution)
    
Method resolution order:
CreateMultiVehTypeDistributions
CreateVehTypeDistribution
builtins.object

Methods defined here:
__init__(self)
Creates a VehicleType Distribution.
See https://sumo.dlr.de/docs/Definition_of_Vehicles,_Vehicle_Types,_and_Routes.html#vehicle_type_distributions
 
Args:
    seed (int, optional): random seed.
    size (int, optional): number of vTypes in the distribution.
    name (str, optional): alphanumerical ID used for the created vehicle type distribution.
    resampling (int, optional): number of attempts to resample a value until it lies in the specified bounds.
    decimal_places (int, optional): number of decimal places.
register_veh_type_distribution(self, veh_type_dist, veh_attributes)
write_xml(self, file_path)
This function will overwrite existing files
 
Args:
    file_path (str): Path to the file to write to

Methods inherited from CreateVehTypeDistribution:
add_attribute(self, attribute)
Add an instance of the attribute class to the Parameters. Pass the sampling attempts "global" parameter
Args:
    attribute (VehAttribute or dict): An instance of VehAttribute or
     a dictionary of parameters to be passed to the VehAttribute constructor
create_veh_dist(self, xml_dom)
save_myself(self, file_path)
This function saves the class to a json format. Used for logging simulation inputs
 
Args:
    file_path (str): path to save json to
to_xml(self, file_path)

Data descriptors inherited from CreateVehTypeDistribution:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class CreateVehTypeDistribution(builtins.object)
    CreateVehTypeDistribution(seed=None, size=100, name='vehDist', resampling=100, decimal_places=3)
 

 
  Methods defined here:
__init__(self, seed=None, size=100, name='vehDist', resampling=100, decimal_places=3)
Creates a VehicleType Distribution.
See https://sumo.dlr.de/docs/Definition_of_Vehicles,_Vehicle_Types,_and_Routes.html#vehicle_type_distributions
 
Args:
    seed (int, optional): random seed.
    size (int, optional): number of vTypes in the distribution.
    name (str, optional): alphanumerical ID used for the created vehicle type distribution.
    resampling (int, optional): number of attempts to resample a value until it lies in the specified bounds.
    decimal_places (int, optional): number of decimal places.
add_attribute(self, attribute)
Add an instance of the attribute class to the Parameters. Pass the sampling attempts "global" parameter
Args:
    attribute (VehAttribute or dict): An instance of VehAttribute or
     a dictionary of parameters to be passed to the VehAttribute constructor
create_veh_dist(self, xml_dom)
save_myself(self, file_path)
This function saves the class to a json format. Used for logging simulation inputs
 
Args:
    file_path (str): path to save json to
to_xml(self, file_path)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class VehAttribute(builtins.object)
    VehAttribute(name, is_param=False, distribution=None, distribution_params=None, bounds=None, attribute_value=None)
 

 
  Methods defined here:
__init__(self, name, is_param=False, distribution=None, distribution_params=None, bounds=None, attribute_value=None)
This emmulates one line of example config.txt in
    https://sumo.dlr.de/docs/Tools/Misc.html#createvehtypedistributionpy
Either distribution or attribute_value should be populated
Args:
    name (str): the name of the attribute. Examples: "tau", "sigma", "length"
    is_param (bool, optional): is the attribute a parameter that should be added as a child element.
    distribution (str, optional): the name of the distribution to use ()
    distribution_params (Union[dict, Any], optional): the parameters corresponding to the distribution
    bounds (tuple, optional): the bounds of the distribution.
    attribute_value (str, optional): if no distribution is given, the fixed value for the attribute
add_sampling_attempts(self, attempts)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        Any = typing.Any
List = typing.List
Tuple = typing.Tuple
Union = typing.Union
absolute_import = _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0), 262144)