Simulink Model Error - Please Help

조회 수: 4 (최근 30일)
Shraddha
Shraddha 2024년 8월 7일
답변: Kautuk Raj 2024년 8월 13일
Can u please help solve this error ?
  댓글 수: 1
Ganesh
Ganesh 2024년 8월 7일
Kindly share the model if possible

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

답변 (1개)

Kautuk Raj
Kautuk Raj 2024년 8월 13일
I understand that you are encountering an error while compiling a Simscape network for your model, specifically related to the "PS Lookup Table (1D)1" block in the "Model/SOLAR PV/Electrolyzer" subsystem.
It is required that all branches of a conditional expression must have consistent types (including size and unit) in the Simscape language. The compiler translates all branches regardless of being active or not. The equations defined inside a conditional section are not subject to this constraint, for example:
component getT
inputs
T = 0;
end
outputs
y = zeros(size(table_T'));
end
parameters
table_T = [1 2 3 4]';
table_val = [1 2 3 4]';
end
parameters(Access=private)
N = size(table_val,2);
end
% equations declared inside a conditional section are not subject to this constraint.
% In this case, only the active branch will be inclused in the system.
if N==1
equations
y == tablelookup(table_T, table_val, T, interpolation = linear, extrapolation = nearest);
end
else
equations
assert(ndims(table_val)==2);
y == tablelookup(table_T,1:N,table_val,ones(1,N)*T,1:N, interpolation = linear, extrapolation =
nearest);
end
end
end
component MyComp
inputs
T = 0;
end
outputs
y = zeros(size(table_T'));
end
parameters
table_T = [1 2 3 4]';
table_val = [1:4; 5:8; 9:12; 13:16];
end
components(ExternalAccess=observe)
getT = getT(table_T=table_T, table_val=table_val);
end
equations
T == getT.T;
y == getT.y;
end
end
However, one may only use conditional sections in a component class and not in Simscape functions.
I trust this response will guide you towards resolving your query.

카테고리

Help CenterFile Exchange에서 Foundation and Custom Domains에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by