API reference
This page provides a detailed reference for all public functions exported by SymbolicAWEModels.jl.
High-level simulation functions
These functions provide convenient wrappers for running common simulation scenarios.
SymbolicAWEModels.sim! — Function
sim!(sam, set_values; dt, total_time, vsm_interval, prn, lin_model)Run a generic simulation for a given AWE model and a matrix of control inputs. Optionally, also simulate a provided linear model, returning both logs.
Arguments
sam::SymbolicAWEModel: Initialized AWE model.set_values::Matrix{Float64}: A matrix of external control torques [Nm] to be applied at each time step. The number of rows must equal the number of simulation steps, and the number of columns must equal the number of winches.
Keywords
dt::Float64: Time step [s]. Defaults to1/sam.set.sample_freq.total_time::Float64: Total simulation duration [s]. Defaults to 10.0.vsm_interval::Int: Interval for the value state machine updates. Defaults to 3.prn::Bool: If true, prints a performance summary upon completion. Defaults to true.lin_model: (optional) a continuous-timeStateSpaceobject fromControlSystemsBase. If provided, the linear model is simulated in parallel and a second log is returned.
Returns
- If
lin_modelis not provided:(SysLog, Nothing)(nonlinear log, nothing) - If
lin_modelis provided:(SysLog, SysLog)(nonlinear, linear logs)
SymbolicAWEModels.sim_oscillate! — Function
sim_oscillate!(sam; dt, total_time, steering_freq, steering_magnitude, vsm_interval,
bias, prn, lin_model)Run a simulation with oscillating steering input on the given AWE model. Optionally also simulate a provided linear model.
Keywords (see sim!)
lin_model: (optional) a continuous-timeStateSpaceobject fromControlSystemsBase.
Returns
- If
lin_modelis not provided:(SysLog, Nothing)(nonlinear log, nothing) - If
lin_modelis provided:(SysLog, SysLog)(nonlinear, linear logs)
SymbolicAWEModels.sim_turn! — Function
sim_turn!(sam; dt, total_time, steering_time, steering_magnitude, vsm_interval, prn,
lin_model)Run a simulation with a constant steering input for a specified duration. Optionally also simulate a provided linear model.
Keywords (see sim!)
lin_model: (optional) a continuous-timeStateSpaceobject fromControlSystemsBase.
Returns
- If
lin_modelis not provided:(SysLog, Nothing)(nonlinear log, nothing) - If
lin_modelis provided:(SysLog, SysLog)(nonlinear, linear logs)
SymbolicAWEModels.sim_reposition! — Function
sim_reposition!(sam; dt, total_time, reposition_interval_s, target_elevation_deg,
target_azimuth_deg, prn)Run a simulation that periodically resets the kite's elevation and azimuth.
This function simulates the AWE model and, at a specified time interval, calls reposition! to reposition the kite to a target elevation and azimuth. It logs the entire simulation and returns a SysLog.
Arguments
sam::SymbolicAWEModel: Initialized AWE model.
Keywords
dt::Float64: Time step [s]. Defaults to1/sam.set.sample_freq.total_time::Float64: Total simulation duration [s]. Defaults to 20.0.reposition_interval_s::Float64: The interval in seconds at which to reset the pose. Defaults to 5.0.target_elevation::Float64: The target elevation in rad for repositioning. Defaults to deg2rad(45.0).target_azimuth::Float64: The target azimuth in rad for repositioning. Defaults to 0.0.target_heading::Float64: The target heading in rad for repositioning. Defaults to 0.0.prn::Bool: If true, prints status messages during the simulation. Defaults to true.
Returns
SysLog: A log of the complete simulation.
Low-level simulation and analysis
These functions provide direct control over the simulation and tools for model analysis.
KiteUtils.init! — Function
init!(sam::SymbolicAWEModel; ...)Initialize the SymbolicAWEModel.
This is the main entry point for setting up the model. It handles:
- Loading or building the symbolic model (
full_sys). - Creating the
ODEProblem,LinearizationProblem, and control functions as needed. - Serializing the model to disk if it was newly built.
- Initializing the ODE integrator.
Keyword Arguments
solver: The ODE solver to use. Ifnothing, a default is chosen based on settings.adaptive::Bool: Enable adaptive time-stepping for the solver.prn::Bool: Enable printing of progress messages.remake::Bool: Force a full rebuild of the symbolic model, ignoring any cached versions.reload::Bool: Force reloading of the serialized model from disk.outputs: A vector of variables to be treated as system outputs.create_prob::Bool: Whether to create theODEProblem.create_lin_prob::Bool: Whether to create theLinearizationProblem.create_control_func::Bool: Whether to generate the control functions.lin_vsm::Bool: Whether to linearize the aerodynamics using the Vortex Step Method (VSM) after initialization.remake_vsm::Bool: Recreate VSM wing and aerodynamics from settings (useful after modifying aero_geometry.yaml or other VSM settings).
Returns
- The initialized
ODEIntegrator.
KiteUtils.next_step! — Function
next_step!(s::SymbolicAWEModel, integrator::ODEIntegrator; set_values, dt, vsm_interval)Take a simulation step, using the provided integrator.
This is a convenience method that calls the main next_step! function.
next_step!(s::SymbolicAWEModel; set_values, dt,
vsm_interval)Take a simulation step forward in time.
Advances the simulation by one time step, optionally updating control inputs and re-linearizing the VSM model. Then updates the SystemStructure with the new state from the ODE integrator. Throws an error if the solver returns an unstable retcode.
Keyword Arguments
set_values=nothing: Control input values. Ifnothing, current values are used.dt=1/s.set.sample_freq: Time step size [s].vsm_interval=1: Steps between VSM re-linearization. 0 disables re-linearization.
SymbolicAWEModels.find_steady_state! — Function
find_steady_state!(s::SymbolicAWEModel, integ=s.integrator; t=1.0, dt=1/s.set.sample_freq)Run the simulation for a short period to allow the system to settle.
During this period, the winches are braked and the wing's elevation and azimuth angles are fixed, but it is free to move radially (in distance). This allows the dynamic components of the bridle and tethers to settle into a stable, steady-state equilibrium before starting a maneuver or analysis.
Arguments
s::SymbolicAWEModel: The model to be stabilized.integ: The integrator to use. Defaults tos.integrator.
Keywords
t::Float64=1.0: The duration [s] for which to run the settling simulation.dt::Float64: The time step [s] for the settling simulation.
SymbolicAWEModels.linearize! — Function
linearize!(s::SymbolicAWEModel; set_values=s.get_set_values(s.integrator)) -> LinTypeCompute the full state-space linearization of the model around the current operating point.
This function uses the LinearizationProblem generated by ModelingToolkit.jl to calculate the A, B, C, and D matrices for the complete, high-order system.
Arguments
s::SymbolicAWEModel: The model to linearize.
Keywords
set_values: The control input vectoruaround which to linearize.
Returns
LinType: A NamedTuple(A, B, C, D)containing the state-space matrices.
SymbolicAWEModels.simple_linearize! — Function
simple_linearize!(s::SymbolicAWEModel; tstab=10.0) -> LinTypeCompute a simplified, low-order state-space model by numerically linearizing the full simulation.
This function performs system identification by perturbing the states and inputs of the full nonlinear model and observing the effect on the state derivatives and outputs. It runs the simulation for a short duration (tstab) after each perturbation to find the steady-state response.
Arguments
s::SymbolicAWEModel: The model to linearize.
Keywords
tstab::Float64=10.0: The simulation time [s] to run after each perturbation to reach a steady state.
Returns
LinType: A NamedTuple(A, B, C, D)containing the identified low-order state-space matrices.
YAML loading
SymbolicAWEModels.load_sys_struct_from_yaml — Function
load_sys_struct_from_yaml(yaml_path::AbstractString; system_name="from_yaml", set=nothing)Build a SystemStructure from a component-based structural YAML file.
IMPORTANT: All indices (points, segments, etc.) must be sequential starting from 1 with no gaps.
Expected top-level blocks
points: table with headers[id,x,y,z,type,mass,body_damping,world_damping]type: STATIC, DYNAMIC, WING, or QUASI_STATICidmust be sequential: 1, 2, 3, ...
segments: table with one of two formats:- Direct format:
[id,point_i,point_j,type,l0,diameter_mm,unit_stiffness,unit_damping,compression_frac] - Named format:
[name,point_i,point_j](requiressegment_propertiesblock)
- Direct format:
segment_properties: (optional) table with headers[name,type,l0,diameter_mm,unit_stiffness,unit_damping,compression_frac]- Used with named segment format for shared properties across symmetric segments
pulleys: table with headers[id,segment_i,segment_j,type]type: DYNAMIC or QUASI_STATIC
groups: (optional) table with headers[id,point_idxs,gamma,type,reference_chord_frac]tethers: (optional) table with headers[id,segment_ids,ground_point_id]winches: (optional) table with headers[id,tether_ids]wings: (optional, typically from VSM configuration)transforms: (optional, typically from settings)
SymbolicAWEModels.update_sys_struct_from_yaml! — Function
update_sys_struct_from_yaml!(sys_struct::SystemStructure,
struc_yaml::AbstractString)Update an existing SystemStructure in-place from a (possibly modified) structural geometry YAML file. Inverse of update_yaml_from_sys_struct!.
Updates pos_cad for points and l0 for segments, matched by symbolic name. When l0 is nothing in the YAML, it is auto-calculated from the endpoint pos_cad positions.
Only raw geometry is updated. Call reinit!(sys_struct, set) afterward to recompute derived quantities (pos_b, pos_w, wing frames, etc.).
Unmatched names are silently skipped (the YAML may contain a subset of components).
Arguments
sys_struct: The SystemStructure to update in-place.struc_yaml: Path to the structural geometry YAML file.
Example
sys = load_sys_struct_from_yaml("struc_geometry.yaml"; ...)
# ... edit YAML externally ...
update_sys_struct_from_yaml!(sys, "struc_geometry.yaml")System configuration
SymbolicAWEModels.set_world_frame_damping — Function
set_world_frame_damping(sys::SystemStructure, damping, point_idxs)Set the world frame damping coefficient for specified points in the system structure.
World frame damping applies a velocity-dependent drag force in the global reference frame: $\mathbf{F}_{damp} = -c_{damp} \odot \mathbf{v}$, where $c_{damp}$ is the damping vector and $\odot$ is element-wise multiplication.
Arguments
sys::SystemStructure: The system structure to modify.damping::Union{Real, AbstractVector}: Damping coefficient(s) [N·s/m]. Scalar applies same value to all 3 axes. Vector must have 3 elements for [x,y,z] damping.point_idxs: Indices of points to apply damping to.
Returns
nothing
set_world_frame_damping(sys::SystemStructure, damping)Set the world frame damping coefficient for all points in the system structure.
World frame damping applies a velocity-dependent drag force in the global reference frame: $\mathbf{F}_{damp} = -c_{damp} \odot \mathbf{v}$, where $c_{damp}$ is the damping vector and $\odot$ is element-wise multiplication.
Arguments
sys::SystemStructure: The system structure to modify.damping::Union{Real, AbstractVector}: Damping coefficient(s) [N·s/m]. Scalar applies same value to all 3 axes. Vector must have 3 elements for [x,y,z] damping.
Returns
nothing
SymbolicAWEModels.set_body_frame_damping — Function
set_body_frame_damping(sys::SystemStructure, damping, point_idxs)Set the body frame damping coefficient for specified points in the system structure.
Arguments
sys::SystemStructure: The system structure to modify.damping::Union{Real, AbstractVector}: Damping coefficient(s) [N·s/m]. Scalar applies same value to all 3 axes. Vector must have 3 elements for [x,y,z] damping.point_idxs: Indices of points to apply damping to.
Returns
nothing
set_body_frame_damping(sys::SystemStructure, damping)Set the body frame damping coefficient for all points in the system structure.
Arguments
sys::SystemStructure: The system structure to modify.damping::Union{Real, AbstractVector}: Damping coefficient(s) [N·s/m]. Scalar applies same value to all 3 axes. Vector must have 3 elements for [x,y,z] damping.
Returns
nothing
SymbolicAWEModels.calc_steady_torque — Function
calc_steady_torque(sam::SymbolicAWEModel)Calculates the torque for each winch that results in zero acceleration (steady state).
State accessor functions
Use these functions to retrieve state information and calculated values from a model instance.
SymbolicAWEModels.winch_force — Function
winch_force(s::SymbolicAWEModel)Returns the winch force [N] for each winch.
SymbolicAWEModels.unstretched_length — Function
unstretched_length(s::SymbolicAWEModel)Returns the unstretched tether length [m] for each winch.
SymbolicAWEModels.tether_length — Function
tether_length(s::SymbolicAWEModel)Returns the current stretched tether length [m] for each tether.
SymbolicAWEModels.segment_stretch_stats — Function
segment_stretch_stats(sys::SystemStructure)Calculate segment stretch statistics for segments in tension.
Returns the maximum and mean relative stretch of segments where len > l0, along with the index of the segment with maximum stretch. Relative stretch is defined as (current_length - l0) / l0. Only segments in tension (stretched) are included in the statistics.
For pulley segments, the combined length of both segments is used against the pulley's sum_l0, since the pulley constraint distributes length between them.
Arguments
sys::SystemStructure: System structure with current segment states
Returns
(max_stretch, mean_stretch, max_idx): Tuple of maximum stretch, mean stretch, and index of the segment with maximum stretch (or first pulley segment index)
Visualization functions
SymbolicAWEModels provides plotting functionality through a package extension that automatically loads when you import GLMakie.
3D system visualization
Plot the 3D structure of the system with interactive features:
using GLMakie
plot(sys::SystemStructure; kwargs...)Keyword arguments:
size::Tuple=(1200, 800): Figure size in pixelsmargin::Float64=10.0: Margin around the system in world unitssegment_color=:black: Default color for segmentshighlight_color=:red: Color for highlighted segmentsshow_points::Bool=true: Show point markersshow_segments::Bool=true: Show tether segmentsshow_orient::Bool=true: Show wing orientation axes
Interactive features:
- Hover over segments to highlight them
- Click on a segment to zoom in
- Click in empty space to zoom out
- Rotate, pan, and zoom with mouse
Time-series visualization
Plot simulation results as multi-panel time-series:
plot(sys::SystemStructure, log::SysLog; kwargs...)Keyword arguments:
plot_default::Bool=true: Enable default plot panelsplot_reelout::Bool=plot_default: Show reel-out velocitiesplot_aero_force::Bool=plot_default: Show aerodynamic forcesplot_twist::Bool=plot_default: Show wing twist anglesplot_aoa::Bool=plot_default: Show angle of attackplot_heading::Bool=plot_default: Show heading angleplot_winch_force::Bool=plot_default: Show winch forcesplot_aero_moment::Bool=false: Show aerodynamic momentsplot_turn_rates::Bool=false: Show angular velocitiesplot_elevation::Bool=false: Show elevation angleplot_azimuth::Bool=false: Show azimuth angleplot_tether_moment::Bool=false: Show tether-induced momentsplot_set_values::Bool=false: Show set torque valuessuffix::String=" - " * sys.name: Suffix for plot labelssize::Tuple=(1200, 800): Figure size in pixels
Simply using GLMakie after loading SymbolicAWEModels to make the plot functions available.
Utility and helper functions
SymbolicAWEModels.init_module — Function
init_module(; force=false, add_pkg=true)Initialize the module in the current working directory.
This function performs the following actions:
- Copies all files from the module's
datadirectory to the current working directory'sdatafolder (pwd()/data). Existing files in the destination are NOT overwritten unlessforce=true. - Copies all example scripts from the module to the current working directory's
examplesfolder (pwd()/examples). The folder is created if it does not exist. Existing files are NOT overwritten unlessforce=true. - Installs all required packages if they are not already installed. This occurs only if
add_pkg=true(default). The packages are automatically determined fromexamples/Project.toml.
Keyword Arguments
force::Bool=false: Iftrue, existing files in the destination directories will be overwritten. Iffalse(default), existing files will be preserved.add_pkg::Bool=true: Iftrue(default), installs required packages if they are not already present. Iffalse, package installation is skipped.