主要内容

DC 电机的滑模控制

自 R2025a 起

此示例说明如何使用 Linear Sliding Mode Controller (State Feedback) 模块,实现 DC 电机位置对方波参考信号的跟踪。

DC 电机实现

DC 电机使用 Simscape™ 进行建模,该工具提供了真实的仿真环境。此示例中的电机基于 Maxon RE 65 系列电机,具体为 24V 规格的 388985 型号。

定义电机参数。

Ra = 0.0891;             % Armature resistance in Ohms
La = 3.1000e-05;         % Armature inductance in Henrys
Kv = 0.0537;             % Back EMF constant in V/(rad/s)
Ki = 0.0537;             % Torque constant in Nm/A
i_noload = 0.6970;       % No-load current in Amperes
V_i_noload = 24;         % No-load voltage in Volts
J = 1.2900e-04;          % Rotor inertia in kg*m^2
InitialRotorSpeed = 10;  % Initial Rotor Speed 

计算空载角速度。

omega_noload = V_i_noload / Kv;

计算阻尼系数。

v = (Ki * i_noload) / omega_noload;

控制器设计

要设计用于参考跟踪的 SMC 控制器,必须使用任务模式参数将 Linear Sliding Mode Controller (State Feedback) 模块配置为参考跟踪模式。此外,为了实现参考跟踪,该模块需要状态空间矩阵 ABC。定义矩阵。

A = [0, 1, 0; 0, -v/J, Ki/J; 0, -Kv/La, -Ra/La];
B = [0; 0; 1/La];
C = [1 0 0];

设计 SMC 控制器的关键在于确定滑动矩阵。在此示例中,不需要您显式定义矩阵 S,而是由该模块使用二次最小化方法计算 S 矩阵。该方法需要提供加权矩阵 (Q) 来计算滑模面。定义矩阵。

Q = diag([1000, 100, 10, 1]);

打开系统。

open_system('smc_dc_motor');

此示例提供一个预配置了 Linear Sliding Mode Controller (State Feedback) 模块的模型。要检查 Linear Sliding Mode Controller (State Feedback) 模块的配置,请打开模块参数。

open_system('smc_dc_motor/Linear Sliding Mode Controller (State Feedback)')

使用真实值对系统进行仿真。

sim_nominal = sim('smc_dc_motor');

为了说明实际应用情况(实际应用情况是,无法始终精确获知模型参数),使用电枢电阻和电感的扰动值对系统进行仿真。这样做有助于证明 SMC 方法的稳健性。

% Perturbation in parameters
Ra=Ra*.7;
La=La*.7;

% Update system matrices
A = [0, 1, 0; 0, -v/J, Ki/J; 0, -Kv/La, -Ra/La];
B = [0; 0; 1/La];

% Simulate with perturbed parameters
sim_perturbed = sim('smc_dc_motor');

提取并绘制仿真结果,显示标称条件和扰动条件下的电机位置和控制输入。

nominal = sim_nominal.logsout.extractTimetable;
nominal = splitvars(nominal,'x','NewVariableNames',["Position", "Velocity", "Current"]);

perturbed = sim_perturbed.logsout.extractTimetable;
perturbed = splitvars(perturbed,'x','NewVariableNames',["Position", "Velocity", "Current"]);

stackedplot(nominal, perturbed,{["Position", "Reference"],"u"})

Figure contains an object of type stackedplot.

此示例凸显了滑模控制器在跟踪参考信号时的有效性,即使系统参数存在不确定性时也是如此。SMC 的这种稳健特性使其适用于存在参数变化和外部扰动的应用场景。

另请参阅

主题