Learn R Programming

bReeze (version 0.4-4)

frequency: Calculation of frequency and mean wind speed

Description

Calculates the frequency of occurrence and mean wind speed per wind direction sector.

Usage

frequency(mast, v.set, dir.set, num.sectors=12, 
  bins=c(5, 10, 15, 20), subset, digits=3, print=TRUE)
freq(mast, v.set, dir.set, num.sectors=12, 
  bins=c(5, 10, 15, 20), subset, digits=3, print=TRUE)

Value

Returns a data frame containing:

wind.speed

Mean wind speed per direction sector.

total

Frequency per direction sector.

...

Frequencies per direction sector, for each given wind speed bin.

Arguments

mast

Met mast object created by mast.

v.set

Set used for wind speed, specified as set number or set name (optional, if dir.set is given).

dir.set

Set used for wind direction, specified as set number or set name (optional, if v.set is given).

num.sectors

Number of wind direction sectors as integer value greater 1. Default is 12.

bins

Wind speed bins as numeric vector or NULL if no classification is desired. Default is c(5, 10, 15, 20).

subset

Optional start and end time stamp for a data subset, as string vector c(start, end). The time stamps format shall follow the rules of ISO 8601 international standard, e.g. "2012-08-08 22:55:00".

digits

Number of decimal places to be used for results as numeric value. Default is 3.

print

If TRUE (the default), results are printed directly.

Optional graphical parameters for plotting

The following graphical parameters can optionally be added to customize the plot:

  • border.leg: Border colour(s) for the legend. One colour for each wind speed bin or a single colour -- default is same as col.

  • bty.leg: Type of box to be drawn around the legend. Allowed values are "n" (no box, the default) and "o".

  • cex: Amount by which text on the plot should be scaled relative to the default (which is 1), as numeric. To be used for scaling of all texts at once.

  • cex.axis: Amount by which axis annotations should be scaled, as numeric value.

  • cex.lab: Amount by which axis labels should be scaled, as numeric value.

  • cex.leg: Amount by which legend text should be scaled, as numeric value.

  • circles: Manual definition of circles to be drawn, as numeric vector of the form c(inner circle, outer circle, interval between the circles).

  • col: Vector of colours -- one colour for each wind speed bin or a single colour if frequency only contains the total frequency per direction sector.

  • col.axis: Colour to be used for axis annotations -- default is "gray45".

  • col.border: Colour to be used for sector borders -- default is NULL (no border is drawn).

  • col.circle: Colour to be used for circles -- default is "gray45".

  • col.cross: Colour to be used for axis lines -- default is "gray45".

  • col.lab: Colour to be used for axis labels -- default is "black".

  • col.leg: Colour to be used for legend text -- default is "black".

  • fg: If TRUE, sectors are plotted in foreground (on top of axis lines and circles) -- default is FALSE.

  • lty.circle: Line type of circles -- default is "dashed". See par for available line types.

  • lty.cross: Line type of axis lines -- default is "solid". See par for available line types.

  • lwd.border: Line width of the sector borders -- default is 0.5. Only used if col.border is set.

  • lwd.circle: Line width of circles, as numeric value -- default is 0.7.

  • lwd.cross: Line width of axis lines, as numeric value -- default is 0.7.

  • pos.axis: Position of axis labels in degree, as numeric value -- default is 60.

  • sec.space: Space between plotted sectors, as numeric value between 0 and 1 -- default is 0.2.

  • title.leg: Alternative legend title, as string.

  • width.leg: Widths of legend space relative to plot space, as numeric value between 0 and 1. If 0, the legend is omitted, default value is 0.2.

  • x.intersp: Horizontal interspacing factor for legend text, as numeric -- default is 0.4.

  • y.intersp: Vertical line distance for legend text, as numeric -- default is 0.4.

Author

Christian Graul

Details

