How to set a system constant to be used in multiple blocks in Simulink

58 visualizzazioni (ultimi 30 giorni)
I am beginner in Simulink.
I have a large system making use of same type of component models (each as user-defined Matlab function). I want to make a parametric study to evaluate the system for different parameter values at the component so I need to define the parameter values centrally. Is there a way to define the system parameters at one block (somehow it will generate the global variables) so the component model parameters will get updated automatically?

Risposta accettata

Fangjun Jiang
Fangjun Jiang il 18 Ott 2019
The general approach is to define a parameter (e.g. MyPar1) in base workspace or in a data dictionary, then you can use this parameter for multiple blocks (for example, specify the Gain as MyPar1 or the value of a Constant block as MyPar1).
In the case of MATLAB function block, you can click "Edit Data" in the Editor and then Add Data, specify the Scope as Parameter.
  3 Commenti
Fangjun Jiang
Fangjun Jiang il 18 Ott 2019
Yes. Just start withy MyPar1=1 in base workspace and then use it anywhere in your model.
Later, you can manage this in a "Simulink data dictionary".

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Interactive Model Editing in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by