Matlab simulink file shows following error Simulink does not have enough information to determine output sizes for this block. If you think the errors below are inaccurate, try specifying types for the block inputs and/or sizes for the block outputs.

6 visualizaciones (últimos 30 días)
function [Sa,Sb,Sc] = Control(Vga,Vgb,ika,ikb,Vsa,Vsb)
% I_ref=0;
% I_meas=0;
% Vga=0;
% Vgb=0;
Ts= 1e-04;
p= 2000;
Vdc=620;
R=0.8;
L=0.005;
g = 0;
v0 = 0;
v1 = 2/3*Vdc;
v2 = 1/3*Vdc + 1j*sqrt(3)/3*Vdc;
v3 = -1/3*Vdc + 1j*sqrt(3)/3*Vdc;
v4 = -2/3*Vdc;
v5 = -1/3*Vdc - 1j*sqrt(3)/3*Vdc;
v6 = 1/3*Vdc - 1j*sqrt(3)/3*Vdc;
v7 = 0;
v = [v0 v1 v2 v3 v4 v5 v6 v7];
% Switching states
states = [0 0 0;1 0 0;1 1 0;0 1 0;0 1 1;0 0 1;1 0 1;1 1 1];
persistent x_old
% Initialize values
if isempty(x_old), x_old = 1; end
g_opt = 1e10;
x_opt=inf;
% Read current measurements at sampling instant k
for i = 1:7
% i-th voltage vector for current prediction
V1= real(v(i));
V2=Imag(v(i));
Iast1=(2*(Vsa)*p)/(3*((Vsa)^2+(Vsb)^2));
Ibst1=(2*(Vsa)*p)/(3*((Vsa)^2+(Vsb)^2));
% Current prediction at instant k+1
ik1a = ( 0.9841)*ika + (1/R)*(1- 0.9841)*(V1 - Vga);
ik1b = ( 0.9841)*ikb + (1/R)*(1- 0.9841)*(V2 - Vgb);
% Cost function
g = (abs(Iast1 -( ik1a)))^2 + (abs(Ibst1 -( ik1b)))^2;
if (g<g_opt)
g_opt = g;
x_opt = i;
end
end
x_old = x_opt;
Sa = states(x_opt,1);
Sb = states(x_opt,2);
Sc = states(x_opt,3);
end

Respuestas (1)

Sabin
Sabin el 20 de Nov. de 2023
Taking a quick look there are two changes that are needed to make this model run:
1) Line 38 in the MATLAB function should be (not uppercase 'I'): V2=imag(v(i));
2) Use a Data Type Conversion on each output of the cls MPC function before doing the NOT. Another Data Type Conversion is needed after the Mux block on the feedback line that is going to the 6 pulse VSC.
In addition line 28 (x_opt=inf) is problematic because if there is no feasible solution then the function will error at line 52 when will try to evaluate Sa = states(inf,1).
I hope this helps.

Categorías

Más información sobre Controller Creation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by