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

refactor: maximum LDV dwell period to 72 hours, finish charging efficiency implementation #314

Merged

Conversation

dmuldrew
Copy link
Collaborator

@dmuldrew dmuldrew commented Oct 4, 2022

Pull Request doc

Purpose

Reconcile LDV and HDV implementations into one.

What the code is doing

  1. Change why_to to dwell_location
  2. Change maximum LDV dwell period to 72 hours like the HDV code
  3. Finish implementation of issue:
    LDV: add charging_efficiency condition #308

Testing

Automated tests

Time estimate

~20 min

@dmuldrew dmuldrew added the transportation electrification UCI Transportation Electrification label Oct 4, 2022
@dmuldrew dmuldrew self-assigned this Oct 4, 2022
@dmuldrew dmuldrew changed the title Dmuldrew/hdv implementation migration maximum LDV dwell period to 72 hours, finish charging efficiency implementation Oct 4, 2022
@dmuldrew dmuldrew changed the title maximum LDV dwell period to 72 hours, finish charging efficiency implementation refactor: maximum LDV dwell period to 72 hours, finish charging efficiency implementation Oct 4, 2022
Copy link
Collaborator

@BainanXia BainanXia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Changing the maximum dwell period for LDV to 72 hours to make it compatible with HDV makes sense, which I believe won't change the behavior of LDV because no LDV trips in the dataset has dwell period greater than 48 hours. Not sure whether it's worth the effort to make the dwell period a variable (maybe still a multiple of 24) so that if there are more HDV data coming in, corner cases will be handled automatically. Maybe that's overkill though.

Comment on lines +142 to +145
if power > 19.2:
charging_efficiency = 0.95
else:
charging_efficiency = 0.9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether we should factor this out given it is used in both immediate charging and smart charging, also it would be great if references of these numbers (from assumptions or from existing studies?) can be added somewhere with the module.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I’d leave it as is, as I’ve been using the diffs between the LDV and HDV immediate/smart charging files. There will be another PR that will just be moving code blocks around…

Comment on lines +493 to +512
model_year_profile[24:48] += (
outputelectricload[48:72]
/ (daily_vmt_total[day_iter] * 1000)
* emfacvmt
)

else:
elif day_iter == len(input_day) - 2:
# MW
model_year_profile[day_iter * 24 : day_iter * 24 + 48] += (
outputelectricload[:48] / (daily_vmt_total[day_iter] * 1000) * emfacvmt
)
model_year_profile[:24] += (
outputelectricload[48:72]
/ (daily_vmt_total[day_iter] * 1000)
* emfacvmt
)

else:
# MW
model_year_profile[day_iter * 24 : day_iter * 24 + 72] += (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether we can simplify the logic in a similar way above.

Copy link
Collaborator Author

@dmuldrew dmuldrew Oct 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I’ve been thinking about what a generalized function for an arbitrary dwell window would look like, though it would likely be later…maybe also some type of detection of how big the dwell window should be.

Copy link
Collaborator

@BainanXia BainanXia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given we decided to save some potential refactors into future PRs, this is good to go.

@dmuldrew dmuldrew merged commit 94319f1 into transportation_electrification Oct 7, 2022
@dmuldrew dmuldrew deleted the dmuldrew/hdv_implementation_migration branch October 7, 2022 16:10
dmuldrew added a commit that referenced this pull request Nov 14, 2022
rouille pushed a commit that referenced this pull request Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
transportation electrification UCI Transportation Electrification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants