Skip to contents

Obtain time-series of EV demand from sessions data set

Usage

get_demand(
  sessions,
  dttm_seq = NULL,
  by = "Profile",
  resolution = 15,
  mc.cores = 1
)

Arguments

sessions

tibble, sessions data set in standard format marked by {evprof} package (see this article)

dttm_seq

sequence of datetime values that will be the datetime variable of the returned time-series data frame.

by

character, being 'Profile' or 'Session'. When by='Profile' each column corresponds to an EV user profile.

resolution

integer, time resolution (in minutes) of the sessions datetime variables. If dttm_seq is defined this parameter is ignored.

mc.cores

integer, number of cores to use. Must be at least one, and parallelization requires at least two cores.

Value

time-series tibble with first column of type datetime

Details

Note that the time resolution of variables ConnectionStartDateTime and ChargingStartDateTime must coincide with resolution parameter. For example, if a charging session in sessions starts charging at 15:32 and resolution = 15, the load of this session won't be computed. To solve this, the function automatically aligns charging sessions' start time according to resolution, so following the previous example the session would start at 15:30.

Examples

suppressMessages(library(lubridate))
suppressMessages(library(dplyr))

# Get demand with the complete datetime sequence from the sessions
sessions <- head(evsim::california_ev_sessions, 100)
demand <- get_demand(
  sessions,
  by = "Session",
  resolution = 60
)
#> Warning: charging sessions are aligned to 60-minute resolution.
demand %>% plot_ts(ylab = "EV demand (kW)")
EV demand (kW)
S1
S2
S3
S4
S5
S6
S7
S8
S9
S10
S11
S12
S13
S14
S15
S16
S17
S18
S19
S20
S21
S22
S23
S24
S25
S26
S27
S28
S29
S30
S31
S32
S33
S34
S35
S36
S37
S38
S39
S40
S41
S42
S43
S44
S45
S46
S47
S48
S49
S50
S51
S52
S53
S54
S55
S56
S57
S58
S59
S60
S61
S62
S63
S64
S65
S66
S67
S68
S69
S70
S71
S72
S73
S74
S75
S76
S77
S78
S79
S80
S81
S82
S83
S84
S85
S86
S87
S88
S89
S90
S91
S92
S93
S94
S95
S96
S97
S98
S99
S100
0
1
2
3
4
5
6
08 Oct
09 Oct
10 Oct
# Get demand with a custom datetime sequence and resolution of 15 minutes sessions <- head(evsim::california_ev_sessions_profiles, 100) dttm_seq <- seq.POSIXt( as_datetime(dmy(08102018)) %>% force_tz(tz(sessions$ConnectionStartDateTime)), as_datetime(dmy(11102018)) %>% force_tz(tz(sessions$ConnectionStartDateTime)), by = "15 mins" ) demand <- get_demand( sessions, dttm_seq = dttm_seq, by = "Profile", resolution = 15 ) #> Warning: charging sessions are aligned to 15-minute resolution. demand %>% plot_ts(ylab = "EV demand (kW)")
EV demand (kW)
Worktime
Visit
0
10
20
30
40
50
60
70
80
90
100
08 Oct
09 Oct
10 Oct