-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: state demand profile interface function #327
feat: state demand profile interface function #327
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's be more specific on the doc strings of input parameters given this will be a user-facing function, i.e. which parameter is used for which charing strategy; if a parameter is only used for smart charing, then it should be optional; speaking of that, it would be great if we can add some checks on different combinations of the input parameters based on different charing strategies.
prereise/gather/demanddata/transportation_electrification/generate_BEV_vehicle_profiles.py
Outdated
Show resolved
Hide resolved
prereise/gather/demanddata/transportation_electrification/generate_BEV_vehicle_profiles.py
Outdated
Show resolved
Hide resolved
prereise/gather/demanddata/transportation_electrification/generate_BEV_vehicle_profiles.py
Outdated
Show resolved
Hide resolved
prereise/gather/demanddata/transportation_electrification/generate_BEV_vehicle_profiles.py
Outdated
Show resolved
Hide resolved
prereise/gather/demanddata/transportation_electrification/generate_BEV_vehicle_profiles.py
Outdated
Show resolved
Hide resolved
:param np.array load_demand: initial load demand (MW for each hour) | ||
:param int power: (optional) charger power, EVSE kW; default value: 6.6 kW; | ||
:param int location_strategy: (optional) where the vehicle can charge-1, 2, 3, 4, or 5; | ||
1-home only, 2-home and work related, 3-anywhere if possibile, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between work related
and work
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing as far as I know. I'll double-check with Kate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! Reply from Kate: It is currently labeled work-related, because there are a couple "whyfrom" and "whyto" answers that have work in the description.
For instance, 04=Work-related meeting / trip
. This is a nuance that I don't think is worth parsing in the data nor the code. I'm ok with leaving it as work related
but also open to changing it.
prereise/gather/demanddata/transportation_electrification/generate_BEV_vehicle_profiles.py
Outdated
Show resolved
Hide resolved
prereise/gather/demanddata/transportation_electrification/generate_BEV_vehicle_profiles.py
Outdated
Show resolved
Hide resolved
prereise/gather/demanddata/transportation_electrification/generate_BEV_vehicle_profiles.py
Show resolved
Hide resolved
urban_bev_vmt = load_urbanized_scaling_factor( | ||
model_year=model_year, | ||
veh_type=veh_type, | ||
veh_range=veh_range, | ||
urbanized_area=urban_area, | ||
state=state, | ||
filepath=urban_scaling_filepath, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the logic that splits large urban areas that crossing state borders will kick in here, in the downstream function calls once implemented, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that logic will actually be part of the pre-algorithm data processing step that we'll finish via #317. Each state will have a separate entry to include its portion of those urban areas.
Example: from the ua_st_list_all.xls
file, Dubuque IA--IL has population of 64,767 in IA and 3,051 in IL.
Currently we've used the ua_list_all.xls
file, which has Dubuque IA--IL with a population of 67,818.
f1a8a2f
to
556f0db
Compare
5a76be2
to
c186098
Compare
prereise/gather/demanddata/transportation_electrification/generate_BEV_vehicle_profiles.py
Outdated
Show resolved
Hide resolved
prereise/gather/demanddata/transportation_electrification/generate_BEV_vehicle_profiles.py
Show resolved
Hide resolved
prereise/gather/demanddata/transportation_electrification/smart_charging.py
Show resolved
Hide resolved
prereise/gather/demanddata/transportation_electrification/smart_charging.py
Outdated
Show resolved
Hide resolved
def ldv_weekend_weekend_check(x, y): | ||
"""Helper function to select weekday/weekend data rows | ||
|
||
:param int x: data weekday/weekend value | ||
:param int y: model year weekday/weekend value | ||
:return: (*bool*) -- if data row matches whether the current day is a weekday/weekend | ||
""" | ||
return x == y | ||
|
||
|
||
def hdv_use_all_data_rows(x, y): | ||
"""Helper function to select weekday/weekend data rows | ||
|
||
:param int x: data weekday/weekend value | ||
:param int y: model year weekday/weekend value | ||
:return: (*bool*) -- always returns true to use all data rows | ||
""" | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite follow what we are doing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks similar to the get_data_day
and/or get_input_day' functions in
data_helper.py`. Could one of those be used instead of creating a new function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bainan - the context is that the LDV and LDT data from NHTS has a differentiation between weekday and weekend trip patterns. The MDV and HDV data does not have that differentiation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Nonetheless, having a function simply returning x == y
and another one always returning True
seems to be redundant. I would suggest to use lambda
if necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an intermediate refactoring step before changing the looping structure...I wanted to use lambda functions instead of function definitions but the linter complained:
https://www.flake8rules.com/rules/E731.html
Ideally I'm going to get rid of the double loop over all the data every day, and switch out weekend and weekday dataframes for the light vehicle case.
The function use_data_row
determines if a data row is used for a particular day:
if use_data_row(data_day[i], input_day[day_iter]):
and is set based on whether veh_type
is "ldv"/"ldt" or "mdv"/"hdv"
if veh_type.lower() == "ldv" or veh_type.lower() == "ldt":
use_data_row = ldv_weekend_weekend_check
elif veh_type.lower() == "mdv" or veh_type.lower() == "hdv":
use_data_row = hdv_use_all_data_rows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmuldrew So eventually we will get rid of this, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I'm definitely not happy with it long-term
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. Let's leave it as it is for now then.
prereise/gather/demanddata/transportation_electrification/smart_charging.py
Outdated
Show resolved
Hide resolved
prereise/gather/demanddata/transportation_electrification/smart_charging.py
Outdated
Show resolved
Hide resolved
...se/gather/demanddata/transportation_electrification/tests/test_smart_charging_integration.py
Outdated
Show resolved
Hide resolved
...se/gather/demanddata/transportation_electrification/tests/test_smart_charging_integration.py
Outdated
Show resolved
Hide resolved
prereise/gather/demanddata/transportation_electrification/smart_charging.py
Show resolved
Hide resolved
bcc38ef
to
a80e79e
Compare
ce796cb
to
17bf9dd
Compare
Looks like |
d93a2c3
to
ff67e97
Compare
99d8c59
to
2f3b94c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
2f3b94c
to
0daa966
Compare
…ile_interface feat: state demand profile interface function
…ile_interface feat: state demand profile interface function
…ile_interface feat: state demand profile interface function
…ile_interface feat: state demand profile interface function
Pull Request doc
Purpose
Create an interface function to simplify generating profiles by state. Also, finished merging the LDV/HDV smart charging functions into one common function.
What the code is doing
This function generates a dictionary of vehicle miles traveled (
bev_vmt
) for a specific geographic regions within a given state. It then outputs a demand profile for each geographic region. The state function input is also mapped to a census region which loads the appropriate vehicle census data.Testing
manual testing so far, would like to eventually add an automated integration test
Time estimate
~30min