nrel.hive.initialization.sample_vehicles

Module Contents

Functions

sample_vehicles(...)

creates {count} vehicles using the provided sampling functions

build_default_location_sampling_fn(...)

constructs a link sampling function that uniformly samples from the provided base locations

build_default_soc_sampling_fn(→ Callable[[], ...)

constructs an SoC sampling function that uniformly samples between a lower and upper bound value

Attributes

log

nrel.hive.initialization.sample_vehicles.log[source]
nrel.hive.initialization.sample_vehicles.sample_vehicles(count: int, sim: nrel.hive.state.simulation_state.simulation_state.SimulationState, env: nrel.hive.runner.Environment, location_sampling_function: Callable[[nrel.hive.state.simulation_state.simulation_state.SimulationState], nrel.hive.model.roadnetwork.link.Link], soc_sampling_function: Callable[[], nrel.hive.util.Ratio], total_seats: int = 4, offset: int = 0) returns.result.Result[nrel.hive.state.simulation_state.simulation_state.SimulationState, Exception][source]

creates {count} vehicles using the provided sampling functions

Parameters:
  • count

  • sim

  • env

  • location_sampling_function – samples the initial location for a vehicle

  • soc_sampling_function – samples the initial state of charge for a vehicle

  • offset – number to begin counting vehicle ids from (by default, begin counting from zero)

Returns:

the updated setup, or, a failure

nrel.hive.initialization.sample_vehicles.build_default_location_sampling_fn(seed: int = 0) Callable[[nrel.hive.state.simulation_state.simulation_state.SimulationState], nrel.hive.model.roadnetwork.link.Link][source]

constructs a link sampling function that uniformly samples from the provided base locations

Parameters:
  • bases – the available bases

  • seed – random seed value

Returns:

a link

nrel.hive.initialization.sample_vehicles.build_default_soc_sampling_fn(lower_bound: nrel.hive.util.Ratio = 1.0, upper_bound: nrel.hive.util.Ratio = 1.0, seed: int = 0) Callable[[], nrel.hive.util.Ratio][source]

constructs an SoC sampling function that uniformly samples between a lower and upper bound value

Parameters:
  • lower_bound – the lower bound to sample from

  • upper_bound – the upper bound to sample from

  • seed – random seed value

Returns:

an SoC value