Simulink Model Error - Please Help

2 visualizaciones (últimos 30 días)
Shraddha
Shraddha el 7 de Ag. de 2024
Respondida: Kautuk Raj el 13 de Ag. de 2024
Can u please help solve this error ?
  1 comentario
Ganesh
Ganesh el 7 de Ag. de 2024
Kindly share the model if possible

Iniciar sesión para comentar.

Respuestas (1)

Kautuk Raj
Kautuk Raj el 13 de Ag. de 2024
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.

Categorías

Más información sobre Foundation and Custom Domains en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by