MATLAB Answers

How to dynamically size arrays in Simscape custom component?

조회 수: 1(최근 30일)
Adam Rhoads
Adam Rhoads 13 May 2015
Answered: Kostas 21 Oct 2019
I am trying to create a custom Simscape component that can accept input/output arrays of a variable size. The size would be chosen by the user and sent to the component to declare the arrays (this is a heat exchanger that is divided into a number of segments). Here is what I am looking to do, essentially:
component heat exchanger
inputs
segments = 1.0;
hin = {segments,'J/kg'}; %hin:left
end
outputs
hout = {segments,'J/kg'}; % hout:right
end
...
Is there any way to elegantly do this? With custom Simulink components, I just used S-function parameters to do this.
Thank you.

  댓글 수: 0

로그인 to comment.

답변 수 (1)

Kostas
Kostas 21 Oct 2019
Have you tried writing right next to your inputs something like: inputs (Size = Variable). I do not know if it works but it is shown here that it works with parameters so I assume it could work with inputs as well.

  댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by