Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
e029fa5
Add simple model
1-Bart-1 Apr 14, 2025
9f95c37
Working simple model
1-Bart-1 Apr 14, 2025
de3da09
Linearize the model
1-Bart-1 Apr 14, 2025
827efbb
Merge branch 'main' into simple
1-Bart-1 Apr 14, 2025
4ae2140
Fix precompilation
1-Bart-1 Apr 14, 2025
5ef3cc9
Working precompilation
1-Bart-1 Apr 14, 2025
05e26fd
Succesful lin
1-Bart-1 Apr 14, 2025
8ccddd4
Create linearization problem
1-Bart-1 Apr 14, 2025
58256d5
Make simple model even simpler
1-Bart-1 Apr 15, 2025
509400f
Stable example
1-Bart-1 Apr 15, 2025
1dac5ef
Working simple example
1-Bart-1 Apr 15, 2025
321c6c3
Update input output
1-Bart-1 Apr 15, 2025
eaf24f1
Merge branch 'simple' into develop
1-Bart-1 Apr 15, 2025
a0fd621
Move init unknowns
1-Bart-1 Apr 15, 2025
d6d387c
Initialize with tether acc
1-Bart-1 Apr 15, 2025
27cc7e9
Reliable in out function
1-Bart-1 Apr 15, 2025
fc74157
Add a prob version as check/baseline
1-Bart-1 Apr 15, 2025
130d9d1
Compare step functions
1-Bart-1 Apr 15, 2025
03be143
Compare step functions
1-Bart-1 Apr 15, 2025
d38a03d
Add back try catch
1-Bart-1 Apr 15, 2025
7896a39
Add name and move functions
1-Bart-1 Apr 15, 2025
210261b
Add polars
1-Bart-1 Apr 16, 2025
4675795
Merge branch 'main' into develop
1-Bart-1 Apr 16, 2025
6b54646
Downgrade MTK
1-Bart-1 Apr 16, 2025
a8b79f0
Passing test with reused model
1-Bart-1 Apr 17, 2025
220db8c
Fix heading calculation
1-Bart-1 Apr 17, 2025
9d60ce7
Check for plot
1-Bart-1 Apr 17, 2025
2853f7b
Check for plot
1-Bart-1 Apr 17, 2025
ef752dc
Add fields to s
1-Bart-1 Apr 17, 2025
2208358
Add fields
1-Bart-1 Apr 17, 2025
f320cd4
Merge branch 'develop' into control2
1-Bart-1 Apr 17, 2025
963c350
Fix state lin
1-Bart-1 Apr 17, 2025
5837f92
Add s from set
1-Bart-1 Apr 18, 2025
f4ef2f5
Lower accuracy
1-Bart-1 Apr 18, 2025
0b5c75b
Add angle of attack
1-Bart-1 Apr 18, 2025
f62df86
Add symbolic aoa
1-Bart-1 Apr 18, 2025
21e65fb
Add todo
1-Bart-1 Apr 18, 2025
3826cdf
Merge branch 'main' into develop
1-Bart-1 Apr 19, 2025
56d01ad
Merge branch 'control2' into develop
1-Bart-1 Apr 19, 2025
47eb290
Fix version name
1-Bart-1 Apr 19, 2025
10a336c
Fix example
1-Bart-1 Apr 19, 2025
69150e9
Merge branch 'main' into develop
1-Bart-1 Apr 19, 2025
245e477
Update MTK
1-Bart-1 Apr 19, 2025
598ca17
Quasi-static init
1-Bart-1 Apr 19, 2025
1eb894b
Fix init bug
1-Bart-1 Apr 20, 2025
9203ca5
Two working examples
1-Bart-1 Apr 20, 2025
d3745a9
Working integ input-output
1-Bart-1 Apr 20, 2025
a746c26
Show that reinit is possible
1-Bart-1 Apr 20, 2025
c94ee59
Add non-adaptive optioin
1-Bart-1 Apr 20, 2025
8b5c3b8
Merge branch 'main' into develop
1-Bart-1 Apr 21, 2025
3c8de85
Add simple twist angle
1-Bart-1 Apr 21, 2025
b63a92b
Add simple twist
1-Bart-1 Apr 22, 2025
cf2b38a
Define var
1-Bart-1 Apr 22, 2025
6ef15a1
Fix bug
1-Bart-1 Apr 22, 2025
09386f9
Add front frac var
1-Bart-1 Apr 22, 2025
e2f4405
Rotate around le
1-Bart-1 Apr 23, 2025
c9515b8
Working ram and simple ram example
1-Bart-1 Apr 23, 2025
663b858
Not all need compression frac
1-Bart-1 Apr 24, 2025
5034820
Very fast
1-Bart-1 Apr 24, 2025
9494544
Fix example
1-Bart-1 Apr 24, 2025
4bfafbd
Merge branch 'main' into develop
1-Bart-1 Apr 24, 2025
542683f
Updade nonlinearsolve
1-Bart-1 Apr 28, 2025
7e3cbc5
Merge branch 'main' into develop
1-Bart-1 Apr 28, 2025
f363bdc
Fix ram test
1-Bart-1 Apr 30, 2025
db25e1f
Update packages
1-Bart-1 Apr 30, 2025
f1afce1
Merge branch 'main' into develop
1-Bart-1 Apr 30, 2025
c7f8bb3
Better initial state
1-Bart-1 Apr 30, 2025
dfeb22b
Fixed omega z
1-Bart-1 Apr 30, 2025
e0b4d12
Small fixes
1-Bart-1 Apr 30, 2025
06fa596
Merge branch 'stabilize' into develop
1-Bart-1 Apr 30, 2025
22a90e0
Fix first init bug
1-Bart-1 Apr 30, 2025
10634e4
Add julia version arg
1-Bart-1 Apr 30, 2025
34b92e7
Fix test and example
1-Bart-1 Apr 30, 2025
55457f2
Improve scripts
1-Bart-1 May 1, 2025
d1a6688
Delete old prob defaults
1-Bart-1 May 1, 2025
71bf97e
Rebuild sys
1-Bart-1 May 1, 2025
74afd94
Fix test and stiff unknowns
1-Bart-1 May 1, 2025
8f5c15b
Align z axis
1-Bart-1 May 3, 2025
bcd0cae
Example working well
1-Bart-1 May 3, 2025
eecfc86
Working example
1-Bart-1 May 3, 2025
a1215bd
Merge branch 'main' into align-z
1-Bart-1 May 5, 2025
e1bbc3a
Short SysState function
1-Bart-1 May 5, 2025
f6d29dc
Add more relax
1-Bart-1 May 5, 2025
59f34b5
Fast non adaptive
1-Bart-1 May 5, 2025
31c6d30
Use new sysstate fields
1-Bart-1 May 5, 2025
f429ea8
Use default init alg
1-Bart-1 May 5, 2025
0d3d1d4
Update for simple
1-Bart-1 May 5, 2025
4eee0e2
Merge branch 'sysstate1' into develop
1-Bart-1 May 5, 2025
c9d8ade
Working input output
1-Bart-1 May 5, 2025
fc151cc
Tests pass
1-Bart-1 May 5, 2025
b1d24de
Working examples
1-Bart-1 May 5, 2025
d9d60f5
Remove unneccesary show
1-Bart-1 May 5, 2025
f1ab7ae
Update manifests
1-Bart-1 May 5, 2025
ff0b843
Add discrete example
1-Bart-1 May 7, 2025
b5b11ea
Small fixes
1-Bart-1 May 10, 2025
53ee00f
Merge branch 'main' into develop
1-Bart-1 May 10, 2025
ac3d787
Add linear model
1-Bart-1 May 10, 2025
8fc5e41
Update operating point
1-Bart-1 May 12, 2025
cd592ed
Actually update op
1-Bart-1 May 12, 2025
bac3c75
Fix lin
1-Bart-1 May 12, 2025
ec40738
Set lin set_values
1-Bart-1 May 12, 2025
c64bab2
Add vsm to lin
1-Bart-1 May 12, 2025
7c3c257
Fix initial set
1-Bart-1 May 12, 2025
107d8d0
Fix stupid bug
1-Bart-1 May 12, 2025
6f5a3b2
Add turn rate
1-Bart-1 May 14, 2025
ca7811c
Dont remake
1-Bart-1 May 14, 2025
15c7cbd
Fixed nonstiff
1-Bart-1 May 14, 2025
e07a560
Improve linearize
1-Bart-1 May 14, 2025
62c896c
Add nonstiff
1-Bart-1 May 14, 2025
97bc386
Fix bug
1-Bart-1 May 14, 2025
ab8f894
Add measurements
1-Bart-1 May 15, 2025
8ad26f1
Correct lin setters
1-Bart-1 May 18, 2025
30616d7
Fix bug
1-Bart-1 May 18, 2025
015b62b
Merge branch 'main' into develop
1-Bart-1 May 22, 2025
92e3267
Fix tests
1-Bart-1 May 22, 2025
dfe7fa4
Update default manifest
ufechner7 May 22, 2025
bff054e
Add test_plan.md
ufechner7 May 22, 2025
6d00a2d
Fix precompile script
1-Bart-1 May 25, 2025
5b3cfb6
Update manifest
1-Bart-1 May 25, 2025
54995f0
Fix type bug
1-Bart-1 May 25, 2025
1c7463a
Improve tether init
1-Bart-1 May 26, 2025
8b0fdb9
Fix prob name
1-Bart-1 May 26, 2025
c71a033
Update test_plan.md
ufechner7 May 26, 2025
62229d4
Update name
1-Bart-1 May 26, 2025
174aebb
Add section Test again
ufechner7 May 26, 2025
a6d883b
Update default bin file
1-Bart-1 May 26, 2025
496ba69
Add version cmd line arg
1-Bart-1 May 26, 2025
dc4187e
Update docs
1-Bart-1 May 26, 2025
29a3034
Precompile full model
1-Bart-1 May 26, 2025
726457b
Document test failure
ufechner7 May 26, 2025
ef4a2d7
Delete bin files when creating a sysimage
ufechner7 May 26, 2025
d12d6b2
Minor change
ufechner7 May 26, 2025
2932149
Fix mistake in point mass system
1-Bart-1 May 27, 2025
2922800
Merge branch 'steady-state' into develop
1-Bart-1 May 27, 2025
785991a
Update precompile.jl
ufechner7 May 27, 2025
92b2e69
Add messages
ufechner7 May 27, 2025
226b034
Update create_sys_image and precompile.jl
ufechner7 May 27, 2025
16b2dd4
New default manifest and new default problem
ufechner7 May 27, 2025
96f812e
Next try
ufechner7 May 27, 2025
147bd5e
Fix info message
ufechner7 May 27, 2025
bcddbfe
Update manifest and xz file for 1.10
ufechner7 May 27, 2025
977e9e7
Update message text
ufechner7 May 27, 2025
91dd4bc
Everything in body frame
1-Bart-1 May 27, 2025
3654188
Add param
1-Bart-1 May 27, 2025
9e69cb6
Correct init with elevation
1-Bart-1 May 27, 2025
e83df80
Remove unused imports
1-Bart-1 May 27, 2025
be6d97e
Correct heading calculation
1-Bart-1 May 28, 2025
2758abf
Update WAIVER
ufechner7 Jun 3, 2025
60a975e
Merge branch 'develop' into steady-state
1-Bart-1 Jun 4, 2025
eeb49b2
Merge branch 'main' into steady-state
1-Bart-1 Jun 7, 2025
afebcc9
Revert bin to main
1-Bart-1 Jun 7, 2025
7c1fa08
Remove unused example
1-Bart-1 Jun 7, 2025
8fb95a9
Change heading name
1-Bart-1 Jun 7, 2025
e7b4f87
Remove .arrow from git
1-Bart-1 Jun 8, 2025
579b05c
Remove arrow
1-Bart-1 Jun 8, 2025
652e5f5
Merge branch 'main' into fix-ram-model
1-Bart-1 Jun 8, 2025
57fd9f0
Move licenses to toml
1-Bart-1 Jun 8, 2025
82b6bec
Fix inconsistent init
1-Bart-1 Jun 8, 2025
f44417e
Remove unused example
1-Bart-1 Jun 8, 2025
d5aa349
Updated prob
1-Bart-1 Jun 8, 2025
8a892c1
Fix test
1-Bart-1 Jun 8, 2025
3648214
Fix const
1-Bart-1 Jun 8, 2025
b03f797
Add option to provide julia version
1-Bart-1 Jun 8, 2025
dba5af3
Merge branch 'main' into fix-ram-model
1-Bart-1 Jun 8, 2025
355554f
Update default prob
1-Bart-1 Jun 8, 2025
1a52db0
Change back to main version
1-Bart-1 Jun 8, 2025
019c2ec
Fix docu error
ufechner7 Jun 8, 2025
a1d6592
Improve docu
ufechner7 Jun 8, 2025
16ccfe9
Merge branch 'main' into fix-ram-model
ufechner7 Jun 8, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.arrow
*.bin
*.xopp
*.so
Expand Down
34 changes: 8 additions & 26 deletions REUSE.toml
Original file line number Diff line number Diff line change
@@ -1,49 +1,31 @@
version = 1

