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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
SPDX-FileCopyrightText: 2025 Uwe Fechner, Bart van de Lint
SPDX-License-Identifier: MIT
-->
### KiteModels v0.11.20 - unreleased
#### Changed
- Requires KiteUtils 0.12. `SysState(kps)` builds a single-winch, single-tether state,
so `winch_force`, `l_tether`, `v_reelout`, `set_force`, `set_torque` and `set_speed` hold one
value instead of four.

### KiteModels v0.11.19 2026-10-10
#### Fixed
- The state of the winch (brake on/off, rate limited set speed) is now updated once per time step
Expand Down
18 changes: 9 additions & 9 deletions Manifest-v1.12.toml.default
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.12.7"
manifest_format = "2.0"
project_hash = "a65497c5784386dc8f131591d94591ac9efaf61b"
project_hash = "3333971938da7090e3107cbd985b6065354118c9"

[[deps.ADTypes]]
deps = ["PrecompileTools"]
Expand Down Expand Up @@ -162,9 +162,9 @@ version = "1.11.0"

[[deps.AtmosphericModels]]
deps = ["FFTW", "HypergeometricFunctions", "KiteUtils", "LinearAlgebra", "MeshGrid", "NPZ", "Printf", "Random", "SHA", "Scratch", "StableRNGs", "Statistics"]
git-tree-sha1 = "542e1acd424d4263392352bb6150934b6140b419"
git-tree-sha1 = "44f7988132487cd264e9f2f765f07f770cab1244"
uuid = "c59cac55-771d-4f45-b14d-1c681463a295"
version = "0.3.8"
version = "0.3.12"

[[deps.Automa]]
deps = ["PrecompileTools", "TranscodingStreams"]
Expand Down Expand Up @@ -1360,21 +1360,21 @@ version = "0.11.19"

[[deps.KitePodModels]]
deps = ["DocStringExtensions", "KiteUtils", "Reexport"]
git-tree-sha1 = "57f6f71a75d2d26f199a64c03a03796139c540f4"
git-tree-sha1 = "a54b0d8d4e011b2c8e6135322b1e57d2f2d250be"
uuid = "9de5dc81-f971-414a-927b-652b2f41c539"
version = "0.4.0"
version = "0.4.2"

[[deps.KiteUtils]]
deps = ["Arrow", "CSV", "DocStringExtensions", "LinearAlgebra", "OrderedCollections", "Parameters", "Parsers", "Pkg", "PrecompileTools", "RecursiveArrayTools", "ReferenceFrameRotations", "Rotations", "StaticArrays", "StructArrays", "StructTypes", "YAML"]
git-tree-sha1 = "0d7307b9656072383b235e7b4e6ca546bc3fd7ae"
git-tree-sha1 = "fbeb8355b4797ffc263320be2dc74dcdbe9310fc"
uuid = "90980105-b163-44e5-ba9f-8b1c83bb0533"
version = "0.11.13"
version = "0.12.2"

[[deps.KiteViewers]]
deps = ["FileIO", "GLMakie", "GeometryBasics", "Joysticks", "KiteUtils", "LinearAlgebra", "Parameters", "Pkg", "PrecompileTools", "Printf", "Reexport", "Rotations", "StaticArrays", "StructArrays", "Timers"]
git-tree-sha1 = "cae633ece41d23e572fd5bce01440cee7912d45a"
git-tree-sha1 = "ba3472753e0fda3b2436936ad12c763c9fd660b7"
uuid = "2e593061-95e7-45e4-95f4-df0491f2e601"
version = "0.5.2"
version = "0.6.0"

[[deps.Krylov]]
deps = ["LinearAlgebra", "Printf", "SparseArrays"]
Expand Down
18 changes: 9 additions & 9 deletions Manifest-v1.13.toml.default
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.13.1"
manifest_format = "2.1"
project_hash = "f8b0f821fe4582a1e16d8efad9295a469ad2e37e"
project_hash = "15bc8be9d852005d661871bfa51ace960c21e8ae"

[[deps.ADTypes]]
deps = ["PrecompileTools"]
Expand Down Expand Up @@ -176,10 +176,10 @@ version = "1.11.0"

[[deps.AtmosphericModels]]
deps = ["FFTW", "HypergeometricFunctions", "KiteUtils", "LinearAlgebra", "MeshGrid", "NPZ", "Printf", "Random", "SHA", "Scratch", "StableRNGs", "Statistics"]
git-tree-sha1 = "542e1acd424d4263392352bb6150934b6140b419"
git-tree-sha1 = "44f7988132487cd264e9f2f765f07f770cab1244"
registries = "General"
uuid = "c59cac55-771d-4f45-b14d-1c681463a295"
version = "0.3.8"
version = "0.3.12"

