Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

network speed updates #113

Open
robfitzgerald opened this issue Nov 15, 2022 · 1 comment
Open

network speed updates #113

robfitzgerald opened this issue Nov 15, 2022 · 1 comment
Milestone

Comments

@robfitzgerald
Copy link
Collaborator

robfitzgerald commented Nov 15, 2022

in order to more realistically estimate travel times, HIVE should support reading tables describing speeds by time of day, of the form:

time_seconds link_id speed_kph
0 z235g 55
...
3600 z235g 53
...
  • to signal that there is a (CSV) file with speeds by time of day, we modify config.network to have a speeds_file: Optional[str] entry.
  • the file is assumed to be sorted by time
  • HIVE can use DictReaderStepper (stored as a new field on the OsmRoadNetwork class) to advance and update link attributes from a file pointer
    • see other examples of DictReaderStepper reading time of day-sorted inputs such as reading the requests.csv file
  • the time should be in the same SimTime system as the config.yaml describes (int or ISO datetime) so we can step through it as the example below
  • if a link id does not match the network, it should cause a failure
  • if a link id isn't represented in the file, we use the free flow travel time found on the network file (see OsmRoadNetwork.from_polygon)

where does this happen? turns out the update method stub already exists on the RoadNetwork class. the OsmRoadNetwork implementation of update would access the reader and, if there are entries that haven't been consumed where the column time >= the current sim time, then the rows are consumed and the network is updated.

for each consumed entry from the CSV, we compute the travel time from distance / speed and overwrite the entry for travel_time on that link. this will require interacting with the underlying networkx MultiDiGraph instance via get_edge_data.

the OsmRoadNetwork.update() method should be called from within a new SimulationUpdateFunction class called nrel.hive.state.simulation_state.update.network_update.py. this update function should be added to the default set of pre-step update functions in the Update.build method if env.network.speeds_file is not None.

@robfitzgerald robfitzgerald added this to the FY23 Q1 milestone Nov 15, 2022
@robfitzgerald robfitzgerald modified the milestones: FY23 Q1, FY23 Q2 Feb 8, 2023
@robfitzgerald robfitzgerald modified the milestones: FY23 Q2/Q3, PyCon 2023 Apr 4, 2023
@robfitzgerald robfitzgerald changed the title speeds by time of day network travel time updates Apr 4, 2023
@robfitzgerald robfitzgerald changed the title network travel time updates network speed updates Apr 18, 2023
@robfitzgerald
Copy link
Collaborator Author

@nreinicke removing this from the issues, it balloons since we need to deal with #154 first.

@robfitzgerald robfitzgerald modified the milestones: PyCon 2023, FY23 Q2/Q3 Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant