Inlined tunable parameter values because of using different data type then double-precision

25 visualizaciones (últimos 30 días)
Simon
Simon el 14 de Nov. de 2024 a las 10:21
Comentada: Simon el 19 de Nov. de 2024 a las 12:22
Currently I am having the following problem when using tunable parameters with data types (uint8, single, etc.) other than double-precision data type in our generated code.
Example: When we want to define initial condition values for merge blocks which are taken from tunable parameters in the model attached data dictionary we get the following error:
The numeric value of the expression 'par_DEI_EnvIllum(2)' (used in parameter 'InitialOutput' of '**/CEI_Merge') because block '**/CEI_Merge' only supports double-precision tunable parameter expressions. The code for this block will not use the tunable variables (par_DEI_EnvIllum (**.sldd)
Tunable Parameter used in initial condition
How can we solve such behaviour, do we really need to define the parameters with double-precision data types, because we won't to get rid of such data type as in the embedded unit this would result into much more computational effort for the MCU. Therefore we would like to use our integer or single-precision data types.

Respuestas (1)

Mark McBroom
Mark McBroom el 16 de Nov. de 2024 a las 22:40
Editada: Mark McBroom el 16 de Nov. de 2024 a las 22:41
You can either set the data to the proper data type in the data dictionary, or you can cast the value in the block dialog. For example, single(par_DEI_EnvIllum(2))
  1 comentario
Simon
Simon el 19 de Nov. de 2024 a las 12:22
Hello Mark!
We want to avoid any additional computational effort and therefore want to avoid any double-precision datat type to be used in the generated code. Therefore changing the data type in the data dictionary is not an option for us.
Your second suggestion I already tested, but this results into the same behaviour and warning ... So it seems casting is not working for such initial condition/value setting as far as I can see.
Do you perhaps have another suggestion for me to try, otherwise we need to live as of now with the warning + behaviour => but this shall be considered for any update to Matlab 2024a and newer verison

Iniciar sesión para comentar.

Categorías

Más información sobre AUTOSAR Blockset en Help Center y File Exchange.

Productos


Versión

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by