Skip to content

Commit

Permalink
fix #65
Browse files Browse the repository at this point in the history
  • Loading branch information
ufechner7 committed Aug 28, 2024
1 parent e307ac7 commit 701256e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion data/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ steering:
c2_cor: 0.93 # correction factor one point model
k_ds: 1.5 # influence of the depower angle on the steering sensitivity
delta_st: 0.02 # steering increment (when pressing RIGHT)
max_steering: 16.83 # max. steering angle of the side planes for four point model [degrees]
max_steering: 16.834 # max. steering angle of the side planes for four point model [degrees]

depower:
alpha_d_max: 31.0 # max depower angle [deg]
Expand Down
13 changes: 6 additions & 7 deletions src/KPS4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ end
const SP = Spring{Int16, SimFloat}
const KITE_PARTICLES = 4
const KITE_SPRINGS = 9
const KITE_ANGLE = 3.83 # angle between the kite and the last tether segment due to the mass of the control pod
const PRE_STRESS = 0.9998 # Multiplier for the initial spring lengths.
const KS = deg2rad(16.565 * 1.064 * 0.875 * 1.033 * 0.9757 * 1.083) # max steering
const DRAG_CORR = 0.93 # correction of the drag for the 4-point model
function zero(::Type{SP})
SP(0,0,0,0,0)
Expand Down Expand Up @@ -108,6 +105,8 @@ $(TYPEDFIELDS)
bridle_factor::S = 1.0
"drag force of kite and bridle; output of calc_aero_forces!"
drag_force::T = zeros(S, 3)
"max_steering angle in radian"
ks::S = 0.0
"lift force of the kite; output of calc_aero_forces!"
lift_force::T = zeros(S, 3)
"spring force of the current tether segment, output of calc_particle_forces!"
Expand Down Expand Up @@ -210,7 +209,8 @@ function clear!(s::KPS4)
s.drag_force .= [0.0, 0, 0]
s.lift_force .= [0.0, 0, 0]
s.rho = s.set.rho_0
s.bridle_factor = s.set.l_bridle / bridle_length(s.set)
s.bridle_factor = s.set.l_bridle / bridle_length(s.set)
s.ks = deg2rad(s.set.max_steering)
s.kcu.depower = s.set.depower/100.0
s.kcu.set_depower = s.kcu.depower
KiteModels.set_depower_steering!(s, get_depower(s.kcu), get_steering(s.kcu))
Expand Down Expand Up @@ -335,10 +335,9 @@ Updates the vector s.forces of the first parameter.
va_xz2 = va_2 - (va_2 y) * y
va_xy3 = va_3 - (va_3 z) * z
va_xy4 = va_4 - (va_4 z) * z

alpha_2 = rad2deg- acos2(normalize(va_xz2) x) - alpha_depower) + s.set.alpha_zero
alpha_3 = rad2deg- acos2(normalize(va_xy3) x) - rel_steering * KS) + s.set.alpha_ztip
alpha_4 = rad2deg- acos2(normalize(va_xy4) x) + rel_steering * KS) + s.set.alpha_ztip
alpha_3 = rad2deg- acos2(normalize(va_xy3) x) - rel_steering * s.ks) + s.set.alpha_ztip
alpha_4 = rad2deg- acos2(normalize(va_xy4) x) + rel_steering * s.ks) + s.set.alpha_ztip
s.alpha_2 = alpha_2
s.alpha_2b = rad2deg/2 + asin2(normalize(va_xz2) x))
s.alpha_3 = alpha_3
Expand Down
3 changes: 2 additions & 1 deletion src/init.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# using Plots
const KITE_ANGLE = 3.83 # angle between the kite and the last tether segment due to the mass of the control pod
const PRE_STRESS = 0.9998 # Multiplier for the initial spring lengths.

# Functions to calculate the inital state vector, the inital masses and initial springs

Expand Down
2 changes: 1 addition & 1 deletion test/test_kps4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ end
[ -9.9385080719600989 -68.915067335201357 -0.9904916722429121]
[ -11.4093091631036021 53.2874848115847612 0.7727700100708267]]
for i in 1:se().segments + KiteModels.KITE_PARTICLES + 1
@test all(forces[i,:] .≈ kps4.forces[i])
@test all(isapprox.(forces[i,:], kps4.forces[i], rtol=1e-4))
end
end

Expand Down

0 comments on commit 701256e

Please sign in to comment.