clusteringTypicalDays: Generate a set of flow-based typical days

Description Usage Arguments Examples

View source: R/clusteringTypicalDays.R

Description

Run a clustering algorithm on the different classes of the calendar (getCalendar). Its principle is to create clusters by gathering the most similar days of each class and to choose among them the best representative: it will be a so-called typical day. The metric used to determine the similarity of two days is a weighted sum of 24 hourly distances, meaning the distances between the domains of the two days at the same hour.

Usage

1
2
3
clusteringTypicalDays(calendar, vertices, nbClustWeek = 3,
  nbClustWeekend = 1, report = TRUE, reportPath = getwd(),
  hourWeight = rep(1, 24), maxDomainSize = 10000)

Arguments

calendar

list, vector of date for each period. Can be obtain with getCalendar

vertices

data.table, 5 columns :

  • Date : date (

  • Period : Hour (1:24), period i corresponds to the hourly time-step [i-1 ; i]

  • BE : belgium vertices

  • DE : german vertices

  • FR : french vertices

This parameter can be obtained with the function ptdfToVertices.

nbClustWeek

numeric, number of clusters for week period(working days). Defaut to 3

nbClustWeekend

numeric, number of clusters for weekend period. Defaut to 1

report

boolean, should a .html report be generated with the results of the clustering. Defaut to TRUE

reportPath

character, path where the report is written. Defaut to getwd()

hourWeight

numeric, vector of 24 weights, one for each hour of the day. The clustering algorithm will be more accurate for the flow-based domains of the hours with a relatively higher weight.

maxDomainSize

numeric limit of domain size in each axis. The function will return an error if one domain or more exceed these limits.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(data.table)

# read vertices (from file, or obtained them with ptdfToVertices() function)
vertices <- fread(system.file("dataset/vertices_example.txt",package = "flowBasedClustering"))

# build calendar (manually here to adapt to the small dataset in example)
 # (for pratical applications getCalendar() function might be more convenient)
 
calendar <- list()
calendar$interSeasonWe <- c("2016-09-17", "2016-09-18")
calendar$interSeasonWd <- c("2016-09-19", "2016-09-20", "2016-09-21", "2016-09-22", "2016-09-23")
calendar$winterWe <- c("2016-12-10", "2016-12-11")
calendar$winterWd <- c("2016-12-12", "2016-12-13", "2016-12-14", "2016-12-15", "2016-12-16")
calendar$summerWe <- c("2016-08-06", "2016-08-07")
calendar$summerWd <- c("2016-08-08", "2016-08-09", "2016-08-10", "2016-08-11", "2016-08-12")

# run clustering algorithm
clusterTD <- clusteringTypicalDays(calendar, vertices, nbClustWeek = 2, nbClustWeekend = 1)

# run clustering algorithm distinguishing the days only with the flow-based domains of hour 18
w <- rep(0,24)
w[18] <- 1
clusterTD <- clusteringTypicalDays(calendar, vertices,  hourWeight = w, report = FALSE)

rte-antares-rpackage/flowBasedClustering documentation built on Nov. 21, 2020, 11:21 a.m.