EV Compatibility Score - Level 3 Chargers
Compatibility of internal combustion engine vehicle driving with electric vehicles based on proximity to Level 3 Chargers
The proximity of level 3 chargers to a vehicle owner's anchor location is a key piece of information for potential electric vehicle owners. In the event an EV owner needs to ensure access to a quick charge (generally 0 to 80% of battery in 40 minutes or less, where a level 2 charger might take 4 to 10 hours to charge from 0 to 80% of battery).
In order to give drivers specific information as to level 3 chargers in their area, we can calculate isochrones
The following code can make use of the MapBox api (see https://docs.mapbox.com/api/navigation/isochrone/) to find isochrones of desired sizes in isochrone_times. Note that MapBox requires the time to be 60 minutes or less, and the contour field should be checked, as the output is not necessarily in the same order as the input).
For example, isochrone_times = [30,15,5]would find the isochrones that are 30, 15, and 5 minutes from the coordinates latitude = anchor_lat and longitude = anchor_lng. These isochrones ... Note that Valhalla has a similar capability (see https://valhalla.github.io/valhalla/api/isochrone/api-reference/).
Similarly, ev_chargers_dc is obtained from https://afdc.energy.gov/fuels/electricity_locations.html#/find/nearest?fuel=ELEC where ev_chargers = ev_chargers.loc[ev_chargers['ev_dc_fast_num'] >= 1] (i.e. using only chargers that have a DC fast charger).
def isochrone_and_chargers_within(anchor_lng, anchor_lat, isochrone_times, ev_chargers_dc, api_key):
isochrone_times_str = ','.join([str(i) for i in isochrone_times])
url = \
f'''https://api.mapbox.com/isochrone/v1/mapbox/driving/{anchor_lng},{anchor_lat}?contours_minutes={isochrone_times_str}&contours_colors=6706ce,04e813,4286f4&polygons=true&access_token={api_key}'''
response = requests.get(url)
geo_lst = []
for i in range(len(response.json()['features'])):
geo_lst.append(response.json()['features'][i]['geometry'])
gdf_lst = []
for i in range(len(geo_lst)):
lngs = [i[0] for i in geo_lst[i]['coordinates'][0]]
lats = [i[1] for i in geo_lst[i]['coordinates'][0]]
#gdf_lst.append(gpd.GeoDataFrame(geometry = gpd.GeoSeries.from_xy(x = lngs, y = lats)))
polygon_geom = Polygon(zip(lngs, lats))
polygon = gpd.GeoDataFrame(index=[0], crs='epsg:4326', geometry=[polygon_geom])
gdf_lst.append(polygon)
num_fast_charging_iso = []
for gdf_iso in gdf_lst:
num_fast_charging_iso.append(ev_chargers_dc.sjoin(gdf_iso).shape[0])
return num_fast_charging_isoUsing this code for about 700 internal combustion engine vehicles, it can be seen that about 23% of these drivers have a level 3 charger within 5 minutes of their primary anchor location, 45% have one more than 5 minutes but less than 10 minutes away, and all but about 14% have one within at most 15 minutes.
It may also be helpful to score long distance drives for how many EV chargers are along the route. There are certainly many ways to determine this information, but one way to find all EV chargers are within one mile of a known route using geopandas is below. Note that an api key may be obtained for free from nrel.gov from https://developer.nrel.gov/ (and information on the nearby-route endpoint can be found here: https://developer.nrel.gov/docs/transportation/alt-fuel-stations-v1/nearby-route/.
Last updated