[[deps.Automa]]
deps = ["PrecompileTools", "TranscodingStreams"]
Expand Down Expand Up @@ -1517,24 +1517,24 @@ version = "0.11.19"

[[deps.KitePodModels]]
deps = ["DocStringExtensions", "KiteUtils", "Reexport"]
git-tree-sha1 = "57f6f71a75d2d26f199a64c03a03796139c540f4"
git-tree-sha1 = "a54b0d8d4e011b2c8e6135322b1e57d2f2d250be"
registries = "General"
uuid = "9de5dc81-f971-414a-927b-652b2f41c539"
version = "0.4.0"
version = "0.4.2"

[[deps.KiteUtils]]
deps = ["Arrow", "CSV", "DocStringExtensions", "LinearAlgebra", "OrderedCollections", "Parameters", "Parsers", "Pkg", "PrecompileTools", "RecursiveArrayTools", "ReferenceFrameRotations", "Rotations", "StaticArrays", "StructArrays", "StructTypes", "YAML"]
git-tree-sha1 = "0d7307b9656072383b235e7b4e6ca546bc3fd7ae"
git-tree-sha1 = "fbeb8355b4797ffc263320be2dc74dcdbe9310fc"
registries = "General"
uuid = "90980105-b163-44e5-ba9f-8b1c83bb0533"
version = "0.11.13"
version = "0.12.2"

[[deps.KiteViewers]]
deps = ["FileIO", "GLMakie", "GeometryBasics", "Joysticks", "KiteUtils", "LinearAlgebra", "Parameters", "Pkg", "PrecompileTools", "Printf", "Reexport", "Rotations", "StaticArrays", "StructArrays", "Timers"]
git-tree-sha1 = "cae633ece41d23e572fd5bce01440cee7912d45a"
git-tree-sha1 = "ba3472753e0fda3b2436936ad12c763c9fd660b7"
registries = "General"
uuid = "2e593061-95e7-45e4-95f4-df0491f2e601"
version = "0.5.2"
version = "0.6.0"

