get_demand {evsim}R Documentation

Time-series EV demand

Description

Obtain time-series of EV demand from sessions data set

Usage

get_demand(
  sessions,
  dttm_seq = NULL,
  by = "Profile",
  resolution = 15,
  align_time = FALSE,
  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.

align_time

logical, whether to align time variables or sessions with the corresponding time resolution

mc.cores

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

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 parameter align_time = TRUE would align charging sessions' start time according to resolution, so following the previous example the session would start at 15:30.

Value

time-series tibble with first column of type datetime

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,
  align_time = TRUE
)
demand %>% plot_ts(ylab = "EV demand (kW)")

# 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,
  align_time = TRUE
)
demand %>% plot_ts(ylab = "EV demand (kW)")


[Package evsim version 1.5.0 Index]