Skip to content

Commit

Permalink
Cálculo dos fatores para PCH.
Browse files Browse the repository at this point in the history
  • Loading branch information
tuberculo committed Jun 25, 2020
1 parent 027952f commit 2d8eed1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions CalcFatorPCH.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FatorPCH <- VazDiaria[VazDiaria$Posto %in% c(34, 94, 254, 277), ]
FatorPCH <- left_join(FatorPCH, tibble(Usina = unique(FatorPCH$Nome), Subsistema = c("Norte", "Sul", "Sudeste", "Nordeste")), by = c("Nome" = "Usina"))
FatorPCH <- mutate(FatorPCH, YEAR = year(Data), MONTH = month(Data), DAY = day(Data))
FatorPCH <- mutate(group_by(FatorPCH, Subsistema, MONTH), VazMedMens = mean(Vazao), fator = Vazao / VazMedMens)
FatorPCH <- pivot_wider(FatorPCH, names_from = Subsistema, values_from = fator, id_cols = c(YEAR, MONTH, DAY))
FatorPCH <- mutate(FatorPCH, across(where(is.double), round, 3))
write.table(FatorPCH, paste0("FatorPCH.tsv"), sep = "\t", dec = ",", row.names = FALSE)



FatorPCH <- mutate(group_by(FatorPCH, Subsistema), porMed = Vazao / mean(Vazao), FC = Vazao / max(Vazao))
summarise(group_by(FatorPCH, Subsistema, mes), média = mean(FC))
colMeans(FatorPCH[-1])

0 comments on commit 2d8eed1

Please sign in to comment.