ShowWakePenalizers: Visualizes the points causing/'suffering' from wake effects.

View source: R/Functions.R

ShowWakePenalizersR Documentation

Visualizes the points causing/'suffering' from wake effects.

Description

After optimization, this function draws a reduced 'field' and shows which points cause wake penalties on which points. 'Causers' are displayed in grey, 'sufferers', i.e. points that are in (possibly multiple) wakes of (several) causers are displayed in gold.

Usage

ShowWakePenalizers(Result, Cones = TRUE, All = FALSE, VectorField = TRUE,
ImposeMST = FALSE, NS = FALSE, NSOnly = FALSE, Exaggerate = TRUE,
DoubleLine = TRUE, Frames = 100, Alpha = 0.5, MaxContrast = TRUE, Soften = TRUE)

Arguments

Result

must be an optimization result as returned by an optimizer such as optim. Usually, this will be a list at least containing '$par'. Most optimizers comply with this R standard. If your optimizer does not, wrap its result into a list containing an object '$par' containing the optimization result (i.e., a vector of points).

Cones

triggers whether the Jensen cones are to be displayed as well. Defaults to TRUE.

All

triggers whether all Jensen cones are to be displayed, instead of just causers and sufferers. Defaults to FALSE, as TRUE results in a mess most of the times.

VectorField

controls whether or not to impose the wind directions vector field (arrows). Defaults to TRUE.

ImposeMST

if TRUE, computes and imposes a minimum spanning tree for the vertices, useful for cable installation purposes. Defaults to FALSE.

NS

if TRUE, imposes a computationally intensive Navier-Stokes based wake simulation image over the plot. Defaults to FALSE.

NSOnly

if TRUE, imposes just the Navier-Stokes wake simulation (no Jensen wakes). Defaults to FALSE.

Exaggerate

if TRUE, displays turbines as squares in the Navier-Stokes visualization. The turbine is then still to scale, but in reality the rotor is a disc instead of a cube, of course. This overly emphasizes wakes, which may be desired in most cases. Thus, defaults to TRUE. Set to FALSE for a more realistic look of the rotor discs, but this will make the wakes appear less severe.

DoubleLine

applies only if Exaggerate == TRUE. The rotor disc is then a disc instead of a cube (or line instead of square), but the line will be two instead of one pixel wide. This option is a trade-off between Exaggerate == TRUE and Exaggerate == FALSE. Set to TRUE (the default) if Exaggerate == FALSE to apply. Note that only if Exaggerate == FALSE and DoubleLine == FALSE, the rotor disc is a one pixel wide line, the most realistic setting which however shows only weak wakes.

Frames

number of frames to pre-compute for the Navier-Stokes simulation. 100 is a good value. Less makes the computation faster, but more inaccurate. More than 100 in only necessary for very low wind speeds. Thus, defaults to 100.

Alpha

The Navier-Stokes wake simulation is imposed semi-transparent over the usual image. This controls the transparency. Alpha = 0 means transparent, Alpha = 1 means opaque. Defaults to 0.5.

MaxContrast

increases the contrast to maximum (this is equivalent to histogram stretching). Defaults to TRUE.

Soften

applies a Gaussian soften filter to the Navier-Stokes image to have a more homogeneous visualization. Defaults to TRUE.

Details

Enables the researcher to inspect the optimization result in an a-posteriori analysis of Jensen's wake model. Parts of the Navier-Stokes code are inspired by Stam (2003).

Value

ShowWakePenalizers invisibly returns a square matrix (dimension: 'number of turbines') of wake penalty pairs: Columns are sufferers, rows are causers. For each row/column pair unequal to one, the turbine in row i sheds wake on the turbine in column j. The actual numbers are those returned by JensenFactor.

Author(s)

Carsten Croonenbroeck

References

Stam, S. (2003). Real-Time Fluid Dynamics for Games. https://www.researchgate.net/publication/2560062_Real-Time_Fluid_Dynamics_for_Games, 1-17

See Also

Use PlotResult to visualize the optimization result.

Examples

## Not run: 
#Will show that turbine 1 sheds wake on turbine 5.
NumTurbines <- 8
set.seed(1357)
Result <- optim(par = runif(NumTurbines * 2), fn = Profit,
  method = "L-BFGS-B", lower = rep(0, NumTurbines * 2),
  upper = rep(1, NumTurbines * 2))
ShowWakePenalizers(Result)

###############

#This may take some time. A progress bar is displayed.
Result = list(par = e$FarmVars$BenchmarkSolution)
ShowWakePenalizers(Result, All = TRUE, NS = TRUE, VectorField = FALSE, Alpha = 0.7)

###############

#Generates a few frames of an animation.
Result <- list(par = e$FarmVars$BenchmarkSolution)
MakeFrames <- function(Frames)
{
	for (i in 100:(100 + Frames - 1))
	{
		bmp(file = paste(i, ".bmp", sep = ""))
		ShowWakePenalizers(Result, All = TRUE, NS = TRUE, Frames = i)
		dev.off()
	}
}
system.time(MakeFrames(30)) #May take an hour.


## End(Not run)

wflo documentation built on Jan. 15, 2023, 5:10 p.m.