Simulation settings

Introduction

The settings are defined in five .yaml files in the folder data, one to define the simulation and one to define the visualization. In addition, there is a projects.yaml and a default.yaml file The function setup converts the first one into three settings structs, containing strings and numbers. The constructor Settings creates a struct of marker types from these settings structs.

For each of the simulation yaml files there must be a folder with the same name (without the .yaml extension) in the data directory. In this folder the required .csv files must be stored.

The constructor Vis(filename) creates a visualisation settings struct from the visualisation yaml file. The file turbine_specs.yaml contains the turbine definitions.

A project has a name and a description and consists of the two yaml files mentioned above. The default.yaml file is autogenerated and must NOT be in git. It stores the name of the active project and the name of the default measurement.

The file 2021_9T_Data.yaml

This is the main input configuration file.

# FLORIDyn project configuration
#
# Flow conditions
# Choose the input files for wind velocity, direction and ambient turbulence intensity as well as shear.
wind:
  # Velocity Input
  # - I_and_I       uses the Immersion and Invariance effective wind speed estimator based on SOWFA data. 
  # - Interpolation linearly interpolates between set-points, the value is equally used for all turbines.
  # - Interpolation_wErrorCov Same as above, but with error covariance. 
  # - InterpTurbine also linearly interpolates between set-points, but individually for every turbine. 
  # - InterpTurbine_wErrorCov Same as above, but with error covariance.
  # - Constant      provides a constant velocity for all turbines.
  # - Constant_wErrorCov      Same as above, but with error covariance.
  # - EnKF_InterpTurbine
  # - RW_with_Mean  random walk with mean
  # - ZOH_wErrorCov
  input_vel: Constant

  # Wind Direction Input
  # - Constant
  # - Constant_wErrorCov
  # - Interpolation
  # - Interpolation_wErrorCov
  # - InterpTurbine
  # - InterpTurbine_wErrorCov
  # - RW_with_mean             random walk with mean
  input_dir: Interpolation
  input_ti: Constant
  input_shear: PowerLaw
  correction:
    vel: None
    dir: All
    ti: None
  perturbation:
    vel: 0
    vel_sigma: 0.2
    dir: 0
    dir_sigma: 0.5
    ti: 0
    ti_sigma: 0.005

sim:
  # the used FLORIS model; currently, only 'gaussian' is supported
  floris: gaussian
  # start & end time of the simulation and the time resolution. 
  start_time: 20000       # [s]
  end_time: 21200         # [s]
  time_step: 4            # [s]

  # The discretization method, 'sunflower' or 'isocell'. The latter provides a regular grid 
  # with equal sized cells. This is the favoured method! Downside is that the number of cells
  # can not be chosen freely, the algorithm might correct the requested number of cells to 
  # the nearest possible number (3, 12, 27, 48, 75, 108, 147, ...).  
  # Sunflower distributes based on an outgoing spiral, the number of cells can be freely chosen.
  rotor_discret: isocell
  rotor_points: 50 # number of points for the discretization of the rotor disk
  
  # Dynamic settings
  dyn:
    # Advection speed
    # Multiplier of the travel speed of the OPs with their own wind speed. 
    # The published FLORIDyn models used 1, other literature suggests values as low as 0.6.
    advection: 1
    advection_mod: linear
    # Operating point (OP) / wind field propagation
    # 'Basic'    iterates the OPs based on their wind speed, OPs do not interact with each other. 
    # 'Averaged' is a weighted average between the new wind speed value and the old value. 
    #            This smoothes out turbulent inputs and reduces the occasions when one OP overtakes another OP. 
    # 'Maximum'  overwrites the state of a slower OP once the faster one overtakes it.
    op_iteration: IterateOPs_basic
    # In case the averaging is used, provide weights for the new value (first weight) 
    # and the old value (second value). They have to sum up to 1.
    op_iter_weights: [0.7, 0.3]
    vel:
      # Spacial-Time-Averaged weight settings for the wind speed
      #   Lejeune: 512 63 126
      #   Becker Energies: 256 126 256
      #   Becker CLC: 256 256 50
      iter_sigma_dw: 256
      iter_sigma_cw: 256
      iter_sigma_time: 50
    dir:
      # Spacial-Time-Averaged weight settings for the wind direction
      iter_sigma_dw: 512
      iter_sigma_cw: 512
      iter_sigma_time: 50
  # Choose if simulation should be initialized, an initialized state should be loaded 
  # or should be started without initialization.
  init: noinit # 'noinit' or 'load' (load requires initT.jld2)
  path_to_data: "data/2021_9T_Data"
  save_init_state: false  # if true, stores T_init.jld2
  save_final_state: false # if true, stores T_final.jld2

# Controller
# Currently only the yaw angle can be set, the axial induction factor is always set to 1/3.
# - 'Interpolate' per turbine reads an orientation file 'Control_YawInterpolation.csv' 
#                 to interpolate the turbines world orientation between different set-points. 
# - SOWFA         reads the file 'SOWFA_nacelleYaw.csv' which is directly the renamed file
#                 from a SOWFA simulation. 
# - Constant      reads a single orientation and applies it to all turbines at all times.
con:
  yaw: SOWFA

floris:
  alpha: 2.32
  beta: 0.154
  k_a: 0.3837
  k_b: 0.0037
  k_fa: 0.73
  k_fb: 0.8325
  k_fc: 0.0325
  k_fd: -0.32
  eta: 1
  p_p: 2.2
  airDen: 1.225 # kg/m^3 (SOWFA)
  TIexp: 3 # TI crosswind distribution is modelled as a factor of sigma_y and sigma_z.
           # This is in contrast to previous literature which assumed a fixed box area and the
           # turbines therein as source of higher TI.

floridyn:
  n_op: 200
  deltaUW: 10.0
  deltaDW: 0.5
  deltaCW: 3.0
  dynStateChange: "None"
  twf_model: "heterogeneous"

turbines:
    - id: 1
      type: DTU 10MW
      x: 600
      y: 2400
      z: 0
      a: 0.33
      yaw: 0
      ti: 0.06
...
    - id: 9
      type: DTU 10MW
      x: 2400
      y: 600
      z: 0
      a: 0.33
      yaw: 0
      ti: 0.06

