Private API

This page documents the internal functions and types of SymbolicAWEModels.jl. These are not part of the public API and may change without notice. They are listed here for developers and for those interested in the model's internal workings.

Core Types and Constructors

SymbolicAWEModels.SerializedModelType
@with_kw mutable struct SerializedModel{...}

A type-stable container for the compiled and serialized components of a SymbolicAWEModel.

This struct holds the products of the ModelingToolkit.jl compilation process, now organized into nested attribute structs (ProbWithAttributes, etc.). This simplifies the structure and improves serialization robustness.

  • set_hash::Vector{UInt8}

  • sys_struct_hash::Vector{UInt8}

  • full_sys::Union{Nothing, ModelingToolkit.System}: Unsimplified system of the mtk model Default: nothing

  • defaults::Vector{Pair}: Default: Pair[]

  • guesses::Vector{Pair}: Default: Pair[]

  • inputs::Union{Symbolics.Arr, Vector{Symbolics.Num}}: Symbolic representation of the control inputs. Default: Num[]

  • outputs::Union{Symbolics.Arr, Vector{Symbolics.Num}}: Outputs of the linearization and control function. Default: Num[]

  • prob::Union{Nothing, SymbolicAWEModels.ProbWithAttributes}: Container for the ODE problem and its getters/setters. Default: nothing

  • simple_lin_model::Union{Nothing, SymbolicAWEModels.SimpleLinModelWithAttributes}: Container for the simplified linear model and its state getters. Default: nothing

  • lin_prob::Union{Nothing, SymbolicAWEModels.LinProbWithAttributes}: Container for the linearization problem and its components. Default: nothing

  • control_funcs::Union{Nothing, SymbolicAWEModels.ControlFuncWithAttributes}: Container for the control functions. Default: nothing

source
SymbolicAWEModels.SimFloatType
const SimFloat = Float64

This type is used for all real variables, used in the Simulation. Possible alternatives: Float32, Double64, Dual Other types than Float64 or Float32 do require support of Julia types by the solver.

source
VortexStepMethod.RamAirWingType
VortexStepMethod.RamAirWing(set::Settings; prn=true, kwargs...)

Create a RamAirWing geometry object from the settings provided.

This is a constructor helper that reads the model and foil file paths from the Settings object and initializes the RamAirWing object from VortexStepMethod.jl.

source
SymbolicAWEModels.create_4_attach_ram_sys_structFunction
create_4_attach_ram_sys_struct(set::Settings)

Create a detailed SystemStructure for a ram-air kite with a 4-point attachment bridle.

This function procedurally builds a complex kite model. Its key feature is that all four bridle attachment points on each of the four wing Group sections are modeled as deforming with the group's twist dynamics.

This model includes:

  • A flexible wing simulated with 4 deformable Group sections.
  • A detailed bridle system with multiple segments and Pulleys to distribute forces.
  • Four main tethers (left/right power, left/right steering) connecting the bridle to the ground winches.
  • A 3-winch system controlling the tethers.

Arguments

  • set::Settings: Configuration parameters defining the kite's geometry and properties.

Returns

  • SystemStructure: A new SystemStructure object representing the detailed model.
source
SymbolicAWEModels.create_tetherFunction
create_tether(tether_idx, set, points, segments, tethers, attach_point, type, dynamics_type; z, axial_stiffness, axial_damping)

Procedurally create a multi-segment tether.

This function builds a tether from a specified number of segments, connecting a given attach_point on the kite to a new anchor point on the ground.

source

State Management and Model Simplification

SymbolicAWEModels.getstateFunction
getstate(sys_struct::SystemStructure) -> Tuple

Capture and return a snapshot of the key dynamic states of the system.

source
SymbolicAWEModels.set_measured!Function
set_measured!(sys_struct, heading, turn_rate, tether_len, tether_vel)

Adjust the model's state to match a set of "measured" or target values.

This function is typically used in state estimation or stabilization loops. It takes a set of target values (e.g., from a sensor or a reference trajectory) and forces the corresponding states in the SystemStructure to match, calculating kinematically consistent values for other related states.

source
SymbolicAWEModels.copy!Function
copy!(sys1::SystemStructure, sys2::SystemStructure)

Copy the dynamic state from one SystemStructure (sys1) to another (sys2).

