Most data from a simulation can be imported in the R session with function readAntares().
myPath<-"E:\\ANTARES\\Exemple_antares\\2_exemple_etudes_importantes\\TYNDP\\ST2030\\ST2030"
opts<-setSimulationPath(myPath, "20170830-1049eco-reference")
myData<-readAntares(
areas = "all",
links="all",
clusters = "all",
linkCapacity = TRUE,
mustRun = TRUE,
showProgress = FALSE
)
You can remove your virtual areas and correct your initial data.
myConData<-removeVirtualAreas(
x=myData,
storageFlexibility = getAreas(select = c("pum", "tur", "z_dsr", "y_mul")),
newCols = FALSE
)
Compute the number of areas without virtual areas.
virtuarAreas<-getAreas(select = c("z_dsr", "y_mul", "pum", "tur"))
realAreas<-getAreas(exclude = virtuarAreas)
length(getAreas(exclude = virtuarAreas))
## [1] 54
Compute the number of links without virtual areas
length(getLinks(areas = realAreas, exclude = virtuarAreas))
## [1] 105
Compute the number of areas with unsupplied energy
length(unique(myConData$areas[`UNSP. ENRG`>0]$area))
## [1] 19
Compute the number of areas with spilled energy
length(unique(myConData$areas[`SPIL. ENRG`>0]$area))
## [1] 24
Compute the number of links with congestion
length(unique(myConData$links[`CONG. PROB +`>0]$link))
## [1] 96
length(unique(myConData$links[`CONG. PROB -`>0]$link))
## [1] 98
length(unique(myConData$links[`CONG. PROB +`>0 | `CONG. PROB -`>0]$link))
## [1] 102
length(unique(myConData$links[`CONG. PROB +`>0 & `CONG. PROB -`>0]$link))
## [1] 89
Compute the sum of the spilled energy by area and order the result by the spilled energy
## PRINT ONLY RESULT
kable(resCompute[, .SD[1:7], ])
| area | sumSpilled |
|---|---|
| es | 2020833 |
| gb | 1664705 |
| de | 1555247 |
| ie | 951593 |
| nl | 497123 |
| ni | 206839 |
| pt | 175267 |
Compute the sum of the unsupplied energy by area and order the result by the unsupplied energy
## PRINT ONLY RESULT
kable(resComputeUnsEne[, .SD[1:7], ])
| area | sumUnspilled |
|---|---|
| fr | 38421 |
| gb | 5587 |
| fi | 3863 |
| luf | 1333 |
| be | 456 |
| ee | 419 |
| pl | 419 |
Get the first year and the first date where there is more than 700MW of unsupplied energy in France and use prodStack to visualize the production stack for this week.
## [1] "mcYear :4"
## [1] "time :2018-01-05 18:00:00"
## [1] "timeId :115"
## [1] "day :5"
## [1] "mcYear :5"
## [1] "time :2018-02-08 18:00:00"
## [1] "timeId :931"
## [1] "day :8"
myDataFr<-suppressWarnings(readAntares(areas = "fr", mcYears = mcYears[1], showProgress = FALSE, links = "all", linkCapacity = TRUE))
prodStack(myDataFr, dateRange=c("2018-01-01 00:00:00", "2018-01-07 23:00:00"), interactive = FALSE, area="fr")
exchangesStack(myDataFr, dateRange=c("2018-01-01 00:00:00", "2018-01-07 23:00:00"), interactive = FALSE, area="fr")
plot(myDataFr$areas, dateRange=c("2018-01-01 00:00:00", "2018-01-07 23:00:00"), interactive = FALSE, elements="fr", variable="MRG. PRICE", mcYear=4, type="ts", stepPlot=TRUE)
myDataFr<-suppressWarnings(readAntares(links = getLinks(areas = c("z_dsr450", "y_mul", "pum", "tur", "fr")), areas = getAreas(select = c("z_dsr450", "y_mul", "pum", "tur", "fr")), mcYears = 4, linkCapacity = TRUE, showProgress = FALSE))
myConDataFr<-removeVirtualAreas(
x=myDataFr,
storageFlexibility = getAreas(select = c("pum", "tur", "z_dsr", "y_mul")),
newCols = FALSE,
reassignCosts = TRUE
)
prodStack(myConDataFr, dateRange=c("2018-01-01 00:00:00", "2018-01-07 23:00:00"), interactive = FALSE, area="fr")
exchangesStack(myConDataFr, dateRange=c("2018-01-01 00:00:00", "2018-01-07 23:00:00"), interactive = FALSE, area="fr")
configure a layout or import one
#mlTyndp<-mapLayout(readLayout())
#plotMapLayout(mlTyndp)
#saveRDS(mlTyndp, file = "E:\\ANTARES\\Exemple_antares\\2_exemple_etudes_importantes\\TYNDP\\ST2030\\ST2030\\user\\mlTyndp2017_V2.rds")
mlTyndp<-readRDS(file = "E:\\ANTARES\\Exemple_antares\\2_exemple_etudes_importantes\\TYNDP\\ST2030\\mapLayoutTyndp.rds")
myDataEurope<-suppressWarnings(readAntares(links = "all", areas = "all", linkCapacity = TRUE, showProgress = FALSE, mcYears = mcYears[1]))
myConDataEurope<-removeVirtualAreas(
x=myDataEurope,
storageFlexibility = getAreas(select = c("pum", "tur", "z_dsr", "y_mul")),
newCols = FALSE
)
addLoadFactorLink(myConDataEurope)
The flow value of Great Britain/France is equal to zero, these two countries have unsupplied energy.
The flow between Belgium/France is 1295 but the link is not congested because Belgium has no marge.
All others flows to France are congested.
plotMap(
myConDataEurope,
mlTyndp,
sizeAreaVars=varPlotMap,
areaChartType="pie",
interactive = FALSE,
sizeMiniPlot = TRUE,
colAreaVar="LOAD",
colLinkVar="congestion",
sizeLinkVar="FLOW LIN.",
popupAreaVars = c(varPlotMap, vecAde, "PSP", "LOAD", "SPIL. ENRG"),
timeId = 115,
type = "detail"
)
plotMap(
myConDataEurope,
mlTyndp,
.updateBtn = TRUE,
.updateBtnInit=TRUE
)
linkColorScaleOpts<-colorScaleOptions(
breaks = 1,
negCol = "#00FF00",
zeroCol = "#FFFFFF",
posCol = "#FF0000",
naCol = "#EEEEEE",
levels = c(0,1)
)
resOptions<-plotMapOptions(
linkColorScaleOpts = linkColorScaleOpts
)
plotMap(
myConDataEurope,
mlTyndp,
sizeAreaVars=varPlotMap,
areaChartType="pie",
interactive = FALSE,
sizeMiniPlot = TRUE,
colAreaVar="LOAD",
colLinkVar="congestion",
sizeLinkVar="FLOW LIN.",
popupAreaVars = c(varPlotMap, vecAde, "PSP", "LOAD", "SPIL. ENRG"),
timeId = 115,
type = "detail",
options = resOptions
)
ListMyDataFr<-list()
for(i in mcYears){
ListMyDataFr[[i]]<-suppressWarnings(
readAntares(
links = "all",
areas = "all",
linkCapacity = TRUE,
showProgress = FALSE,
mcYears = i,
hydroStorageMaxPower = TRUE
)
)
ListMyDataFr[[i]]<-removeVirtualAreas(
x=ListMyDataFr[[i]],
storageFlexibility = getAreas(select = c("pum", "tur", "z_dsr", "y_mul")),
newCols = FALSE
)}
resPlotMap<-list()
timeId<-NULL
for(i in mcYears){
addLoadFactorLink(ListMyDataFr[[i]])
addUpwardMargin(ListMyDataFr[[i]])
ListMyDataFr[[i]]$areas[area=="tr", interconnectedUpwardMargin:=0]
}
Write your simulation in h5.
writeAntaresH5(
path="E:\\ANTARES\\Exemple_antares\\2_exemple_etudes_importantes\\TYNDP\\ST2030\\ST2030\\writeH5",
allData = FALSE, #thermalAvailabilites and hydroStorage were not exported
misc = TRUE,
thermalAvailabilities = FALSE,
hydroStorageMaxPower = TRUE,
reserve = TRUE,
linkCapacity = TRUE,
mustRun = TRUE,
writeAllSimulations = TRUE,
writeMcAll = TRUE,
nbCores=3,
removeVirtualAreas=TRUE,
storageFlexibility=getAreas(select = c("pum", "tur", "z_dsr", "y_mul")),
newCols = FALSE,
overwrite = TRUE,
timeSteps = "hourly"
)