@@ -101,6 +101,12 @@ function eval_fct_lfc(x)
101101 count_eval = true
102102 return (success, count_eval, bb_outputs)
103103end
104+ function eval_fct_ufc (x)
105+ bb_outputs = [simulate_ufc (x)]
106+ success = true
107+ count_eval = true
108+ return (success, count_eval, bb_outputs)
109+ end
104110
105111function simulate_lfc (x:: Vector{Cdouble} ; return_lg:: Bool = false )
106112 wcs = WCSettings (dt= 0.02 )
@@ -164,12 +170,25 @@ function autotune(controller::WinchControllerState)
164170 println (" Autotuning upper force control..." )
165171 # Define the parameters for the autotuning
166172 x0 = [maximum ([2e-5 , wcs. pf_high]), wcs. if_high] # initial guess for the speed controller gain
167- x, info = bobyqa (simulate_lfc, x0;
168- xl = 0.25 .* x0,
169- xu = 2.0 .* x0,
170- rhobeg = maximum ([2e-5 , minimum (x0)/ 4 ]),
171- maxfun = 500
172- )
173+ # x, info = bobyqa(simulate_lfc, x0;
174+ # xl = 0.25 .* x0,
175+ # xu = 2.0 .* x0,
176+ # rhobeg = maximum([2e-5, minimum(x0)/4]),
177+ # maxfun = 500
178+ # )
179+ pb = NomadProblem (2 , # number of inputs of the blackbox
180+ 1 , # number of outputs of the blackbox
181+ [" OBJ" ], # type of outputs of the blackbox
182+ eval_fct_ufc;
183+ lower_bound = 0.25 .* x0,
184+ upper_bound = 2.0 .* x0)
185+ try
186+ result = solve (pb, x0)
187+ x = result. x_best_feas
188+ catch e
189+ @error " Autotuning ufc failed: $(e) "
190+ x = x0
191+ end
173192 else
174193 error (" Unknown controller state: $controller " )
175194 return
0 commit comments