# Renewables Energy Sources

     # CRAN limite CPU usage
    data.table::setDTthreads(2)
    library(antaresEditObject)

Antares v8.0.3 allow to work with renewable energy sources, implemented in Antares as a new functionnality: renewables clusters. Here’s a quick start guide to use those new features.

As always, setup the study you want to use:

    tmp <- tempfile()
    createStudy(path = tmp, study_name = "res-study")
    opts <- setSimulationPath(tmp)

## Activate RES

First you need to activate RES functionality, to do so you can use:

    activateRES()

This will set `renewable-generation-modelling` parameters to `clusters` and create appropriate file structure to create RES clusters.

You can also update `renewable-generation-modelling` parameters manually with:

    updateOptimizationSettings(renewable.generation.modelling = "clusters")

## Manipulate clusters

Like thermal clusters, there’s equivalent functions to create, edit and remove RES clusters:

    # create an area to create a cluster in it
    createArea(name = "area51")

    # Create a renewable cluster
    createClusterRES(
      area = "area51",
      cluster_name = "ren01",
      add_prefix = FALSE
    )

    # Use an other group and some parameters
    createClusterRES(
      area = "area51",
      cluster_name = "ren02",
      group = "Wind Offshore",
      nominalcapacity = 123,
      ts_interpretation = "production-factor",
      add_prefix = FALSE
    )

Edit an existing cluster with:

    editClusterRES(
      area = "area51",
      cluster_name = "ren02",
      group = "Solar Rooftop", # new group
      add_prefix = FALSE
    )

And remove a cluster with:

    removeClusterRES(area = "area51", cluster_name = "ren01")

## Scenario builder

There’s a new type of serie allowed in scenario builder for renewable clusters called `r`:

    readScenarioBuilder()

    $r
          [,1] [,2] [,3]
    area51   1    2    3

To update the scenario builder, you can use:

    # generate scenario
    sbuilder <- scenarioBuilder(n_scenario = 51)

    # Update with:
    updateScenarioBuilder(ldata = sbuilder, series = "renewables")
    # OR
    updateScenarioBuilder(ldata = list(r = sbuilder))