The file vis_default.yaml

This is the default file, used to configure the simulation output. All plots listed in the sections flow_fields and measurements are created in the output folder when running the script main_all.jl.

vis:
  show_plots: true       # Enable/disable showing plots during simulation
  log_debug: false       # Enable/disable logging of debug information
  save: true             # Enable/disable saving of plots to disk
  save_results: true     # Enable/disable saving of simulation results as .jld2 files
  print_filenames: false # If true, print the names of the saved files
  video_folder: "video"  # Relative video folder path 
  output_folder: "out"   # Relative output folder path
  unique_output_folder: true # If true, a unique output folder is created for each simulation run
  skip_flow_fields: false    # When true, do not create flow field visualizations
  skip_measurements: false   # When true, do not create measurement visualizations
  field_limits_min: [0.0, 0.0, 0.0]          # [xmin, ymin, zmin] in meters
  field_limits_max: [3000.0, 3000.0, 400.0]  # [xmax, ymax, zmax] in meters
  field_resolution: 20.0                     # Resolution of the field in meters
  flow_fields:               # List of flow field visualizations to be created
    - name: "flow_field_vel_reduction"    # Flow field relative wind speed (video)
      online: true
      create_video: true
      skip: true
    - name: "flow_field_vel_reduction"    # Flow field relative wind speed (plot)
      online: false
      create_video: false
      skip: false      
    - name: "flow_field_added_turbulence" # Flow field added turbulence
      online: true
      create_video: true
      skip: true
    - name: "flow_field_eff_wind_speed"   # Flow field effective wind speed
      online: false
      create_video: false
      skip: false
  measurements:           # List of measurement plots to be created
    - name: "msr_vel_reduction"     # Measurement relative wind speed
      separated: true
      skip: false
    - name: "msr_vel_reduction"     # Measurement relative wind speed
      separated: false
      skip: false
    - name: "msr_added_turbulence"  # Measurement added turbulence
      separated: false
      skip: false
    - name: "msr_added_turbulence"  # Measurement added turbulence
      separated: true
      skip: false
    - name: "msr_eff_wind_speed"    # Measurement effective wind speed
      separated: false
      skip: false
    - name: "msr_eff_wind_speed"    # Measurement effective wind speed
      separated: true
      skip: false
  v_min:  2.0   # Minimum velocity for color scale in flow field visualizations [m/s] 
  v_max: 10.0   # Maximum velocity for color scale in flow field visualizations [m/s]
  # Minimum relative velocity value for velocity reduction visualizations (msr=VelReduction)
  # Controls the color scale for relative wind speed plots. Range: 0 .. 100 %
  rel_v_min:  20.0 # Unit: [%]
  # Maximum relative velocity value for velocity reduction visualizations (msr=VelReduction)
  # Controls the upper limit for relative wind speed plots. Range: 0 .. 100 %
  rel_v_max: 100.0 # Unit: [%]
  # Maximum turbulence value for added turbulence visualizations (msr=AddedTurbulence)
  # Controls the upper limit for turbulence plots
  turb_max: 35.0   # Turbulence intensity, Unit: [%]
  up_int: 1        # Update interval - how frequently visualization updates occur  [s]
  unit_test: false # When true, closes plots automatically after 1 second

Types created from the yaml files

FLORIDyn.SimType
Sim

A mutable struct representing the simulation settings.

Fields

  • floris::String: The name of the FLORIS model to be used.
  • start_time::Int64: The start time of the simulation in seconds.
  • end_time::Int64: The end time of the simulation in seconds.
  • time_step::Int64: The time step for the simulation in seconds.
  • sim_step::Union{Nothing, Int64}: Optional simulation step size.
  • n_sim_steps::Union{Nothing, Int64}: Optional number of simulation steps.
  • rotor_discret::String: The rotor discretization method, e.g., "Uniform", "Gaussian".
  • rotor_points::Int64: The number of rotor points for discretization.
  • dyn::Dyn: The dynamic settings for the simulation.
  • init::String: The initialization method, e.g., "init", "load".
  • path_to_data::String: The path to the directory where simulation data is stored.
  • save_init_state::Bool: Whether to save the initial state of the simulation.
  • save_final_state::Bool: Whether to save the final state of the simulation.
source
FLORIDyn.WindType
Wind

A mutable struct representing comprehensive wind field settings for wind farm simulations.

This struct configures all aspects of the wind field including velocity, direction, turbulence intensity, and wind shear profiles. It supports various input types from constant values to complex time-series data with error covariance for uncertainty quantification.

Fields

  • input_vel::String: Wind velocity input type. Default: "Constant". Options: "Constant", "Interpolation".
  • input_dir::String: Wind direction input type. Default: "Constant". Options: "Constant", "Interpolation".
  • input_ti::String: Turbulence intensity input type. Default: "Constant". Options: "Constant", "Interpolation".
  • input_shear::String: Wind shear input type. Default: "PowerLaw". Options: "PowerLaw", "Interpolation".
  • correction::WindCorrection: Wind field correction settings. See WindCorrection.
  • perturbation::WindPerturbation: Wind field perturbation settings for uncertainty analysis. See WindPerturbation.
  • vel::Union{Nothing, Float64, AbstractMatrix, WindVelType, WindVelMatrix}: Wind velocity data container.
    • Nothing: No velocity data specified
    • Float64: Constant velocity value [m/s]
    • AbstractMatrix: Time series for interpolation or per-turbine data (including EnKF)
    • WindVelType: Constant velocity with error covariance
    • WindVelMatrix: Interpolation with error covariance variants
  • dir::Union{Nothing, Matrix{Float64}, WindDirMatrix, WindDirType, WindDirTriple}: Wind direction data container.
    • Nothing: Use dir_fixed value
    • Matrix{Float64}: Direction time series [degrees]
    • WindDirMatrix: Direction data with error covariance
    • WindDirType: Constant direction with uncertainty
    • WindDirTriple: Three-component direction specification
  • dir_fixed::Float64: Fixed wind direction when dir is Nothing. Default: 270.0 [degrees].
  • ti::Union{Nothing, Float64, Matrix{Float64}}: Turbulence intensity data.
    • Nothing: No turbulence intensity specified
    • Float64: Constant turbulence intensity [-]
    • Matrix{Float64}: Time-varying turbulence intensity data
  • shear::Union{Nothing, WindShear, Matrix{Float64}}: Wind shear profile data.
    • Nothing: No wind shear applied
    • WindShear: Wind shear profile specification. See WindShear.
    • Matrix{Float64}: Time-varying shear profile data

