Skip to content

Commit

Permalink
Fixed NA values in voltages causing NA voltage summaries
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Fletcher committed Nov 9, 2022
1 parent 08b1259 commit ee908f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion BDInterface/data_cleaning_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ voltages_in_bounds <- function(v) {
MIN_VOLTAGE <- 10
MAX_VOLTAGE <- 1000

return(sum(v > MIN_VOLTAGE & v < MAX_VOLTAGE))
return(sum(v > MIN_VOLTAGE & v < MAX_VOLTAGE, na.rm=TRUE))
}

#' Replace outlier voltages with NA to avoid corrupting results
Expand Down
6 changes: 3 additions & 3 deletions anti_islanding_detection/anti_islanding.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ summarise_voltage_data <- function(combined_data) {
summarised_voltage_data <- combined_data %>%
group_by(c_id) %>%
summarise(
vmax_max=max(ifelse(vmax_na, v, vmax)),
vmin_min=min(ifelse(vmin_na, v, vmin)),
vmean_mean=mean(ifelse(vmean_na, v, vmean)),
vmax_max=max(ifelse(vmax_na, v, vmax), na.rm=TRUE),
vmin_min=min(ifelse(vmin_na, v, vmin), na.rm=TRUE),
vmean_mean=mean(ifelse(vmean_na, v, vmean), na.rm=TRUE),
vmin_na_all=all(vmin_na), vmax_na_all=all(vmax_na), vmean_na_all=all(vmean_na),
antiislanding_v_excursion_2015_triggered=any(!is.na(antiislanding_v_excursion_2015)),
antiislanding_v_excursion_2020_triggered=any(!is.na(antiislanding_v_excursion_2020))
Expand Down

0 comments on commit ee908f3

Please sign in to comment.