Main Content

控制手推车上的倒摆

此示例使用Systuneto control an inverted pendulum on a cart.

摆钟组件

手推车/摆组件如图1所示,并使用SimScape™MultiBody™在Simulink®中进行建模。金宝app

图1:在购物车上的倒摆

Figure 2: Simscape Multibody model

This system is controlled by exerting a variable force$F$在购物车上。控制器需要在将购物车移至新位置或钟摆向前移动时保持钟摆直立(脉冲干扰$dF$)。

Control Structure

The upright position is an unstable equilibrium for the inverted pendulum. The unstable nature of the plant makes the control task more challenging. For this example, you use the following two-loop control structure:

open_system('rct_pendulum.slx')set_param('rct_pendulum',,,,'SimMechanicsOpenEditorOnUpdate',,,,'off');

内部循环使用二阶状态空间控制器来稳定摆在其直立位置($\theta$control), while the outer loop uses a Proportional-Derivative (PD) controller to control the cart position. You use a PD rather than PID controller because the plant already provides some integral action.

Design Requirements

UseTuningGoalrequirements to specify the desired closed-loop behavior. Specify a response time of 3 seconds for tracking a setpoint change in cart position$x$

% Tracking of x commandreq1 = tuninggoal.tracking('xref',,,,'X',3);

To adequately reject impulse disturbances$dF$on the tip of the pendulum, use an LQR penalty of the form

$$ \int_0^\infty (16 \theta^2(t) + x^2(t) + 0.01 F^2(t)) dt $$

that emphasizes a small angular deviation$\theta$并限制了控制工作$F$

%拒绝冲动干扰DFqxu = diag([16 1 0.01]);req2 = tuninggoal.lqg('df',,,,{'theta',,,,'X',,,,'F'},1,qxu);

为了鲁棒性,在工厂输入处至少需要至少6 dB的增益边缘和40度的相位边缘。

% Stability marginsreq3 = tuninggoal.margins('F',,,,6,40);

最后,限制闭环杆的阻尼和固有频率,以防止生涩或阻尼不足的瞬变。

%杆位置MinDamping = 0.5;MaxFrequency = 45; req4 = TuningGoal.Poles(0,MinDamping,MaxFrequency);

控制系统调整

The closed-loop system is unstable for the initial values of the PD and state-space controllers (1 and$ 2/s $, 分别)。您可以使用Systuneto jointly tune these two controllers. Use theSltunerinterface to specify the tunable blocks and register the plant inputF作为测量稳定边缘的分析点。

ST0 = slTuner('rct_pendulum',,,,{'Position Controller',,,,'Angle Controller'});ADDPOINT(ST0,'F');

Next, useSystune调整PD和状态空间控制器,但受到上述性能要求的约束。优化受稳定性边缘和极点限制(硬要求)的跟踪和干扰拒绝性能(软要求)。

rng(0)选项= SystuneOptions(“随机启动”,5);[ST,FSOFT] = Systune(ST0,[REQ1,REQ2],[REQ3,REQ4],options);
最终:soft = 1.38,硬= 0.99987,迭代= 312最终:soft = 1.44,硬= 0.99933,迭代= 139最终:soft = 1.44,硬= 0.99871,迭代= 0.99871,迭代= 325最终:soft = 1.27,硬= 0.999599,迭代,迭代,迭代,迭代= 309最终:软= 1.44,硬= 0.99995,迭代= 321最终:软= 1.4,硬= 0.99959,迭代= 233

最佳设计可满足软性需求的价值,同时满足硬性要求(难的<1)。这意味着调整的控制系统几乎达到了跟踪和干扰拒绝的目标性能,同时满足稳定性边缘和极点位置约束。

验证

UseViewGoalto further analyze how the best design fares against each requirement.

数字('Position',,,,[100 100 575 660]) viewGoal([req1,req3,req4],ST)

These plots confirm that the first two requirements are nearly satisfied while the last two are strictly enforced. Next, plot the responses to a step change in position and to a force impulse on the cart.

T = getIOTransfer(ST,{'xref',,,,'df'},{'X',,,,'theta'});数字('Position',[100 100 650 420]);子图(121),步骤(t(::,1),10)标题(“跟踪位置的设定点变化”)子图(122),Impulse(t(:,2),10)标题('Rejection of impulse disturbance'

The responses are smooth with the desired settling times. Inspect the tuned values of the controllers.

c1 = getBlockValue(st,'Position Controller'
C1 = S KP + KD * --------------------------------- kp = 5.9,kd = 1.94,tf = 0.0513名称:position_controller连续时间PDF控制器以并行形式。
C2 = zpk(getBlockValue(ST,'Angle Controller'))
C2 = -1600.6 (s+13) (s+4.279) ------------------------ (s+134.3) (s-14.27) Name: Angle_Controller Continuous-time zero/pole/gain model.

请注意,角控制器具有一个不稳定的杆,该杆与植物不稳定的杆配对以稳定倒置的摆。要看到这一点,请在工厂输入处获取开环转移并绘制根源基因座。

l = getlooptransfer(st,'F',-1);图Rlocus(L)集(GCA,'XLim',[-25 20],'ylim',[-20 20])

要完成验证,请上传调谐值以模拟和模拟CART/PENDULUM组件的非线性响应。金宝app结果模拟的视频显示在下面。

WriteBlockValue(ST)

Figure 3: Cart/pendulum simulation with tuned controllers.

关闭the model after simulation.

set_param('rct_pendulum',,,,'SimMechanicsOpenEditorOnUpdate',,,,'在');close_system('rct_pendulum',,,,0);

也可以看看

(金宝appSimulink控制设计)|(金宝appSimulink控制设计)

Related Topics