🍁🥬🕒摘要🕒🥬🍁
该存储库包含遗传算法 (GA) 的实现,用于调整 PID 控制器的增益。 本研究的重点是无人机(UAV)上使用的PID控制器。
autotuning_script.m: 这是一个独立的文件,模拟二阶系统的动力学。调优基于满意度等标准。
autotuning_v2: 此文件需要“reference_tracking.slx”Simulink 模型才能运行。基于参考跟踪实现调谐 a 要求的产出。
✨🔎⚡运行结果⚡🔎✨
💂♨️👨🎓Matlab代码👨🎓♨️💂
clear all; clc; % Values of damping, natural frequency and SS gain damping_ratio = (2:8)/10; natural_freq = (3:10); b0 = 1; %variables used to selected different frequency/damping values i = 1; % natural frequency j = 1; % damping ratio % Calculating the values of the nominator and denominator of the TF a = b0*(natural_freq(i)^2); b = 2*natural_freq(i)*damping_ratio(j); c = natural_freq(i)^2; k =1; %Simulink model required model = 'reference_tracking'; load_system(model) max_prop_gain = 1; max_int_gain = 1; % kp_initial = rand*max_prop_gain; % ki_initial = rand*max_int_gain; kp_initial = 3; ki_initial = 3; %population creation gains = [ kp_initial ki_initial; 0.5*kp_initial ki_initial; kp_initial 0.5*ki_initial; 0.5*kp_initial 0.5*ki_initial 2*kp_initial 2*ki_initial]; disp(gains); kp = kp_initial; ki = ki_initial; kp_p1 = num2str(kp); ki_p2 = num2str(ki); s_kp_p1 = strcat('Initial P Gain: ', kp_p1); s_ki_p2 = strcat('Initial I Gain: ',ki_p2); initial_gains = [s_kp_p1 char(10) s_ki_p2]; % textbox element
📜📢🌈参考文献🌈📢📜
[1]杨黎明. 一种改进的免疫遗传算法及在PID控制器优化设计中的应用[D].中南大学,2007.