R = numpy.concatenate([ numpy.full(M, 0.125), numpy.full(M, 0.307), numpy.full(M, 8.68e-5), numpy.full(M, 6.20), numpy.full(M, 3.39) ]) # Simulation setup t_end = 20 t_sim = numpy.linspace(0, t_end, t_end * 10) sim = Simulate.SimulateMPC(G, N, M, P, dt_model, Q, R, dvs=2, known_dvs=0, constraints=constraints) df = sim.simulate(Ysp_fun, t_sim, Udv=Udv, save_data="data/cons", live_plot=False) tuner = Tuner.Tuner(sim, Ysp_fun, t_sim, Udv=Udv,
Q = numpy.concatenate( [numpy.full(P, 0.513), numpy.full(P, 3.25), numpy.full(P, 2.37)]) R = numpy.concatenate( [numpy.full(M, 0.468), numpy.full(M, 0.406), numpy.full(M, 0.036)]) # Simulation setup t_end = 600 t_sim = numpy.linspace(0, t_end, t_end * 10) sim = Simulate.SimulateMPC(G, N, M, P, dt_model, Q, R, dvs=2, known_dvs=1) tune = False if tune: tuner = Tuner.Tuner(sim, Ysp_fun, t_sim, error_method="ISE", Udv=Udv) initial = [9, 5, 0.1, 1e-8, 1e-8, 1e-8] bounds = [(1e-12, 100)] * len(initial) a = datetime.datetime.now() result = tuner.tune(initial, bounds, simple_tune=True) b = datetime.datetime.now() print("Total time: ", b - a) print(result) else: