Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 46 additions & 152 deletions README.md

Large diffs are not rendered by default.

Binary file removed docs/source/_static/denver_demo.jpg
Binary file not shown.
Binary file added docs/source/images/manhattan.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions nrel/hive/reporting/handler/kepler_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
from typing import List, Tuple, TypedDict, NamedTuple
import h3
from nrel.hive.model.sim_time import SimTime
from nrel.hive.util.typealiases import *
from nrel.hive.util.typealiases import VehicleId, GeoId


class Property(TypedDict):
vehicle_id: VehicleId
vehicle_state: str
start_time: str
start_time: int


class Coord(NamedTuple):
lon: float
lat: float
z: float
timestamp: str
timestamp: int


class Geometry(TypedDict):
Expand Down Expand Up @@ -65,7 +65,7 @@ def gen_json(self) -> Feature:
"properties": {
"vehicle_id": self.id,
"vehicle_state": self.state,
"start_time": f"{self.starttime.as_epoch_time():010}",
"start_time": self.starttime.as_epoch_time(),
},
"geometry": {"type": "LineString", "coordinates": []},
}
Expand All @@ -74,7 +74,7 @@ def gen_json(self) -> Feature:
assert isinstance(lat, float)
assert isinstance(lon, float)
log_dict["geometry"]["coordinates"].append(
Coord(lon, lat, 0, f"{timestamp.as_epoch_time():010}")
Coord(lon, lat, 0, timestamp.as_epoch_time())
)

return log_dict
Expand Down
9 changes: 5 additions & 4 deletions nrel/hive/reporting/handler/kepler_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
from pathlib import Path
from typing import TYPE_CHECKING, List, Dict
from nrel.hive.util.typealiases import *
from nrel.hive.util.typealiases import VehicleId
from nrel.hive.reporting.handler.handler import Handler
from nrel.hive.reporting.handler.kepler_feature import KeplerFeature

Expand Down Expand Up @@ -32,7 +32,8 @@ def __init__(self, scenario_output_directory: Path) -> None:
"""
Create the Kepler Handler to generate a kepler.json file for Kepler.gl

:param scenario_output_directory: path to the output directory where kepler.json will be written
:param scenario_output_directory: path to the output directory
where kepler.json will be written
"""
log_path = scenario_output_directory / "kepler.json"
self.log_file = open(log_path, "a")
Expand All @@ -42,8 +43,8 @@ def __init__(self, scenario_output_directory: Path) -> None:

def handle(self, reports: List[Report], runner_payload: RunnerPayload) -> None:
"""
Capture the current states/locations of all vehicles and save in the in memory Dict and write complete trips to
the kepler.json file
Capture the current states/locations of all vehicles and save in
the in memory Dict and write complete trips to the kepler.json file
"""
sim_state = runner_payload.s

Expand Down
10 changes: 4 additions & 6 deletions nrel/hive/resources/scenarios/manhattan/manhattan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ sim:
sim_name: manhattan_20k
timestep_duration_seconds: 60
request_cancel_time_seconds: 600
start_time: 0
end_time: 86400
start_time: "2014-12-21 00:00:00"
end_time: "2014-12-22 00:00:00"
sim_h3_search_resolution: 7 # around 12ish hexes covering manhattan
network:
network_type: osm_network
Expand All @@ -19,7 +19,5 @@ dispatcher:
valid_dispatch_states:
- idle
- repositioning
- reservebase
- chargingbase


- reservebase
- chargingbase
Loading