Effacer les filtres
Effacer les filtres

How to get variable from Simulink model workspace for use with Multiple Simulations?

3 vues (au cours des 30 derniers jours)
Mark
Mark le 9 Avr 2024
Commenté : Fangjun Jiang le 9 Avr 2024
I am using a slightly modified copy of the Fuel Cell / EV Reference model. ('autoblkFCEvStart')
I would like to use the Multiple Simulations function with this model, to vary some of the input parameters. For example, Fuel Cell area is in the model workspace as 'stack_area'.
Looking at the Multiple Simulations panel, it looks like I would create a new study, and then add a variable to the design study. Variable name is 'stack_area', but what do I use for "Workspace"? Or is there some other setup needed?
From the Matlab command line, I can access this variable by:
hws = get_param('FCElectricPlant','ModelWorkspace')
area = hws.getVariable('stack_area')
I'm not sure how to translate that into how to configure the design study inputs.
Thanks!

Réponses (1)

Fangjun Jiang
Fangjun Jiang le 9 Avr 2024
  3 commentaires
Fangjun Jiang
Fangjun Jiang le 9 Avr 2024
You can specify the workspace as global-workspace or as you did, the model name, which means the model workspace. You need to add the square bracket to the values, [294, 308, 322, 336, 350].
global-workspace is most likely the base workspace.
At the model, press Ctrl+H to open the Model Explorer, navigate to find the Model Workspace.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Simulink dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by