[[annotations]]
path = "data/prob*"

SPDX-FileCopyrightText = "2025 Bart van de Lint"
SPDX-License-Identifier = "MPL-2.0"

[[annotations]]
path = "data/ram_air_kite*"

path = ["data/prob*", "data/ram*", "examples/discrete_jacobian.jl"]
SPDX-FileCopyrightText = "2025 Bart van de Lint"
SPDX-License-Identifier = "MPL-2.0"

[[annotations]]
path = "Manifest*"

SPDX-FileCopyrightText = "2025 Uwe Fechner, Bart van de Lint"
SPDX-License-Identifier = "MIT"

[[annotations]]
path = "Project.toml"

SPDX-FileCopyrightText = "2025 Uwe Fechner, Bart van de Lint"
SPDX-License-Identifier = "MIT"
path = "data/*ram.yaml"
SPDX-FileCopyrightText = "2025 Bart van de Lint, Uwe Fechner"
SPDX-License-Identifier = "CC-BY-4.0"

[[annotations]]
path = "CITATION.cff"

path = ["data/settings.yaml", "data/system.yaml", "data/vsm_settings.yaml"]
SPDX-FileCopyrightText = "2025 Uwe Fechner"
SPDX-License-Identifier = "MIT"
SPDX-License-Identifier = "CC-BY-4.0"

