Batch linearization without recompiling dimulink model

4 Ansichten (letzte 30 Tage)
g g
g g am 16 Jul. 2025
Beantwortet: Shishir Reddy am 21 Jul. 2025

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!

Antworten (1)

Shishir Reddy
Shishir Reddy am 21 Jul. 2025
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.

Kategorien

Mehr zu Operating Points finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by