This function is designed to transfer the state (positions, velocities, etc.) between two system models, which can have different levels of fidelity. For example, it can copy the state from a detailed multi-segment tether model (sys1) to a simplified single-segment model (sys2).

The function handles several cases:

  • If sys1 and sys2 have the same structure, it performs a direct copy of all point states.
  • If sys2 is a simplified (1-segment per tether) version of sys1, it copies the positions and velocities of the tether endpoints.
  • It also copies the state of wings, groups, winches, and pulleys where applicable.
source
SymbolicAWEModels.reinit!Function
reinit!(transforms::Vector{Transform}, sys_struct::SystemStructure)

Apply the initial spatial transformations to all components in a SystemStructure.

This function iterates through all transforms and applies the specified translation and rotation to position and orient the kite system components correctly in the world frame at the beginning of a simulation.

source
reinit!(sys_struct::SystemStructure, set::Settings)

Re-initialize a SystemStructure from a Settings object.

This function resets various component states (e.g., winch lengths, group twists, pulley positions) to their initial values as defined in the Settings object. It is typically called before starting a new simulation run.

source
reinit!(sam::SymbolicAWEModel, lin_prob::ModelingToolkit.LinearizationProblem)

Reinitializes a LinearizationProblem with the current system and settings parameters.

This function updates the internal parameter vectors of the linearization problem with the latest values from the SymbolicAWEModel's sys_struct and set fields.

source
reinit!(s::SymbolicAWEModel, prob::ODEProblem, solver; prn, precompile, reload, outputs) -> (ODEIntegrator, Bool)

Reinitializes an existing kite power system model's ODE integrator.

This function resets the integrator's state with new values from s.set, allowing for the simulation to be restarted from a new initial condition without needing to rebuild the entire symbolic model.

Arguments

  • s::SymbolicAWEModel: The kite power system state object.
  • prob::ODEProblem: The ODE problem to be solved.
  • solver: The solver to be used.

Keyword Arguments

  • adaptive::Bool=true: Whether to use adaptive time-stepping.
  • reload::Bool=true: Force reloading the model from disk.
  • lin_vsm::Bool=true: If true, linearizes the VSM model after reinitialization.

Returns

  • (ODEIntegrator, Bool): A tuple containing the reinitialized integrator and a success flag.
source
SymbolicAWEModels.reposition!Function
reposition!(transforms::Vector{Transform}, sys_struct::SystemStructure)

Update the system's spatial orientation based on its current position, preserving velocities.

This function adjusts the orientation of all components in the SystemStructure without altering their dynamic state. Unlike reinit!, it uses the current world positions (pos_w) as the starting point for rotations, rather than resetting from the CAD coordinates.

This function is useful for making real-time adjustments to the system's pose during a simulation. Crucially, it preserves the existing velocities (vel_w) of all points and wings.

NOTE: the transform.heading is applied relative to the current heading of the system.

Arguments

  • sys_struct::SystemStructure: The system model to update.
source
SymbolicAWEModels.update_sys_struct!Function
update_sys_struct!(s::SymbolicAWEModel, sys_struct::SystemStructure, integ=s.integrator)

Updates the high-level SystemStructure from the low-level integrator state vector.

This function reads the raw state vector from the ODE integrator and uses the generated getter functions to populate the human-readable fields in the SystemStructure. This synchronization step is crucial for making the simulation results accessible.

source
SymbolicAWEModels.get_set_hashFunction
get_set_hash(set::Settings; fields)

Calculates a SHA1 hash for a subset of fields in the Settings object. This is used to check if a cached model is still valid.

source
SymbolicAWEModels.get_sys_struct_hashFunction
get_sys_struct_hash(sys_struct::SystemStructure)

Calculates a SHA1 hash for the topology of a SystemStructure. This is used to check if a cached model is still valid.

source

Physics and Geometry Helpers

SymbolicAWEModels.calc_headingFunction
calc_heading(R_t_w, R_v_w)

Calculate the heading angle [rad] of the wing. Heading is the rotation angle between the tether frame and the view frame around the common z-axis.

source
SymbolicAWEModels.calc_R_t_wFunction
calc_R_t_w(wing_pos)

Calculate the rotation matrix from the local tether frame (_t) to the world frame (_w).

