Questions regarding Unit Delay block initial condition and model recompilation

11 vues (au cours des 30 derniers jours)
Mohamed
Mohamed le 22 Août 2024
Hello,
I have two questions regarding the behavior of the Unit Delay block in Simulink:
For the Unit Delay block, when the initial condition is set to a vector, is it possible to declare this initial condition using a Simulink.Signal or a Simulink.Parameter ?
Are there any restrictions or special considerations when using these types of objects as the initial condition?
When compiling a Simulink model that contains a Unit Delay block, and after generating the compiled model, if I later want to change the initial condition of the Unit Delay block, do I need to go back to Simulink, modify the initial condition, and recompile the model? Or is it possible to adjust the initial condition parameter after the model has been compiled and is being used in a simulation environment?
Thank you for your help!

Réponses (1)

Fangjun Jiang
Fangjun Jiang le 22 Août 2024
  1. Use Simulink.Parameter
  2. Specify its storage class as "ImportFromFile" and specify a HeaderFile name.
When the code is generated, the value of this parameter will be generated in the header file. Then you can modify its value, use a different version of the header file, or use some calibration tool, without the need to modify the model and re-generate code.

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by