Skip to content

Commit

Permalink
one more test script uses new plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
ufechner7 committed Mar 16, 2024
1 parent 040fadf commit 985f5c3
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions test/test_forcespeedcontroller2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ using Timers; tic()
# Input: A varying wind speed. Implements the simulink block diagram, shown in
# docs/force_speed_controller_test2.png
using KiteControllers, Plots, BenchmarkTools
inspectdr()
InspectDR.defaults.xaxiscontrol_visible = false

wcs = WCSettings()
wcs.test = true
Expand Down Expand Up @@ -69,30 +67,22 @@ for i in 1:SAMPLES
speed_controller_step4!(pid1, pid2, pid3, mix3, winch, calc, i, last_force, last_v_set_out, V_WIND, STARTUP, V_RO, ACC, FORCE, V_SET_OUT, STATE, V_ERR, F_ERR)
end

p1=plot(TIME, V_WIND, label="v_wind [m/s]", width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12)
plot!(TIME, V_RO, label="v_reel_out [m/s]", width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12)
plot!(TIME, V_SET_OUT, label="v_set_out [m/s]", width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12)
plot3(TIME, V_WIND, V_RO, V_SET_OUT;
labels=["v_wind [m/s]", "v_reel_out [m/s]", "v_set_out [m/s]"],
fig="test_forcespeed_2a")

p2=plot(TIME, F_ERR*0.001, label="f_err [kN]", width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12)
plot!(TIME, V_ERR, label="v_error [m/s]", width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12)
plot2(TIME, F_ERR*0.001, V_ERR;
labels=["f_err [kN]", "v_error [m/s]"],
fig="test_forcespeed_2b")

p3=#plot(TIME, ACC, label="acc [m/s²]", width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12)
plot(TIME, FORCE*0.001, label="force [kN]", width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12)
plot!(TIME, STATE, label="state", width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12)
# plot!(TIME, V_ERR, label="v_error [m/s]", width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12)
# plot!(TIME, F_ERR*0.001, label="f_error [kN]", width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12)
plot3(TIME, ACC, FORCE*0.001, STATE;
labels=["acc [m/s²]", "force [kN]", "state"],
fig="test_forcespeed_2c")

pIDR = display(p1) # Display with InspectDR and keep plot object
resize!(pIDR.wnd, 1200, 700) # Resize GTK window directly
# plot!(TIME, V_ERR, label="v_error [m/s]")
# plot!(TIME, F_ERR*0.001, label="f_error [kN]")

pIDR2 = display(p2) # Display with InspectDR and keep plot object
resize!(pIDR2.wnd, 1200, 700) # Resize GTK window directly

pIDR3 = display(p3)
resize!(pIDR3.wnd, 1200, 700)
toc()

println("Max iterations needed: $(wcs.iter)")

# return TIME, V_WIND, V_RO, V_SET_OUT, ACC, FORCE, STATE, V_ERR, F_ERR

0 comments on commit 985f5c3

Please sign in to comment.