Code generation for fixed-point data type signals and parameters to interfacing code

2 views (last 30 days)
I am trying to figure out if there is a mechanism that will allow the generated code from my top model to show how the fixed-point data type signals and parameters are intended to be scaled, biased, etc. Currently in my model, I have an input bus that is made up of other buses that have signals that use fixed point data types. In addition to the input bus, some of the parameters that are external (and tunable) in code generation are also fixed point data types. The problem that I would like to solve, is when our software engineer takes the controller code to integrate into their code base, they have no knowledge of what the fixed point scaling is intended to be, the code generated data types only show up as int16_T, uint16_T, etc.
I was playing around with using Simulink.NumericType with the proper word length and fraction bits defined as an alias and assigning this to the parameter or bus signal, but this method seems tedious (even though it would describe the fixed-point data type to the software engineer) and not sure if there is a better method to use.
The other alternative I was looking at, was leaving the input signals and parameters as a float representation and just do the data type conversion in the model, but feel that with this approach (at least with parameters) there will be wasted CPU cycles converting parameters every time step.
Any help would be appreciated, thanks.

Answers (0)

Community Treasure Hunt

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

Start Hunting!