Skip to content

Commit

Permalink
Dev v84 (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
AssilMa authored Dec 5, 2022
1 parent d48df3f commit a4a1a96
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 22 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: rcmdcheck

- uses: r-lib/actions/check-r-package@v1
- uses: r-lib/actions/check-r-package@v2

- name: Show testthat output
if: always()
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: antaresEditObject
Type: Package
Title: Edit an 'Antares' Simulation
Version: 0.3.0.9000
Version: 0.4.0
Authors@R: c(
person("Veronique", "Bachelier", email = "[email protected]", role = c("aut", "cre")),
person("Frederic", "Breant", role = "aut"),
Expand All @@ -20,7 +20,7 @@ License: GPL (>= 2) | file LICENSE
URL: https://github.com/rte-antares-rpackage/antaresEditObject
BugReports: https://github.com/rte-antares-rpackage/antaresEditObject/issues
Encoding: UTF-8
RoxygenNote: 7.2.1
RoxygenNote: 7.2.2
Roxygen: list(markdown = TRUE)
Depends: antaresRead (>= 2.3.0)
Imports:
Expand Down
17 changes: 8 additions & 9 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# antaresEditObject (unreleased)

### Antares v820

* `createLink()` and `editLink()` have a new argument `tsLink` allowing to write transmission capacities time-series.

# antaresEditObject 0.4.0

### New functions

*`createBindingConstraintBulk()` allow to create multiple binding constraints at once.
* 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.


### Breaking changes

* Argument's order of `writeInputTS()` has changed, `data` is now in first place.


### Variant management with API
This release include some new features to interact with Antares Web.

* Main functions are now compatible to interact with a variant through the API: `createArea()`, `editArea()`, `removeArea()`, `createLink()`, `editLink()`, `removeLink()`, `createCluster()`, `editCluster()`, `removeCluster()`, `createBindingConstraint()`, `editBindingConstraint()`, `removeBindingConstraint()`, `createDistrict()`, `updateGeneralSettings()`, `updateInputSettings()`, `updateOptimizationSettings()`, `updateOutputSettings()`, `writeInputTS()`, `readScenarioBuilder()`, `updateScenarioBuilder()`, `clearScenarioBuilder()`, `writeWaterValues()`, `createDSR()`, `createPSP()`.
* Main functions are now compatible to interact with a variant through the API: `createArea()`, `editArea()`, `removeArea()`, `createLink()`, `editLink()`, `removeLink()`, `createCluster()`, `editCluster()`, `removeCluster()`, `createBindingConstraint()`, `editBindingConstraint()`, `removeBindingConstraint()`, `createDistrict()`, `updateGeneralSettings()`, `updateInputSettings()`, `updateOptimizationSettings()`, `updateOutputSettings()`, `updateAdequacySettings()`, `writeInputTS()`, `readScenarioBuilder()`, `updateScenarioBuilder()`, `clearScenarioBuilder()`, `writeWaterValues()`, `createDSR()`, `createPSP()`.
* New functions to use or create variants: `useVariant()`, `createVariant()`.
* New function to create studies on AntaREST server: `createStudyAPI()`.
* New function to search studies on AntaREST server: `searchStudy()`.
Expand Down
17 changes: 14 additions & 3 deletions R/updateOptimizationSettings.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#' Update optimization parameters and other preferences of an Antares study
#'
#' @param simplex.range week or day
#' @param transmission.capacities true, false or infinite
#' @param transmission.capacities true, false or infinite (since v8.4 can also take : local-values,
#' null-for-all-links, infinite-for-all-links, null-for-physical-links, infinite-for-physical-links)
#' @param include.constraints true or false
#' @param include.hurdlecosts true or false
#' @param include.tc.min.stable.power true or false
Expand Down Expand Up @@ -66,7 +67,17 @@ updateOptimizationSettings <- function(simplex.range = NULL,
if (!is.null(simplex.range))
assertthat::assert_that(simplex.range %in% c("week", "day"))
if (!is.null(transmission.capacities))
assertthat::assert_that(transmission.capacities %in% c("true", "false", "infinite"))
if (opts$antaresVersion >= 840){
assertthat::assert_that(transmission.capacities %in% c("true", "false", "infinite",
"local-values", "null-for-all-links", "infinite-for-all-links",
"null-for-physical-links", "infinite-for-physical-links"))
if (transmission.capacities == "true") transmission.capacities <- "local-values"
else if (transmission.capacities == "false") transmission.capacities <- "null-for-all-links"
else if (transmission.capacities == "infinite") transmission.capacities <- "infinite-for-all-links"
} else {
assertthat::assert_that(transmission.capacities %in% c("true", "false", "infinite"))

}
if (!is.null(include.constraints))
assertthat::assert_that(include.constraints %in% c("true", "false"))
if (!is.null(include.hurdlecosts))
Expand All @@ -88,7 +99,7 @@ updateOptimizationSettings <- function(simplex.range = NULL,
assertthat::assert_that(include.exportmps %in% c("true", "false",
"none", "optim-1", "optim-2", "both-optims"))
if (include.exportmps == "true") include.exportmps <- "both-optims"
if (include.exportmps == "false") include.exportmps <- "none"
else if (include.exportmps == "false") include.exportmps <- "none"
} else {
assertthat::assert_that(include.exportmps %in% c("true", "false"))
}
Expand Down
8 changes: 7 additions & 1 deletion R/updateOutputSettings.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#' synthesis will be printed out.
#' @param storenewset Logical. See Antares General Reference Guide.
#' @param archives Character vector. Series to archive.
#' @param result.format Character. Output format (txt-files or zip).
#'
#' @template opts
#'
Expand All @@ -25,13 +26,15 @@
#' synthesis = TRUE,
#' storenewset = FALSE,
#' archives = c("load", "wind")
#' result.format = "zip"
#' )
#'
#' }
#'
updateOutputSettings <- function(synthesis = NULL,
storenewset = NULL,
archives = NULL,
result.format = NULL,
opts = antaresRead::simOptions()) {

assertthat::assert_that(inherits(opts, "simOptions"))
Expand All @@ -43,7 +46,8 @@ updateOutputSettings <- function(synthesis = NULL,
listData = list(
synthesis = synthesis,
storenewset = storenewset,
archives = paste(archives, collapse = ", ")
archives = paste(archives, collapse = ", "),
`result-format` = result.format
),
pathIni = "settings/generaldata/output",
opts = opts
Expand All @@ -62,6 +66,8 @@ updateOutputSettings <- function(synthesis = NULL,
outputs$storenewset <- storenewset
if (!is.null(archives))
outputs$archives <- paste(archives, collapse = ", ")
if (!is.null(result.format))
outputs$`result-format` <- result.format
general$output <- outputs

writeIni(listData = general, pathIni = pathIni, overwrite = TRUE)
Expand Down
2 changes: 1 addition & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

0 errors | 0 warnings | 0 note

New realease, no revdep, all OK (https://cran.r-project.org/web/checks/check_results_antaresEditObject.html)
New release, no revdep, all OK (https://cran.r-project.org/web/checks/check_results_antaresEditObject.html)
Thanks!
3 changes: 2 additions & 1 deletion man/updateOptimizationSettings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions man/updateOutputSettings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a4a1a96

Please sign in to comment.