Simulink physical sys is stable even the Matlab model for the same sys is unstable

4 ビュー (過去 30 日間)
mohamed
mohamed 2025 年 2 月 11 日
編集済み: Sam Chak 2025 年 2 月 11 日
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
PLANT = 3.292e10 ----------------------- s^2 + 4938 s + 7.407e08 Continuous-time transfer function.
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
oploop = 4.313e17 s^2 + 1.208e22 s + 1.164e25 ------------------------------------------------------------- s^5 + 2.503e05 s^4 + 1.701e10 s^3 + 2.561e14 s^2 + 1.115e19 s Continuous-time transfer function.
GH = oploop*H
GH = 2.156e15 s^2 + 6.038e19 s + 5.822e22 ------------------------------------------------------------- s^5 + 2.503e05 s^4 + 1.701e10 s^3 + 2.561e14 s^2 + 1.115e19 s Continuous-time transfer function.
%%%%%%%%%%%%%%%%%%%%% Closed Loop System %%%%%%%%%%%%%%%
cloop=feedback(oploop,H)
cloop = 4.313e17 s^2 + 1.208e22 s + 1.164e25 ------------------------------------------------------------------------ s^5 + 2.503e05 s^4 + 1.701e10 s^3 + 2.413e15 s^2 + 7.153e19 s + 5.822e22 Continuous-time transfer function.
%%%%%%%%%%%%%%%%%%%% Stimulating the Closed Loop with SinVawe%%%%
HBTime = 0: 100e-6: 5;
freqsin =50 %9.78e4
freqsin = 50
inp = 0.5*sin(2*pi*freqsin*HBTime);%9.78e4
[y, cl_out, x] = lsim(cloop, inp, HBTime);
Warning: The input signal is undersampled. Use a sampling period smaller than 1.5e-05.
%%%%%%%%%%%%%%%%%%%%% 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');

回答 (1 件)

Sam Chak
Sam Chak 2025 年 2 月 11 日
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
PLANT = 3.292e10 ----------------------- s^2 + 4938 s + 7.407e08 Continuous-time transfer function.
omega = sqrt(1/(l*c)); % Resonant Frequency
zeta = 1/(2*r*c*omega) % Damping Ratio \zeta
zeta = 0.0907
PLANT = tf([vdc/(l*c*Vsaw)], [1 (2*zeta*omega) omega^2])
PLANT = 3.292e10 ----------------------- s^2 + 4938 s + 7.407e08 Continuous-time transfer function.
%%%%%%%%%%%%%%%%%%% 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)
comp = s^2 + 28000 s + 2.7e07 ----------------------------- s^3 + 245400 s^2 + 1.506e10 s Continuous-time transfer function.
oploop = gain*comp*PLANT
oploop = 4.313e17 s^2 + 1.208e22 s + 1.164e25 ------------------------------------------------------------- s^5 + 2.503e05 s^4 + 1.701e10 s^3 + 2.561e14 s^2 + 1.115e19 s Continuous-time transfer function.
GH = oploop*H
GH = 2.156e15 s^2 + 6.038e19 s + 5.822e22 ------------------------------------------------------------- s^5 + 2.503e05 s^4 + 1.701e10 s^3 + 2.561e14 s^2 + 1.115e19 s Continuous-time transfer function.
%%%%%%%%%%%%%%%%%%%%% Closed Loop System %%%%%%%%%%%%%%%
cloop = feedback(oploop, H)
cloop = 4.313e17 s^2 + 1.208e22 s + 1.164e25 ------------------------------------------------------------------------ s^5 + 2.503e05 s^4 + 1.701e10 s^3 + 2.413e15 s^2 + 7.153e19 s + 5.822e22 Continuous-time transfer function.
pole(cloop)
ans =
1.0e+05 * -2.1623 + 0.0000i 0.0009 + 0.9804i 0.0009 - 0.9804i -0.3345 + 0.0000i -0.0084 + 0.0000i
  2 件のコメント
mohamed
mohamed 2025 年 2 月 11 日
@Sam Chak, Thanks for answering, It's clear that the system is unstable
I shared the simulink file named inverter_x.slx in the orginal post.
my Question is,
WHY simulink is giving very stable output, even the system is unstable?
Sam Chak
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeConverters (High Power) についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by