windfarmga

R Package to Optimize Windfarm Layouts

https://github.com/ysosirius/windfarmga

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.1%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

R Package to Optimize Windfarm Layouts

Basic Info
Statistics
  • Stars: 29
  • Watchers: 4
  • Forks: 7
  • Open Issues: 1
  • Releases: 4
Created over 9 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License Codemeta

README.md

windfarmGA

R build status CRAN status CRAN checks codecov

A genetic algorithm to optimize the layout of wind farms.

Installation

The latest version can be installed from GitHub with: R devtools::install_github("YsoSirius/windfarmGA") install.packages("windfarmGA")

Description

The genetic algorithm is designed to optimize wind farms of any shape. It requires a predefined number of turbines, a uniform rotor radius and an average wind speed per wind direction. It can include a terrain effect model, which requires an elevation raster and a surface roughness raster. The elevation data is used to find mountains and valleys and to adjust the wind speeds accordingly by 'wind multipliers' and to determine the air densities at rotor heights. The surface roughness raster with an additional elevation roughness value is used to re-evaluate the surface roughness and to individually determine the wake-decay constant for each turbine.

To start an optimization use the function genetic_algorithm.

Since version 1.1, hexagonal grid cells are possible, with their center points being possible locations for wind turbines. Furthermore, rasters can be included, which contain information on the Weibull parameters. For Austria this data is already included in the package.

Create an input Polygon

  • Input Polygon by source R library(sf) dsn <- "Path to the Shapefile" layer <- "Name of the Shapefile" Polygon1 <- sf::st_read(dsn = dsn, layer = layer) plot(Polygon1, col = "blue")

  • Or create a random Polygon R library(sf) Polygon1 <- sf::st_as_sf(sf::st_sfc( sf::st_polygon(list(cbind( c(0, 0, 2000, 2000, 0), c(0, 2000, 2000, 0, 0)))), crs = 3035 )) plot(Polygon1, col = "blue", axes = TRUE)

Create random Wind data

  • Exemplary input Wind data with uniform wind speed and single wind direction R wind_df <- data.frame(ws = c(12, 12), wd = c(0, 0), probab = c(25, 25)) windrosePlot <- plot_windrose(data = wind_df, spd = wind_df$ws, dir = wind_df$wd, dirres=10, spdmax = 20)

  • Exemplary input Wind data with random wind speeds and random wind directions R wind_df <- data.frame(ws = sample(1:25, 10), wd = sample(1:260, 10))) windrosePlot <- plot_windrose(data = wind_df, spd = wind_df$ws, dir = wind_df$wd)

Grid Spacing

Rectangular Grid Cells

Verify that the grid spacing is appropriate. Adapt the following input variables if necessary: - Rotor: The rotor radius in meters. - fcrR: The grid spacing factor, which should at least be 2, so that a single grid covers at least the whole rotor diameter. - prop: The proportionality factor used for grid calculation. It determines the minimum percentage that a grid cell must cover of the area.

Make sure that the Polygon is projected in meters. R Rotor <- 20 fcrR <- 9 Grid <- grid_area(Polygon1, size = (Rotor * fcrR), prop = 1, plotGrid = TRUE) str(Grid)

Hexagonal Grid Cells

R Rotor <- 20 fcrR <- 9 HexGrid <- hexa_area(Polygon1, size = (Rotor * fcrR), plotGrid = TRUE) str(HexGrid)

Terrain Effect Model

If the input variable topograp for the functions windfarmGA or genetic_algorithm is TRUE, the genetic algorithm will take terrain effects into account. For this purpose an elevation model and a Corine Land Cover raster are downloaded automatically, but can also be given manually. ( Download a CLC raster ).

