Simulink physical sys is stable even the Matlab model for the same sys is unstable
4 ビュー (過去 30 日間)
古いコメントを表示
Iam building a SPWM inverter, which is simply modeled by a Gain driving and LC with Rload || to the C "PLANT". Iam using closed loop control with output voltage feedback through a divider ratio "H" and with Compensator "COMP".
I do moedel the full system with simulink/simcap using Mosfet, capacitors, coils, resistor, sawtooth generator and added the controller "COMP as a Zero/poles block. the reference input is 50Hz 0.5v sine wave.
the systems is running smoothly within simulink
But when i model the full OPENLOOP (PLANT*H*COMP) the system is deeply unstable, also the ClosedLoop is unstable when excited by a step input.
my Question is,
WHY simulink is giving very stable output, even the Matlab shows it is unstable?
Any explanation?
close all;
%clear all;
%%%%%%%%%%%%%%%%%%% PLANT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Vsaw= 4.5; % sawtooth peak amplitude
l = 500e-6; % Inductance of LC filter
c = 2.7e-6; % Icapacitance of LC filter
r = 75; % [1:75]% Max load
H = 1/200; % feedback ratio
vdc = 200; % supply/2
PLANT = tf([vdc/(l*c*Vsaw)],[1 1/(r*c) 1/(l*c)]) %tf
omega =sqrt(1/(l*c)); % Resonant Frequency
zeta = 1/(2*r*c*omega); % Dampin Ratio \zeta
PLANT = tf([vdc/(l*c*Vsaw)],[1 (2*zeta*omega) omega^2]);
%%%%%%%%%%%%%%%%%%% COMP %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
z1 = 1000;%20216.5527
z2 = 27000;%0.7*omega%27000%20216.5527
p1 = 122700;%172165.527
p2 = 122700;%122165.527%172165.527
gain = 13.1e6;
NUM = [1 z1+z2 z1*z2];
DUM = [1 p1+p2 p1*p2 0];
comp = tf(NUM,DUM);
oploop = gain*comp*PLANT
GH = oploop*H
%%%%%%%%%%%%%%%%%%%%% Closed Loop System %%%%%%%%%%%%%%%
cloop=feedback(oploop,H)
%%%%%%%%%%%%%%%%%%%% Stimulating the Closed Loop with SinVawe%%%%
HBTime = 0: 100e-6: 5;
freqsin =50 %9.78e4
inp = 0.5*sin(2*pi*freqsin*HBTime);%9.78e4
[y, cl_out, x] = lsim(cloop, inp, HBTime);
%%%%%%%%%%%%%%%%%%%%% PLOTS %%%%%%%%%%%%%%%
figure
subplot(2,2,1)
%%%%%%%%%%%%%%%%%%%%% OpenLoop Bode %%%%%%%%%%%%%%%
bode(GH)
title('Bode Plot of the Transfer K{G_c}GH');
grid on
%%%%%%%%%%%%%%%%%%%%% RootLocus %%%%%%%%%%%%%%%
subplot(2,2,2)
rlocus(GH)
grid on
title('RootLocus');
%%%%%%%%%%%%%%%%%%%%% Closed Loop Step %%%%%%%%%%%%%%%
subplot(2,2,3)
step(cloop)
title('ClosedLoop Step Response');
grid on
%%%%%%%%%%%%%%%%%%%%% Closed Loop with Sinwave Input %%%%%%%%%%%%%%%
subplot(2,2,4);
plot(cl_out, y);
title('ClosedLoop Response SinWave Input');
xlabel('Time (s)');
ylabel('Amplitude');
0 件のコメント
回答 (1 件)
Sam Chak
2025 年 2 月 11 日
Hi @mohamed
If at least one pole of the closed-loop system has a positive real part, the system is considered unstable. You may either implement active control or redesign the RLC components to stabilize the system.
%%%%%%%%%%%%%%%%%%% PLANT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Vsaw = 4.5; % sawtooth peak amplitude
l = 500e-6; % Inductance of LC filter
c = 2.7e-6; % Icapacitance of LC filter
r = 75; % [1:75]% Max load
H = 1/200; % feedback ratio
vdc = 200; % supply/2
PLANT = tf([vdc/(l*c*Vsaw)], [1 1/(r*c) 1/(l*c)]) % tf
omega = sqrt(1/(l*c)); % Resonant Frequency
zeta = 1/(2*r*c*omega) % Damping Ratio \zeta
PLANT = tf([vdc/(l*c*Vsaw)], [1 (2*zeta*omega) omega^2])
%%%%%%%%%%%%%%%%%%% COMP %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
z1 = 1000; % 20216.5527
z2 = 27000; % 0.7*omega%27000%20216.5527
p1 = 122700; % 172165.527
p2 = 122700; % 122165.527 %172165.527
gain = 13.1e6;
NUM = [1 z1+z2 z1*z2];
DUM = [1 p1+p2 p1*p2 0];
comp = tf(NUM, DUM)
oploop = gain*comp*PLANT
GH = oploop*H
%%%%%%%%%%%%%%%%%%%%% Closed Loop System %%%%%%%%%%%%%%%
cloop = feedback(oploop, H)
pole(cloop)
2 件のコメント
Sam Chak
2025 年 2 月 11 日
編集済み: Sam Chak
2025 年 2 月 11 日
You're welcome, @mohamed. Unfortunately, I do not have Simscape Electrical. However, I strongly believe that your Simscape electrical model differs from your transfer function model in MATLAB. Can you possibly derive the mathematical model by hand (using pen and paper) from the Simscape blocks? This approach would enable you to rely on your modeling knowledge and math skills rather than solely depend on the linmod() tool.
Additionally, whenever I review works that depict Simscape models, I consistently ask researchers to demonstrate or verify that the mathematical model of their Simscape physical model is exactly the same as the mathematical model described in their preprints or manuscripts. Otherwise, unless the model is presented in transfer function, state-space, or S-function format, there is insufficient basis to trust that their Simscape physical model is reliable, especially given the numerous values and selections available in the drop-down pre-design list.

参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!