The tether frame is a local spherical coordinate system:

  • z-axis: Aligned with the tether (radial direction).
  • y-axis: Azimuthal direction, parallel to the XY plane.
  • x-axis: Elevation direction, tangent to the sphere (y × z).
source
SymbolicAWEModels.calc_R_v_wFunction
calc_R_v_w(wing_pos, e_x)

Calculate the rotation matrix from the view frame (_v) to the world frame (_w).

The view frame is defined with its z-axis pointing from the origin to the wing, and its x-axis aligned with the wing's x-axis projected onto the view plane.

source
SymbolicAWEModels.calc_posFunction
calc_pos(wing::RamAirWing, gamma, frac)

Calculate a position on the kite based on spanwise (gamma) and chordwise (frac) parameters.

source
SymbolicAWEModels.calc_winch_forceFunction
calc_winch_force(tether_vel, tether_acc, motor_torque, set)

Calculate the tensile force on the winch tether based on its motion and motor torque.

This function uses a settings object to define the physical parameters of the winch.

Arguments

  • tether_vel: The velocity of the tether [m/s].
  • tether_acc: The acceleration of the tether [m/s²].
  • motor_torque: The torque applied by the motor [Nm].
  • set: A settings struct.

Returns

  • The calculated force on the winch tether [N].
source
SymbolicAWEModels.find_axis_pointFunction
find_axis_point(P, l, v=[0,0,1])

Calculate the coordinates of a point Q that lies on a line defined by vector v and is at a distance l from a given point P.

source
SymbolicAWEModels.get_base_posFunction
get_base_pos(transform::Transform, wings, points)

Get the base position for a given transform, resolving chained transforms if necessary.

source

Equations and System Management

SymbolicAWEModels.create_sys!Function
create_sys!(s::SymbolicAWEModel, system::SystemStructure; prn=true)

Create the full ModelingToolkit.ODESystem for the AWE model.

This is the main top-level function that orchestrates the generation of the entire set of differential-algebraic equations (DAEs). It calls specialized sub-functions to build the equations for each part of the system (forces, wing dynamics, scalar kinematics, linearized aerodynamics) and assembles them into a single System.

Arguments

  • s::SymbolicAWEModel: The main model object to be populated with the system.
  • system::SystemStructure: The physical structure definition.
  • prn::Bool=true: If true, print progress information during system creation.

Returns

  • set_values: The symbolic variable representing the control inputs (winch torques).
source
SymbolicAWEModels.scalar_eqs!Function
scalar_eqs!(s, eqs, psys, pset; kwargs...)

Generate equations for derived scalar kinematic quantities useful for control and analysis.

This includes elevation, azimuth, heading, course, angle of attack, and their time derivatives, as well as apparent wind calculations.

Arguments

  • s::SymbolicAWEModel: The main model object.
  • eqs, psys, pset: Accumulating vectors and symbolic parameters.
  • kwargs...: Symbolic variables for the system's state.

Returns

  • eqs: The updated list of system equations.
source
SymbolicAWEModels.wing_eqs!Function
wing_eqs!(s, eqs, psys, pset, defaults; kwargs...)

Generate the differential equations for the wing's rigid body dynamics.

This function builds the equations for:

  • Quaternion kinematics for the wing's orientation.
  • Euler's rotation equations for the angular acceleration.
  • Newton's second law for the translational motion of the wing's center of mass.

Arguments

  • s::SymbolicAWEModel: The main model object.
  • eqs, psys, pset, defaults: Accumulating vectors and symbolic parameters.
  • kwargs...: Symbolic variables for forces, moments, and states.

Returns

  • A tuple (eqs, defaults) containing the updated equation and default value lists.
source
SymbolicAWEModels.linear_vsm_eqs!Function
linear_vsm_eqs!(s, eqs, guesses, psys; kwargs...)

Generate linearized aerodynamic equations using the Vortex Step Method (VSM).

This function approximates the aerodynamic forces and moments using a first-order Taylor expansion around a pre-calculated operating point. The Jacobian of the aerodynamic forces w.r.t. the state variables is provided via symbolic parameters.

Arguments

  • s::SymbolicAWEModel: The main model object.
  • eqs, guesses, psys: Accumulating vectors and symbolic parameters.
  • kwargs...: Symbolic variables for aerodynamic and state quantities.