[[deps.Krylov]]
deps = ["LinearAlgebra", "Printf", "SparseArrays"]
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ DiscretePIDs = "0.1.5, 1.0"
DocStringExtensions = "0.9.4"
Interpolations = "0.15.1, 0.16"
KitePodModels = "0.4.0"
KiteUtils = "0.11.8"
KiteUtils = "0.12"
LinearAlgebra = "1.11, 1.12"
LinearSolve = "3.59"
Logging = "1.11, 1.12"
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ KiteModels = {path = ".."}
[compat]
Documenter = "1.11"
KitePodModels = "0.4"
KiteUtils = "0.7, 0.8, 0.9, 0.10, 0.11"
KiteUtils = "0.7, 0.8, 0.9, 0.10, 0.11, 0.12"
OpenSSL_jll = "3.0.0"
julia = "1.12, 1.13"
2 changes: 1 addition & 1 deletion examples_3d/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ KiteModels = {path = ".."}
[compat]
MakieControlPlots = "0.1.4"
KiteModels = "0.11.0"
KiteViewers = "0.5.1"
KiteViewers = "0.5.1, 0.6"
julia = "1.12, 1.13"
26 changes: 7 additions & 19 deletions src/KiteModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -534,16 +534,16 @@ function update_sys_state!(ss::SysState, s::AKM, zoom=1.0)
d_az = atan(sin(new_azimuth - ss.azimuth), cos(new_azimuth - ss.azimuth))
ss.azimuth_rate = d_az / dt
ss.azimuth = new_azimuth
ss.winch_force .= [winch_force(s); 0; 0; 0]
ss.winch_force[1] = winch_force(s)
new_heading = calc_heading(s)
# Use shortest-angle difference to avoid artificial spikes at wrap boundaries
d_psi = atan(sin(new_heading - ss.heading), cos(new_heading - ss.heading))
ss.heading_rate = d_psi / dt
ss.heading = new_heading
ss.course = calc_course(s)
ss.v_app = norm(s.v_apparent)
ss.l_tether .= [s.l_tether; 0; 0; 0]
ss.v_reelout .= [s.v_reel_out; 0; 0; 0]
ss.l_tether[1] = s.l_tether
ss.v_reelout[1] = s.v_reel_out
ss.depower = s.depower
ss.steering = s.steering/s.set.cs_4p
ss.kcu_steering = s.kcu_steering/s.set.cs_4p
Expand All @@ -553,11 +553,7 @@ function update_sys_state!(ss::SysState, s::AKM, zoom=1.0)
if isa(s, KPS4)
ss.alpha3 = deg2rad(s.alpha_3)
ss.alpha4 = deg2rad(s.alpha_4)
if isnothing(s.set_force)
ss.set_force .= [NaN, 0, 0, 0]
else
ss.set_force .= [s.set_force, 0, 0, 0]
end
ss.set_force[1] = something(s.set_force, NaN)
if isnothing(s.bearing)
ss.bearing = NaN
else
Expand All @@ -570,16 +566,8 @@ function update_sys_state!(ss::SysState, s::AKM, zoom=1.0)
end
end
ss.set_steering = s.kcu.set_steering
if isnothing(s.set_torque)
ss.set_torque .= [NaN, 0, 0, 0]
else
ss.set_torque .= [s.set_torque, 0, 0, 0]
end
if isnothing(s.sync_speed)
ss.set_speed .= [NaN, 0, 0, 0]
else
ss.set_speed .= [s.sync_speed, 0, 0, 0]
end
ss.set_torque[1] = something(s.set_torque, NaN)
ss.set_speed[1] = something(s.sync_speed, NaN)
ss.roll, ss.pitch, ss.yaw = orient_euler(s)
# Calculate body turn rate around z-axis using Erhard and Strauch (2013) formula
# psi_m = psi - phi_dot * cos(theta)
Expand All @@ -604,7 +592,7 @@ system state in a viewer. Optionally the position arrays can be zoomed
according to the requirements of the viewer.
"""
function SysState(s::AKM, zoom=1.0)
ss = SysState{length(s.pos)}()
ss = SysState(length(s.pos))
update_sys_state!(ss, s, zoom)
ss
end
Expand Down
17 changes: 8 additions & 9 deletions test/test-update-sys-state.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ end
@test ss.v_wind_gnd ≈ kps4.v_wind_gnd
@test ss.v_wind_kite ≈ kps4.v_wind
@test ss.v_wind_200m ≈ kps4.v_wind_gnd * calc_wind_factor(kps4.am, 200.0)
# the winch quantities are scalars on a single-tether model, in slot 1 of a 4-tether vector
@test ss.winch_force ≈ [winch_force(kps4), 0, 0, 0]
@test ss.l_tether ≈ [kps4.l_tether, 0, 0, 0]
@test ss.v_reelout ≈ [kps4.v_reel_out, 0, 0, 0]
@test ss.winch_force ≈ [winch_force(kps4)]
@test ss.l_tether ≈ [kps4.l_tether]
@test ss.v_reelout ≈ [kps4.v_reel_out]
end

@testset "update_sys_state! zoom" begin
Expand All @@ -75,7 +74,7 @@ end
ss = SysState(kps4)
next_step!(kps4, integrator; set_speed=0.5, dt=DT)
update_sys_state!(ss, kps4)
@test ss.set_speed ≈ [0.5, 0, 0, 0]
@test ss.set_speed ≈ [0.5]
# a set value of `nothing` is logged as NaN, not as zero
@test isnan(ss.set_torque[1])
@test isnan(ss.set_force[1])
Expand All @@ -89,8 +88,8 @@ end
kps4.attractor = SVector(0.1, 0.7)
update_sys_state!(ss, kps4)
@test isnan(ss.set_speed[1])
@test ss.set_torque ≈ [-20.0, 0, 0, 0]
@test ss.set_force ≈ [1200.0, 0, 0, 0]
@test ss.set_torque ≈ [-20.0]
@test ss.set_force ≈ [1200.0]
@test ss.bearing ≈ 0.3
@test ss.attractor ≈ [0.1, 0.7]
end
Expand Down Expand Up @@ -131,10 +130,10 @@ end
@test ss.elevation ≈ calc_elevation(kps3)
@test ss.azimuth ≈ calc_azimuth(kps3)
@test ss.heading ≈ calc_heading(kps3)
@test ss.l_tether ≈ [kps3.l_tether, 0, 0, 0]
@test ss.l_tether ≈ [kps3.l_tether]
# set_force, bearing and attractor are KPS4 only and keep their defaults here
@test ss.bearing == 0
@test ss.set_force ≈ [0, 0, 0, 0]
@test ss.set_force ≈ [0]
@test ss.attractor ≈ [0, 0]

azimuth_0, heading_0, time_0 = ss.azimuth, ss.heading, ss.time
Expand Down
Loading