天天看點

在Simulink中設計多工位的系列PID控制器Design Family of PID Controllers for Multiple Operating Points打開一個裝置的模型排程增益Gain Scheduling的簡介在多個工作點得到線性模型為裝置模型設計PID控制器

打開一個裝置的模型

該裝置是一個連續攪拌釜式反應器(CSTR),可在大範圍的操作點上運作。單台PID控制器可以有效地利用冷卻液溫度在PID控制器設計的小工作範圍内調節輸出濃度。然而,由于該裝置是一個強非線性系統,當工作點發生顯著變化時,控制性能會下降。閉環系統甚至會變得不穩定。

首先打開CSTR裝置的模型

mdl = 'scdcstrctrlplant';
open_system(mdl)
           
在Simulink中設計多工位的系列PID控制器Design Family of PID Controllers for Multiple Operating Points打開一個裝置的模型排程增益Gain Scheduling的簡介在多個工作點得到線性模型為裝置模型設計PID控制器

排程增益Gain Scheduling的簡介

求解非線性控制問題的一般方法就是排程增益——用系列線性控制器去排程。一般來說,設計一個排程增益控制系統需要以下4步:

  1. 獲得每個運作範圍内的模型。得到運作域範圍内一系列點的線性化模型。
  2. 設計一系列的線性控制器,比如PID控制器,來應用于步驟1的模型。
  3. 實作一個排程機制,根據排程變量的值變化不同的控制器系數,例如PID增益。
  4. 仿真,評估控制性能。

在多個工作點得到線性模型

輸出濃度C通常用來描述不同的工作點。

确定工作範圍

建立一個預設工作點operating point specification數組

初始化工作點,确定輸出濃度(确定值),和輸出濃度值

for ct = 1:numel(C)
    op(ct).Outsputs.known = true;
    op(ct).Outputs.y = C(ct);
end
           

根據C的值計算平衡運作點 equilibrium operating points

在這些工作點線性化

因為CSTR模型是非線性的,而線性系統顯示出了不同的特性。

比如說,裝置的模型在低轉換率和高轉換率的時候是穩定的,但是在其他時候就不穩定(0表示不穩定)

isStable(Plants,'elem')

# ehcho
ans =

  1x8 logical array

   1   1   0   0   0   0   1 
           

為裝置模型設計PID控制器

使用

pidtune

函數,可以批量的生成PID控制器。理想的開環交叉頻率為1 rad/sec,相位裕度為預設值60度。

為了分析步長跟蹤step setpoint tracking的閉環響應,首先構造閉環系統。

畫出閉環的響應

figure
hold on
for ct = 1:length(C)
    sys = clsys(:,:,ct);
    sys.Name = ['C=',num2str(C(ct))];
    syss.InputName = 'Reference';
    stepplot(sys,20);
end
legend('show','location','southeast')
           
在Simulink中設計多工位的系列PID控制器Design Family of PID Controllers for Multiple Operating Points打開一個裝置的模型排程增益Gain Scheduling的簡介在多個工作點得到線性模型為裝置模型設計PID控制器

所有的閉環都是穩定的,但是超調有點大,增加目标開環帶寬到10rad/sec。

對不穩定的裝置模型重新設計控制器

構造閉環系統,并且畫出新控制器閉環階躍響應的圖。

clsys = feedback(Plants*Controllers,1);
figure
hold on
for ct = 1:length(C)
    % Select a system from the LTI array
    sys = clsys(:,:,ct);
    set(sys,'Name',['C=',num2str(C(ct))],'InputName','Reference');
    % Plot step response
    stepplot(sys,20);
end
legend('show','location','southeast')
           
在Simulink中設計多工位的系列PID控制器Design Family of PID Controllers for Multiple Operating Points打開一個裝置的模型排程增益Gain Scheduling的簡介在多個工作點得到線性模型為裝置模型設計PID控制器

所有的閉環響應現在都是令人滿意的。為了進行比較,檢驗在所有操作點使用同一個控制器時的響應。建立一組閉環系統,其中每個系統使用C = 2控制器,并繪制它們的響應。

% clsys_flat用的都是C=2的控制器
clsys_flat = feedback(Plants*Controllers(:,:,1),1);

figure
stepplot(clsys,clsys_flat,20)
legend('C-dependent Controllers','Single Controller')
           
在Simulink中設計多工位的系列PID控制器Design Family of PID Controllers for Multiple Operating Points打開一個裝置的模型排程增益Gain Scheduling的簡介在多個工作點得到線性模型為裝置模型設計PID控制器

為每個濃度單獨設計的PID控制器陣列比單個控制器具有更好的性能。然而,上面所示的閉環響應是基于整個非線性系統的線性近似來計算的。要驗證設計,還需要使用PID控制器塊在模型中實作排程機制。

最後,關閉模型

參考文章:

Design Family of PID Controllers for Multiple Operating Points - MATLAB & Simulink - MathWorks 中國

完整代碼附錄

clc
clear all
close all

mdl = 'scdcstrctrlplant';
open_system(mdl)

%sepcify the operating regions
C = [2 3 4 5 6 7 8 9];

% creat an array of default operating point specifications
op = operspec(mdl,numel(C));

for ct = 1:numel(C)
    op(ct).Outputs.known = true;
    op(ct).Outputs.y = C(ct);
end

% equilibrium operating points corresponding to values of c
opoint = findop(mdl,op,findopOptions('DisplayReport','off'));

% linearize the plant at operating points
Plants = linearize(mdl,opoint)

isstable(Plants,'elem')'

Controllers = pidtune(Plants,'pidf',pidtuneOptions('Crossover',1));

Controllers(:,:,4)

% closed loop systems
clsys = feedback(Plants*Controllers,1);

figure
hold on
for ct = 1:length(C)
    % Select a system from the LTI array
    sys = clsys(:,:,ct);
    sys.Name = ['C=',num2str(C(ct))];
    sys.InputName = 'Reference';
    % Plot step response
    hold on;
    stepplot(sys,20);
end
legend('show','location','southeast')

% open-loop bandwidth to 10rad/sec
Controllers = pidtune(Plants,'pidf',10);

% display controller for c = 4
Controllers(:,:,4)

% closed-loop step response for the new controllers
clsys = feedback(Plants*Controllers,1);
figure
hold on
for ct = 1:length(C)
    % Select a system from the LTI array
    sys = clsys(:,:,ct);
    set(sys,'Name',['C=',num2str(C(ct))],'InputName','Reference');
    % Plot step response
    hold on;
    stepplot(sys,20);
end
legend('show','location','southeast')


clsys_flat = feedback(Plants*Controllers(:,:,1),1);

figure
stepplot(clsys,clsys_flat,20)
legend('C-dependent Controllers','Single Controller')
           

繼續閱讀