Returns

  • A tuple (eqs, guesses) containing the updated equation and guess lists.
source
SymbolicAWEModels.force_eqs!Function
force_eqs!(s, system, psys, pset, eqs, defaults, guesses; kwargs...)

Generate the force and constraint equations for the mass-spring-damper components.

This function builds the core dynamic and kinematic equations for all parts of the tether and bridle system, including points, segments, pulleys, winches, and the deformable groups on the wing.

Arguments

  • s::SymbolicAWEModel: The main model object.
  • system::SystemStructure: The physical structure definition.
  • psys, pset: Symbolic parameters representing system and s.set.
  • eqs, defaults, guesses: The accumulating vectors for the MTK system.
  • kwargs...: Symbolic variables for the system's state (e.g., R_b_w, wing_pos).

Returns

  • A tuple (eqs, defaults, guesses, tether_wing_force, tether_wing_moment) containing the updated equation lists and the aggregate forces and moments exerted by the tethers on the wing.
source
SymbolicAWEModels.linearize_vsm!Function
linearize_vsm!(s::SymbolicAWEModel, integ=s.integrator)

Update the linearized aerodynamic model from the Vortex Step Method (VSM).

This function takes the current kinematic state of the wing (apparent wind, angular velocity, twist angles), linearizes the VSM aerodynamics around this operating point, and updates the Jacobian (vsm_jac) and the steady-state forces (vsm_x) in the SystemStructure. This is typically called periodically during a simulation.

source
SymbolicAWEModels.jacobianFunction
jacobian(f::Function, x::AbstractVector, ϵ::AbstractVector) -> Matrix

Numerically compute the Jacobian of a vector-valued function f at point x.

This function uses a simple forward finite difference method to approximate the partial derivatives of f with respect to each component of x.

Arguments

  • f::Function: The function to differentiate (y = f(x)).
  • x::AbstractVector: The point at which to evaluate the Jacobian.
  • ϵ::AbstractVector: A vector of perturbation sizes for each component of x.

Returns

  • Matrix: The Jacobian matrix J, where J[i, j] = ∂f[i] / ∂x[j].
source
SymbolicAWEModels.load_serialized_model!Function
load_serialized_model!(sam, model_path; remake=false, reload=false)

Load a serialized model from disk if it is valid.

A model is considered valid if its settings and system structure hashes match the current ones in the SymbolicAWEModel object (sam).

Arguments

  • sam::SymbolicAWEModel: The main model object.
  • model_path::String: The path to the serialized model file.
  • remake::Bool: If true, forces the model to be considered invalid, triggering a rebuild.
  • reload::Bool: If true, forces reloading from disk even if the model is already in memory.

Returns

  • true if a valid model was successfully loaded into sam.serialized_model, false otherwise.
source
SymbolicAWEModels.maybe_create_lin_prob!Function
maybe_create_lin_prob!(sam, outputs; ...)

Create and cache the LinearizationProblem if it does not exist or if the outputs have changed.

Arguments

  • sam::SymbolicAWEModel: The main model object.
  • outputs: A vector of output variables for the linearization.
  • create_lin_prob::Bool: Flag to enable/disable creation.
  • outputs_changed::Bool: Flag indicating if the output vector has changed.
  • prn::Bool: Flag to enable/disable printing of progress messages.

Returns

  • true if a new problem was created, false otherwise.
source
SymbolicAWEModels.maybe_create_control_functions!Function
maybe_create_control_functions!(sam, outputs; ...)

Create and cache the control functions if they do not exist or if the outputs have changed.

Arguments

  • sam::SymbolicAWEModel: The main model object.
  • outputs: A vector of output variables for the control functions.
  • create_control_func::Bool: Flag to enable/disable creation.
  • outputs_changed::Bool: Flag indicating if the output vector has changed.
  • prn::Bool: Flag to enable/disable printing of progress messages.

Returns

  • true if new functions were created, false otherwise.
source
SymbolicAWEModels.maybe_create_prob!Function
maybe_create_prob!(sam; create_prob=true, prn=true)

Create and cache the ODEProblem if it does not already exist.

This function compiles the full system, creates the ODEProblem, and generates the necessary getter/setter functions.

Arguments

  • sam::SymbolicAWEModel: The main model object.
  • create_prob::Bool: A flag to enable or disable the creation of the problem.
  • prn::Bool: A flag to enable or disable printing of progress messages.

