Introduction
Most functions need an instance of the struct AtmosphericModel as first parameter, which can be created using the following code:
using AtmosphericModels, KiteUtils
set_data_path("data")
set = load_settings("system.yaml"; relax=true)
am::AtmosphericModel = AtmosphericModel(set)This requires that the files system.yaml and settings.yaml exist in the folder data. See also Settings. The parameter relax=true allows loading a yaml file that does not contain all sections needed to run a kite power system simulation. This is useful if you want to use this package for other purposes than simulating kite power systems.
Types
Exported types
AtmosphericModels.ProfileLaw — Type@enum ProfileLaw EXP=1 LOG=2 EXPLOG=3Enumeration to describe the wind profile low that is used.
AtmosphericModels.AtmosphericModel — Typemutable struct AtmosphericModelStruct that is storing the settings and the state of the atmosphere.
Fields
- set::Settings: The Settings struct
rho_zero_temp- wf::Union{WindField, Nothing}: The 3D
WindFieldornothing
AtmosphericModels.AtmosphericModel — MethodAtmosphericModel(set::Settings; nowindfield::Bool=false)Constructs an AtmosphericModel using the provided Settings.
Arguments
set::Settings: The settings object containing configuration parameters for the atmospheric model.nowindfield::Bool=false: Optional keyword argument. Iftrue, the wind field will not be loaded.
Returns
- An instance of
AtmosphericModelconfigured according to the provided settings.
Private types
AtmosphericModels.WindField — Typestruct WindFieldStruct that is storing a 3D model of wind vectors of the atmosphere. The Fields x, y and z store the grid coordinates, the fields u, v and w the wind turbulence vectors.
Fields
- x_max::Float64 = NaN
- x_min::Float64 = NaN
- y_max::Float64 = NaN
- y_min::Float64 = NaN
- z_max::Float64 = NaN
- z_min::Float64 = NaN
- last_speed::Float64 = 0.0
- valid::Bool = false
- x::Union{SRL, Array{Float64, 3}}
- y::Union{SRL, Array{Float64, 3}}
- z::Union{SRL, Array{Float64, 3}}
- u::Array{Float64, 3}
- v::Array{Float64, 3}
- w::Array{Float64, 3}
- param::Vector{Float64} = [0, 0] # [alpha,
v_wind_gnd]
Functions
Wind shear and air density calculation
AtmosphericModels.calc_rho — Functioncalc_rho(s::AM, height)Calculates the air density at a given height above ground level.
Arguments
s::AM: An instance of theAM(Atmospheric Model) struct containing atmospheric parameters.height: The height above ground level (in meters) at which to calculate the air density.
Returns
- The air density at the specified height (in kg/m³).
Notes
- The calculation assumes an exponential decrease of air density with altitude.
s.rho_zero_tempis the reference air density at ground level.s.set.height_gndis the ground height offset.- The scale height used is 8550.0 meters.
AtmosphericModels.calc_wind_factor — Functioncalc_wind_factor(am::AM, height; profile_law::Int64=am.set.profile_law)Calculates the wind factor at a given height using the specified wind profile law.
Arguments
am::AM: An instance of theAMtype containing atmospheric model parameters.height: The height (in meters) at which to calculate the wind factor.profile_law::Int64: (Optional) The wind profile law to use for the calculation. Defaults toam.set.profile_law.
Returns
- The wind factor at the specified height as determined by the chosen profile law.
Wind turbulence calculation
AtmosphericModels.get_wind — Functionget_wind(am::AtmosphericModel, x, y, z, t; interpolate=false)Returns the wind vector at the specified position (x, y, z) and time t using the given AtmosphericModel (am).
Arguments
am::AtmosphericModel: The atmospheric model providing environmental parameters.x,y,z: Coordinates specifying the location where the wind is to be evaluated. [m]t: Time at which the wind is to be evaluated. [s]interpolate(optional, default =false): Iftrue, interpolate wind values between grid points; otherwise, use nearest or direct values.
Returns
- A wind vector representing the wind at the specified location and time.
AtmosphericModels.rel_turbo — Functionrel_turbo(am::AtmosphericModel, v_wind = am.set.v_wind)Find the closest relative turbulence value for a given ground wind speed.
Arguments
am::AtmosphericModel: The atmospheric model instance containing relevant parameters.v_wind: (Optional) The wind velocity to use for the calculation. Defaults toam.set.v_wind.
Returns
- The computed relative turbulence value.
AtmosphericModels.new_windfield — Functionnew_windfield(am::AtmosphericModel, v_wind_gnd; prn=true)Create a new wind field file using the given, scalar ground wind velocity v_wind_gnd.
Parameters
am::AtmosphericModel: The atmospheric model for which the wind field is created.v_wind_gnd: A scalar representing the wind velocity at ground level.prn: Optional boolean flag to control printing of progress messages (default istrue).
Returns
- nothing
AtmosphericModels.new_windfields — Functionnew_windfields(am::AtmosphericModel; prn=true)Create and initialize new wind fields for all ground wind speeds, defined in am.set.v_wind_gnds and save them for the given AtmosphericModel instance am.
Arguments
am::AtmosphericModel: The atmospheric model for which wind fields are to be generated.prn: Optional boolean flag to control printing of progress messages (default istrue).
Returns
- nothing