If you want to include your own Land Cover Raster, you must assign the Raster Image path to the input variable sourceCCL. The algorithm uses an adapted version of the Raster legend ("clclegend.csv"), which is stored in the package subdirectory (/extdata). To use own values for the land cover roughness lengths, insert a column named **Rauhigkeitz** to the .csv file. Assign a surface roughness length to all land cover types. Be sure that all rows are filled with numeric values and save the .csv file with ";" delimiter. Assign the .csv file path to the input variable sourceCCLRoughness.

Start an Optimization

An optimization can be initiated with the function genetic_algorithm

  • without terrain effects R result <- genetic_algorithm( Polygon1 = Polygon1, n = 12, Rotor = 20, fcrR = 9, iteration = 10, vdirspe = wind_df, crossPart1 = "EQU", selstate = "FIX", mutr = 0.8, Proportionality = 1, SurfaceRoughness = 0.3, topograp = FALSE, elitism =TRUE, nelit = 7, trimForce = TRUE, referenceHeight = 50, RotorHeight = 100 )

  • with terrain effects ```R sourceCCL <- "Source of the CCL raster (TIF)" sourceCCLRoughness <- "Source of the Adaped CCL legend (CSV)"

result <- geneticalgorithm( Polygon1 = Polygon1, n = 12, Rotor = 20, fcrR = 9, iteration = 10, vdirspe = winddf, crossPart1 = "EQU", selstate = "FIX", mutr = 0.8, Proportionality = 1, SurfaceRoughness = 0.3, topograp = TRUE, elitism = TRUE, nelit = 7, trimForce = TRUE, referenceHeight = 50, RotorHeight = 100, sourceCCL = sourceCCL, sourceCCLRoughness = sourceCCLRoughness ) ```

```R

Run an optimization with your own Weibull parameter rasters. The shape and scale

parameter rasters of the weibull distributions must be added to a list, with the first

list item being the shape parameter (k) and the second list item being the scale

parameter (a). Adapt the paths to your raster data and run an optimization.

kraster <- "/..pathto../kparamraster.tif" araster <- "/..pathto../aparamraster.tif" weibullrasters <- list(raster(kraster), raster(araster))

resultweibull <- geneticalgorithm( Polygon1 = Polygon1, GridMethod ="h", n=12, fcrR=5, iteration=10, vdirspe = winddf, crossPart1 = "EQU", selstate="FIX", mutr=0.8, Proportionality = 1, Rotor=30, SurfaceRoughness = 0.3, topograp = FALSE, elitism=TRUE, nelit = 7, trimForce = TRUE, referenceHeight = 50,RotorHeight = 100, weibull = TRUE, weibullsrc = weibullrasters) plotwindfarmGA(result = result_weibull, Polygon1 = Polygon1) ```

Plot the Results on a Leaflet Map

```R

Plot the best wind farm on a leaflet map (ordered by energy values)

plot_leaflet(result = resulthex, Polygon1, which = 1)

Plot the last wind farm (ordered by chronology).

plot_leaflet(result = resulthex, Polygon1, orderitems = FALSE, which = 1) ```

Plotting Methods of the Genetic Algorithm

Several plotting functions are available: R - plot_windfarmGA(result, Polygon1) - plot_result(result, Polygon1, best = 1) - plot_evolution(result, ask = TRUE, spar = 0.1) - plot_development(result) - plot_parkfitness(result, spar = 0.1) - plot_fitness_evolution(result) - plot_cloud(result, pl = TRUE) - plot_heatmap(result = result, si = 5) - plot_leaflet(result = result, Polygon1 = Polygon1, which = 1)

A full documentation of the genetic algorithm is given in my master thesis.

Shiny Windfarm Optimization

I also made a Shiny App for the Genetic Algorithm. Unfortunately, as an optimization takes quite some time and the app is currently hosted by shinyapps.io under a public license, there is only 1 R-worker at hand. So only 1 optimization can be run at a time.

Full Optimization example:

```R library(sf) library(windfarmGA)

Polygon1 <- sf::stassf(sf::stsfc( sf::stpolygon(list(cbind( c(4651704, 4651704, 4654475, 4654475, 4651704), c(2692925, 2694746, 2694746, 2692925, 2692925)))), crs = 3035 )) plot(Polygon1, col = "blue", axes = TRUE)

winddf <- data.frame(ws = 12, wd = 0) windrosePlot <- plotwindrose(data = winddf, spd = winddf$ws, dir = winddf$wd, dirres = 10, spdmax = 20) Rotor <- 20 fcrR <- 9 Grid <- gridarea(shape = Polygon1, size = (Rotor*fcrR), prop = 1, plotGrid = TRUE)

result <- geneticalgorithm(Polygon1 = sppolygon, n = 20, Rotor = Rotor, fcrR = fcrR, iteration = 50, vdirspe = wind_df, referenceHeight = 50, RotorHeight = 100)

The following function will execute all plotting function further below:

plot_windfarmGA(result, Polygon1, whichPl = "all", best = 1, plotEn = 1)

The plotting functions can also be called individually:

plotresult(result, Polygon1, best = 1, plotEn = 1, topographie = FALSE) plotevolution(result, ask = TRUE, spar = 0.1) plotparkfitness(result, spar = 0.1) plotfitnessevolution(result) plotcloud(result, pl = TRUE) plotheatmap(result = result, si = 5) plotleaflet(result = result, Polygon1 = Polygon1, which = 1) ```

Owner

  • Login: YsoSirius
  • Kind: user

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "windfarmGA",
  "description": "The genetic algorithm is designed to optimize wind farms of any shape. It requires a predefined amount of turbines, a unified rotor radius and an average wind speed value for each incoming wind direction. A terrain effect model can be included that downloads an 'SRTM' elevation model and loads a Corine Land Cover raster to approximate surface roughness.",
  "name": "windfarmGA: Genetic Algorithm for Wind Farm Layout Optimization",
  "codeRepository": "https://github.com/YsoSirius/windfarmGA",
  "issueTracker": "https://github.com/YsoSirius/windfarmGA/issues",
  "license": "https://spdx.org/licenses/MIT",
  "version": "4.0.0",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.4.0 Patched (2024-05-26 r86642 ucrt)",
  "author": [
    {
      "@type": "Person",
      "givenName": "Sebastian",
      "familyName": "Gatscha",
      "email": "sebastian_gatscha@gmx.at"
    }
  ],
  "copyrightHolder": [
    {
      "@type": "Person",
      "givenName": "Sebastian",
      "familyName": "Gatscha",
      "email": "sebastian_gatscha@gmx.at"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Sebastian",
      "familyName": "Gatscha",
      "email": "sebastian_gatscha@gmx.at"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "testthat",
      "name": "testthat",
      "version": ">= 3.0.0",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=testthat"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "foreach",
      "name": "foreach",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=foreach"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "parallel",
      "name": "parallel"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "doParallel",
      "name": "doParallel",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=doParallel"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "progress",
      "name": "progress",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=progress"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "stars",
      "name": "stars",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=stars"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "raster",
      "name": "raster",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=raster"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "leaflet",
      "name": "leaflet",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=leaflet"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "elevatr",
      "name": "elevatr",
      "version": ">= 0.99.0",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=elevatr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "ggplot2",
      "name": "ggplot2",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=ggplot2"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "gstat",
      "name": "gstat",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=gstat"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "rworldmap",
      "name": "rworldmap",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rworldmap"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "R",
      "name": "R",
      "version": ">= 4.1.0"
    },
    "2": {
      "@type": "SoftwareApplication",
      "identifier": "Rcpp",
      "name": "Rcpp",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=Rcpp"
    },
    "3": {
      "@type": "SoftwareApplication",
      "identifier": "terra",
      "name": "terra",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=terra"
    },
    "4": {
      "@type": "SoftwareApplication",
      "identifier": "sf",
      "name": "sf",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=sf"
    },
    "5": {
      "@type": "SoftwareApplication",
      "identifier": "RColorBrewer",
      "name": "RColorBrewer",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=RColorBrewer"
    },
    "6": {
      "@type": "SoftwareApplication",
      "identifier": "calibrate",
      "name": "calibrate",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=calibrate"
    },
    "7": {
      "@type": "SoftwareApplication",
      "identifier": "grDevices",
      "name": "grDevices"
    },
    "8": {
      "@type": "SoftwareApplication",
      "identifier": "graphics",
      "name": "graphics"
    },
    "9": {
      "@type": "SoftwareApplication",
      "identifier": "magrittr",
      "name": "magrittr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=magrittr"
    },
    "10": {
      "@type": "SoftwareApplication",
      "identifier": "methods",
      "name": "methods"
    },
    "11": {
      "@type": "SoftwareApplication",
      "identifier": "stats",
      "name": "stats"
    },
    "12": {
      "@type": "SoftwareApplication",
      "identifier": "utils",
      "name": "utils"
    },
    "SystemRequirements": null
  },
  "keywords": [
    "windfarm-layout",
    "optimization",
    "genetic-algorithm",
    "renewable-energy",
    "r",
    "rstats",
    "r-package"
  ],
  "fileSize": "5158.004KB",
  "relatedLink": "https://ysosirius.github.io/windfarmGA/index.html",
  "releaseNotes": "https://github.com/YsoSirius/windfarmGA/blob/master/NEWS.md",
  "readme": "https://github.com/YsoSirius/windfarmGA/blob/master/README.md",
  "contIntegration": [
    "https://github.com/YsoSirius/windfarmGA/actions",
    "https://app.codecov.io/gh/YsoSirius/windfarmGA"
  ],
  "developmentStatus": "https://lifecycle.r-lib.org/articles/stages.html"
}

