Primary tabs

Researchers and analysts in Marine Scotland often use coding to solve analytical tasks and modelling. This group contains code that has been released as a package that can be used by others.
Please note that in most cases, this will be packages of functions or scripts that can be applied in an existing software package, rather than a full software solution.

License

UK Open Government Licence (OGL)

Other Access

The information on this page (the dataset metadata) is also available in these formats.

Social

The R code produced as part of Masden, E. (2015) Developing an avian collision risk model to incorporate variability and uncertainty. Scottish Marine and Freshwater Science Vol 6 No 14 (Masden (2015)), Developing an avian collision risk model to incorporate variability and uncertainty, required to produce collision estimates for the Basic and Extended versions of the Band Collision Risk Model. Full details of approach taken and description of model are contained within Masden (2015).

Full details are available in the worked example contained within the Masden (2015)report.] Model set up Before the model can be run it requires information to be entered into the file "BandModel.txt". 1. Set working directory First, set the working directory. This is the location where the folders ‘scripts’ and ‘data’ have been saved as well as ‘BandModel.R’. For example, setwd("F:\BAND CRM For R") This step directs R to all the files and data that are required to run the model therefore all the files required much be within this directory. 2. Set results folder The model will save output to a folder. Set the name of the results folder, for example, the name of the development. For example, results_folder <- "windfarm1" If no name is specified the model will default to the date. WARNING: If the model is run several times on the same day and no folder name is specified, it will over-write files in the folder. 3. Set model components Next set the model components. These include: The number of iterations the model simulation will execute, for example 1000 iter<- 1000 The species to include, for example kittiwake CRSpecies = "Black_legged_Kittiwake" If more species were to be included this would look like CRSpecies = c("Black_legged_Kittiwake", "Northern_Gannet", "Arctic_Skua") The target power (in MW) to be generated within wind farm, for example 600MW. This is used in conjunction with the turbine name i.e. 6 if a 6MW turbine, to calculate the number of turbines in the array. TPower = 600 Large array correction (Yes/No), for example LargeArrayCorrection = "yes" The wind farm width (km), for example 10km WFWidth = 10 The proportion of bird flights up/downwind, for example 50% Prop_Upwind = 0.5 The latitude of the wind farm in decimal degrees, for example 55.8 degrees. This is used to calculate day length at the site location throughout the year. Latitude = 55.8 The tidal offset in metres (to correct for flight heights being calculated in relation to mean sea-level and turbine dimensions being calculated in relation to Highest Astronomical Tide), for example 2.5 metres TideOff = 2.5 4. Parameterise wind speed sampling distribution The model uses wind speed data to calculate rotor speed and pitch. Wind speed data are therefore required. At the time of production it was unclear what format wind speed data would be available to wind farm developers. To avoid inconsistencies, the model samples wind speed from a truncated normal distribution parameterised by the user. The mean wind speed (m.s-1) and standard deviation are required to be set, for example windSpeedMean<- 7.74 windSpeedSD<- 3.2 It is expected that these will be obtained from met mast data or other sources of wind speed data such as NASA’s Modern-Era Retrospective Analysis for Research and Applications (MERRA). 5. Running the model… Once you have set the working directory and entered all of the necessary information, all that is needed to run the model is to copy and paste all of BandModel.R into the R console, or alternatively type source("*****EnterMyDirectoryHere****\BandModel.R") in the R console, and press return. The code is designed to loop through multiple species and multiple turbine designs in a single step. The number of results obtained will depend on the number of different turbine designs entered in TurbineData.csv and the number of different species for which data are entered and listed. A progress bar will provide an indication of progress and at the end of the model, the time elapsed since the model was started will be displayed.