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.Sim
— TypeSim
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.
FLORIDyn.Wind
— TypeWind
A mutable struct representing wind settings.
Fields
input_vel::String
: The type of wind velocity input, e.g., "Constant", "Interpolation".input_dir::String
: The type of wind direction input, e.g., "Constant", "Interpolation".input_ti::String
: The type of turbulence intensity input, e.g., "Constant", "Interpolation".input_shear::String
: The type of wind shear input, e.g., "PowerLaw", "Interpolation".correction::WindCorrection
: Settings for wind corrections.perturbation::WindPerturbation
: Settings for wind perturbations.vel::Union{Nothing, Float64}
: Optional wind velocity value.dir::Union{Nothing, Matrix{Float64}, WindDirMatrix, WindDirType, WindDirTriple}
: Optional wind direction matrix or covariance data.ti::Union{Nothing, Float64}
: Optional turbulence intensity value.shear::Union{Nothing, WindShear}
: Optional wind shear profile.
FLORIDyn.Con
— TypeCon
A mutable struct for configuration settings.
Fields
yaw::String
: The yaw control strategy, e.g., "Constant", "Interpolation".yaw_data::Union{Nothing, Matrix{Float64}}
: Optional yaw data matrix.tanh_yaw::Bool
: Whether to use hyperbolic tangent yaw control.
FLORIDyn.Vis
— TypeVis
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. Whentrue
, live plots and animations are displayed during the simulation run. Whenfalse
, visualization is disabled for faster computation.save::Bool
: Enable/disable saving of plots to disk. Whentrue
, plots are saved to disk in PNG format. Whenfalse
, plots are only displayed (default:false
).print_filenames::Bool
: Enable/disable printing of saved filenames to console. Whentrue
, filenames of saved plots are printed (default:false
).video_folder::String
: Relative path for the video output directory. Used whenonline=true
andsave=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 whenonline=false
andsave=true
(default:"out"
).unique_output_folder::Bool
: Iftrue
, a unique timestamped folder is created for each simulation run. Iffalse
, files are saved directly to the output folder (default:true
).flow_fields::Vector{FlowField}
: List of flow field visualizations to be created. EachFlowField
contains configuration for name, online display, video creation, and skip control. SeeFlowField
for details (default:FlowField[]
).measurements::Vector{Measurement}
: List of measurement visualizations to be created. EachMeasurement
contains configuration for name, separated plotting, and skip control. SeeMeasurement
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. Whentrue
, 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 tovideo_path
(for animations)online=false
: Files saved tooutput_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
FlowField
: Configuration struct for flow field visualizationsMeasurement
: Configuration struct for measurement visualizationsparse_flow_fields
: Function to convert YAML flow field configurationsparse_measurements
: Function to convert YAML measurement configurations
FLORIDyn.Floris
— TypeFloris
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.
FLORIDyn.FloriDyn
— TypeFloriDyn
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".
FLORIDyn.TurbineArray
— TypeTurbineArray
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
turbines = TurbineArray(pos, type, init_states)
FLORIDyn.TurbineData
— TypeTurbineData
A structure containing technical specifications for wind turbines.
Fields
nac_pos::Matrix{Float64}
: AnN × 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")
FLORIDyn.FlowField
— TypeFlowField
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 arraysplotFlowField
: Function that uses these configurations for visualization
FLORIDyn.Measurement
— TypeMeasurement
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
parse_measurements
: Function to convert YAML measurement configurations to Measurement arraysplotMeasurements
: Function that uses these configurations for visualization
Settings
The Settings struct and functions related to examples and settings.
FLORIDyn.install_examples
— Functioninstall_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 localbin
directory (viacopy_bin
) - Model configuration files and data to a local
data
directory (viacopy_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
FLORIDyn.copy_examples
— Functioncopy_examples()
Copy all example scripts to the folder "examples" (it will be created if it doesn't exist).
FLORIDyn.copy_model_settings
— Functioncopy_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 seriesSOWFA_generatorPower.csv
: Generator power output dataSOWFA_generatorTorque.csv
: Generator torque measurementsSOWFA_nacelleYaw.csv
: Nacelle yaw angle dataSOWFA_rotorSpeedFiltered.csv
: Filtered rotor speed measurementsU.csv
,WindVel.csv
: Wind velocity dataWindDir.csv
,WindDirConstant.csv
: Wind direction measurementsWindTI.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
FLORIDyn.copy_bin
— Functioncopy_bin()
Copy the script run_julia to the folder "bin" (it will be created if it doesn't exist).
FLORIDyn.copy_files
— Functioncopy_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 copiedfiles::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 inputfiles
)
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
FLORIDyn.setup
— Functionsetup(filename) -> (wind, sim, con, floris, floridyn, ta)
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, and turbine array layout.
Arguments
filename::String
: Path to the YAML configuration file. The file should contain sections for: wind, sim, con, floris, floridyn, and turbines.
Returns
A 6-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)
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 = 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
FLORIDyn.Settings
— TypeSettings
A mutable struct that holds configuration parameters for the FLORIDyn simulation environment.
Fields
FLORIDyn.Settings
— MethodSettings(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 theWind
struct containing wind-related parameters.sim::Sim
: An instance of theSim
struct containing the simulation parameters.con::Con
: An instance of theCon
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.
FLORIDyn.getTurbineData
— FunctiongetTurbineData(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 thedata/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}
: AnN × 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.
FLORIDyn.parse_measurements
— Functionparse_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
- Iterate through each measurement entry in the YAML vector
- Check type: Determine if entry is string or dictionary
- Extract values: Get name, separated, and skip flags based on format
- 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 functionVis
: Visualization settings struct that uses these measurementsplotMeasurements
: Function that consumes these measurement configurations
FLORIDyn.parse_flow_fields
— Functionparse_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
FlowField
: The struct type created by this functionparse_measurements
: Similar function for measurement configurations