Esempio n. 1
0
            
            for a in av_w:
        #        if (s == 'Commuter_LP') & (a == [17,20]):
        #            continue
                print('Starting with availability window {}'.format(a))
                #av_window = [17, 20] 
                aw_s = str(a[0]) + '_' + str(a[1])
                shift = 12   
                av_window_idxs = [int(((a[0]-shift)%24)*60/step), int(((a[1]-shift)%24)*60/step)]
                if a == [0, 24]:
                    av_window_idxs = [0, int(24*60/step)]
                t.append(time.time())
                
                # Extracting data
                nameset=grid.ev_sets[0]
                ch_profs, dn_profs = fpf.get_ev_profs(grid, ovn=ovn, av_days=av_days, nameset=nameset)
                (nevs, ndays_pr, nsteps) = ch_profs.shape
                ch_profs_av_w = fpf.get_av_window(ch_profs, av_window_idxs)
                if type(dn_profs) == dict:
                    dn_profs_av_w = dict()
                    for i in dn_profs:
                        dn_profs_av_w[i] = fpf.get_av_window(dn_profs[i], av_window_idxs)
                else:
                    dn_profs_av_w = fpf.get_av_window(dn_profs, av_window_idxs)
                #baseloads = fpf.get_av_window(np.tile(load, (nfleets, ndays, 1)), av_window_idxs)
                
                t.append(time.time())
#                print('EV profiles extracted, t={:.2f} seg'.format(t[-1]-t[-2]))
                
                ##%% Iterate on number of evs per fleet
                stats_VxG = {}
Esempio n. 2
0
    int(((av_window[0] - shift) % 24) * 60 / step),
    int(((av_window[1] - shift) % 24) * 60 / step)
]
if av_window == [0, 24]:
    av_window_idxs = [0, int(24 * 60 / step)]
av_days = 'weekdays'

sets = grid.ev_sets
ch_profs = {}
dn_profs = {}
fch = {}
fdn = {}
for s in sets:
    ch_profs[s], dn_profs[s] = fpf.get_ev_profs(grid,
                                                ovn=True,
                                                av_days=av_days,
                                                nameset=s,
                                                step=step)
#    fch[s], fdn[s] = fpf.get_fleet_profs(ch_profs[s], dn_profs[s],
#                                         nfleets=1, nevs_fleet=n_evs)

fleet_size = 20
nfleets = 500
ch_fleets = {}
for s in sets:
    fch, _ = fpf.get_fleet_profs(ch_profs[s],
                                 dn_profs[s],
                                 nevs_fleet=fleet_size,
                                 nfleets=nfleets)
    (k, nd, ns) = fch.shape
    #    print(fch.max(axis=(1,2)).mean())
Esempio n. 3
0
    load = util.get_max_load_week(load)
    load = util.interpolate(load, step=step, method='polynomial', order=3)
    n = int(60 / step) * 24

    load = load[int(n * (3 - shift / 24)):int(n * (4 - shift / 24))]
else:
    load = 0
t.append(time.time())
print('More params, t={:.2f} seg'.format(t[-1] - t[-2]))
#%% Extract data
t.append(time.time())

nameset = 'Commuter_LP'
ch_profs, dn_profs = fpf.get_ev_profs(grid,
                                      ovn=ovn,
                                      av_days=av_days,
                                      baseline='i',
                                      nameset=nameset)
(nevs, ndays, nsteps) = ch_profs.shape
ch_profs_av_w = fpf.get_av_window(ch_profs, av_window_idxs)
dn_profs_av_w = fpf.get_av_window(dn_profs, av_window_idxs)
baseloads = fpf.get_av_window(np.tile(load, (nfleets, ndays, 1)),
                              av_window_idxs)

t.append(time.time())
print('EV profiles extracted, t={:.2f} seg'.format(t[-1] - t[-2]))
#%% Iterate on number of evs

fleet_range = [5, 1000]
nrange = 25
x = np.logspace(np.log10(fleet_range[0]), np.log10(fleet_range[1]),
Esempio n. 4
0
    load = pd.read_csv(r'c:\user\U546416\Documents\PhD\Data\Mobilité\Data_Base\Conso\conso-inf36_profiles.csv',
                       engine='python', index_col=0)
    load = load['RES1 (+ RES1WE)'] / load['RES1 (+ RES1WE)'].max() * max_load
    load.index = pd.to_datetime(load.index)
    load = util.get_max_load_week(load)
    load = util.interpolate(load, step=step, method='polynomial', order=3)
    n = int(60/step)*24
    
    load = load[int(n*(3-shift/24)):int(n*(4-shift/24))]
else:
    load=0
t.append(time.time())                              
print('More params, t={:.2f} seg'.format(t[-1]-t[-2]))
#%% Evaluation params:

ch_company, dn_company = flex_payment_funcs.get_ev_profs(grid, nameset='Company')
ch_comm_h, dn_comm_h = flex_payment_funcs.get_ev_profs(grid, nameset='Commuter_HP')
ch_comm_l, dn_comm_l = flex_payment_funcs.get_ev_profs(grid, nameset='Commuter_LP')
(nevs, ndays, nsteps) = ch_comm_h.shape

# This is to include (or not) the baseload into the EV baseline computation
if baseload:
    loadevs = np.tile(load.values, (nevs, ndays,1)).sum(axis=0)
else:
    loadevs = 0
    
fleet_ch = np.array([ch_company.sum(axis=0) + loadevs, 
                     ch_comm_h.sum(axis=0) + loadevs, 
                     ch_comm_l.sum(axis=0) + loadevs])
fleet_dn = np.array([dn_company[0].sum(axis=0) + loadevs, 
                     dn_comm_h[0].sum(axis=0) + loadevs, 
if ovn:
    shift = 12
else:
    shift = 0    
av_window_idxs = [int(((av_window[0]-shift)%24)*60/step), int(((av_window[1]-shift)%24)*60/step)]
if av_window == [0, 24]:
    av_window_idxs = [0, int(24*60/step)]
av_days = 'weekdays'

sets = grid.ev_sets
ch_profs = {}
dn_profs = {}
fch = {}
fdn = {}
for s in sets:
    ch_profs[s], dn_profs[s] = fpf.get_ev_profs(grid, ovn=ovn, av_days=av_days, nameset=s)
    fch[s], fdn[s] = fpf.get_fleet_profs(ch_profs[s], dn_profs[s], 
                                         nfleets=1, nevs_fleet=30)

#%% Plot avg profiles and range
conf = 0.95
x = np.arange(0,24,step/60)
xticks = np.arange(0,25,4)

NUM_COLORS = 6
cm = plt.get_cmap('Paired')
colors = [cm(1.*(i*2+1)/(NUM_COLORS*2)) for i in range(NUM_COLORS)]
colors = [colors[0], colors[2], colors[1], colors[3],]

(k, nd, ns) = fch[s].shape