Batch linearization without recompiling dimulink model

4 次查看(过去 30 天)

Hello everyone,

I want to linearize an aircraft Simulink model for many different cases, each with its own set of linear plant matrices (A, B, C, D). When I change the linear plant data in the base workspace, the Simulink model recompiles itself.

I'm looking for a way to update the linear plant matrices without triggering recompilation of the simulation model.

Currently, the linear plants are provided to the model via Constant blocks. I also tried using sllinearizer, but the problem is that it only accepts double arrays, and I couldn’t find a way to feed in full A, B, C, D matrices dynamically.

Can you suggest a solution that allows changing the linear plant matrices (A, B, C, D) between simulations without recompiling the model?

Thank you!

回答(1 个)

Shishir Reddy
Shishir Reddy 2025-7-21
Hi @g g
As per my understanding, you would like to avoid the recompilation overhead and looking for a way to dynamically update the plant matrices.
To avoid triggering model recompilation when updating A, B, C, D matrices between simulations, consider encapsulating your plant using a MATLAB Function block that references matrices from a Simulink data dictionary or a persistent variable, rather than using Constant blocks tied to workspace variables.
Instead of feeding the matrices via Constant blocks, define the matrices as 'Simulink.Parameter' objects and set their '.Tunable' property to 'true'. This can prevent recompilation.
A = Simulink.Parameter;
A.Value = [...]; % your matrix
A.CoderInfo.StorageClass = 'ExportedGlobal';
A.Tunable = true;
Use these parameters inside a MATLAB Function block to build your model.
For more information regarding 'MATLAB Function block', kindly refer the following documentation - https://www.mathworks.com/help/simulink/ug/what-is-a-matlab-function-block.html
I hope this helps.

类别

Help CenterFile Exchange 中查找有关 Operating Points 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by