資源簡介
模型預測控制學習(適合基礎學習,主要包括DMC,MPC),內容有程序及建模。

代碼片段和文件信息
function?p=dmc(p)
%?DMC???Dynamic?Matrix?Control
%?P=DMC(P)?determines?the?dynamic?matrix?control?(input?change)?based?on
%?the?plant?model?(step?response)?and?current?measurement?stored?in?the
%?structure?P.?
%?Input:
%???P.sr?-?unit?step?response?data
%???P.u??-?current?input?initially?0
%???P.v??-?past?input?initially?empty
%???P.G??-?dynamic?matrix?set?by?the?initial?call
%???P.F??-?matrix?to?calculate?free?response?set?by?the?initial?call
%???P.k??-?DMC?gain?set?by?the?initial?call
%???P.r??-?reference?(set?point)
%???P.a??-?reference?smooth?factor
%???P.p??-?prediction?horizon
%???P.m??-?moving?horizon
%???P.y??-?current?mrasurement
%???P.la?-?performance?criterion?weight?i.e.?J?=?||r-y||?+?p.la*||du||
%??????????where?du?is?the?input?change
%?Output:
%???P.u??-?new?input?for?next?step
%???P.f??-?updated?free?response
%???P.G??-?dynamic?matrix?if?it?is?the?first?step.
%???P.k??-?DMC?gain?if?it?is?the?first?step
%
%?See?Also:?mpc
%?Version?1.0?created?by?Yi?Cao?at?Cranfield?University?on?6th?April?2008.
%?Example:?
%{
p.sr=filter([0?0?0.2713][1?-0.8351]ones(501));
p.p=10;
p.m=5;
p.y=0;
p.v=[];
u=zeros(13);
N=120;
Y=zeros(N1);
U=zeros(N1);
R=zeros(N1);
R([1:30?61:90])=1;
p.la=1;
for?k=1:120
????p.a=0;
????p.r=R(k:min(Nk+p.p));
????if?k>60
????????p.a=0.7;
????end
????p=dmc(p);
????Y(k)=p.y;
????U(k)=p.u;
????u=[u(2:3)?p.u];
????p.y=0.8351*p.y+0.2713*u(1);
end
subplot(211)
plot(1:NY‘b-‘1:NR‘r--‘[60?60][-0.5?1.5]‘:‘‘linewidth‘2)
title(‘solid:?output?dashed:?reference‘)
text(351‘\alpha=0‘)
text(951‘\alpha=0.7‘)
axis([0?120?-0.5?1.5])
subplot(212)
[xxyy]=stairs(1:NU);
plot(xxyy‘-‘[60?60][-0.5?1.5]‘:‘‘linewidth‘2)
axis([0?120?-0.5?1.5])
title(‘input‘)
xlabel(‘time?min‘)
%}
%?Input?and?output?check
error(nargchk(11nargin));
error(nargoutchk(01nargout));
%?length?of?step?response
N=numel(p.sr);
P=p.p;
%?initial?setup
if?isempty(p.v)
????%?number?of?past?inputs?to?keep
????n=N-P;
????%?storage?for?past?input
????p.v=zeros(n1);
????%?matrix?to?calculate?free?response?from?past?input
????x=p.sr(1:n);
????p.F=hankel(p.sr(2:P+1)p.sr(P+1:N))-repmat(x(:)‘P1);
????%?dynamic?matrix
????p.G=toeplitz(p.sr(1:P)p.sr(1)*eye(1p.m));
????%?calculate?DMC?gain
????R=chol(p.G‘*p.G+p.la*eye(p.m));
????K=R\(R‘\p.G‘);
????%?only?the?first?input?will?be?used
????p.k=K(1:);
????p.u=0;
end
%?free?response
f=p.F*p.v+p.y;
%?smooth?reference
nr=numel(p.r);
if?nr>=P
????ref=p.r(1:P);
else
????ref=[p.r(:);p.r(end)+zeros(P-nr1)];
end
w=filter([0?(1-p.a)][1?-p.a]refp.y);
%?DMC?input?change
u=p.k*(w-f);
%?past?input?change?for?next?step
p.v=[u;p.v(1:end-1)];
%?next?input
p.u=p.u+u(1);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-08-16?13:39??MPC程序\
?????目錄???????????0??2018-09-24?13:42??MPC程序\無約束\
?????文件????????1416??2014-02-23?14:41??MPC程序\無約束\noise.m
?????文件?????????280??2018-09-25?19:46??MPC程序\無約束\step_model.m
?????文件?????2403161??2014-02-23?14:42??MPC程序\無約束\step_model.mat
?????文件?????1169443??2014-02-23?14:42??MPC程序\無約束\unconstrained_MPC.mat
?????文件????????1912??2014-02-23?14:42??MPC程序\無約束\unconstrained_m.m
?????文件????????1935??2014-02-23?14:42??MPC程序\無約束\unconstrained_p.m
?????文件????????1888??2014-02-23?14:42??MPC程序\無約束\unconstrained_uw.m
?????文件????????1916??2014-02-23?14:42??MPC程序\無約束\unconstrained_yw.m
?????目錄???????????0??2018-08-16?13:39??MPC程序\約束\
?????文件????????1782??2014-02-23?14:42??MPC程序\約束\cmpcQP.m
?????文件????????1758??2014-02-23?14:42??MPC程序\約束\cmpcQP_m.m
?????文件????????1735??2014-02-23?14:42??MPC程序\約束\cmpcQP_yw.m
?????文件????????1910??2014-02-23?14:42??MPC程序\約束\cmpcQPnoise.m
?????文件????????2393??2014-02-23?14:42??MPC程序\約束\compare.m
?????文件?????2327554??2014-02-23?14:43??MPC程序\約束\dstatespace.mat
?????文件????????1410??2014-02-23?14:42??MPC程序\約束\genQP.m
?????文件?????????392??2014-02-23?14:42??MPC程序\約束\get_F.m
?????文件?????????243??2014-02-23?14:42??MPC程序\約束\state_model_c2d.m
?????文件??????939731??2014-02-23?14:43??MPC程序\約束\step_model.mat
?????目錄???????????0??2018-08-16?13:55??dmc\
?????文件????????2766??2008-04-08?09:18??dmc\dmc.m
?????文件???????28477??2018-08-16?13:48??dmc\dmc.zip
?????文件????????4862??2008-04-08?09:21??dmc\dmctutorial.m
?????文件????????1306??2014-02-12?12:35??dmc\license.txt
?????目錄???????????0??2018-09-24?13:05??先進控制算法MPC和DMC\
?????文件?????????526??2018-03-20?11:06??先進控制算法MPC和DMC\MAC1.m
?????文件?????????370??2018-03-20?11:29??先進控制算法MPC和DMC\MAC2.m
?????文件?????????310??2018-03-20?17:37??先進控制算法MPC和DMC\MAC3.m
?????文件?????????426??2018-03-20?17:22??先進控制算法MPC和DMC\MAC4.m
............此處省略3個文件信息
- 上一篇:思量QQ亮鉆大師 v2.0.zip
- 下一篇:計算機網絡打作業實現QQ.zip
評論
共有 條評論