Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
12 changes: 0 additions & 12 deletions data/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,6 @@ kps4:
smc: 0.0 # steering moment coefficient [-]
cmq: 0.0 # pitch rate dependant moment coefficient [-]
cord_length: 2.0 # average aerodynamic cord length of the kite [m]

kps4_3l:
radius: 2.0 # the radius of the circle shape on which the kite lines, viewed
# from the front [m]
bridle_center_distance: 4.0 # the distance from point the center bridle connection point of
# the middle line to the kite [m]
middle_length: 1.5 # the cord length of the kite in the middle [m]
tip_length: 0.62 # the cord length of the kite at the tips [m]
min_steering_line_distance: 1.0 # the distance between the left and right steering bridle [m]
# line connections on the kite that are closest to each other [m]
width_3l: 4.1 # width of the kite [m]
aero_surfaces: 3 # the number of aerodynamic surfaces to use per mass point [-]

bridle:
d_line: 2.5 # bridle line diameter [mm]
Expand Down
12 changes: 0 additions & 12 deletions data/settings2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,6 @@ kps4:
rel_nose_mass: 0.47 # relative nose mass
rel_top_mass: 0.4 # mass of the top particle relative to the sum of top and side particles

kps4_3l:
radius: 2.0 # the radius of the circle shape on which the kite lines, viewed
# from the front [m]
bridle_center_distance: 4.0 # the distance from point the center bridle connection point of
# the middle line to the kite [m]
middle_length: 1.5 # the cord length of the kite in the middle [m]
tip_length: 0.62 # the cord length of the kite at the tips [m]
min_steering_line_distance: 1.0 # the distance between the left and right steering bridle [m]
# line connections on the kite that are closest to each other [m]
width_3l: 4.1 # width of the kite [m]
aero_surfaces: 3 # the number of aerodynamic surfaces to use per mass point [-]

bridle:
d_line: 2.5 # bridle line diameter [mm]
l_bridle: 33.4 # sum of the lengths of the bridle lines [m]
Expand Down
77 changes: 14 additions & 63 deletions data/settings_3l.yaml → data/settings_ram.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ initial:
l_tether: 50.0 # initial tether length [m]
elevation: 70.8 # initial elevation angle [deg]
v_reel_out: 0.0 # initial reel out speed [m/s]
depower: 25.0 # initial depower settings [%]

solver:
abs_tol: 0.006 # absolute tolerance of the DAE solver [m, m/s]
Expand All @@ -23,71 +22,23 @@ solver:
max_order: 4 # maximal order, usually between 3 and 5
max_iter: 10000 # max number of iterations of the steady-state-solver

steering:
c0: 0.0 # steering offset -0.0032 [-]
c_s: 2.59 # steering coefficient one point model; 2.59 was 0.6; TODO: check if it must be divided by kite_area
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]

depower:
alpha_d_max: 31.0 # max depower angle [deg]
depower_offset: 23.6 # at rel_depower=0.236 the kite is fully powered [%]

kite:
model: "data/kite.obj" # 3D model of the kite
foil_file: "data/MH82.dat" # filename for the foil shape
polar_file: "data/polars.csv" # filename for the polars file
physical_model: "KPS4_3L" # name of the kite model to use (KPS3 or KPS4)
version: 2 # version of the model to use
mass: 0.9 # kite mass [kg]
area: 10.18 # projected kite area [m²]
rel_side_area: 30.6 # relative side area [%]
height: 2.23 # height of the kite [m]
alpha_cl: [-180.0, -160.0, -90.0, -20.0, -10.0, -5.0, 0.0, 20.0, 40.0, 90.0, 160.0, 180.0]
cl_list: [ 0.0, 0.5, 0.0, 0.08, 0.125, 0.15, 0.2, 1.0, 1.0, 0.0, -0.5, 0.0]
alpha_cd: [-180.0, -170.0, -140.0, -90.0, -20.0, 0.0, 20.0, 90.0, 140.0, 170.0, 180.0]
cd_list: [ 0.5, 0.5, 0.5, 1.0, 0.2, 0.1, 0.2, 1.0, 0.5, 0.5, 0.5]

kps4:
alpha_zero: 10.0 # should be 4..10 [degrees]
alpha_ztip: 10.0 # [degrees]
m_k: 0.2 # relative nose distance; increasing m_k increases C2 of the turn-rate law
rel_nose_mass: 0.47 # relative nose mass
rel_top_mass: 0.4 # mass of the top particle relative to the sum of top and side particles

