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: LDV uses bev_vmt scaling; performance improvement; simplify model_year_profile updates #321

Merged
merged 7 commits into from
Oct 31, 2022

Conversation

dmuldrew
Copy link
Collaborator

Pull Request doc

Purpose

This PR:

  1. scales LDV model year profiles by bev_vmt similar to HDV implementation
  2. further continues merging functionality of LDV and HDV implementations
  3. improves performance by removing unused data frame copying
  4. simplifies addition to model_year_profile by using modulo arithmetic

What the code is doing

  1. further consolidates LDV/HDV file loading code
  2. LDV implementation uses the get_kwhmi helper function
  3. column order more similar for LDV/HDV dataframes
  4. removes unused copy back of individual dataframe
  5. uses modulo arithmetic in the following:
profile_window_indices = np.arange(day_iter * 24, day_iter * 24 + 72) % len(model_year_profile)

to simply model_year_profile updates

Testing

automated integration tests

Time estimate

~20min

Comment on lines +289 to +296
profile_window_indices = np.arange(day_iter * 24, day_iter * 24 + 72) % len(
model_year_profile
)

else:
# MW
model_year_profile[day_iter * 24 : day_iter * 24 + 72] += (
outputelectricload / (daily_vmt_total[day_iter] * 1000) * emfacvmt
)
# MW
model_year_profile[profile_window_indices] += (
outputelectricload / (daily_vmt_total[day_iter] * 1000) * bev_vmt
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice.

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.

LGTM

@dmuldrew dmuldrew merged commit 6b449de into transportation_electrification Oct 31, 2022
@dmuldrew dmuldrew deleted the dmuldrew/merge_ldv_hdv branch October 31, 2022 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants