diff --git a/.Rbuildignore b/.Rbuildignore index 726d769c..48fe7288 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -9,3 +9,4 @@ test_case/ ^pkgdown$ ^\.github$ man-roxygen/ +^codecov\.yml$ diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 00000000..2c5bb502 --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,50 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: test-coverage + +jobs: + test-coverage: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::covr + needs: coverage + + - name: Test coverage + run: | + covr::codecov( + quiet = FALSE, + clean = FALSE, + install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") + ) + shell: Rscript {0} + + - name: Show testthat output + if: always() + run: | + ## -------------------------------------------------------------------- + find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v3 + with: + name: coverage-test-failures + path: ${{ runner.temp }}/package diff --git a/README.md b/README.md index 7c7f5bbb..0e32093e 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,13 @@ > Edit an Antares study before running a simulation. -[![Coverage Status](https://img.shields.io/codecov/c/github/rte-antares-rpackage/antaresEditObject/master.svg)](https://codecov.io/github/rte-antares-rpackage/antaresEditObject?branch=master) [![version](http://www.r-pkg.org/badges/version/antaresEditObject)](https://CRAN.R-project.org/package=antaresEditObject) [![cran checks](https://cranchecks.info/badges/worst/antaresEditObject)](https://cranchecks.info/pkgs/antaresEditObject) [![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) [![cranlogs](http://cranlogs.r-pkg.org/badges/antaresEditObject)](https://CRAN.R-project.org/package=antaresEditObject) [![R-CMD-check](https://github.com/rte-antares-rpackage/antaresEditObject/workflows/R-CMD-check/badge.svg)](https://github.com/rte-antares-rpackage/antaresEditObject/actions) +[![Codecov test coverage](https://codecov.io/gh/rte-antares-rpackage/antaresEditObject/branch/master/graph/badge.svg)](https://app.codecov.io/gh/rte-antares-rpackage/antaresEditObject?branch=master) diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..04c55859 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,14 @@ +comment: false + +coverage: + status: + project: + default: + target: auto + threshold: 1% + informational: true + patch: + default: + target: auto + threshold: 1% + informational: true diff --git a/docs/404.html b/docs/404.html index 3543e1a8..502668b1 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@
@@ -109,7 +109,7 @@Site built with pkgdown 2.0.7.
+Site built with pkgdown 2.0.6.
diff --git a/docs/articles/api-variant-management.html b/docs/articles/api-variant-management.html index e01e0437..e0c4d4ed 100644 --- a/docs/articles/api-variant-management.html +++ b/docs/articles/api-variant-management.html @@ -33,7 +33,7 @@ @@ -342,10 +342,6 @@Site built with pkgdown 2.0.7.
+Site built with pkgdown 2.0.6.
diff --git a/docs/articles/index.html b/docs/articles/index.html index 17ceec26..9939b304 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -17,7 +17,7 @@ @@ -87,7 +87,7 @@Site built with pkgdown 2.0.7.
+Site built with pkgdown 2.0.6.
diff --git a/docs/articles/scenario-builder.html b/docs/articles/scenario-builder.html index 2defddeb..c3ee486c 100644 --- a/docs/articles/scenario-builder.html +++ b/docs/articles/scenario-builder.html @@ -33,7 +33,7 @@ @@ -118,33 +118,13 @@updateScenarioBuilder(
ldata = my_scenario,
series = "thermal",
- clusters_areas = data.table::data.table(
+ clusters_areas = data.table::data.table(
area = c("earth", "earth"),
cluster = c("africa", "europe")
)
@@ -318,7 +298,7 @@ Scenario Builder
diff --git a/docs/authors.html b/docs/authors.html
index f5de7fc7..e479929d 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -17,7 +17,7 @@
@@ -122,13 +122,13 @@ Citation
Bachelier V, Breant F, Perrier V (2023).
antaresEditObject: Edit an 'Antares' Simulation.
-R package version 0.5.0, https://github.com/rte-antares-rpackage/antaresEditObject.
+R package version 0.5.1, https://github.com/rte-antares-rpackage/antaresEditObject.
@Manual{,
title = {antaresEditObject: Edit an 'Antares' Simulation},
author = {Veronique Bachelier and Frederic Breant and Victor Perrier},
year = {2023},
- note = {R package version 0.5.0},
+ note = {R package version 0.5.1},
url = {https://github.com/rte-antares-rpackage/antaresEditObject},
}
@@ -143,7 +143,7 @@ Citation
diff --git a/docs/index.html b/docs/index.html
index 11590671..e16870e9 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -35,7 +35,7 @@
@@ -103,7 +103,7 @@ Installationinstall.packages("antaresEditObject")
Or install dev version from GitHub:
-remotes::install_github("rte-antares-rpackage/antaresEditObject", build_vignettes = TRUE)
remotes::install_github("rte-antares-rpackage/antaresEditObject", build_vignettes = TRUE)
NEWS.md
+ NEW FEATURES :
+deleteStudy()
(API compatible)copyStudyWeb()
to import physical study into a managed study (API).createClusterBulk()
to create multiple thermal clusters at once.writeHydroValues()
to write hydro input files.backupStudy()
+BUGFIXES :
+removeArea()
.writeEconomicOptions()
in API mode.NEW FEATURES :
@@ -96,11 +109,12 @@Antares v840 : new parameter result-format
to choose output format (txt/zip) + new values for transmission-capacities
parameter.
Antares v832 : added filtering options to bindingConstraints.
Antares v830 : updateAdequacySettings()
function to activate Adequacy Patch and set parameters.
Antares v820 : createLink()
and editLink()
have a new argument tsLink
allowing to write transmission capacities time-series.
createBindingConstraintBulk()
allow to create multiple binding constraints at once.
result-format
to choose output format (txt/zip) + new values for transmission-capacities
parameter.updateAdequacySettings()
function to activate Adequacy Patch and set parameters. + createArea()
and editArea()
support for new adequacy_patch.ini file.createLink()
and editLink()
have a new argument tsLink
allowing to write transmission capacities time-series.createBindingConstraintBulk()
allow to create multiple binding constraints at once.Save an Antares Study or only inputs in a .tar.gz
file
Save an Antares Study or only inputs in a .tar.gz
or .zip
file
backupStudy(
backupfile,
- what = c("input", "study"),
- opts = antaresRead::simOptions()
+ what = "study",
+ opts = antaresRead::simOptions(),
+ extension = ".zip"
)
List of simulation parameters returned by the function
antaresRead::setSimulationPath
Defaut is .zip.
R/importStudyAPI.R
+ copyStudyWeb.Rd
Copy study from an existing workspace into a managed study. +NOTE : The study must be present in a workspace (DRD, PPSE..) not just locally.
+copyStudyWeb(
+ opts = antaresRead::simOptions(),
+ host,
+ token,
+ outputs = T,
+ groups = NULL,
+ suffix = "managedCopy"
+)
List of simulation parameters returned by the function antaresRead::setSimulationPath
.
+If id is not available, antaresRead::searchStudy
will be used to find study.
Host of AntaREST server API.
API personnal access token.
Logical. Determine if outputs are copied too.
Character. Add study to groups of Antares Web.
Character. default is "managedCopy" +By default the new study will be : studyname_managedCopy
New managed study ID
+For each area, the thermal cluster data are generated :
Writing .ini
files
Writing time_series files
Writing prepro_data files
Writing prepro_modulation files
createClusterBulk(
+ cluster_object,
+ area_zone,
+ add_prefix = TRUE,
+ opts = antaresRead::simOptions()
+)
list
mutiple list containing the parameters for writing each cluster
character
name of area to create cluster
logical
prefix cluster name with area name
List of simulation parameters returned by the function
+antaresRead::setSimulationPath()
An updated list containing various information about the simulation.
+ + +list
containing meta information about the simulation
see the example to write a cluster object,
+see the original function createCluster()
Structure of cluster_object
:
The list must be structured with named items
parameter
: list
of paramaters to write in .ini file
overwrite
: logical
to choose to overwrite an existing cluster (if not present, set to FALSE
)
time_series
: matrix
or data.frame
the "ready-made" 8760-hour time-series
prepro_data
: matrix
or data.frame
Pre-process data
prepro_modulation
: matrix
or data.frame
Pre-process modulation
Details for sublist cluster_object[["parameter"]]
:
name
: Name for the cluster,
+it will prefixed by area name, unless you set add_prefix = FALSE
group
: Group of the cluster, depends on cluster type
...
: Parameters to write in the Ini file
if (FALSE) {
+
+# /!\/!\/!\ use or create a study /!\/!\/!\
+
+# data preparation for sutructures
+ts <- matrix(rep(c(0, 8000), each = 24*364),
+ ncol = 2)
+
+df_pd <- matrix(rep(c(1, 1, 1, 0), each = 24*365),
+ ncol = 4)
+
+df_pm <- matrix(data = c(rep(1, times = 365 * 24 * 3), rep(0, times = 365 * 24 * 1)),
+ ncol = 4)
+
+
+# Example cluster object
+zone_test_1 <- list(
+ `CCGT old 1`= list(
+ parameter= list(
+ name= "CCGT old 1",
+ group = "Other",
+ unitcount= 10L,
+ nominalcapacity= 100,
+ enabled= "true",
+ `min-stable-power`= 80L,
+ `min-up-time`= 20L,
+ `min-down_time`= 30L),
+ overwrite= TRUE,
+ time_series = ts_8760,
+ prepro_data = df_pd,
+ prepro_modulation = df_pm))
+
+ # overwrite existing cluster
+zone_test_2 <- list(
+ `PEAK`= list(parameter= list(
+ name= "PEAK",
+ group = "Other"),
+ overwrite= TRUE,
+ time_series = ts,
+ prepro_data = df_pd,
+ prepro_modulation = df_pm))
+
+# Create multiple areas with multiple clusters
+list_areas <- antaresRead::getAreas()[1:5]
+
+lapply(list_areas, createClusterBulk,
+cluster_object = c(zone_test_1, zone_test_2),
+add_prefix = TRUE)
+
+}
+
+
Delete a study
+deleteStudy(opts = simOptions())
List. study options
copyOutput()
Copy of the output files of an Antares study
Import physical study to Antares Web (managed study)
createArea()
Create an area in an Antares study
Create serial thermal cluster
createPSP()
getCapacityPSP()
editPSP()
Create a Pumped Storage Power plant (PSP)
Delete a study
writeEconomicOptions()
Write Economic Options
Write Hydro Values
Write waterValues, reservoirLevels, maxpower, inflowPattern and creditModulations data for a given area.
+writeHydroValues(
+ area,
+ type,
+ data = NULL,
+ overwrite = TRUE,
+ opts = antaresRead::simOptions()
+)
The area where to add the values.
Type of hydro file, it can be "waterValues", "reservoir", "maxpower", "inflowPattern" or "creditmodulations".
The data must have specific dimension depending on the type of file :
waterValues: a 365x101 numeric matrix: +marginal values for the stored energy based on date (365 days) +and on the reservoir level (101 round percentage values ranging from +0% to 100%). OR a 3-column matrix with 365x101 rows. In this latter case the 3 columns must +be 'date', 'level' and 'value' (in this order), and the rows must be sorted by: +ascending day, ascending level.
reservoir: a 365x3 numeric matrix. The columns contains respectively the levels min, avg and max.
maxpower: a 365x4 numeric matrix.
inflowPattern: a 365x1 numeric matrix.
creditmodulations: a 2x101 numeric matrix.
Logical. Overwrite the values if a file already exists.
List of simulation parameters returned by the function
+antaresRead::setSimulationPath()
.