Clear Filters
Clear Filters

If a Parameter is used as a symbolic dimension, can it have it's value assigned to a simple operation of 2 other parameters that are also used as symbolic dimensions ?

2 views (last 30 days)
Im trying to generate code by Using an SLDD for my simulink objects.
I have decided on 3 parameters whom will act as a symbolic dimension for other parameters.
1 of these 3 parameters is a multiplication of the other 2, and used as a base symbolic dimension for other parameters. The model compiles fine.
I get the following error but Im not sure what might the cause be. Im just speculating that this operation that I have done might have something to do with it. Can someone help me please.
Code generation assertion 'symDims.getNumDimensions() == static_cast<unsigned>(getSourceNumDimensions(b, port, busSelElIdx))' failed in 'b:\matlab\src\sl_engine_classes\engine\sleactsrcattributes.cpp:107'
Thank You.

Answers (1)

Abhas
Abhas on 26 Mar 2024
Hi Omar,
The error you're encountering during code generation from your Simulink model, particularly the assertion failure 'symDims.getNumDimensions() == static_cast<unsigned>(getSourceNumDimensions(b, port, busSelElIdx))' in the source file 'sleactsrcattributes.cpp', suggests a mismatch in the expected number of dimensions for a symbolic dimension object (symDims) compared to what is actually obtained from a source block (getSourceNumDimensions).
The following steps can help you solve the issue:
  1. Verify Symbolic Dimension Definitions: Ensure the three parameters you've defined as symbolic dimensions and their relationships (especially the multiplication aspect) are correctly set up in the SLDD.
  2. Check Usage of Symbolic Dimensions: Make sure that the symbolic dimensions are used consistently across the model. For instance, if a parameter is defined with a symbolic dimension that is a product of two other parameters, all related blocks or signals that depend on this dimension must correctly reference it.
  3. Review Model Configuration Parameters: Sometimes, model configuration settings related to code generation can affect how symbolic dimensions are handled. Review these settings to ensure they align with your model's requirements, particularly those related to data types and sizes.
  4. Re-evaluate the Multiplication of Parameters: Given that one of your symbolic dimensions is derived from multiplying two others, ensure this operation is supported and correctly implemented for symbolic dimensions in your context. It's possible that this multiplication introduces complexity that isn't properly handled during code generation.
You may refer to the following documentation links to have a better understanding on working with symbolic dimensions:
  1. https://www.mathworks.com/help/ecoder/ug/implement-dimension-variants-for-array-sizes-in-generated-code.html
  2. https://www.mathworks.com/help/rtw/ref/code-generation-pane-general.html

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!