3. 倾转机构建模
任务定义
本案例建立倾转旋翼机倾转机构的执行器动态模型,用于模拟倾转角度指令下的响应过程。模型包含二阶执行器动态特性、倾转角度与角速度限幅,以及执行器速率饱和约束,为后续控制律设计提供可替换的倾转执行器仿真模块。
倾转执行器动态模型
倾转机构采用二阶动态模型描述从倾转角度指令到实际倾转角度的响应关系:
θ̈ = ωₙ²·(θ_cmd − θ) − 2·ζ·ωₙ·θ̇
其中θ为实际倾转角度,θ_cmd为倾转角度指令,ωₙ为执行器自然频率,ζ为阻尼比。模型在积分环节后依次施加角度限幅[θ_min, θ_max]与角速度限幅[ω_max, ω_max],模拟真实执行器的物理约束。角度限幅反映机械行程边界,角速度限幅反映液压/电动执行机构的速率饱和特性。
Python仿真实现
import numpy as np
import matplotlib.pyplot as plt
class TiltActuator:
"""倾转执行器动态模型(二阶+限幅)"""
def __init__(self, wn=8.0, zeta=0.8, theta_min=-1.2, theta_max=1.2,
omega_max=0.6, dt=0.001):
self.wn = wn
self.zeta = zeta
self.theta_min = theta_min
self.theta_max = theta_max
self.omega_max = omega_max
self.dt = dt
self.theta = 0.0
self.omega = 0.0
def reset(self):
self.theta = 0.0
self.omega = 0.0
def step(self, theta_cmd):
"""单步更新,输入倾转指令(rad),返回实际倾角(rad)"""
# 二阶动态方程(加速度计算)
accel = self.wn**2 * (theta_cmd - self.theta) - 2*self.zeta*self.wn*self.omega
# 半隐式欧拉积分
self.omega += accel * self.dt
# 角速度限幅
self.omega = np.clip(self.omega, -self.omega_max, self.omega_max)
self.theta += self.omega * self.dt
# 角度限幅
self.theta = np.clip(self.theta, self.theta_min, self.theta_max)
return self.theta
def simulate_tilt_response(actuator, cmd_profile, dt=0.001):
"""执行仿真序列,返回时间、指令、实际角度"""
t = np.arange(0, len(cmd_profile)*dt, dt)
theta_actual = np.zeros_like(cmd_profile)
for i, cmd in enumerate(cmd_profile):
theta_actual[i] = actuator.step(cmd)
return t, cmd_profile, theta_actual
# 仿真参数
dt = 0.001
act = TiltActuator(wn=8.0, zeta=0.8, dt=dt)
# 指令序列:0→0.8rad→0.2rad→1.0rad(阶跃变化)
cmd_steps = [0.0, 0.8, 0.2, 1.0]
hold_time = 2.0 # 每段保持时间(秒)
n_hold = int(hold_time / dt)
cmd_profile = np.concatenate([np.full(n_hold, val) for val in cmd_steps])
# 运行仿真
t, cmd, theta = simulate_tilt_response(act, cmd_profile, dt)
# 绘制响应曲线
plt.figure(figsize=(10, 5))
plt.plot(t, cmd, 'k--', label='指令角度', linewidth=1.5)
plt.plot(t, theta, 'b-', label='实际倾角', linewidth=2)
plt.xlabel('时间 (s)')
plt.ylabel('倾转角度 (rad)')
plt.title('倾转机构动态响应(含限幅)')
plt.legend()
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig('tilt_response.png', dpi=150)
plt.show()
模型验证方法
运行上述代码后,通过以下观测点验证模型正确性:
- 稳态跟踪:每段指令保持2秒后,实际倾角应收敛至指令值(误差<0.01 rad),验证二阶模型无稳态误差;
- 动态特性:0→0.8 rad阶跃响应中,超调量应约为1.5%(ζ=0.8对应理论超调1.5%),峰值时间约0.4 s;
- 速率限幅生效:1.0 rad指令对应角速度需求超过ω_max=0.6 rad/s时,响应曲线呈现线性爬升段(斜率≈0.6),而非二阶振荡形态;
- 角度限幅生效:若指令超过θ_max=1.2 rad,实际角度将被钳位在1.2 rad不再上升。
判定标准:仿真曲线中同时出现二阶振荡响应与线性速率饱和段,且稳态值与指令一致,即证明执行器动态与限幅特性建模正确。
模型集成接口
该执行器模型可直接嵌入倾转旋翼控制律仿真回路。控制律输出倾转角度指令后,调用actuator.step(theta_cmd)即可获得带动态延迟与限幅的实际倾角。模型以类封装,内部状态独立,支持多实例并行仿真(如左右倾转机构独立建模)。通过调整wn、zeta参数可匹配不同执行器响应特性,调整omega_max可模拟不同速率饱和水平。