Simulink Model Error - Please Help

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 日

0 投票

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.

カテゴリ

ヘルプ センター および File ExchangeFoundation and Custom Domains についてさらに検索

タグ

質問済み:

2024 年 8 月 7 日

回答済み:

2024 年 8 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by