Borrar filtros
Borrar filtros

Error in Simulink , output sizes of the block

122 visualizaciones (últimos 30 días)
Jirada Gosumbonggot
Jirada Gosumbonggot el 20 de Nov. de 2017
Comentada: FRANCOIS GONZALES PALACIOS el 22 de Abr. de 2020
Hello;
I've tried to writing matlab code for determining global peaks for shading pv panel and set the output as maximum power, region and short circuit current to be used in next block. My inputs are PV voltage and current from PV block, both are 3000x1 double sizes.
However, when I run the program it shows the error of
_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 output_ s.
I expected the outputs to be single number.
The code is below;
function [Region,Isc_step,P_Gmppt] = initial(V1, I1)
P1= V1.*I1;
[P_Lmppt,V_Lmppt] = findpeaks(P1,V1);
P_Gmppt = max(P_Lmppt); % find global max
V_Gmppt_loc = find(P_Gmppt == P_Lmppt);
V_Gmppt = V_Lmppt(V_Gmppt_loc); % find V at global max
P_inv = P_Gmppt - P1; % inverse the data
[P_drop_Lmppt,V_drop_Lmppt] =findpeaks(P_inv,V1);
V_drop = max(V_drop_Lmppt);
V_drop_loc = find(V1 == V_drop);
P_drop = P_inv(V_drop_loc);
% calculate shading short circuit current (after step)
I_shade = I1(V_drop_loc:end,:); % filter I that beyond V_drop
V_shade = V1(V_drop_loc:end,:); % filter I that beyond V_drop
Isc_step = I_shade(1);
if V_Gmppt > V_drop
Region = 1;
else
Region = 2;
end
end
The figure for simulink is
Any suggestions for solving this? Many thanks in Advanced

Respuesta aceptada

Birdman
Birdman el 20 de Nov. de 2017
Make three assignments at the beginning of your function: If the outputs are scalar
Region=0;
Isc_step=0;
P_Gmppt=0;
If vector
Region=zeros(n,1);
Isc_step=zeros(n,1);
P_Gmppt=zeros(n,1)%n is the row number you define
By this way, Simulink has an idea of what type and dimension the output is going to be.
  5 comentarios
Palyam Prakash
Palyam Prakash el 3 de Feb. de 2020
thank you so much sir
its working
FRANCOIS GONZALES PALACIOS
FRANCOIS GONZALES PALACIOS el 22 de Abr. de 2020
Excellent!! thanks so much!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Electrical Sensors 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