nrel.hive.initialization.initialize_simulation_with_sampling
Module Contents
Functions
constructs a SimulationState and Environment with sampled vehicles. |
|
|
all your base are belong to us |
|
all your station are belong to us |
Attributes
- nrel.hive.initialization.initialize_simulation_with_sampling.initialize_simulation_with_sampling(config: nrel.hive.config.HiveConfig, vehicle_count: int, vehicle_location_sampling_function: Callable[Ellipsis, nrel.hive.model.roadnetwork.link.Link] | None = None, vehicle_soc_sampling_function: Callable[Ellipsis, nrel.hive.util.Ratio] | None = None, random_seed: int = 0) Tuple[nrel.hive.state.simulation_state.simulation_state.SimulationState, nrel.hive.runner.environment.Environment][source]
constructs a SimulationState and Environment with sampled vehicles. uses sampling functions to build vehicles
- Parameters:
config – the configuration of this run
vehicle_count – how many vehicles to initialize
vehicle_location_sampling_function – an optional location sampling function; uses default if none
vehicle_soc_sampling_function – an optional vehicle soc sampling function; uses default if none
random_seed – the random seed used for all sampling functions
- Returns:
a Simulation State and an Environment
:raises Exception due to IOErrors, missing keys in DictReader rows, or parsing errors
- nrel.hive.initialization.initialize_simulation_with_sampling._build_bases(bases_file: str, simulation_state: nrel.hive.state.simulation_state.simulation_state.SimulationState) nrel.hive.state.simulation_state.simulation_state.SimulationState[source]
all your base are belong to us
- Parameters:
bases_file – path to file with bases
simulation_state – the partial simulation state
- Returns:
the simulation state with all bases in it
:raises Exception if a parse error in Base.from_row or any error adding the Base to the Sim
- nrel.hive.initialization.initialize_simulation_with_sampling._build_stations(stations_file: str, simulation_state: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.environment.Environment) nrel.hive.state.simulation_state.simulation_state.SimulationState[source]
all your station are belong to us
- Parameters:
stations_file – the file with stations in it
simulation_state – the partial simulation state
- Returns:
the resulting simulation state with all stations in it
:raises Exception if parsing a Station row failed or adding a Station to the Simulation failed