Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ times faster.
- the documentation was improved

## Provides
The type [`AbstractKiteModel`](@ref) with the implementation [`KPS3`](@ref), [`KPS4`](@ref) and [`SymbolicAWEModel`](@ref), representing the one point, the four point kite model and the ram air kite model, together with the high level simulation interface consisting of the functions [`init_sim!`](@ref) and [`next_step!`](@ref). Other kite models can be added inside or outside of this package by implementing the non-generic methods required for an AbstractKiteModel.
The types [`KPS3`](@ref), [`KPS4`](@ref) and [`SymbolicAWEModel`](@ref), representing the one point, the four point kite model and the ram air kite model, together with the high level simulation interface consisting of the functions [`init_sim!`](@ref) and [`next_step!`](@ref). Other kite models can be added inside or outside of this package by implementing the non-generic methods required for an AbstractKiteModel.

Additional functions to provide inputs and outputs of the model on each time step. In particular the constructor [`SysState`](@ref) can be called once per time step to create a SysState struct for
logging or for displaying the state in a viewer. For the KPS3 and KPS4 model, once per time step the [`residual!`](@ref) function is called as many times as needed to find the solution at the end
Expand Down
1 change: 0 additions & 1 deletion docs/src/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ CurrentModule = KiteModels
SimFloat
KVec3
SVec3
AbstractKiteModel
AKM
```

Expand Down
6 changes: 6 additions & 0 deletions src/KPS3.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ $(TYPEDFIELDS)
am::AtmosphericModel = AtmosphericModel()
"Reference to winch model as implemented in the package WinchModels"
wm::Union{AbstractWinchModel, Nothing} = nothing
"Integrator, storing the current state"
integrator::Union{OrdinaryDiffEqCore.ODEIntegrator, Nothing} = nothing
"Iterations, number of calls to the function residual!"
iter:: Int64 = 0
"Function for calculation the lift coefficent, using a spline based on the provided value pairs."
Expand Down Expand Up @@ -188,6 +190,10 @@ function KPS3(kcu::KCU)
clear!(s)
return s
end
function KPS3(set::Settings)
kcu = KCU(set)
KPS3(kcu)
end

"""
calc_drag(s::KPS3, v_segment, unit_vector, rho, last_tether_drag, v_app_perp)
Expand Down
6 changes: 6 additions & 0 deletions src/KPS4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ $(TYPEDFIELDS)
am::AtmosphericModel = AtmosphericModel()
"Reference to winch model as implemented in the package WinchModels"
wm::AbstractWinchModel
"Integrator, storing the current state"
integrator::Union{OrdinaryDiffEqCore.ODEIntegrator, Nothing} = nothing
"Iterations, number of calls to the function residual!"
iter:: Int64 = 0
"Function for calculation the lift coefficient, using a spline based on the provided value pairs."
Expand Down Expand Up @@ -233,6 +235,10 @@ function KPS4(kcu::KCU)
clear!(s)
return s
end
function KPS4(set::Settings)
kcu = KCU(set)
KPS4(kcu)
end

"""
calc_particle_forces!(s::KPS4, pos1, pos2, vel1, vel2, spring, segments, d_tether, rho, i)
Expand Down
8 changes: 0 additions & 8 deletions src/KiteModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ Basic 3-dimensional vector, stack allocated, immutable.
"""
const SVec3 = SVector{3, SimFloat}

"""
abstract type AbstractKiteModel

All kite models must inherit from this type. All methods that are defined on this type must work
with all kite models. All exported methods must work on this type.
"""
abstract type AbstractKiteModel end

"""
const AKM = AbstractKiteModel

Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ KiteUtils.set_data_path("")
println("--> 4")
include("test_inertia_calculation.jl")
println("--> 5")
include("test_interface.jl")
println("--> 6")
include("aqua.jl")
end
33 changes: 33 additions & 0 deletions test/test_interface.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SPDX-FileCopyrightText: 2025 Uwe Fechner
# SPDX-License-Identifier: MIT

using KiteModels, KiteUtils, Test

set = load_settings("system.yaml")
kps3::KPS3 = KPS3(set)
kps4::KPS4 = KPS4(set)
set = load_settings("system_ram.yaml")
sam::SymbolicAWEModel = SymbolicAWEModel(set)

@testset "KPS3 constructor interface" begin
@test kps3 isa KiteUtils.AbstractKiteModel
@test kps3.set isa KiteUtils.Settings
@test isnothing(kps3.integrator)
@test kps3.am isa AtmosphericModel
@test kps3.iter isa Int64
end
@testset "KPS4 constructor interface" begin
@test kps4 isa KiteUtils.AbstractKiteModel
@test kps4.set isa KiteUtils.Settings
@test isnothing(kps4.integrator)
@test kps4.am isa AtmosphericModel
@test kps4.iter isa Int64
end
@testset "SymbolicAWEModel constructor interface" begin
@test sam isa KiteUtils.AbstractKiteModel
@test sam.set isa KiteUtils.Settings
@test isnothing(sam.integrator)
@test sam.am isa AtmosphericModel
@test sam.iter isa Int64
end
nothing
Loading