Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions R/define_inputs.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' make a list of bird parameters for input into CRM
#' Make a list of bird parameters for input into CRM
#'
#' Makes a list of avian biological parameters for the bird(s) being modelled
#' as a function directly in R. This function is designed for R-based workflows.
Expand All @@ -15,8 +15,7 @@
#' - a single number representing the average (preferably median) of the
#' variable
#
#' @returns list where items define the value or stochastic distribution f
#' or each parameter
#' @returns list whose items define the value or stochastic distribution for each parameter
#'
#' @param species char; species identifier
#' @param bird_length Length of archetype bird (metres), or distribution
Expand Down Expand Up @@ -82,9 +81,9 @@ define_bird <- function(

#' define_turbine
#'
#' make a list of turbine parameters for input into the default CRM
#' Make a list of turbine parameters for input into the default CRM.
#'
#' Makes a list of parameters for the a given turbine
#' Makes a list of parameters for the a given turbine.
#'
#' # Details
#'
Expand All @@ -95,13 +94,17 @@ define_bird <- function(
#' up stochastic inputs.
#' - a single number representing the average (preferably median) of the
#' variable
#'
#' If this object is being defined for multiple turbines of the same model
#' `prop_operational` should be the average between all turbines. For example
#' if there are two turbines, and one is operational for 24 hours while the other
#' is operational for 18 hours each day, then `prop_operational = (0.75 + 1)/2 = 0.875`.
#'
#'
#' @returns list where items define the value or stochastic distribution for
#' @returns list whose items define the value or stochastic distribution for
#' each parameter
#'
#' @param model_id character; Label for turbine model - allows the user to
#'define multiple turbine types on a site
#' @param model_id character; Label for turbine model
#' @param blade_length blade length (m)
#' @param blade_thickness_narrow the thickness of the blade (side on) at its thinnest point (m)
#' @param blade_thickness_wide the thickness of the blade (side on) at its widest point (m)
Expand Down
8 changes: 6 additions & 2 deletions R/p_collision.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ prob_collision_static <- function(
#' @param bird_speed numeric; Average flight speed (m/sec)
#' @param prop_at_height proportion of flights at rotor swept height
#' @param prop_below_height proportion of flights below rotor swept height
#' @param prop_operational numeric; Proportion of a 24 hour day that turbines
#' are operational. A single number or distribution information using
#' [set_random]. Default 1. See [define_turbine()] for more detail.
#'
#' @return numeric; probability of collision with leading edge of blade.
#' Range from 0 to 1
Expand Down Expand Up @@ -179,7 +182,8 @@ prob_collision_dynamic <- function(
bird_length,
bird_speed,
prop_at_height,
prop_below_height
prop_below_height,
prop_operational = 1
) {

stopifnot(
Expand Down Expand Up @@ -209,5 +213,5 @@ prob_collision_dynamic <- function(
presented_area <- presented_area * prop_at_height /
(prop_at_height+prop_below_height)

return(presented_area/turbine_plane_area)
return(presented_area/turbine_plane_area*prop_operational)
}
5 changes: 2 additions & 3 deletions man/define_bird.Rd

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

14 changes: 9 additions & 5 deletions man/define_turbine.Rd

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

7 changes: 6 additions & 1 deletion man/prob_collision_dynamic.Rd

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

3 changes: 2 additions & 1 deletion vignettes/deterministic-example.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ df_turbines$p_coll_dyn <- prob_collision_dynamic(
bird_length = wte$bird_length,
bird_speed = wte$bird_speed,
prop_at_height = prop_at_height,
prop_below_height = prop_below_height
prop_below_height = prop_below_height,
prop_operational = v90_single$prop_operational
)


Expand Down
3 changes: 2 additions & 1 deletion vignettes/one-bird-one-turbine.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ p_coll_dyn <- prob_collision_dynamic(
bird_length = wte$bird_length,
bird_speed = wte$bird_speed,
prop_at_height = 0.75,
prop_below_height = 0.2
prop_below_height = 0.2,
prop_operational = v90_single$prop_operational
)

p_coll_dyn + p_coll_static
Expand Down
6 changes: 4 additions & 2 deletions vignettes/simple-simulation-example.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,8 @@ lst_results <- lapply(1:iterations, function(i) {
bird_length = bird_i$bird_length,
bird_speed = bird_i$bird_speed,
prop_at_height = prop_at_height1_i,
prop_below_height = prop_below_height1_i
prop_below_height = prop_below_height1_i,
prop_operational = turbines1_i$prop_operational
)

df_turbines_results[df_turbines_results$model == "Turbine 150",
Expand All @@ -505,7 +506,8 @@ lst_results <- lapply(1:iterations, function(i) {
bird_length = bird_i$bird_length,
bird_speed = bird_i$bird_speed,
prop_at_height = prop_at_height2_i,
prop_below_height = prop_below_height2_i
prop_below_height = prop_below_height2_i,
prop_operational = turbines2_i$prop_operational
)


Expand Down
Loading