Borrar filtros
Borrar filtros

Dynamically sized ports not correct when compiled to s-function

11 visualizaciones (últimos 30 días)
Robrecht
Robrecht el 29 de Mayo de 2024
Respondida: Ashutosh Thakur el 16 de Jul. de 2024 a las 6:58
Hello,
I have created a simple model with just one block. The input and output port dimension are configured to be inherited. When i use this model in another model i have no issues. But when i compile the model to an S-funcion block, the generated S-funcion always uses a 1-dimensional vetcor with a single element as its dimension even when i connect a multidimensional signal. This should not be the case i think.
What could be the reason for this issue?

Respuestas (1)

Ashutosh Thakur
Ashutosh Thakur el 16 de Jul. de 2024 a las 6:58
Hi Robrecht,
It seems like the dimensions of the signals are not being propagated correctly when you compile the model to the S-Function block. This behavior might be due to the way the S-Function is implemented to handle variable dimensions.
You should check that the mdlInitializeSizes function has specified the DYNAMICALLY_SIZED attribute. The input and output ports can be set to this attribute to tell the Simulink engine to size them dynamically. You can refer to the following documentation for more information: https://www.mathworks.com/help/simulink/sfg/mdlinitializesizes.html.
Additionally, you can look into different functions such as ssSetInputPortMatrixDimensions and ssSetInputPortDimensionInfo. These functions help in setting the dimensions of the input and output ports dynamically. Here are some useful documentation links for more information and examples:
I hope this information helps you!

Categorías

Más información sobre Block Authoring and Simulation Integration 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