[[annotations]]
path = ".gitignore"

path = ["Manifest*", "Project.toml", ".gitignore"]
SPDX-FileCopyrightText = "2025 Uwe Fechner, Bart van de Lint"
SPDX-License-Identifier = "MIT"

[[annotations]]
path = ["docs/src/*.png", "docs/src/*.md", "docs/src/kite_power_tools.drawio"]

SPDX-FileCopyrightText = "2025 Uwe Fechner"
SPDX-License-Identifier = "CC-BY-4.0"

[[annotations]]
path = ["docs/.gitignore", "docs/Project.toml"]

path = ["docs/.gitignore", "docs/Project.toml", "CITATION.cff"]
SPDX-FileCopyrightText = "2025 Uwe Fechner"
SPDX-License-Identifier = "MIT"
Binary file modified data/prob_1.10_ram_dynamic_3_seg.bin.default.xz
Binary file not shown.
Binary file modified data/prob_1.11_ram_dynamic_3_seg.bin.default.xz
Binary file not shown.
3 changes: 0 additions & 3 deletions data/settings.yaml.license

This file was deleted.

2 changes: 0 additions & 2 deletions data/settings_ram.yaml.license

This file was deleted.

3 changes: 0 additions & 3 deletions data/system.yaml.license

This file was deleted.

