@@ -51,6 +51,18 @@ function calc_force(v_wind, v_ro)
5151 (v_wind - v_ro)^ 2 * 4000.0 / 16.0
5252end
5353
54+ # create the upper force controller
55+ # Tf can typically be chosen as Ti/NT for a PI controller and Td/N for a PID controller, and N is commonly in the range 2 to 20.
56+ # Td = wcs.df_high / wcs.pf_high Kd/Kp
57+ function upper_force_controller (wcs)
58+ # wcs: WCSettings object
59+ Td = wcs. df_high / wcs. pf_high
60+ N = wcs. nf_high
61+ Tf = Td / N
62+ C = pid (wcs. pf_high, wcs. if_high, wcs. df_high; form= :parallel , filter_order= 1 , state_space= true , Tf)
63+ return C
64+ end
65+
5466function system_dynamics (x, u)
5567 # x: state vector, e.g., [v_act]
5668 # u: input vector, e.g., [v_set, v_wind]
@@ -73,10 +85,18 @@ function linearize(winch, v_set, v_wind)
7385 siso_sys = ss (A, B[:, 1 ], C, D[:, 1 ])
7486end
7587
88+ function open_loop_system (winch, v_set, v_wind)
89+ # Create the open loop system with the upper force controller
90+ C = upper_force_controller (winch. wcs)
91+ sys = linearize (winch, v_set, v_wind)
92+ # sys_open = feedback(C * sys, 1.0; sign=-1)
93+ return C * sys
94+ end
95+
7696for v_wind in range (1 , 9 , length= 9 )
7797 local v_set, sys
7898 v_set = 0.57 * v_wind
7999 @info " Linearizing for v_wind: $v_wind m/s, v_ro: $(round (v_set, digits= 2 )) m/s"
80- sys = linearize (winch, v_set, v_wind)
100+ sys = open_loop_system (winch, v_set, v_wind)
81101 bode_plot (sys; from= 0.76 , to= 2.85 , title= " Linearized System, v_wind=1..9 m/s" )
82102end
0 commit comments