cp4_3.m
来自「离散控制系统设计的MATLAB 代码」· M 代码 · 共 79 行
M
79 行
%%%%%%%%%%% Comprehensive Problem 4.3 %%%%%%%%%%%
% Discrete-Time Control Problems using %
% MATLAB and the Control System Toolbox %
% by J.H. Chow, D.K. Frederick, & N.W. Chbat %
% Brooks/Cole Publishing Company %
% September 2002 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Electric Power Generation System
clear all, close all
disp('Comprehensive Problem CP4.3')
dpower % read data
disp('Power system model state matrices, with Vterminal, ')
disp(' w(speed), and P(power) as output')
disp('*****>'), pause
Gz
disp('*****>'), pause
disp('Open-loop system poles')
xy2p(pole(Gz));
disp('Open-loop system zeros')
xy2p(tzero(Gz));
disp('DC gain')
dcgain(Gz)
disp('*****>'), pause
disp('System model with Vterminal as the only output')
G1 = Gz(1,1)
disp('*****>'), pause
disp('System model in modal form')
G1m = canon(Gz(1,1),'modal')
disp('*****>'), pause
disp('Value of KI such that the controller zero is at z=0.9')
KI = (1/0.9 - 1)/Ts
disp('*****>'), pause
disp('Applying PI controller to Vterminal control')
disp('PI controller is of form')
disp(' (1+K_I T_s) z - 1 ')
disp('K_V(z) = K_P(-----------------) ')
disp(' z-1 ')
disp('Proportional gain')
K_P = [10 20 30 40 50]'
len_K = length(K_P);
disp('*****>'), pause
for i = 1:len_K
disp(['investigate the controller performance for K_P = ',num2str(K_P(i))])
disp(['controller transfer function for K_P = ', num2str(K_P(i))])
K_V = K_P(i)*tf([(1+KI*Ts) -1],[1 -1],Ts)
ss(K_V)
disp('*****>'), pause
disp('Closed-loop transfer function')
Gcl = feedback(G1*K_V,1)
disp('*****>'), pause
[zCL,pCL,kCL]=zpkdata(Gcl);
disp('Closed-loop zeros')
xy2p(zCL{1,:});
disp('Closed-loop poles')
xy2p(pCL{1,:});
disp('DC gain')
dcgain(Gcl)
disp('*****>'), pause
disp('step response')
figure, [y,t] = step(Gcl,10);
plot(t,0.05*y,'o'), xlabel('Time (s)'), ylabel('Amplitude')
grid;title('CP4.3: Power system model step response with PI controller')
text('Units','norm','Pos',[0.3 0.2],...
'Str',['Proportional gain = ' num2str(K_P(i))])
disp('*****>'), pause
end
%
disp('end of Comprehensive Problem 4.3')
%%%%%%%%%%
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?