kps4_3l:
radius: 2.0
bridle_center_distance: 4.0
middle_length: 1.5
tip_length: 0.62
min_steering_line_distance: 1.0
width: 4.1 # width of the kite [m]
aero_surfaces: 3 # number of aerodynamic surfaces in 3 line model
flap_height: 0.05 # height at the start of the flap [m]

kcu:
kcu_model: "KCU1" # name of the kite control unit model, KCU1 or KCU2
kcu_mass: 8.4 # mass of the kite control unit [kg]
kcu_diameter: 0.4 # diameter of the KCU for drag calculation [m]
cd_kcu: 0.3 # drag coefficient of the KCU [-]
power2steer_dist: 1.3 # [m]
depower_drum_diameter: 0.069 # [m]
tape_thickness: 0.0006 # [m]
v_depower: 0.075 # max velocity of depowering in units per second (full range: 1 unit)
v_steering: 0.2 # max velocity of steering in units per second (full range: 2 units)
depower_gain: 3.0 # 3.0 means: more than 33% error -> full speed
steering_gain: 3.0

bridle:
l_bridle: 33.4 # sum of the lengths of the bridle lines [m]
h_bridle: 4.9 # height of bridle [m]
rel_compr_stiffness: 0.25 # relative compression stiffness of the kite springs
rel_damping: 6.0 # relative damping of the kite spring (relative to main tether)
model: "data/ram_air_kite_body.obj" # 3D model of the kite
foil_file: "data/ram_air_kite_foil.dat" # filename for the foil shape
physical_model: "RamAirKite" # name of the kite model to use (KPS3, KPS4 or RamAirKite)
top_bridle_points: # top bridle points that are not on the kite body in CAD frame
- [0.290199, 0.784697, -2.61305]
- [0.392683, 0.785271, -2.61201]
- [0.498202, 0.786175, -2.62148]
- [0.535543, 0.786175, -2.62148]
crease_frac: 0.82 # distance along normalized foil chord for the trailing edge deformation crease
bridle_fracs: [0.088, 0.31, 0.58, 0.93] # distances along normalized foil chord for bridle attachment points
fixed_index: 1 # the bridle frac index around which the kite twists

tether:
d_tether: 1 # tether diameter [mm]
bridle_tether_diameter: 2 # [mm]
power_tether_diameter: 2 # [mm]
steering_tether_diameter: 1 # [mm]
cd_tether: 0.958 # drag coefficient of the tether
damping: 473.0 # unit damping coefficient [Ns]
c_spring: 614600.0 # unit spring constant coefficient [N]
Expand Down
3 changes: 0 additions & 3 deletions data/system_3l.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions data/system_ram.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
system:
sim_settings: "settings_ram.yaml" # simulator settings
wc_settings: "wc_settings.yaml" # settings of the winch controller
fpc_settings: "fpc_settings.yaml" # flight path controller settings
fpp_settings: "fpp_settings.yaml" # flight path planner settings

2 changes: 0 additions & 2 deletions docs/src/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ get_unit
```@docs
demo_state
demo_state_4p
demo_state_4p_3lines
demo_syslog
demo_log
get_particles
get_particles_3l
```

