nrel.hive.model.roadnetwork.linktraversal

Module Contents

Classes

LinkTraversal

represents either an intention to traverse some or all of a link

LinkTraversalResult

the result from a vehicle moving over a link traversal.

Functions

traverse_up_to(→ Tuple[Optional[Exception], ...)

using the ground truth road network, and some agent Link traversal, attempt to traverse

class nrel.hive.model.roadnetwork.linktraversal.LinkTraversal[source]

Bases: NamedTuple

represents either an intention to traverse some or all of a link or, an experience over some or all of a link

property travel_time_seconds: nrel.hive.util.units.Seconds
start: nrel.hive.util.typealiases.GeoId
end: nrel.hive.util.typealiases.GeoId
distance_km: nrel.hive.util.units.Kilometers
speed_kmph: nrel.hive.util.units.Kmph
classmethod build(link_id: nrel.hive.util.typealiases.LinkId, start: nrel.hive.util.typealiases.GeoId, end: nrel.hive.util.typealiases.GeoId, speed_kmph: nrel.hive.util.units.Kmph, distance_km: nrel.hive.util.units.Kilometers | None = None) LinkTraversal[source]
update_start(new_start: nrel.hive.util.typealiases.GeoId) LinkTraversal[source]

changes the start GeoId of the (experienced) LinkTraversal. used to set trip positions on partially-traversed Links or to set a location of a stationary entity.

Parameters:

new_start – the new start GeoId (should be a position along the h3_line between Link.start and Link.end)

Returns:

the link with an updated start GeoId

update_end(new_end: nrel.hive.util.typealiases.GeoId) LinkTraversal[source]

changes the end GeoId of the (experienced) LinkTraversal. used to set trip positions on partially-traversed Links or to set a location of a stationary entity.

Parameters:

new_end – the new end GeoId (should be a position along the h3_line between Link.start and Link.end)

Returns:

the link with an updated end GeoId

class nrel.hive.model.roadnetwork.linktraversal.LinkTraversalResult[source]

Bases: NamedTuple

the result from a vehicle moving over a link traversal.

Parameters:
  • traversed – represents any part of the link that was traversed.

  • remaining – represents any part of the link that remains to be traversed

  • remaining_time_seconds – represents any time the agent has left to traverse additional links

traversed: LinkTraversal | None
remaining: LinkTraversal | None
remaining_time_seconds: nrel.hive.util.units.Seconds
nrel.hive.model.roadnetwork.linktraversal.traverse_up_to(link: LinkTraversal, available_time_seconds: nrel.hive.util.units.Seconds) Tuple[Exception | None, LinkTraversalResult | None][source]

using the ground truth road network, and some agent Link traversal, attempt to traverse the link, based on travel time calculations from the Link’s PropertyLink attributes.

Parameters:
  • link – the plan the agent has to traverse a subset of a road network link

  • available_time_seconds – the remaining time the agent has in this time step

Returns:

the updated traversal, or, an exception. on update, if there is any remaining traversal, return an updated Link. if no traversal remains, return None. regardless, return the agent’s remaining time after traversing if there was any error, return the exception instead.