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

1 次查看(过去 30 天)
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 个评论
Alvaro
Alvaro 2023-1-23
编辑:Alvaro 2023-1-23
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:

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programmatic Model Editing 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by