Effacer les filtres
Effacer les filtres

Using data from a CompiledSimulink object to set model initial conditions.

1 vue (au cours des 30 derniers jours)
SB
SB le 17 Nov 2022
Modifié(e) : Alvaro le 23 Jan 2023
I must run an existing Simulink model with a large number of different configurations. Currently, the configuration parameters in the model are rendered through constant blocks and initial conditions using variables in the base workspace.
Since I am running many different configurations, I have decided to use the parsim() function with an array of simulationInput objects that reference this existing Simulink model. There are also many existing scripts setting variables in the base workspace that are meant to configure the simulation.
My approach for parallelizing the simulations is to save the workspace variables in a .mat for each configuration, then use the loadVariablesFromMATFile() funtion to set the model variables for each simulationInput object.
The problem I am running into is one of the variables generated in the base workspace is a CompiledSimulink object that contains member variables of interest. When blocks try to access this object's member variables (ex. CompiledObject.output.x) to set their initial values, an error is thrown, that "Dot indexing is not supported for variables of this type."
Are CompiledObjects not allowed to be used as a Simulink model variable in this way? Thank you in advance.
  1 commentaire
Alvaro
Alvaro le 23 Jan 2023
Modifié(e) : Alvaro le 23 Jan 2023
I need some clarification on a couple points:
  1. Where is the CompiledSimulink class? Is it a custom class you made? I am having trouble finding this in the documentation.
  2. Does your approach work in serial but breaks down in parallel?
Also, you should be able to attach variables as properties of the Simulink.SimulationInput objects:

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by