From 8dd02858b4715062424912ac04fdb51a3149a481 Mon Sep 17 00:00:00 2001 From: Daniel Muldrew Date: Tue, 8 Nov 2022 12:43:30 -0800 Subject: [PATCH] refactor: rename wraparound trip indices for clarity --- .../demanddata/transportation_electrification/immediate.py | 6 ++---- .../immediate_charging_HDV.py | 6 ++---- .../transportation_electrification/smart_charging.py | 4 ++-- .../transportation_electrification/smart_charging_HDV.py | 4 ++-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/prereise/gather/demanddata/transportation_electrification/immediate.py b/prereise/gather/demanddata/transportation_electrification/immediate.py index fb5ee7741..61be40d22 100644 --- a/prereise/gather/demanddata/transportation_electrification/immediate.py +++ b/prereise/gather/demanddata/transportation_electrification/immediate.py @@ -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() diff --git a/prereise/gather/demanddata/transportation_electrification/immediate_charging_HDV.py b/prereise/gather/demanddata/transportation_electrification/immediate_charging_HDV.py index d23e7365b..40091a053 100644 --- a/prereise/gather/demanddata/transportation_electrification/immediate_charging_HDV.py +++ b/prereise/gather/demanddata/transportation_electrification/immediate_charging_HDV.py @@ -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() diff --git a/prereise/gather/demanddata/transportation_electrification/smart_charging.py b/prereise/gather/demanddata/transportation_electrification/smart_charging.py index 43cb5d234..e3b3e57c3 100644 --- a/prereise/gather/demanddata/transportation_electrification/smart_charging.py +++ b/prereise/gather/demanddata/transportation_electrification/smart_charging.py @@ -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 ) diff --git a/prereise/gather/demanddata/transportation_electrification/smart_charging_HDV.py b/prereise/gather/demanddata/transportation_electrification/smart_charging_HDV.py index bf68028fe..35cf0f4bd 100644 --- a/prereise/gather/demanddata/transportation_electrification/smart_charging_HDV.py +++ b/prereise/gather/demanddata/transportation_electrification/smart_charging_HDV.py @@ -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 )