필터 지우기
필터 지우기

Error in Simulink , output sizes of the block

조회 수: 84 (최근 30일)
Jirada Gosumbonggot
Jirada Gosumbonggot 2017년 11월 20일
댓글: FRANCOIS GONZALES PALACIOS 2020년 4월 22일
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

채택된 답변

Birdman
Birdman 2017년 11월 20일
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
Palyam Prakash
Palyam Prakash 2020년 2월 3일
thank you so much sir
its working
FRANCOIS GONZALES PALACIOS
FRANCOIS GONZALES PALACIOS 2020년 4월 22일
Excellent!! thanks so much!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Electrical Sensors에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by