Returns

  • true if a new problem was created, false otherwise.
source
SymbolicAWEModels.maybe_create_simple_lin_model!Function
maybe_create_simple_lin_model!(sam, outputs; ...)

Create and cache a simplified linear model if it does not exist or if the outputs have changed.

Arguments

  • sam::SymbolicAWEModel: The main model object.
  • outputs: A vector of output variables for the linear model.
  • create_simple_lin_model::Bool: Flag to enable/disable creation.
  • outputs_changed::Bool: Flag indicating if the output vector has changed.
  • prn::Bool: Flag to enable/disable printing of progress messages.

Returns

  • true if a new model was created, false otherwise.
source
SymbolicAWEModels.generate_control_funcsFunction
generate_control_funcs(model, inputs, outputs)

Generate in-place and out-of-place control functions from a ModelingToolkit system.

This function wraps ModelingToolkit.generate_control_function and ModelingToolkit.build_explicit_observed_function to create the necessary functions for simulation and analysis.

Arguments

  • model: The full ODESystem.
  • inputs: A vector of input variables.
  • outputs: A vector of output variables.

Returns

  • A NamedTuple containing the generated functions (f_oop, f_ip, h_oop, h_ip), system dimensions (nu, nx, ny), and symbolic variables (dvs, psym, io_sys).
source
SymbolicAWEModels.generate_simple_lin_modelFunction
generate_simple_lin_model(sys_struct, sys, y_vec)

Generate a simplified linear state-space model for a single-wing system.

This model is a minimal representation suitable for simple controllers, focusing on heading, turn rate, and tether dynamics.

Arguments

  • sys_struct::SystemStructure: The structure defining the system topology.
  • sys::ODESystem: The compiled ModelingToolkit system.
  • y_vec: A vector of output variables for the linear model.

Returns

  • A NamedTuple containing the state-space matrices (model), and getters for the state (get_x), state derivatives (get_dx), and outputs (get_y). Returns nothing for all fields if the system does not have exactly one wing.
source
SymbolicAWEModels.generate_lin_gettersFunction
generate_lin_getters(sys)

Generate setter functions for the parameters of a linearized system.

Arguments

  • sys: The linearized ModelingToolkit system.

Returns

  • A NamedTuple containing setter functions for the winch set-points (set_set_values), the system structure parameters (set_sys), and the settings parameters (set_set).
source
SymbolicAWEModels.generate_prob_gettersFunction
generate_prob_getters(sys_struct, sys)

Generate getter and setter functions for the state variables of the full system model.

These functions provide a convenient way to access and modify the state and parameters of the compiled ODESystem (sys).

Arguments

  • sys_struct::SystemStructure: The structure defining the system topology.
  • sys::ODESystem: The compiled ModelingToolkit system.

Returns

  • A NamedTuple containing various getter and setter functions for different parts of the system state.
source
SymbolicAWEModels.LinProbWithAttributesType
@with_kw struct LinProbWithAttributes{SetLinSetValues, SetLinSys, SetLinSet, LinOut}

A container for the general-purpose linearization problem and the resulting full linearized model (A,B,C,D matrices).

  • prob::ModelingToolkit.LinearizationProblem: Linearization problem of the mtk model.

  • set_set_values::Any

  • set_sys::Any

  • set_set::Any

source
SymbolicAWEModels.ProbWithAttributesType
@with_kw struct ProbWithAttributes{...}

A container for the main Ordinary Differential Equation (ODE) problem and its associated getter and setter functions for the full, nonlinear physical state.

source
SymbolicAWEModels.ControlFuncWithAttributesType
@with_kw struct ControlFuncWithAttributes{FIP, FOOP, HIP, HOOP, DVS, PSYM}

A container for callable control functions and their symbolic representations, generated from the full system model.

  • f_ip::Any: In-place dynamics function f(dx, x, u, p, t).

  • f_oop::Any: Out-of-place dynamics function dx = f(x, u, p, t).

  • h_ip::Any: In-place observation function h(y, x, u, p, t).

  • h_oop::Any: Out-of-place observation function y = h(x, u, p, t).

  • nu::Int64: Number of inputs (u).

  • nx::Int64: Number of states (x).

  • ny::Int64: Number of outputs (y).

  • dvs::Any: The symbolic state vector.

  • psym::Any: The symbolic parameter vector.

  • io_sys::ModelingToolkit.System: The generated input-output system.

