Skip to content

Commit

Permalink
refactor: rename wraparound trip indices for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
dmuldrew committed Nov 14, 2022
1 parent e91c5a3 commit 8dd0285
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,10 @@ def immediate_charging(
daily_profile = daily_resampled_profiles[flag_translation[weekday_flag]]

# create wrap-around indexing function
profile_window_indices = np.arange(i * 24, i * 24 + 72) % len(
model_year_profile
)
trip_window_indices = np.arange(i * 24, i * 24 + 72) % len(model_year_profile)

# MW
model_year_profile[profile_window_indices] += daily_profile
model_year_profile[trip_window_indices] += daily_profile

# Normalize the output so that it sums to 1
summed_profile = model_year_profile / model_year_profile.sum()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,10 @@ def immediate_charging(

for i in range(model_year_len):
# create wrap-around indexing function
profile_window_indices = np.arange(i * 24, i * 24 + 72) % len(
model_year_profile
)
trip_window_indices = np.arange(i * 24, i * 24 + 72) % len(model_year_profile)

# MW
model_year_profile[profile_window_indices] += daily_profile
model_year_profile[trip_window_indices] += daily_profile

# Normalize the output so that it sums to 1
summed_profile = model_year_profile / model_year_profile.sum()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ def smart_charging(
outputelectricload = sum(g2v_load)

# create wrap-around indexing function
profile_window_indices = np.arange(day_iter * 24, day_iter * 24 + 72) % len(
trip_window_indices = np.arange(day_iter * 24, day_iter * 24 + 72) % len(
model_year_profile
)

# MW
model_year_profile[profile_window_indices] += (
model_year_profile[trip_window_indices] += (
outputelectricload / (daily_vmt_total[day_iter] * 1000) * bev_vmt
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,12 @@ def smart_charging(
outputelectricload = sum(g2v_load)

# create wrap-around indexing function
profile_window_indices = np.arange(day_iter * 24, day_iter * 24 + 72) % len(
trip_window_indices = np.arange(day_iter * 24, day_iter * 24 + 72) % len(
model_year_profile
)

# MW
model_year_profile[profile_window_indices] += (
model_year_profile[trip_window_indices] += (
outputelectricload / (daily_vmt_total[day_iter] * 1000) * bev_vmt
)

Expand Down

0 comments on commit 8dd0285

Please sign in to comment.