Constructor

The struct uses @with_kw macro, allowing keyword-only construction with default values.

Example

# Basic constant wind
wind = Wind(vel=10.0, dir_fixed=270.0, ti=0.1)

# Wind with time series data
wind_ts = Wind(
    input_vel="Interpolation",
    vel=velocity_matrix,
    input_dir="Interpolation", 
    dir=direction_matrix
)
source
FLORIDyn.ConType
Con

A mutable struct for wind turbine controller configuration settings. This struct defines the control strategies and parameters for yaw and induction factor control.

Fields

Yaw Control

  • yaw::String: The yaw control strategy. Supported values:
    • "Constant": Fixed yaw angle for all turbines
    • "Interpolation": Time-based interpolation from data matrix
    • "SOWFA": Compatible with SOWFA simulation data format
  • yaw_fixed::Float64: Constant yaw angle in degrees (default: 270.0°)
  • yaw_data::Union{Nothing, Matrix{Float64}}: Optional yaw control data matrix where:
    • First column contains time values (seconds)
    • Subsequent columns contain yaw angles for each turbine (degrees)
  • tanh_yaw::Bool: Whether to apply hyperbolic tangent smoothing to yaw control (default: false)

Induction Control

  • induction::String: The induction factor control strategy. Supported values:
    • "Constant": Fixed induction factor for all turbines
    • "Interpolate": Time-based interpolation from data matrix
  • induction_fixed::Float64: Constant induction factor (dimensionless, default: 0.33)
  • induction_data::Union{Nothing, Matrix{Float64}}: Induction control data matrix where:
    • First column contains time values (seconds) for time-varying control
    • Subsequent columns contain induction factors for each turbine (dimensionless)
    • For constant control, contains a single value (default: [0.33;;])

Usage

The controller settings are typically loaded from a YAML configuration file and used throughout the simulation to determine turbine control actions.

See Also

source
FLORIDyn.VisType
Vis

A mutable struct for visualization settings in wind farm simulations.

This struct controls visualization options during simulation runtime, particularly for live plotting and animation features. It provides both stored fields and computed properties for flexible path management.

Fields

  • online::Bool: Enable/disable online visualization during simulation. When true, live plots and animations are displayed during the simulation run. When false, visualization is disabled for faster computation.
  • save::Bool: Enable/disable saving of plots to disk. When true, plots are saved to disk in PNG format. When false, plots are only displayed (default: false).
  • print_filenames::Bool: Enable/disable printing of saved filenames to console. When true, filenames of saved plots are printed (default: false).
  • video_folder::String: Relative path for the video output directory. Used when online=true and save=true (default: "video").
  • fps::Int: Frames per second for video output when creating videos from saved frames. Controls the playback speed of generated MP4 videos (default: 12).
  • output_folder::String: Relative path for the output directory. Used when online=false and save=true (default: "out").
  • unique_output_folder::Bool: If true, a unique timestamped folder is created for each simulation run. If false, files are saved directly to the output folder (default: true).
  • flow_fields::Vector{FlowField}: List of flow field visualizations to be created. Each FlowField contains configuration for name, online display, video creation, and skip control. See FlowField for details (default: FlowField[]).
  • measurements::Vector{Measurement}: List of measurement visualizations to be created. Each Measurement contains configuration for name, separated plotting, and skip control. See Measurement for details (default: Measurement[]).
  • v_min::Float64: Minimum velocity value for color scale in effective wind speed visualizations (msr=EffWind). Used to set consistent color scale limits across animation frames (default: 2.0).
  • v_max::Float64: Maximum velocity value for color scale in effective wind speed visualizations (msr=EffWind). Used to set consistent upper limits across animation frames (default: 10.0).
  • rel_v_min::Float64: Minimum relative velocity value for velocity reduction visualizations (msr=VelReduction). Controls the color scale for relative wind speed plots. Range: [0, 100] (default: 20.0).
  • rel_v_max::Float64: Maximum relative velocity value for velocity reduction visualizations (msr=VelReduction). Controls the upper limit for relative wind speed plots. Range: [0, 100] (default: 100.0).
  • turb_max::Float64: Maximum turbulence value for added turbulence visualizations (msr=AddedTurbulence). Controls the upper limit for turbulence plots (default: 35.0).
  • up_int::Int: Update interval - controls how frequently visualization updates occur. Higher values result in less frequent updates for better performance (default: 1).
  • unit_test::Bool: Enable unit test mode for visualization functions. When true, plots are automatically closed after 1 second for testing purposes (default: false).

Computed Properties

  • video_path::String: Full absolute path to the video directory. Automatically creates the directory if it doesn't exist. Path is environment-dependent: ~/scratch/video_folder on Delft Blue, pwd()/video_folder elsewhere.
  • output_path::String: Full absolute path to the output directory. Automatically creates the directory if it doesn't exist. Path is environment-dependent: ~/scratch/output_folder on Delft Blue, pwd()/output_folder elsewhere.

Constructors

# Default constructor with keyword arguments
vis = Vis(online=true, save=true, v_min=2.0, v_max=12.0)

# Constructor from YAML file
vis = Vis("path/to/config.yaml")  # Loads from data["vis"] section

Examples

# Enable online visualization with plot saving and custom color scales
vis = Vis(online=true, save=true, v_min=2.0, v_max=12.0, rel_v_min=20.0, rel_v_max=100.0, up_int=5)

# Display only, no saving with default color scales
vis = Vis(online=true, save=false, v_min=2.0, rel_v_min=20.0)

# Specify flow field and measurement visualizations to create
flow_fields = [FlowField("flow_field_vel_reduction", true, true), FlowField("flow_field_added_turbulence", false, false)]
measurements = [Measurement("msr_vel_reduction", true), Measurement("msr_added_turbulence", false)]
vis = Vis(online=true, save=true, flow_fields=flow_fields, measurements=measurements)

