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

조회 수: 6 (최근 30일)

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?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2025년 3월 4일
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개)

카테고리

Help CenterFile Exchange에서 Linear Plant Specification에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by