Error in Simulink , output sizes of the block
85 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jirada Gosumbonggot
le 20 Nov 2017
Commenté : FRANCOIS GONZALES PALACIOS
le 22 Avr 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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/169873/image.jpeg)
Any suggestions for solving this? Many thanks in Advanced
0 commentaires
Réponse acceptée
Birdman
le 20 Nov 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Electrical Sensors dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!