# Disable online visualization for batch processing
vis = Vis(online=false, save=false)

# Load from YAML configuration (automatically parses flow_fields and measurements)
vis = Vis("data/vis_default.yaml")

# Access computed properties (creates directories automatically)
println("Saving plots to: ", vis.video_path)  # When online=true
println("Output directory: ", vis.output_path) # When online=false

YAML Configuration Format

When loading from YAML files, the flow_fields and measurements are automatically parsed:

vis:
  online: true
  save: true
  flow_fields:
    - name: "flow_field_vel_reduction"
      online: true
      create_video: true
      skip: false
    - "flow_field_added_turbulence"  # Simple format, defaults applied
  measurements:
    - name: "msr_vel_reduction" 
      separated: true
      skip: false
    - "msr_added_turbulence"  # Simple format, defaults applied

File Saving Behavior

When save=true, plots are saved as PNG files with descriptive names:

  • ff_velocity_reduction.png - for velocity reduction plots (msr=VelReduction)
  • ff_added_turbulence.png - for turbulence intensity plots (msr=AddedTurbulence)
  • ff_wind_speed.png - for effective wind speed plots (msr=EffWind)
  • Time-stamped versions: ff_velocity_reduction_t0120s.png when time parameter is provided

Save location depends on the online setting:

  • online=true: Files saved to video_path (for animations)
  • online=false: Files saved to output_path (for final results)

Performance Notes

  • Online visualization significantly slows down simulation performance
  • Useful for debugging, monitoring simulation progress, or creating videos of the simulation
  • When disabled, visualization functions are skipped to improve computational efficiency
  • up_int can be used to reduce visualization frequency and improve simulation speed
  • Directory creation is automatic but occurs only when computed properties are accessed
  • Flow fields and measurements with skip=true are ignored completely for optimal performance

Environment Adaptation

The struct automatically adapts to different computing environments:

  • Delft Blue supercomputer: Uses ~/scratch/ directory for ample storage space
  • Local systems: Uses current working directory (pwd())
  • Detection is automatic via the isdelftblue() function

See Also

source
FLORIDyn.FlorisType
Floris

A mutable struct representing the settings for the FLORIDyn simulation.

Fields

  • alpha::Float64: The alpha parameter for the FLORIS model.
  • beta::Float64: The beta parameter for the FLORIS model.
  • k_a::Float64: The k_a parameter for the FLORIS model.
  • k_b::Float64: The k_b parameter for the FLORIS model.
  • k_fa::Float64: The k_fa parameter for the FLORIS model.
  • k_fb::Float64: The k_fb parameter for the FLORIS model.
  • k_fc::Float64: The k_fc parameter for the FLORIS model.
  • k_fd::Float64: The k_fd parameter for the FLORIS model.
  • eta::Int: The eta parameter for the FLORIS model.
  • p_p::Float64: The p_p parameter for the FLORIS model.
  • airDen::Float64: The air density for the FLORIS model.
  • TIexp::Int: The turbulence intensity exponent for the FLORIS model.
  • rotor_points::Union{Nothing, Int64}: Optional number of rotor points.
source
FLORIDyn.FloriDynType
FloriDyn

A structure representing the settings for the FLORIDyn simulation environment.

Fields

  • n_op::Int: The number of operating points.
  • deltaUW::Float64: The delta U wind speed perturbation.
  • deltaDW::Float64: The delta D wind direction perturbation.
  • deltaCW::Float64: The delta C wind turbulence intensity perturbation.
  • dynStateChange::String: The type of dynamic state change, e.g., "Constant", "Interpolation".
  • twf_model::String: The type of TWF (Turbine Wake Flow) model used, e.g., "Gaussian", "FLORIDyn".
source
FLORIDyn.TurbineArrayType
TurbineArray

A structure representing the configuration and properties of a wind turbine array.

Fields

  • pos::Matrix{Float64}: A matrix containing the positions of turbines. Each row represents a turbine with columns for x, y, and z coordinates (in meters).
  • type::Vector{String}: A vector of strings specifying the type/model of each turbine.
  • init_States::Matrix{Float64}: A matrix containing the initial states of each turbine. Each row represents a turbine with columns for: - Column 1: a - axial induction factor - Column 2: yaw - initial yaw angle (in degrees) - Column 3: ti - turbulence intensity

Example

# Create a simple 2-turbine array
pos = [0.0 0.0 0.0; 500.0 0.0 0.0]  # Two turbines 500m apart
type = ["NREL_5MW", "NREL_5MW"]
init_states = [0.33 0.0 0.1; 0.33 0.0 0.1]  # Both start with same initial conditions
groups = [TurbineGroup("all", 0, [1, 2])]  # Default group containing all turbines
turbines = TurbineArray(pos, type, init_states, groups)
source
FLORIDyn.TurbinePropertiesType
TurbineProperties

A mutable struct containing the physical and aerodynamic properties of a wind turbine.

This struct encapsulates all the key properties needed for wind turbine modeling and control, including aerodynamic performance characteristics, drivetrain properties, and operating parameters. It serves as a comprehensive specification for turbine behavior in wind farm simulations.

Fields

  • name::String: Descriptive name of the turbine model (default: "DTU 10MW"). Used for identification and reporting purposes.
  • gearbox_ratio::Float64: Gearbox transmission ratio between the low-speed rotor shaft and high-speed generator shaft (default: 50.0). Higher values indicate more speed multiplication from rotor to generator.
  • inertia_total::Float64: Total rotational inertia of the drivetrain system in kg⋅m² (default: 1.409969209E+08). Includes contributions from rotor, gearbox, and generator inertias referred to the low-speed shaft.
  • rotor_radius::Float64: Rotor radius in meters (default: 89.2). Half of the rotor diameter, defining the swept area of the turbine.
  • cp_fun::Function: Power coefficient function Cp(λ, β) where λ is tip-speed ratio and β is blade pitch angle in degrees. Returns the aerodynamic power coefficient (dimensionless, range [0, ~0.5]).
  • fluid_density::Float64: Air density in kg/m³ (default: 1.23). Used for calculating aerodynamic forces and power. Standard air density at sea level.
  • gearbox_efficiency::Float64: Gearbox mechanical efficiency as a fraction (default: 1.0). Accounts for power losses in the drivetrain. Range: [0, 1].

