removeVirtualAreas | R Documentation

## Remove virtual areas

### Description

This function removes virtual areas from an `antaresDataList` object and corrects the data for the real areas. The `antaresDataList` object should contain area and link data to function correctly.

### Usage

    removeVirtualAreas(x, storageFlexibility = NULL, production = NULL,
      reassignCosts = FALSE, newCols = TRUE)

### Arguments

`x` | An object of class `antaresDataList` with at least components `areas` and `links`.
`storageFlexibility` | A vector containing the names of the virtual storage/flexibility areas.
`production` | A vector containing the names of the virtual production areas.
`reassignCosts` | If TRUE, the production costs of the virtual areas are reallocated to the real areas they are connected to. If the virtual areas are connected to a virtual hub, their costs are first reallocated to the hub and then the costs of the hub are reallocated to the real areas.
`newCols` | If `TRUE`, new columns containing the production of the virtual areas are added. If FALSE their production is added to the production of the real areas they are connected to.

### Details

Two types of virtual areas have been defined corresponding to different types of modeling in Antares and different types of post-treatment to do:

- Flexibility/storage areas are areas created to model pumping unit or any other flexibility that behave as a storage. For those virtual areas, the important results are flows on the links.

- Production areas are areas created to isolate some generation from the "real" areas. They can be isolate for several reasons: to distinguish time-series (for example wind onshore/offshore), to select some specific unit to participate to day-ahead reserve, etc.

`removeVirtualAreas` performs different corrections:

- Correct the balance of the real areas by removing the flows to or from virtual areas.

- If parameter `reassignCosts` is TRUE, then the costs of the virtual areas are reassigned to the real areas they are connected to. The affected columns are `OV. COST`, `OP. COST`, `CO2 EMIS.` and `NP COST`. If a virtual area is connected to a single real area, all its costs are attributed to the real area. If it is connected to several real areas, then costs at a given time step are divided between them proportionally to the flows between them and the virtual area.

- For each storage/flexibility area, a column named like the area is created. It contains the values of the flow between the virtual area and the real areas. This column is interpreted as a production of electricity: it is positive if the flow from the virtual area to the real area is positive and negative otherwise. If parameter `newCols` is `FALSE`, the values are added to the variable `PSP` and the columns is removed.

- If the parameter `production` is specified, then the non null productions of the virtual areas are either added to the ones of the real areas they are connected to if `newCols = FALSE` or put in new columns if `newCols = TRUE`. In the second case the columns are named `*_virtual` where "`*`" is a type of production (wind, solar, nuclear, ...). Productions that are zero for all virtual areas are omited. If virtual production areas contains clusters then they will be move to the real area.

- Finally, virtual areas and the links connected to them are removed from the data.

The functions makes a few assumptions about the network. if they are violated it will not act correctly:

- storage/flexibility areas can be connected to other storage/flexibility areas (hubs), but at least one of them is connected to a real area. That means that there is no group of virtual areas disconnected from the real network. If such a group exists, you can either remove them manually or simply not import them.

- production areas are connected to one and only one real area. They cannot be connected to virtual areas. But a real area may by connected to several production areas.

### Value

An `antaresDataList` object in which virtual areas have been removed and data of the real has been corrected. See details for an explanation of the corrections.

### Examples

    ## Not run:

    # Assume we have a network with two virtual areas acting as pump storage and
    # an area representing offshore production
    #
    #  offshore
    #     |
    # real area - psp in
    #           \
    #             psp out
    #

    data <- readAntares(areas="all", links="all")

    # Remove pump storage virtual areas

    correctedData <- removeVirtualAreas(data,
                                        storageFlexibility = c("psp in", "psp out"),
                                        production = "offshore")

    ## End(Not run)