Wrong flipped peak in phase response around resonance point of a transfer function.

I am getting a wrong peak around the resonance point of a tranfer function. The correct peak should be opposite one. if I look at the response in PIDTuner the peak appears to be correct.
%% System parameters
freq = 60;
V_ll = 13.8e3; %rms
Vph = V_ll/sqrt(3); %rms
Rg = 0.01;
Rc = 0.01;
Lg = 1e-3;
Ls = 0;
Lc = 2.4e-3;
Rt = Rg+Rc;
Lt = Lg+Lc;
Cf = 5000e-9;
fsw = 7.5e3;
Tsw = 1/fsw;
fs = 2*fsw;
Ts = 1/fs;
wres = (sqrt((Lc+Lg+Ls)/(Lc*(Lg+Ls)*Cf)))*0.1592; %Hz
wres_min = sqrt(1/(Lc*Cf))*0.1592; %Hz
%% pu Calculation
Vbase = (sqrt(2/3))*V_ll; %Vph,pk
Sbase = 10e6; %VA
Ibase = (2/3)*(Sbase/Vbase);
Zbase = Vbase/Ibase;
wbase = 2*pi*freq;
Lbase = Zbase/wbase;
Cbase = 1/(Zbase*wbase);
Ltpu = Lt/Lbase;
Rtpu = Rt/Zbase;
Lgpu = Lg/Lbase;
Lcpu = Lc/Lbase;
Cfpu = Cf/Cbase;
%% Inner Current Control Design
% plant transfer function
s =tf('s');
Gs = 1/(1+s*Ts);
GiLc_vc = wbase*((s^2*Cfpu*Lgpu+wbase*wbase)/(s^3*Cfpu*Lgpu*Lcpu+s*wbase*wbase*(Lcpu+Lgpu)));
Gp = Gs*GiLc_vc;
kp_1 = 0.1658;
ki_1 = 62.431;
Gc_1 = tf([kp_1,ki_1],[1,0]);
sys_u_1 = Gc_1*Gp;
sys_cl_1 = (sys_u_1/(1+sys_u_1));
[mag,phase, wout] = bode(sys_u_1);
subplot(2,1,1);
semilogx(wout(:,1)/(2*pi), 20*log10(squeeze(mag)), '-b',LineWidth=1.5); zoom on; grid on;
title('magnitude'); xlabel('Frequency (Hz)'); ylabel('Magnitude (dB)');
subplot(2,1,2);
semilogx(wout(:,1)/(2*pi), squeeze(phase), '-b',LineWidth=1.5); zoom on; grid on;
title('Phase'); xlabel('Frequecy (Hz)'); ylabel('Phase (deg)');
The result it gives is:
The correct one should have the phase response peak just opposite:

Answers (0)

Asked:

on 3 Nov 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!