目录
💥1 概述
📚2 运行结果
🎉3 参考文献
👨💻4 Matlab代码
💥1 概述
基于扰动观测器的LQMPC:
扰动观测器(Disturbance Observer)是一种用于估计系统扰动的技术。它可以通过观测系统输出和状态估计误差来估计扰动。
LQMPC是线性二次模型预测控制(Linear Quadratic Model Predictive Control)的一种形式。它使用系统的线性动态模型进行预测,并通过最小化一个性能指标来计算控制器的优化输入。
在仿真文件中编写一个模拟基于扰动观测器的LQMPC控制器的系统。这可能涉及定义系统模型、设计控制器、设置性能指标和约束,并进行仿真实验。
双积分器动力学:
双积分器动力学是指系统状态包括位置和速度两个积分变量的动态行为。这种动力学常见于位置控制或运动控制问题中。
在仿真文件中编写一个模拟具有双积分器动力学的系统。定义系统的初始状态、输入信号和系统参数,并通过模拟仿真来观察系统的响应和稳定性。
自适应巡航控制系统:
自适应巡航控制系统是一种用于汽车等车辆的控制系统,可根据前方交通情况和速度设定来自动调整车辆的巡航速度和距离。
在仿真文件中编写一个模拟自适应巡航控制系统的环境。定义车辆的初始状态、前方交通情况、速度设定和控制策略,并观察系统在不同情况下的行为和性能。
📚2 运行结果
主函数部分代码:
% % ACC - 2nd-order dynamics - with disturbance observer % % Coded using the Reference Tracking formulation 2 of % % Module 5 - Introduction to MPC - Kolmanovsky % % Note 1: Qe and L are the most important tuning parameters % % Note 2: It might be impossible to apply Terminal weight and constraints % % Note 3: Since the problem is modelled as a TRACKING problem, it might % % be impossible to apply Tube-MPC % % Note 4: It showcases the use of a Disturbance observer in MPC clear all close all clc %% Discrete-time model Ts = 0.1; % sampling period Ad = [1, Ts;0, 1]; Bd = [0.5*Ts^2; Ts]; Bu = -Bd; Cd = [1, 0;0, 1]; Dd = 0; nx = size(Ad,2); % number of states nu = size(Bd,2); % number of inputs ny = size(Cd,1); % number of outputs nr = 2; % number of references nd = 1; % number of disturbances %% Extend state to include disturbance estimate \hat{w} % % state z = [x(k); \hat{w}(k)]; Az = [Ad, Bd; zeros(nd,size(Ad,2)), eye(nd)]; Bz = [Bu; zeros(nd,size(Bu,2))]; Cz = [Cd, zeros(size(Cd,1),nd)]; nz = size(Az,2); %% Extend state to include control increments du and reference r % % state z = [z(k); u(k-1); r(k)]; Az_ext = [Az, Bz, zeros(size(Az,1),nr); zeros(nu,size(Az,2)), eye(nu), zeros(nu,nr); zeros(nr,size(Az,2)), zeros(nr,nu), eye(nr) ]; Bz_ext = [Bz; eye(nu); zeros(nr,nu)]; E = [Cz, zeros(size(Cz,1),1), -eye(nr)]; %% Time data Tsim = 40; % simulation time Nsim = floor(Tsim/Ts); % simulation steps %% State constraints % % % velocity constraints min_v = 0; % not negative in highways max_v = 36.11; % [m/s] == 130 km/h; imposed by law min_delta_v = -max_v; % % safe distance constraint max_sensing_range = 115; tau_h = 1.4; % constant time headway % 0.5 d0 = 10; % stopping distance max_delta_d = max_sensing_range;%-d0; % x1_min = d0; x1_max = max_delta_d; x2_min = min_delta_v; x2_max = max_v; % x_set = Polyhedron('lb',[x1_min;x2_min],'ub',[x1_max;x2_max]); % % Polyhedron matrices of x: Fx * x <= fx Fx = [1, 0;-1, 0;0 1;0 -1]; fx = [x1_max;-x1_min;x2_max;-x2_min]; % % Extend to Polyhedron matrices of z: Fz * z <= fz Fz = Fx*[eye(nx), zeros(nx,nd)]; fz = fx; % % Extend to Polyhedron matrices of z_ext: Fz_ext * z_ext <= fz_ext Fz_ext = Fz*[eye(nz), zeros(nz,nu), zeros(nz,nr)]; fz_ext = fx; %% Control constraint % % % Input constraints gacc = 9.81; u_min = -0.5*gacc; u_max = 0.25*gacc; % u_set = Polyhedron('lb',u_min,'ub',u_max); % % Polyhedron matrices of u: Gu * u <= gu Gu = [1;-1]; gu = [u_max;-u_min]; % % u(k) = u(k-1) + du(k) % % Gu * u(k) <= gu --> Gu * ( u(k-1) + du(k) ) <= gu % % --> Gu*[zeros(nu,nz), eye(nu), zeros(nu,nr)] * z_ext + Gu * du(k) <= gu % % --> Gz_ext* z_ext + Gu * du(k) <= gu Gz_ext = Gu*[zeros(nu,nz), eye(nu), zeros(nu,nr)]; %% MPC data Np = 10; R = 1; Qe = diag([1, 1]); %diag([0.1, 5]); Q = E'*Qe*E; %% Stacked constraints Uad = AdmissibleInputs(Az_ext,Bz_ext,Np,Fz_ext,fz_ext,Gu,gu,Gz_ext); %% Quadratic Programming Q_bar = blkdiag(kron(eye(Np-1),Q),Q); R_bar = kron(eye(Np),R); [A_bar,B_bar] = genConMat(Az_ext,Bz_ext,Np); H = B_bar'*Q_bar*B_bar + R_bar; options = mpcActiveSetOptions; iA0 = false(size(Uad.b));
🎉3 参考文献
[1]严珺雄. 基于扰动观测器的移动机人轨迹跟踪控制研究[D].天津工业大学,2019.
部分理论引用网络文献,若有侵权联系博主删除。