diff --git a/test/plot.jl b/test/plot.jl index 4213382d..6c00dd97 100644 --- a/test/plot.jl +++ b/test/plot.jl @@ -47,13 +47,14 @@ function plot3(X, Y1, Y2, Y3; labels=["", "", ""], fig="", title="") ax1 = plt.subplot(311) plt.suptitle(title, fontsize=14) # Super title plt.plot(X, Y1, label=labels[1]); - ylabel(labels[1], fontsize=14); + plt.ylabel(labels[1], fontsize=14); plt.grid(true) plt.setp(ax1.get_xticklabels(), visible=false) ax2 = plt.subplot(312, sharex = ax1) plt.plot(X, Y2, label=labels[2]) plt.grid(true) - ylabel(labels[2], fontsize=14); grid(true) + plt.ylabel(labels[2], fontsize=14); + plt.grid(true) plt.setp(ax2.get_xticklabels(), visible=false) ax3 = plt.subplot(313, sharex = ax1) plt.plot(X, Y3, label=labels[3]) diff --git a/test/test_forcespeedcontroller1.jl b/test/test_forcespeedcontroller1.jl index e7349195..9f3e402d 100644 --- a/test/test_forcespeedcontroller1.jl +++ b/test/test_forcespeedcontroller1.jl @@ -9,8 +9,6 @@ using Timers; tic() # Input: A varying wind speed. Implements the simulink block diagram, shown in # docs/force_speed_controller_test1.png using KiteControllers, Plots, BenchmarkTools -inspectdr() -InspectDR.defaults.xaxiscontrol_visible = false wcs = WCSettings() wcs.test = true @@ -57,29 +55,24 @@ for i in 1:SAMPLES speed_controller_step3!(pid1, pid2, winch, calc, i, last_force, last_v_set_out, V_WIND, STARTUP, V_RO, ACC, FORCE, V_SET_OUT, V_SET_OUT_B, 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) +include("plot.jl") +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_1a") -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_1b") -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) +plot2(TIME, ACC, FORCE*0.001, + labels=["acc [m/s²]", "force [kN]"], + fig="test_forcespeed_1c") -pIDR = display(p1) # Display with InspectDR and keep plot object -resize!(pIDR.wnd, 1200, 700) # Resize GTK window directly +# plot!(TIME, STATE, label="state") +# 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 - -# display(p3) toc() println("Max iterations needed: $(wcs.iter)") - -# return TIME, V_WIND, V_RO, V_SET_OUT, ACC, FORCE, STATE, V_ERR, F_ERR \ No newline at end of file