Why is there a large array allocated in the design work struct during AUTOSAR code generation with an MPC Interior Point Solver in R2024a?

I am generating code from an R2024a AUTOSAR model where I am using MathWorks dense MPC interior point solver with N horizons on my engine control module (ECM). The generated code for the AUTOSAR component creates a single large array that stores a number of intermediary solver variables, as well as solver output, in the generated design work struct. This results in a required contiguous memory block > 380KB for N horizons, which is too large for my ECM.
Is there an optimization or customizations to the SLX or TLC that will results in generated code with this design work array broken up into the sub-arrays as global variables?

 采纳的回答

Please try the following to mitigate this behavior:
  1. Turn on this configuration parameter in your SLX model: https://www.mathworks.com/help/ecoder/ref/generateseparateinternaldataperentrypointfunction.html
  2. Use a mult-instance storage class for the data and have the "CodeInterfacePackaging" configuration parameter set to "nonreusable" from the top-level model. This can change the data be a global variable instead of a struct in the generated code. 

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Code Generation 的更多信息

产品

版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by