Constructors

# Default constructor with keyword arguments
tp = TurbineProperties(name="NREL 5MW", rotor_radius=63.0, gearbox_ratio=97.0)

# Constructor from power coefficient file
tp = TurbineProperties("path/to/cp.csv")  # Loads cp_fun from CSV file

Power Coefficient Function

The cp_fun field contains a function that maps tip-speed ratio and pitch angle to the power coefficient:

cp_value = tp.cp_fun(tip_speed_ratio, pitch_angle_degrees)

The function is created by loading tabulated data from CSV files using bilinear interpolation. The CSV format should have:

  • First column: Tip-speed ratio values (λ)
  • Remaining columns: Power coefficient values for different pitch angles
  • Column headers: Pitch angles in degrees

Physical Relationships

Key relationships between the properties:

  • Swept Area: A = π × rotor_radius²
  • Power: P = 0.5 × fluid_density × A × V³ × cp_fun(λ, β)
  • Tip-Speed Ratio: λ = Ω × rotor_radius / V (where Ω is rotor speed, V is wind speed)
  • Torque: τ = P / Ω (aerodynamic torque on low-speed shaft)

Examples

# Create turbine properties with custom parameters
tp = TurbineProperties(
    name="Custom 8MW",
    rotor_radius=80.0,
    gearbox_ratio=100.0,
    inertia_total=1.2e8,
    fluid_density=1.225,
    gearbox_efficiency=0.95,
    cp_fun=my_cp_function
)

# Load from power coefficient file
tp = TurbineProperties("data/DTU_10MW/cp.csv")

# Access properties
println("Turbine: ", tp.name)
println("Swept area: ", π * tp.rotor_radius^2, " m²")
cp_max = tp.cp_fun(7.0, 0.0)  # Cp at λ=7, β=0°
println("Max Cp: ", cp_max)

# Calculate power at given conditions
wind_speed = 12.0  # m/s
rotor_speed = 1.0  # rad/s  
tip_speed_ratio = rotor_speed * tp.rotor_radius / wind_speed
power_coeff = tp.cp_fun(tip_speed_ratio, 0.0)
swept_area = π * tp.rotor_radius^2
power = 0.5 * tp.fluid_density * swept_area * wind_speed^3 * power_coeff
println("Power output: ", power / 1e6, " MW")

CSV File Format

When using the filename constructor, the CSV file should follow this structure:

λ\β,0.0,2.0,4.0,6.0,8.0,10.0
1.0,0.1,0.09,0.08,0.07,0.06,0.05
2.0,0.2,0.18,0.16,0.14,0.12,0.10
...

Where:

  • First column header can be "λ\β" or similar (contains backslash)
  • First column contains tip-speed ratio values
  • Remaining columns contain Cp values for different pitch angles
  • Column headers are pitch angles in degrees

See Also

  • cp_fun: Function for creating power coefficient interpolators from CSV files
  • TurbineArray: Container for multiple turbines with their positions and types
  • setup: Main configuration loader that creates TurbineProperties instances
source
FLORIDyn.TurbineDataType
TurbineData

A structure containing technical specifications for wind turbines.

Fields

  • nac_pos::Matrix{Float64}: An N × 3 matrix where each row corresponds to the (x, y, z) coordinates of the nacelle position for each turbine in meters.
  • rotor_diameter::Vector{Float64}: A vector of rotor diameters corresponding to each turbine in meters.

Example

# Get turbine data for specific types
names = ["DTU 10MW", "V116", "GE Haliade X"]
turbine_data = getTurbineData(names)
println("First turbine nacelle height: ", turbine_data.nac_pos[1, 3], " m")
println("First turbine rotor diameter: ", turbine_data.rotor_diameter[1], " m")
source
FLORIDyn.FlowFieldType
FlowField

Structure representing a single flow field visualization configuration.

This struct defines the configuration for individual flow field visualizations, including the flow field type, online visualization settings, video creation options, and skip control.

Fields

  • name::String: The name/identifier of the flow field type (e.g., "flow_field_vel_reduction", "flow_field_added_turbulence", "flow_field_eff_wind_speed")
  • online::Bool: Whether the flow field should be displayed during online visualization (true) or only saved offline (false). Default is false for offline-only processing.
  • create_video::Bool: Whether to create a video from the flow field frames (true) or not (false). Default is false for no video creation.
  • skip::Bool: Whether to skip processing of this flow field entirely (true) or process normally (false). Default is false for normal processing. When true, the flow field will be ignored completely.

Examples

# Velocity reduction flow field with online display and video creation
vel_field = FlowField("flow_field_vel_reduction", true, true)

# Turbulence flow field with offline-only processing, no video
turb_field = FlowField("flow_field_added_turbulence", false, false)

# Flow field that should be skipped entirely
skipped_field = FlowField("flow_field_eff_wind_speed", false, false, true)

# Using keyword arguments
eff_field = FlowField(name="flow_field_eff_wind_speed", online=false, create_video=true, skip=false)

See Also

  • parse_flow_fields: Function to convert YAML flow field configurations to FlowField arrays
  • plotFlowField: Function that uses these configurations for visualization
source
FLORIDyn.MeasurementType
Measurement

Structure representing a single measurement visualization configuration.

This struct defines the configuration for individual measurement visualizations, including the measurement type, whether it should be displayed in separated plots, and skip control.

Fields

  • name::String: The name/identifier of the measurement type (e.g., "msr_vel_reduction", "msr_added_turbulence", "msr_eff_wind_speed")
  • separated::Bool: Whether the measurement should be plotted in separate individual plots (true) or combined in a single plot (false). Default is false for combined plotting.
  • skip::Bool: Whether to skip processing of this measurement entirely (true) or process normally (false). Default is false for normal processing. When true, the measurement will be ignored completely.

Examples

# Velocity reduction measurement with separated plots
vel_measurement = Measurement("msr_vel_reduction", true)