The directional frequency of occurrence is an important factor for the design of a wind project. The influence is clear for the arrangement of turbines in a wind farm, that should be perpendicular to the most frequent wind direction. But also single turbines are affected, e.g. by fatigue tower loads in most frequent directions or in directions with highest wind speeds.

References

Brower, M., Marcus, M., Taylor, M., Bernadett, D., Filippelli, M., Beaucage, P., Hale, E., Elsholz, K., Doane, J., Eberhard, M., Tensen, J., Ryan, D. (2010) Wind Resource Assessment Handbook. http://www.renewablenrgsystems.com/TechSupport/~/media/Files/PDFs/wind_resource_handbook.ashx

See Also

mast

Examples

Run this code
if (FALSE) {
## load and prepare data
data("winddata", package="bReeze")
set40 <- set(height=40, v.avg=winddata[,2], dir.avg=winddata[,14])
set30 <- set(height=30, v.avg=winddata[,6], dir.avg=winddata[,16])
set20 <- set(height=20, v.avg=winddata[,10])
ts <- timestamp(timestamp=winddata[,1])
neubuerg <- mast(timestamp=ts, set40, set30, set20)
neubuerg <- clean(mast=neubuerg)

## calculate frequency
frequency(mast=neubuerg, v.set=1)

# if only one of v.set and dir.set is given, 
# the dataset is assigned to both
frequency(mast=neubuerg, v.set=1)
frequency(mast=neubuerg, dir.set=1)

# use different datasets for wind speed and direction
frequency(mast=neubuerg, v.set=3)	# no direction in dataset
frequency(mast=neubuerg, v.set=3, dir.set=2)
frequency(mast=neubuerg, v.set="set3", dir.set="set2")	# same as above

# change number of direction sectors 
frequency(mast=neubuerg, v.set=1, num.sectors=4)
frequency(mast=neubuerg, v.set=1, num.sectors=16)

# calculate frequency for 1 m/s speed bins and without binning
frequency(mast=neubuerg, v.set=1, bins=1:25)
frequency(mast=neubuerg, v.set=1, bins=0:25)	# same as above
frequency(mast=neubuerg, v.set=1, bins=NULL)

# data subsets
frequency(mast=neubuerg, v.set=1, 
  subset=c("2009-12-01 00:00:00", "2009-12-31 23:50:00"))
frequency(mast=neubuerg, v.set=1, 
  subset=c("2010-01-01 00:00:00", NA)) # just 'start' time stamp
frequency(mast=neubuerg, v.set=1, 
  subset=c(NA, "2009-12-31 23:50:00")) # just 'end' time stamp

# change number of digits and hide results
frequency(mast=neubuerg, v.set=1, digits=2)
neubuerg.freq <- frequency(mast=neubuerg, v.set=1, print=FALSE)
neubuerg.freq

## plot frequency objects
plot(neubuerg.freq)  # default
plot(neubuerg.freq, col=gray(5:0 / 5.5), cex=0.8)  # change colours/text sizes
plot(neubuerg.freq, circles=c(10, 30, 10))  # manual definition of circles
plot(neubuerg.freq, fg=TRUE)  # plot sectors in foreground
plot(neubuerg.freq, pos.axis=135) # change axis label position
plot(neubuerg.freq, width.leg=0)  # no legend

# freaky
plot(neubuerg.freq, border.leg=heat.colors(5), bty.leg="o", 
  cex.axis=0.5, cex.lab=2, cex.leg=0.5, circles=c(5, 30, 5), 
  col=rainbow(5), col.axis="green", col.border="orange", 
  col.circle="purple", col.cross="yellow", col.lab="pink", 
  col.leg="lightblue", fg=TRUE, lwd.border=2, lwd.circle=3, lwd.cross=3, 
  lty.circle="12345678", lty.cross="87654321", sec.space=0.6, 
  title.leg="* WiNd SpEeD *", x.intersp=2, y.intersp=5)
}

Run the code above in your browser using DataLab