source

Utility and Internal Functions

SymbolicAWEModels.get_model_nameFunction
get_model_name(set::Settings; precompile=false)

Constructs a unique filename for the serialized model based on its configuration. The filename includes the Julia version, physical model, dynamics type, and number of segments to ensure that the correct cached model is loaded.

source
SymbolicAWEModels.posFunction
pos(s::SymbolicAWEModel)

Returns a vector of the position vectors [m] for each point in the system.

source
SymbolicAWEModels.calc_spring_propsFunction
calc_spring_props(sam, tether_sam; prn=false) -> (Vector, Vector, Matrix, Float64)

Calculate the equivalent axial stiffness and damping, and return the step response data.

This function orchestrates the process by performing a step response test on the tether_sam model and then analyzing the resulting tether length data.

Arguments

  • sam::SymbolicAWEModel: The reference model, used for its physical properties.
  • tether_sam::SymbolicAWEModel: A copy of the model to perform the step test on.

Keywords

  • prn::Bool=false: If true, enables printing of intermediate results.

Returns

  • Tuple{Vector{Float64}, Vector{Float64}, Matrix{Float64}, Float64}: A tuple containing:
    1. axial_stiffness [N]
    2. axial_damping [Ns]
    3. tether_lens (the step response data)
    4. dt (the simulation time step)
source
calc_spring_props(sam, tether_lens, F_step; p=5, prn=false) -> (Vector, Vector)

Calculate spring constant k and damping coefficient c from a step response.

This function analyzes the time series of tether lengths (tether_lens) resulting from a step force (F_step) to estimate the parameters of an equivalent second-order mass-spring-damper system.

Arguments

  • sam::SymbolicAWEModel: The model from which to take physical parameters (mass).
  • tether_lens::Matrix{Float64}: A matrix of tether length time series data.
  • F_step::Float64: The magnitude of the applied step force.

Keywords

  • p::Int=5: The percentage band used to determine the settling time.
  • prn::Bool=false: If true, enables printing of detailed calculations.

Returns

  • Tuple{Vector{Float64}, Vector{Float64}}: A tuple containing two vectors:
    1. k_values (spring constants [N/m])
    2. c_values (damping coefficients [Ns/m])
source
SymbolicAWEModels.set_v_wind_ground!Function
set_v_wind_ground!(s::SymbolicAWEModel, v_wind_gnd=s.set.v_wind, upwind_dir=-π/2)

Sets the ground wind speed [m/s] and upwind direction [rad] in the model.

source
SymbolicAWEModels.in_percent_bandFunction
in_percent_band(x, steady, delta_x, i, p) -> Bool

Helper function to check if a time series has settled within a percentage band.

It checks if all values of the time series x from index i to the end are within a tolerance band defined by p percent of the total change delta_x.

source
SymbolicAWEModels.stepFunction
step(sam, steps, F_step, F_0; abs_tol, consecutive_steps_needed, prn) -> Matrix

Apply a step force to a model and simulate its dynamic response.

This function records the length of each tether over a specified number of simulation steps. It includes an early exit condition if the system's state settles.

Arguments

  • sam::SymbolicAWEModel: The model to be simulated.
  • steps::Int: The total number of simulation steps.
  • F_step::Float64: The magnitude of the step force to apply.
  • F_0::Vector{KVec3}: The initial force vector for each tether attachment point.

Keywords

  • abs_tol::Float64=1e-6: Absolute tolerance for the settling check.
  • consecutive_steps_needed::Int=10: Number of consecutive steps required to be within tolerance to be considered settled.
  • prn::Bool=false: If true, enables printing of status messages.

Returns

  • Matrix{Float64}: A matrix where each row corresponds to a tether and each column to a time step, containing the tether lengths.
source
SymbolicAWEModels.create_model_archiveFunction
create_model_archive(source_dir, archive_path)

Finds all model*.bin files in the source_dir, copies them to a temporary directory, and compresses that directory into a .tar.gz archive at the specified archive_path.

source
SymbolicAWEModels.filecmpFunction
filecmp(path1::AbstractString, path2::AbstractString) -> Bool