3 changes: 0 additions & 3 deletions data/system_ram.yaml.license

This file was deleted.

3 changes: 0 additions & 3 deletions data/vsm_settings.yaml.license

This file was deleted.

13 changes: 12 additions & 1 deletion docs/src/examples_ram_air.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,15 @@ SIMPLE=true; include("examples/ram_air_kite.jl")
The simple model has a very simple bridle system without pulleys and with less attachment points on the wing.
While the default model has a [speed system](https://kiteboarding.com/proddetail.asp?prod=ozone-r1v4-pro-tune-speedsystem-complete) with pulleys and more attachment points on the wing.

![Oscillating steering input response, simple system](oscillating_steering_simple.png)
![Oscillating steering input response, simple system](oscillating_steering_simple.png)

## How to create a RamAirKite
The following code is a minimal example that shows how to create a ram air kite struct:
```
using KiteModels

# Initialize model
set = load_settings("system_ram.yaml")

rak = RamAirKite(set)
```
1 change: 0 additions & 1 deletion docs/src/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ calculate_rotational_inertia!
calc_set_cl_cd!
calc_aero_forces!
calc_particle_forces!
find_z_axis_point
inner_loop!
loop!
```
32 changes: 17 additions & 15 deletions examples/ram_air_kite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ include(joinpath(@__DIR__, "plotting.jl"))

# Simulation parameters
dt = 0.05
total_time = 10 # Longer simulation to see oscillations
total_time = 10.0 # Longer simulation to see oscillations
vsm_interval = 3
steps = Int(round(total_time / dt))

Expand All @@ -47,25 +47,25 @@ s.set.abs_tol = 1e-2
s.set.rel_tol = 1e-2
toc()

measure = Measurement()
measure.sphere_pos .= deg2rad.([70.0 70.0; 1.0 -1.0])

# init_Q_b_w, R_b_w = KiteModels.measure_to_q(measure)
# init_kite_pos = init!(s.point_system, s.set, R_b_w, init_Q_b_w)
# plot(s.point_system, 0.0; zoom=false, front=true)

measure = Measurement()
# plot(s.point_system, 0.0; zoom=false, front=false)

# Initialize at elevation
s.point_system.winches[2].tether_length += 0.2
s.point_system.winches[3].tether_length += 0.2
measure.sphere_pos .= deg2rad.([70.0 70.0; 1.0 -1.0])
KiteModels.init_sim!(s, measure; remake=false, reload=true)
sys = s.sys

@info "System initialized at:"
toc()

# # Stabilize system
# Stabilize system
s.integrator.ps[sys.stabilize] = true
for i in 1:10÷dt
for i in 1:1÷dt
next_step!(s; dt, vsm_interval=1)
end
s.integrator.ps[sys.stabilize] = false
Expand All @@ -75,7 +75,8 @@ sys_state = KiteModels.SysState(s)
t = 0.0
runtime = 0.0
integ_runtime = 0.0
bias = 0.5
bias = 0.35
t0 = s.integrator.t

try
while t < total_time
Expand All @@ -84,7 +85,7 @@ try
PLOT && plot(s, t; zoom=false, front=false)

# Calculate steering inputs based on cosine wave
steering = steering_magnitude * cos(2π * steering_freq * t+bias)
steering = steering_magnitude * cos(2π * steering_freq * t + bias)
set_values = -s.set.drum_radius .* s.integrator[sys.winch_force]
_vsm_interval = 1
if t > 1.0
Expand All @@ -93,8 +94,8 @@ try
end

# Step simulation
steptime = @elapsed (t_new, integ_steptime) = next_step!(s, set_values; dt, vsm_interval=_vsm_interval)
t = t_new - 10.0 # Adjust for initial stabilization time
steptime = @elapsed (t_new, integ_steptime) = next_step!(s, set_values; dt, vsm_interval=vsm_interval)
t = t_new - t0 # Adjust for initial stabilization time

# Track performance after initial transient
if (t > total_time/2)
Expand All @@ -105,6 +106,7 @@ try

# Log state variables
KiteModels.update_sys_state!(sys_state, s)
sys_state.time = t
log!(logger, sys_state)
end
catch e
Expand All @@ -129,15 +131,15 @@ sl = lg.syslog
turn_rates_deg = rad2deg.(hcat(sl.turn_rates...))
v_reelout_23 = [sl.v_reelout[i][2] for i in eachindex(sl.v_reelout)], [sl.v_reelout[i][3] for i in eachindex(sl.v_reelout)] # Winch 2 and 3
aero_force_z = [sl.aero_force_b[i][3] for i in eachindex(sl.aero_force_b)]
aero_moment_y = [sl.aero_moment_b[i][2] for i in eachindex(sl.aero_moment_b)]
aero_moment_z = [sl.aero_moment_b[i][3] for i in eachindex(sl.aero_moment_b)]
twist_angles_deg = rad2deg.(hcat(sl.twist_angles...))
AoA_deg = rad2deg.(sl.AoA)
heading_deg = rad2deg.(sl.heading)

p = plotx(sl.time .- 10,
p = plotx(sl.time,
[turn_rates_deg[1,:], turn_rates_deg[2,:], turn_rates_deg[3,:]],
v_reelout_23,
[aero_force_z, aero_moment_y],
[aero_force_z, aero_moment_z],
[twist_angles_deg[1,:], twist_angles_deg[2,:], twist_angles_deg[3,:], twist_angles_deg[4,:]],
[AoA_deg],
[heading_deg];
Expand All @@ -146,7 +148,7 @@ p = plotx(sl.time .- 10,
labels=[
[L"\omega_x", L"\omega_y", L"\omega_z"],
["v_ro[2]", "v_ro[3]"],
[L"F_{aero,z}", L"M_{aero,y}"],
[L"F_{aero,z}", L"M_{aero,z}"],
["twist[1]", "twist[2]", "twist[3]", "twist[4]"],
["AoA"],
["heading"]
Expand Down
50 changes: 27 additions & 23 deletions src/mtk_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,13 @@ function force_eqs!(s, system, eqs, defaults, guesses;
inertia = 1/3 * (s.set.mass/length(groups)) * (norm(group.chord))^2 # plate inertia around leading edge
@assert !(inertia ≈ 0.0)
@parameters twist_damp = 50
@parameters max_twist = deg2rad(90)

eqs = [
eqs
group_tether_moment[group.idx] ~ sum(tether_moment[group.idx, :])
twist_α[group.idx] ~ (group_aero_moment[group.idx] + group_tether_moment[group.idx]) / inertia
twist_angle[group.idx] ~ clamp(free_twist_angle[group.idx], -π/2, π/2)
twist_angle[group.idx] ~ clamp(free_twist_angle[group.idx], -max_twist, max_twist)
]
if group.type == DYNAMIC
eqs = [
Expand Down Expand Up @@ -618,6 +619,20 @@ function diff_eqs!(s, eqs, defaults; tether_kite_force, tether_kite_moment, aero
return eqs, defaults
end

function calc_R_v_w(kite_pos, e_x)
z = sym_normalize(kite_pos)
y = sym_normalize(z × e_x)
x = y × z
return [x y z]
end

function calc_R_t_w(elevation, azimuth)
x = rotate_around_z(rotate_around_y([0, 0, -1], -elevation), azimuth)
z = rotate_around_z(rotate_around_y([1, 0, 0], -elevation), azimuth)
y = z × x
return [x y z]
end

"""
scalar_eqs!(s, eqs, measure; R_b_w, wind_vec_gnd, va_kite_b, kite_pos, kite_vel, kite_acc, twist_angle, twist_ω)

Expand Down Expand Up @@ -663,7 +678,7 @@ function scalar_eqs!(s, eqs, measure; R_b_w, wind_vec_gnd, va_kite_b, kite_pos,
va_kite_b ~ R_b_w' * va_kite
]
@variables begin
heading_x(t)
heading(t)
turn_rate(t)[1:3]
turn_acc(t)[1:3]
azimuth(t)
Expand All @@ -682,9 +697,7 @@ function scalar_eqs!(s, eqs, measure; R_b_w, wind_vec_gnd, va_kite_b, kite_pos,
simple_twist_angle(t)[1:2]
simple_twist_ω(t)[1:2]
R_v_w(t)[1:3, 1:3]
view_z(t)[1:3]
view_y(t)[1:3]
view_x(t)[1:3]
R_t_w(t)[1:3, 1:3]
distance(t)
distance_vel(t)
distance_acc(t)
Expand All @@ -695,21 +708,18 @@ function scalar_eqs!(s, eqs, measure; R_b_w, wind_vec_gnd, va_kite_b, kite_pos,
x´´, y´´, z´´ = kite_acc

half_len = length(twist_angle)÷2
heading_vec = R_t_w' * R_v_w[:,1]

eqs = [
eqs
view_z ~ sym_normalize(kite_pos)
view_y ~ view_z × e_y
view_x ~ view_y × view_z
R_v_w[:,1] ~ view_x
R_v_w[:,2] ~ view_y
R_v_w[:,3] ~ view_z
heading_x ~ calc_heading(e_x)
vec(R_v_w) .~ vec(calc_R_v_w(kite_pos, e_x))
vec(R_t_w) .~ vec(calc_R_t_w(elevation, azimuth))
heading ~ atan(heading_vec[2], heading_vec[1])
turn_rate ~ R_v_w' * (R_b_w * ω_b) # Project angular velocity onto view frame
turn_acc ~ R_v_w' * (R_b_w * α_b)
distance ~ norm(kite_pos)
distance_vel ~ kite_vel ⋅ view_z
distance_acc ~ kite_acc ⋅ view_z
distance_vel ~ kite_vel ⋅ R_v_w[:,3]
distance_acc ~ kite_acc ⋅ R_v_w[:,3]

elevation ~ atan(z / x)
# elevation_vel = d/dt(atan(z/x)) = (x*ż' - z*ẋ')/(x^2 + z^2) according to wolframalpha
Expand All @@ -721,9 +731,9 @@ function scalar_eqs!(s, eqs, measure; R_b_w, wind_vec_gnd, va_kite_b, kite_pos,
azimuth_vel ~ (-y*x´ + x*y´) /
(x^2 + y^2)
azimuth_acc ~ ((x^2 + y^2)*(-y*x´´ + x*y´´) + 2(y*x´ - x*y´)*(x*x´ + y*y´))/(x^2 + y^2)^2
course ~ atan(-azimuth_vel, elevation_vel)
x_acc ~ kite_acc ⋅ e_x
y_acc ~ kite_acc ⋅ e_y
course ~ atan(-azimuth_vel, elevation_vel)

angle_of_attack ~ calc_angle_of_attack(va_kite_b) + 0.5twist_angle[half_len] + 0.5twist_angle[half_len+1]
simple_twist_angle[1] ~ sum(twist_angle[1:half_len]) / half_len
Expand Down Expand Up @@ -763,14 +773,8 @@ function linear_vsm_eqs!(s, eqs, guesses; aero_force_b, aero_moment_b, group_aer
@assert length(s.point_system.groups) == length(sol.group_moment_dist)

y_ = [init_va_b; zeros(length(s.point_system.groups)); zeros(3)]
jac_, x_ = VortexStepMethod.linearize(
s.vsm_solver,
s.aero,
y_;
va_idxs=1:3,
omega_idxs=4:6,
theta_idxs=7:6+length(s.point_system.groups),
moment_frac=s.point_system.groups[1].moment_frac)
x_ = zeros(3+3+length(s.point_system.groups))
jac_ = zeros(length(x_), length(y_))

@parameters begin
last_y[eachindex(y_)] = y_
Expand Down
Loading
Loading