GitHub Events

Total
  • Create event: 1
  • Issues event: 1
  • Release event: 1
  • Watch event: 4
  • Push event: 19
  • Pull request event: 4
Last Year
  • Create event: 1
  • Issues event: 1
  • Release event: 1
  • Watch event: 4
  • Push event: 19
  • Pull request event: 4

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 440
  • Total Committers: 2
  • Avg Commits per committer: 220.0
  • Development Distribution Score (DDS): 0.411
Past Year
  • Commits: 26
  • Committers: 1
  • Avg Commits per committer: 26.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Sebastian Gatscha g****a@t****u 259
YsoSirius k****1@g****t 181
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 11
  • Total pull requests: 29
  • Average time to close issues: 11 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 8
  • Total pull request authors: 2
  • Average comments per issue: 2.55
  • Average comments per pull request: 0.45
  • Merged pull requests: 29
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • MrEtmAr (3)
  • trafficonese (2)
  • teunbrand (1)
  • edzer (1)
  • tristanfabregas (1)
  • rsbivand (1)
  • SamAct (1)
  • FDavisA (1)
Pull Request Authors
  • trafficonese (31)
  • YsoSirius (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 215 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 11
  • Total maintainers: 1
cran.r-project.org: windfarmGA

Genetic Algorithm for Wind Farm Layout Optimization

  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 215 Last month
Rankings
Dependent packages count: 27.4%
Dependent repos count: 33.8%
Average: 48.4%
Downloads: 84.0%
Maintainers (1)
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.2.3 depends
  • RColorBrewer * imports
  • Rcpp * imports
  • calibrate * imports
  • doParallel * imports
  • elevatr * imports
  • foreach * imports
  • grDevices * imports
  • graphics * imports
  • magrittr * imports
  • methods * imports
  • parallel * imports
  • raster * imports
  • sf * imports
  • stats * imports
  • utils * imports
  • ggplot2 * suggests
  • gstat * suggests
  • leaflet * suggests
  • rgdal * suggests
  • rgeos * suggests
  • rworldmap * suggests
  • stars * suggests
  • testthat * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite