Signal dimensions propagation to submodels

조회 수: 4 (최근 30일)
defunct C7=5F>20
defunct C7=5F>20 2012년 6월 18일
Hi, all!
I am trying to creare a submodel in simulink. In the submodel, there is one input port and one output port, and some image processing blocks inbetween. To encorporate submodel i use 'model' block (standard). The top-level model loads an image and passes it to the submodel. I have a problem, that image dimensions are determined for image loading block on during the compilation time (the load image block is implemented as Level-2 MATLAB function, path to the image is a parameter, in the setup() function image information is read and the dimensions of the output port are set based on this information), but for submodel the input port dimensions are somehow set to 1, although port dimenstions property for input port is set to inherit.
Why is it happening? Does anybody know the way to fix this?
Best regards, Alina

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2012년 6월 18일
AFAIK, referenced models cannot inherit signal dimensions - if specified as Inherited (-1) on the port, by default it is assumed that the input is a scalar variable. This is done because the referenced model is compiled independently of the parent, so you must specify the input/output size, datatype and complexity. It looks like the sample time however can be inherited under some conditions.
In your case, since the referenced systems input size changes depending on a parameter in the parent, it might be better to copy the other model in as a subsystem instead of a referenced model.
  댓글 수: 2
defunct C7=5F>20
defunct C7=5F>20 2012년 6월 19일
Thank you! now it works
Kaustubha Govind
Kaustubha Govind 2012년 6월 19일
Glad that helped. Could you accept my answer please? Thanks!

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by