# Turbulence measurement with combined plots  
turb_measurement = Measurement("msr_added_turbulence", false)

# Measurement that should be skipped entirely
skipped_measurement = Measurement("msr_eff_wind_speed", false, true)

# Using keyword arguments
eff_measurement = Measurement(name="msr_eff_wind_speed", separated=false, skip=false)

See Also

source

Settings

The Settings struct and functions related to examples and settings.

FLORIDyn.SettingsType
Settings

A mutable struct that holds configuration parameters for the FLORIDyn simulation environment.

Fields

  • vel_mode::VelModel: See: VelModel
  • dir_mode::DirModel: See: DirModel
  • turb_mode
  • shear_mode
  • cor_dir_mode
  • cor_vel_mode
  • cor_turb_mode
  • iterate_mode
  • control_mode
  • parallel::Bool: Run plotting in a separate process.
  • threading::Bool: Enable threading for parallel computation within a single process
source
FLORIDyn.SettingsMethod
Settings(wind::Wind, sim::Sim, con::Con, parallel=false, threading=false)

Create and return a Settings object using the provided wind and sim parameters.

Arguments

  • wind::Wind: An instance of the Wind struct containing wind-related parameters.
  • sim::Sim: An instance of the Sim struct containing the simulation parameters.
  • con::Con: An instance of the Con struct containing the controller parameters.
  • parallel::Bool: Enable plotting in a separate process (default: false)
  • threading::Bool: Enable threading for parallel computation within a single process (default: false)

Returns

  • A Settings struct configured with the given wind and simulation parameters.

Notes

  • The function uses the str2type helper to convert string representations of model types into their corresponding Julia types.
  • The Settings struct encapsulates the model settings for velocity, direction, turbulence intensity, shear, and correction modes.
source

Helper functions

FLORIDyn.install_examplesFunction
install_examples(add_packages=true)

Install example files, executables, and data files for the FLORIDyn.jl package.

This function sets up a complete working environment by copying:

  • Example Julia scripts from the package's examples directory (via copy_examples)
  • Executable scripts (like run_julia) to a local bin directory (via copy_bin)
  • Model configuration files and data to a local data directory (via copy_model_settings)

Arguments

  • add_packages::Bool=true: Whether to automatically install additional required packages ("LaTeXStrings", "Timers") that are commonly used in the examples

Example

# Install examples with automatic package installation
install_examples()

# Install examples without installing additional packages
install_examples(false)

After running this function, you can:

  • Run example scripts from the created examples/ directory
  • Execute ./bin/run_julia to start Julia with the project environment
  • Access model data files in the data/ directory

See also: copy_examples, copy_bin, copy_model_settings

source
FLORIDyn.copy_examplesFunction
copy_examples()

