Adding Initial State when Compiling Simscape Model

3 次查看(过去 30 天)
I am compiling Simscape models for use in LabVIEW. The models themselves compile and can be sucessfully run in LabVIEW using the model interface toolkit. However, I want to include initial states in a compiled model. Otherwise the model must 'find' steady state every simulation. I know I can start simscape simulations from a saved initial state, but the compiler never finds the initial state i include in the model workspace.
I can run Simscape simulations from an initial state. I can't figure out a way to intialize COMPILED simscape models. How can I do this?
If that's not possible, is it possible to set all initial states en masse before compiling?
Thanks

回答(1 个)

Abhishek Chakram
Abhishek Chakram 2023-11-9
Hi Jacob Wenner,
According to my understanding, you want to add an initial state when compiling a simscape model. You can use a saved operating point to initialize the model. Here are few required steps to follow:
  • Create an operating point object from the model or from the simulation data using the “simscape.op.create” function.
  • Set the target values and priorities for the variables in the operating point object using the “set” and “get” methods.
  • Save the operating point object to a MAT-file using the “save” function.
  • Load the MAT-file in the model workspace using the “load” function.
  • In the Configuration Parameters dialog box, on the Simscape pane, set the Operating point source parameter to MAT-file in model workspace.
  • Specify the name of the MAT-file variable that contains the operating point object in the Operating point MAT-file variable name parameter.
  • Compile and run the model.
You can refer to the following documentation to know more about the functions used:
Best Regards,
Abhishek Chakram

类别

Help CenterFile Exchange 中查找有关 Simscape Multibody 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by