Compare two files byte-by-byte to check if they are identical.

source
SymbolicAWEModels.extract_model_archiveFunction
extract_model_archive(archive_path, dest_dir)

Safely decompress a .tar.gz file by first extracting to a temporary directory and then copying the contents to the final destination.

Arguments

  • archive_path::String: The path to the .tar.gz file to be extracted.
  • dest_dir::String: The path to the target directory.
source
SymbolicAWEModels.copy_dirFunction
copy_dir(src_dir, dst_dir)

Copies all files from src_dir to dst_dir. Overwrites existing files if force=true. Creates dst_dir if it does not exist.

source
SymbolicAWEModels.get_example_packagesFunction
get_example_packages()

Get the list of packages from examples/Project.toml, excluding SymbolicAWEModels itself. This ensures init_module installs the correct dependencies for running examples.

source

Base Overloads (Internal Use)

Base.getindexFunction
Base.getindex(x::ModelingToolkit.Symbolics.SymArray, idxs::Vector{Int16})

Extend Base.getindex to allow indexing a symbolic array with a vector of integer indices, which is not natively supported by ModelingToolkit.

source
Base.getpropertyFunction
Base.getproperty(pa::ProbWithAttributes, sym::Symbol)

Overloads getproperty to provide convenient access to the simplified system (sys) contained within the ODE problem's function definition.

source
Base.getproperty(sam::SymbolicAWEModel, sym::Symbol)

Overloads getproperty to allow direct access to fields within the nested serialized_model. This provides a convenient way to access compiled functions and other model components without explicitly referencing sam.serialized_model.

source
Base.setproperty!Function
Base.setproperty!(sam::SymbolicAWEModel, sym::Symbol, val)

Overloads setproperty! to allow direct setting of fields within the nested serialized_model. This allows you to change properties of the compiled model as if they were fields of the SymbolicAWEModel itself.

source

Plotting Recipes (Internal Use)

RecipesBase.apply_recipeFunction
@recipe function f(sys::SystemStructure; zoom=false, front=false, kite_pos=nothing, reltime=nothing)

A plot recipe for a SystemStructure type (assumed to be defined, e.g., in SymbolicAWEModels.jl) using RecipesBase.jl.

This recipe allows plotting a SystemStructure in 2D, showing either a side view (X-Z plane) or a front view (Y-Z plane). It supports zooming in on the last point of the system (assumed to be the kite or primary object of interest).

Type Assumptions for SystemStructure

This recipe assumes SystemStructure has fields:

  • points::Vector{Point}: Where each Point object has a pos_w field (e.g., p.pos_w) that yields a 3D position vector (like SVector{3, Float64}).
  • segments::Vector{Segment}: Where each Segment object has a points field (e.g., seg.points) that yields a tuple of two integers, representing 1-based indices into the sys.points vector.

Adjust field access within the recipe if your struct definitions differ.

Attributes

These can be passed as keyword arguments to the plot call:

  • zoom::Bool (default: get(plotattributes, :zoom, false)): If true, the plot view zooms in on the last point in sys.points.
  • front::Bool (default: get(plotattributes, :front, false)): If true, shows the front view (Y-Z). Otherwise, shows the side view (X-Z).
  • kite_pos::Union{AbstractVector{<:Real}, Nothing} (default: get(plotattributes, :kite_pos, nothing)): Optionally, an additional 3D position vector (e.g., SVector{3, Float64}(x,y,z) or [x,y,z]) to be plotted as a distinct point. This point is included in zoom calculations if zoom is true and kite_pos is the last effective point.
  • reltime::Union{Real, Nothing} (default: get(plotattributes, :reltime, nothing)): If provided, sets the plot title to "Time: [reltime] s".

Example

# Make sure SystemStructure, Point, Segment are defined and you have an instance `my_system`.
# using Plots # Or any other RecipesBase-compatible plotting backend

# Basic side view
# plot(my_system)

# Zoomed side view
# plot(my_system, zoom=true)

# Front view
# plot(my_system, front=true)

# Zoomed front view with a specific kite position and time display
# extra_kite_marker = SVector(10.0, 2.0, 30.0) # Or KVec3(10.0, 2.0, 30.0)
# current_time = 1.23
# plot(my_system, zoom=true, front=true, kite_pos=extra_kite_marker, reltime=current_time)
source