compare: Compare two simulations or two antaresData

Description Usage Arguments Value Examples

View source: R/compare.R

Description

compare has been designed to compare two surpluses created with function surplus but it can be used to compare the values of two tables of class antaresData that contain the same type of data.

Usage

1
compare(x, y, method = c("diff", "ratio", "rate"))

Arguments

x

Table of class antaresData. x can be an antaresDataTable or antaresDataList.

y

Table of class antaresData. x can be an antaresDataTable or antaresDataList. It must contain the same type of data than 'x': if 'x' contains areas, it must contain areas, ... Moreover it has to have same time step and contain either synthetic or detailed results like 'x'.

method

Method used two compare the two tables. "diff" compute the difference between 'y' and 'x'. "ratio" computes the ratio between 'y' and 'x'. Finally, "rate" computes the rate of change between 'y' and 'x' ( it is equal to the ratio between 'y' and 'x' minus one).

Value

a data.table of class antaresDataTable. It contains all shared rows and columns between 'x' and 'y'. The columns contain the statistic chosen: difference, ratio or rate of change.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
## Not run: 
# First simulation
studyPath <- "path/to/study/"

setSimulationPath(studyPath, 1)
mydata1 <- readAntares("all", "all", synthesis = FALSE)
surplus1 <- surplus(mydata1, groupByDistrict = TRUE)

# Second simulation
setSimulationPath(studyPath, 2)
mydata2 <- readAntares("all", "all", synthesis = FALSE)
surplus2 <- surplus(mydata2, groupByDistrict = TRUE)

compare(surplus1, surplus2)

opts1 <- setSimulationPath(studyPath,-1)
mydata1<-readAntares(areas = "all",
links = "all",
select = c("allAreas", "allLinks"),
mcYears = c(1),
linkCapacity = TRUE)

opts2 <- setSimulationPath(studyPath,-2)
mydata2 <- readAntares(areas = "all",
links = "all",
select = c("allAreas", "allLinks"),
mcYears = c(1),
linkCapacity = TRUE)

opts3 <- setSimulationPath(studyPath,-3)
mydata3 <- readAntares(areas = "all",
links = "all",
select = c("allAreas", "allLinks"),
mcYears = c(1),
linkCapacity = TRUE)

opts4 <- setSimulationPath(studyPath, -4)
mydata4 <- readAntares(areas = "all",
links = "all",
select=c("allAreas", "allLinks"),
mcYears = c(1),
linkCapacity = TRUE)

opts5 <- setSimulationPath(studyPath, -5)
mydata5 <- readAntares(areas = "all",
links = "all",
select=c("allAreas", "allLinks"),
mcYears = c(1),
linkCapacity = TRUE)

resCompare1 <- compare(mydata2, mydata1, method = "diff")
resCompare2 <- compare(mydata3, mydata1, method = "diff")
resCompare3 <- compare(mydata4, mydata1, method = "diff")
resCompare4 <- compare(mydata5, mydata1, method = "diff")

listCompare <- list(resCompare1, resCompare2, resCompare3, resCompare4)

for (i in 1:length(listCompare)){
listCompare[[i]] <- removeVirtualAreas(listCompare[[i]],
                                       storageFlexibility =
                                       getAreas(select = c("z_dsr", "y_mul", "pum", "tur")))
}

ml <- readRDS("path/to/mapLayout.rds")
plotMap(listCompare, ml)

## End(Not run)

antaresProcessing documentation built on Nov. 7, 2021, 1:06 a.m.