# Loading, saving and converting log files
Expand Down
111 changes: 1 addition & 110 deletions src/KiteUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import Base.length
import ReferenceFrameRotations as RFR
export demo_state, demo_syslog, demo_log, load_log, save_log, export_log, import_log # functions for logging
export log!, syslog, length, euler2rot, menu
export demo_state_4p, demo_state_4p_3lines, initial_kite_ref_frame # functions for four point and three line kite
export demo_state_4p, initial_kite_ref_frame # functions for four point and three line kite
export rot, rot3d, ground_dist, calc_elevation, azimuth_east, azimuth_north, asin2
export acos2, wrap2pi, quat2euler, quat2viewer # geometric functions
export fromEG2W, fromENU2EG,fromW2SE, fromKS2EX, fromEX2EG # reference frame transformations
Expand Down Expand Up @@ -229,35 +229,6 @@ function get_particles(height_k, height_b, width, m_k, pos_pod= [ 75., 0., 129.9
[zeros(3), pos0, pos_A, pos_kite, pos_C, pos_D] # 0, p7, p8, p9, p10, p11
end


"""
Calculate the initial positions of the particles representing
a 4-point 3 line kite.
"""
function get_particles_3l(width, radius, middle_length, tip_length, bridle_center_distance, pos_kite = [ 75., 0., 129.90381057], vec_c=[-15., 0., -25.98076211], v_app=[10.4855, 0, -3.08324])
# inclination angle of the kite; beta = atan(-pos_kite[2], pos_kite[1]) ???
beta = pi/2.0
e_z = normalize(vec_c) # vec_c is the direction of the last two particles
e_y = normalize(cross(v_app, e_z))
e_x = normalize(cross(e_y, e_z))

α_0 = pi/2 - width/2/radius
α_C = α_0 + width*(-2*tip_length + sqrt(2*middle_length^2 + 2*tip_length^2)) /
(4*(middle_length - tip_length)) / radius
α_D = π - α_C

E = pos_kite
E_c = pos_kite + e_z * (-bridle_center_distance + radius) # E at center of circle on which the kite shape lies
C = E_c + e_y*cos(α_C)*radius - e_z*sin(α_C)*radius
D = E_c + e_y*cos(α_D)*radius - e_z*sin(α_D)*radius

kite_length_C = tip_length + (middle_length-tip_length) * (α_C - α_0) / (π/2 - α_0)
P_c = (C+D)./2
A = P_c - e_x*(kite_length_C*(3/4 - 1/4))

E, C, D, A, α_C, kite_length_C # important to have the order E = 1, C = 2, D = 3, A = 4
end

"""
demo_state_4p(P, height=6.0, time=0.0; azimuth_north=-pi/2)

Expand Down Expand Up @@ -316,86 +287,6 @@ function demo_state_4p(P, height=6.0, time=0.0; azimuth_north=-pi/2)
ss
end

"""
demo_state_4p_3lines(P, height=6.0, time=0.0)

Create a demo state, using the 4 point kite model with a given height and time.
P is the number of middle tether particles.

Returns a SysState instance.
"""
function demo_state_4p_3lines(P, height=6.0, time=0.0)
P_ = P*3+3 # P_ is total number of particles in the system (kite + 3 tethers)
ss = SysState{P_}()
num_A = P_
num_D = P_-1
num_C = P_-2
num_E = P_-3
pos = zeros(SVector{P_, MVector{3, Float64}})

# ground points
[pos[i] .= [0.0, 0.0, 0.0] for i in 1:3]

# middle tether
sin_el, cos_el = sin(deg2rad(se().elevation)), cos(deg2rad(se().elevation))
for (i, j) in enumerate(range(6, step=3, length=se().segments))
radius = i * (se().l_tether/se().segments)
pos[j] .= [cos_el*radius, 0.0, sin_el*radius]
end

# kite points
vec_c = pos[num_E-3] - pos[num_E]
E, C, D, A, _, _ = get_particles_3l(se().width, se().radius, se().middle_length, se().tip_length, se().bridle_center_distance, pos[num_E], vec_c)
pos[num_A] .= A
pos[num_C] .= C
pos[num_D] .= [pos[num_C][1], -pos[num_C][2], pos[num_C][3]]

# build tether connection points
e_z = normalize(vec_c)
distance_c_l = 0.5 # distance between c and left steering line
pos[num_E-2] .= pos[num_C] + e_z .* (distance_c_l)
pos[num_E-1] .= pos[num_E-2] .* [1.0, -1.0, 1.0]

# build left and right tether points
for (i, j) in enumerate(range(4, step=3, length=se().segments-1))
pos[j] .= pos[num_E-2] ./ se().segments .* i
pos[j+1] .= [pos[j][1], -pos[j][2], pos[j][3]]
end

X = zeros(P_)
Y = zeros(P_)
Z = zeros(P_)
for (i, p) in enumerate(pos)
# println("pos ", pos)
X[i] = p[1]
Y[i] = p[2]
Z[i] = p[3]
end
# println("X ", X)
pos_centre = 0.5 * (C + D)
delta = E - pos_centre
z = normalize(delta)
y = normalize(C - D)
x = y × z
pos_before = pos[num_E] + z

rotation = rot(pos[num_E], pos_before, -x)
q = QuatRotation(rotation)
orient = MVector{4, Float32}(Rotations.params(q))
elevation = calc_elevation([X[end], 0.0, Z[end]])
ss.v_wind_gnd .= [10.4855, 0, -3.08324]
ss.v_wind_200m .= [10.4855, 0, -3.08324]
ss.v_wind_kite .= [10.4855, 0, -3.08324]
ss.t_sim = 0.014
ss.time = time
ss.orient = orient
ss.elevation = elevation
ss.X .= X
ss.Y .= Y
ss.Z .= Z
ss
end

include("_demo_syslog.jl")

"""
Expand Down
59 changes: 31 additions & 28 deletions src/settings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@
"file name of the 3D model of the kite for the viewer"
model::String = "data/kite.obj"
"filename with or without extension for the foil shape [in dat format]"
foil_file::String = ""
"filename with or without extension for the polars [in csv format]"
polar_file::String = "data/polars.csv"
"name of the kite model to use (KPS3 or KPS4)"
physical_model::String = ""
"version of the model to use"
version::Int64 = 1
Expand Down Expand Up @@ -139,23 +135,26 @@
"average aerodynamic cord length of the kite [m]"
cord_length = 0

# model KPS4_3L
"the radius of the circle shape on which the kite lines, viewed from the front [m]"
radius::Float64 = 10.0
"the distance from point the center bridle connection point of the middle line to the kite [m]"
bridle_center_distance::Float64 = 2.0
"the cord length of the kite in the middle [m]"
middle_length::Float64 = 2.0
"the cord length of the kite at the tips [m]"
tip_length::Float64 = 1.0
"the distance between the left and right steering bridle line connections on the kite that are closest to eachother [m]"
min_steering_line_distance::Float64 = 4.0
"the number of aerodynamic surfaces to use per mass point [-]"
aero_surfaces::Int64 = 10
"height at the start of the flap [m]"
flap_height::Float64 = 0.05
"the width of the 3 line kite laid flat"
width_3l = 20
# Ram air kite specific parameters
"filename of the foil shape [in dat format]"
foil_file::String = "data/ram_air_kite_foil.dat"
"top bridle points that are not on the kite body in CAD frame"
top_bridle_points::Vector{Vector{Float64}} = [[0.290199, 0.784697, -2.61305],
[0.392683, 0.785271, -2.61201],
[0.498202, 0.786175, -2.62148],
[0.535543, 0.786175, -2.62148]]
"bridle tether diameter [mm]"
bridle_tether_diameter = 2.0
"power tether diameter [mm]"
power_tether_diameter = 2.0
"steering tether diameter [mm]"
steering_tether_diameter= 1.0
"distance along normalized foil chord for the trailing edge deformation crease"
crease_frac = 0.82
"distances along normalized foil chord for bridle attachment points"
bridle_fracs::Vector{Float64} = [0.088, 0.31, 0.58, 0.93]
"the bridle frac index around which the kite twists"
fixed_index::Int = 1

"bridle line diameter [mm]"
d_line = 0
Expand Down Expand Up @@ -338,7 +337,7 @@
if ! isdir(DATA_PATH[1])
mkdir(DATA_PATH[1])
end
files = ["settings.yaml", "system.yaml", "settings_3l.yaml", "system_3l.yaml", "kite.obj"]
files = ["settings.yaml", "system.yaml", "settings_ram.yaml", "system_ram.yaml", "kite.obj"]
append!(files, extra_files)
copy_files("data", files)
set_data_path(joinpath(pwd(), "data"))
Expand Down Expand Up @@ -403,16 +402,20 @@
dict = YAML.load_file(joinpath(DATA_PATH[1], SETTINGS.sim_settings))
SE_DICT[1] = dict
# update the SETTINGS struct from the dictionary
update_settings(dict, ["system", "initial", "solver", "steering", "depower", "kite", "kps4", "bridle",
"kcu", "tether", "winch", "environment"])
oblig_sections = ["system", "initial", "solver", "kite", "tether", "winch", "environment"]
update_settings(dict, oblig_sections)
try
update_settings(dict, ["kps4_3l"])
catch
println("Warning! Key kps4_3l not found in $(joinpath(DATA_PATH[1], basename(project))) .")
update_settings(dict, ["steering", "depower", "kps4", "bridle", "kcu"])
catch e
if !(e isa KeyError)
rethrow(e)

Check warning on line 411 in src/settings.jl

View check run for this annotation

Codecov / codecov/patch

src/settings.jl#L411

Added line #L411 was not covered by tests
end
end
tmp = split(dict["system"]["log_file"], "/")
SETTINGS.log_file = joinpath(tmp[1], tmp[2])
SETTINGS.height_k = dict["kite"]["height"]
if haskey(dict["kite"], "height")
SETTINGS.height_k = dict["kite"]["height"]
end
end
return SETTINGS
end
Expand Down
Loading
Loading