Copy all example scripts to the folder "examples" (it will be created if it doesn't exist).

source
FLORIDyn.copy_model_settingsFunction
copy_model_settings()

Copy model configuration files and data directories to the local data directory.

This function copies essential model configuration files and simulation data from the package's data directory to a local data/ directory in the current working directory.

Files and Directories Copied

Configuration File

  • 2021_9T_Data.yaml: Main wind farm configuration file containing turbine layout, simulation parameters, and model settings

Data Directory

  • 2021_9T_Data/: Complete SOWFA simulation data directory containing:
    • SOWFA_bladePitch.csv: Blade pitch angle time series
    • SOWFA_generatorPower.csv: Generator power output data
    • SOWFA_generatorTorque.csv: Generator torque measurements
    • SOWFA_nacelleYaw.csv: Nacelle yaw angle data
    • SOWFA_rotorSpeedFiltered.csv: Filtered rotor speed measurements
    • U.csv, WindVel.csv: Wind velocity data
    • WindDir.csv, WindDirConstant.csv: Wind direction measurements
    • WindTI.csv, WindTIConstant.csv: Turbulence intensity data
    • Additional covariance and profile files

Automatic Operations

The function automatically:

  • Creates the data/ directory if it doesn't exist
  • Copies the main YAML configuration file using copy_files
  • Recursively copies the entire 2021_9T_Data/ subdirectory with all CSV files
  • Sets proper file permissions (0o774) on all copied files

This function is called as part of install_examples to set up a complete working environment with all necessary configuration files and simulation data.

See also: copy_files, install_examples

source
FLORIDyn.copy_binFunction
copy_bin()

Copy the script run_julia to the folder "bin" (it will be created if it doesn't exist).

source
FLORIDyn.copy_filesFunction
copy_files(relpath, files)

Copy a list of files from the package directory to a local directory.

This utility function copies files from the package's source directory structure to a corresponding local directory. It automatically handles directory creation and sets appropriate file permissions.

Arguments

  • relpath::String: The relative path (directory name) within both the package and local filesystem where files should be copied
  • files::Vector{String}: A vector of filenames to copy from the source to destination

Details

The function:

  • Creates the destination directory (relpath) if it doesn't exist
  • Copies each file from <package_dir>/<relpath>/<file> to ./<relpath>/<file>
  • Sets executable permissions (0o774) on all copied files
  • Overwrites existing files (uses force=true)

Returns

  • Vector{String}: The list of files that were copied (same as input files)

Example

# Copy specific example files to local examples directory
copy_files("examples", ["main.jl", "menu.jl"])

# Copy data files to local data directory  
copy_files("data", ["config.yaml", "turbine_data.csv"])

This function is used internally by copy_examples, copy_model_settings, and other file copying utilities.

See also: copy_examples, copy_model_settings, copy_bin

source
FLORIDyn.cp_funFunction
cp_fun(filename = "data/DTU_10MW/cp.csv") -> Function

Create a power coefficient interpolation function from tabulated data in a CSV file.

This function loads wind turbine power coefficient (Cp) data from a CSV file and creates a bilinear interpolation function that can be used to compute power coefficients for arbitrary combinations of tip-speed ratio (λ) and blade pitch angle (β).

Arguments

  • filename::String: Path to the CSV file containing power coefficient data (default: DTU 10MW reference turbine data)

Returns

  • Function: An interpolation function cp(tsr, pitch) that takes:
    • tsr::Real: Tip-speed ratio λ = Ω×R/V (dimensionless)
    • pitch::Real: Blade pitch angle β in degrees
    • Returns: Power coefficient Cp (dimensionless, typically 0.0 to ~0.5)

CSV File Format

The input CSV file must follow this structure:

  • First column: Tip-speed ratio values (λ), with header containing a backslash (e.g., "λ\β")
  • Remaining columns: Power coefficient values for different pitch angles
  • Column headers: Pitch angles in degrees (e.g., "0.0", "2.0", "4.0", ...)
  • Data rows: Cp values corresponding to each (λ, β) combination

Example CSV structure:

λ\β,0.0,2.0,4.0,6.0,8.0,10.0
1.0,0.05,0.04,0.03,0.02,0.01,0.00
2.0,0.15,0.14,0.13,0.11,0.09,0.06
4.0,0.35,0.33,0.30,0.26,0.21,0.15
6.0,0.45,0.42,0.38,0.33,0.27,0.20
8.0,0.48,0.44,0.39,0.33,0.26,0.18
10.0,0.42,0.38,0.33,0.27,0.20,0.12

Interpolation Method

  • Uses bilinear interpolation via Interpolations.jl
  • Gridded(Linear()): Provides smooth interpolation between tabulated points
  • Extrapolation: Values outside the data range use nearest-neighbor extrapolation
  • Performance: Optimized for repeated evaluations during simulation

Physical Context

The power coefficient Cp represents the aerodynamic efficiency of a wind turbine:

  • Definition: Cp = Pextracted / Pavailable = P / (0.5 × ρ × A × V³)
  • Range: Theoretical maximum is ~0.593 (Betz limit), practical turbines achieve ~0.45-0.50
  • Dependencies: Strong function of tip-speed ratio λ and pitch angle β
  • Optimal operation: Peak Cp typically occurs around λ = 7-8 with β ≈ 0°

Usage Examples

# Create interpolation function from default DTU 10MW data
cp = cp_fun()

# Create from custom turbine data
cp_custom = cp_fun("data/NREL_5MW/cp.csv")

# Evaluate power coefficient at specific operating point
tsr = 7.5      # Tip-speed ratio
pitch = 0.0    # Pitch angle [degrees]
cp_value = cp(tsr, pitch)
println("Cp = ", cp_value)  # Expected: ~0.45-0.48 for optimal conditions

# Power calculation example
wind_speed = 12.0    # m/s
rotor_radius = 89.2  # m (DTU 10MW)
rotor_speed = wind_speed * tsr / rotor_radius  # rad/s
air_density = 1.225  # kg/m³
swept_area = π * rotor_radius^2  # m²
power = 0.5 * air_density * swept_area * wind_speed^3 * cp_value  # W

# Variable pitch control example
pitch_angles = 0.0:2.0:20.0
cp_values = [cp(8.0, β) for β in pitch_angles]
println("Cp variation with pitch: ", cp_values)

Implementation Details

The function performs these steps:

  1. Data Loading: Reads CSV using CSV.jl with automatic header detection
  2. Column Parsing: Extracts tip-speed ratio from first column and pitch angles from headers
  3. Matrix Construction: Builds 2D matrix of Cp values indexed by (λ, β)
  4. Interpolation Setup: Creates bilinear interpolator using Interpolations.jl
  5. Function Return: Returns optimized evaluation function for repeated use

Error Handling

  • File not found: Throws standard file I/O errors if CSV file doesn't exist
  • Malformed CSV: May throw parsing errors if format doesn't match expected structure
  • Invalid data: Interpolation may produce unexpected results for malformed numeric data

Performance Notes

  • Initialization cost: Moderate (file I/O + interpolation setup)
  • Evaluation cost: Very fast (optimized bilinear interpolation)
  • Memory usage: Scales with data table size (typically <1MB for standard turbines)
  • Thread safety: Returned function is thread-safe for evaluation

See Also

source
FLORIDyn.setupFunction
setup(filename) -> (wind, sim, con, floris, floridyn, ta, tp)

Load wind farm configuration from a YAML file and parse all simulation components.

This function reads the configuration file of the simulation and extracts all necessary parameters for setting up a FLORIDyn simulation, including wind conditions, simulation settings, control strategies, FLORIS model parameters, FLORIDyn dynamics, turbine array layout and turbine properties.

Arguments

  • filename::String: Path to the YAML configuration file. The file should contain sections for: wind, sim, con, floris, floridyn, and turbines.

Returns

A 7-tuple containing fully configured simulation components:

  • wind::Wind: Wind conditions and input specifications (velocity, direction, turbulence, shear, corrections, perturbations)
  • sim::Sim: Simulation parameters (time range, discretization, dynamics, initialization, data paths)
  • con::Con: Control settings (yaw strategies, control data)
  • floris::Floris: FLORIS wake model parameters (alpha, beta, k coefficients, air density, etc.)
  • floridyn::FloriDyn: FLORIDyn dynamic model settings (operating points, perturbations, state changes)
  • ta::TurbineArray: Turbine array configuration (positions, types, initial states)
  • tp::TurbineProperties: Turbine properties (name, rotor radius, power coefficient function)

YAML File Structure

The configuration file must contain these top-level sections:

wind:          # Wind input specifications and corrections
sim:           # Simulation time, discretization, and dynamics  
con:           # Control strategies and yaw data
floris:        # FLORIS model coefficients and parameters
floridyn:      # FLORIDyn dynamic model settings
turbines:      # Array of turbine definitions with position, type, initial states

Example

# Load complete wind farm configuration
wind, sim, con, floris, floridyn, ta, tp = setup("data/2021_9T_Data.yaml")

# Access turbine positions  
println("Number of turbines: ", size(ta.pos, 1))
println("Simulation duration: ", sim.end_time - sim.start_time, " seconds")

See Also

  • Wind: Wind conditions and input specifications
  • Sim: Simulation parameters and settings
  • Con: Control configuration
  • Floris: FLORIS wake model parameters
  • FloriDyn: FLORIDyn dynamic model settings
  • TurbineArray: Turbine array layout and properties
source
FLORIDyn.getTurbineDataFunction
getTurbineData(names::Vector{String}) -> TurbineData

Retrieve nacelle positions and rotor diameters for a given list of wind turbine types.

Arguments

  • names::Vector{String}: A vector of wind turbine type names. Supported types are loaded from the data/turbine_specs.yaml file and currently include:
    • "DTU 10MW"
    • "DTU 5MW"
    • "Senvion 6.2M"
    • "V116"
    • "V117"
    • "V162"
    • "GE Haliade X"

Returns

  • A TurbineData struct with the following fields:
    • nac_pos::Matrix{Float64}: An N × 3 matrix where each row corresponds to the (x, y, z) coordinates of the nacelle position for each turbine.
    • rotor_diameter::Vector{Float64}: A vector of rotor diameters corresponding to each turbine.

Raises

  • ArgumentError if an unknown or misspelled turbine name is encountered.

Example

names = ["DTU 10MW", "V116"]
turbine_data = getTurbineData(names)
println("Nacelle positions: ", turbine_data.nac_pos)
println("Rotor diameters: ", turbine_data.rotor_diameter)

Data Source

Turbine specifications are loaded from data/turbine_specs.yaml. To add new turbine types, add entries to this file following the existing format.

source
FLORIDyn.parse_measurementsFunction
parse_measurements(measurements_yaml::Vector) -> Vector{Measurement}

Convert YAML measurement configurations into an array of Measurement structs.

This function parses the measurement section from a YAML visualization configuration and converts it into a structured array of Measurement objects. It handles both simple string entries and complex dictionary entries with name, separated, and skip flag specifications.

Arguments

  • measurements_yaml::Vector: Vector containing measurement configurations from YAML. Each element can be either:
    • A simple string (measurement name)
    • A dictionary with "name", "separated", and "skip" keys

Returns

  • Vector{Measurement}: Array of Measurement structs with parsed configurations

YAML Format Support

The function supports multiple YAML formats:

Simple Format (separated=false, skip=false by default)

measurements:
  - "msr_vel_reduction"
  - "msr_added_turbulence" 

Extended Format (with separated and skip flags)

measurements:
  - name: "msr_vel_reduction"
    separated: true
    skip: false
  - name: "msr_added_turbulence"
    separated: false
    skip: true

Mixed Format

measurements:
  - "msr_vel_reduction"           # Simple string, defaults applied
  - name: "msr_added_turbulence"  # Dictionary format
    separated: true
    skip: false

Algorithm

  1. Iterate through each measurement entry in the YAML vector
  2. Check type: Determine if entry is string or dictionary
  3. Extract values: Get name, separated, and skip flags based on format
  4. Create struct: Construct Measurement struct with parsed values

Error Handling

  • Handles missing separated and skip flags by defaulting to false
  • Processes mixed simple/complex YAML structures gracefully
  • Validates measurement name extraction

Examples

# Parse from YAML data
yaml_measurements = [
    "msr_vel_reduction",
    Dict("name" => "msr_added_turbulence", "separated" => true, "skip" => false)
]

measurements = parse_measurements(yaml_measurements)
# Returns: [Measurement("msr_vel_reduction", false, false), 
#          Measurement("msr_added_turbulence", true, false)]

See Also

  • Measurement: The struct type created by this function
  • Vis: Visualization settings struct that uses these measurements
  • plotMeasurements: Function that consumes these measurement configurations
source
FLORIDyn.parse_flow_fieldsFunction
parse_flow_fields(flow_fields_yaml::Vector) -> Vector{FlowField}

Convert YAML flow field configurations into an array of FlowField structs.

This function parses the flow_fields section from a YAML visualization configuration and converts it into a structured array of FlowField objects. It handles both simple string entries and complex dictionary entries with name, online, create_video, and skip flag specifications.

Arguments

  • flow_fields_yaml::Vector: Vector containing flow field configurations from YAML. Each element can be either:
    • A simple string (flow field name)
    • A dictionary with "name", "online", "create_video", and "skip" keys

Returns

  • Vector{FlowField}: Array of FlowField structs with parsed configurations

YAML Format Support

The function supports multiple YAML formats:

Simple Format (online=false, create_video=false, skip=false by default)

flow_fields:
  - "flow_field_vel_reduction"
  - "flow_field_added_turbulence" 

Extended Format (with online, create_video, and skip flags)

flow_fields:
  - name: "flow_field_vel_reduction"
    online: true
    create_video: true
    skip: false
  - name: "flow_field_added_turbulence"
    online: false
    create_video: false
    skip: true

Mixed Format

flow_fields:
  - "flow_field_vel_reduction"           # Simple string, defaults applied
  - name: "flow_field_added_turbulence"  # Dictionary format
    online: true
    create_video: false
    skip: false

Examples

# Parse from YAML data
yaml_flow_fields = [
    "flow_field_vel_reduction",
    Dict("name" => "flow_field_added_turbulence", "online" => true, "create_video" => false, "skip" => true)
]

flow_fields = parse_flow_fields(yaml_flow_fields)

See Also

source
FLORIDyn.turbine_groupFunction
turbine_group(ta::TurbineArray, turbine::Int) -> Int

Find the group ID for a specific turbine in the turbine array.

This function searches through all turbine groups in the array to find which group contains the specified turbine and returns the group's ID. If a turbine belongs to multiple groups, it returns the ID of the first non-"all" group found, or the "all" group if no specific group is found.

Arguments

  • ta::TurbineArray: The turbine array containing the groups
  • turbine::Int: The turbine number (1-based index) to find the group for

Returns

  • Int: The ID of the group that contains the specified turbine

Throws

  • ArgumentError: If the turbine number is not found in any group or is out of bounds

Examples

# Load turbine array from configuration
wind, sim, con, floris, floridyn, ta = setup("data/2021_54T_NordseeOne.yaml")

# Find which group turbine 15 belongs to
group_id = turbine_group(ta, 15)
println("Turbine 15 belongs to group with ID: ", group_id)

# Get the group name
for group in ta.groups
    if group.id == group_id
        println("Group name: ", group.name)
        break
    end
end

Performance

  • Time complexity: O(n*m) where n is the number of groups and m is the average group size
  • For typical wind farm layouts, this is very fast since group counts are small
source