Skip to content

Commit 05403a5

Browse files
committed
Add mwe_01.jl
1 parent c90f4a3 commit 05403a5

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

mwes/mwe_01.jl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Linearize the winch
2+
# input: set_speed
3+
# output: speed
4+
5+
using WinchControllers, KiteUtils
6+
7+
if isfile("data/system_tuned.yaml")
8+
set = load_settings("system_tuned.yaml")
9+
else
10+
set = load_settings("system.yaml")
11+
end
12+
wcs = WCSettings(dt=0.02)
13+
update(wcs)
14+
wcs.test = true
15+
16+
winch = Winch(wcs, set)
17+
18+
# find equilibrium speed
19+
function find_equilibrium_speed(winch, force)
20+
set_speed = 0.0
21+
for _ in 1:1000
22+
v_act = get_speed(winch)
23+
set_force(winch, force)
24+
set_v_set(winch, set_speed)
25+
26+
on_timer(winch)
27+
28+
# check if the speed is close enough to the desired equilibrium
29+
if abs(get_speed(winch) - set_speed) < 0.01
30+
break
31+
end
32+
end
33+
set_v_set(winch, set_speed)
34+
on_timer(winch)
35+
return get_speed(winch)
36+
end

0 commit comments

Comments
 (0)