Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed Apr 25, 2018
1 parent 3935887 commit cf3a096
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
.Ruserdata
*.Rproj
test_case/
test_output/
7 changes: 5 additions & 2 deletions R/create_wm_cluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ create_wm_cluster <- function(data, start = NULL, rm_prev_clus = TRUE, sort_othe
if (!is.null(start)) {
start <- as.Date(start)
data <- copy(data)
data <- data[as.Date(datetime, tz = "Europe/Paris") >= start]
data <- data[as.Date(datetime) < start + 7]
# data <- data[as.Date(datetime, tz = "Europe/Paris") >= start]
# data <- data[as.Date(datetime) < start + 7]
data <- data[format(datetime, format = "%Y-%m-%d") >= format(start)]
data <- data[format(datetime, format = "%Y-%m-%d") < format(start + 7)]
}

n_168 <- data[, .N, by = code_groupe]
Expand Down Expand Up @@ -123,6 +125,7 @@ create_wm_cluster <- function(data, start = NULL, rm_prev_clus = TRUE, sort_othe
tryCreateCluster <- function(args) {
# Sys.sleep(0.1)
# try(stop("erreur"), silent = TRUE)
args <- args[!duplicated(names(args))]
try(do.call(createCluster, args), silent = TRUE)
}

Expand Down
17 changes: 10 additions & 7 deletions R/create_wm_hydro_areas.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ create_wm_hydro_areas <- function(start,

# Configuration des liens areas/lac
for (i in areas) {
print(i)
# print(i)
cat(format(sprintf("Creating links for %s...\n", i), width = getOption("width")))
links_etude <- antaresRead::getLinks(opts = opts)

if (paste0(i, " - lac") %in% links_etude || paste0("lac - ", i) %in% links_etude) {
Expand Down Expand Up @@ -106,16 +107,16 @@ create_wm_hydro_areas <- function(start,
max_lac <- max_lac_area + max_lac
}

print(max_lac)
# print(max_lac)
# Changement de nominal capacity du lac_generator
if (nrow(readClusterDesc(opts = opts)[area == "lac", ]) != 0 ) {
cluster_lac <- readClusterDesc(opts = opts)[area == "lac", ]
capa_lac_fr <- cluster_lac$nominalcapacity

# Test avec capa_lac_autres qui reste a determiner

capa_cluster_lac <- capa_lac_fr+max_lac
print(capa_cluster_lac)
capa_cluster_lac <- capa_lac_fr + max_lac
# print(capa_cluster_lac)

opts <- createCluster(
area = "lac",
Expand All @@ -137,7 +138,8 @@ create_wm_hydro_areas <- function(start,
# Creation des binding constraints pour l'energie turbine par le noeud lac

for (i in areas) {
print(i)
# print(i)
cat(format(sprintf("Creating binding constraints for %s...\n", i), width = getOption("width")))

energy_lac <- readEnergy(area = i, opts = input_pdh)
energy_lac <- energy_lac[date >= date_i & date < date_f]$expectation
Expand Down Expand Up @@ -175,10 +177,11 @@ create_wm_hydro_areas <- function(start,
}
}

print(i)
# print(i)
cat(format(sprintf("Reset hydro storage for %s...\n", i), width = getOption("width")))
# antaresWaterValues::resetHydroStorage(i, opts = opts)
matrix_null <- NULL
print("reset hydro storage")
# print("reset hydro storage")

write.table(
x = matrix_null,
Expand Down
2 changes: 1 addition & 1 deletion R/create_wm_misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ create_wm_misc <- function(data, start = NULL, sort_misc = TRUE, opts = antaresR
start_sim = opts$start
)
}
cat("\nReordering Misc - Done!\n")
cat(format("\nReordering Misc - Done!\n", width = getOption("width")))
}


Expand Down
4 changes: 2 additions & 2 deletions R/create_wm_ror.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ create_wm_ror <- function(data, start = NULL, startday = "samedi", sort_areas =
if (sort_areas) {
areas <- getAreas(exclude = "fr")
for (a in areas) {
cat(sprintf("\rReordering ROR for %s...", a))
cat(format(sprintf("\rReordering ROR for %s...", a), width = getOption("width")))
reorder_hourly(
path = file.path(inputPath, "hydro", "series", a, "ror.txt"),
start_wm = start,
start_sim = opts$start
)
}
cat("\rReordering ROR - Done!\n")
cat(format("\rReordering ROR - Done!\n", width = getOption("width")))
}
}

Expand Down

0 comments on commit cf3a096

Please sign in to comment.