Odd behavior defining operating point as initial state
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I found two ways to set an operating point as initial state of a Simscape simulation:
- https://www.mathworks.com/help/stateflow/ug/specify-initial-state-for-simulation.html
- https://www.mathworks.com/help/simscape/ug/using-operating-point-data-for-model-initialization.html
Approach 1 works perfectly on my model:
Save state at the end of this phase

Load previously saved state as initial state

However, Simulink Coder code generation seems to be not supported that way, I get this error during generation:
Specifying initial operating point is only supported for models in Normal or Accelerator or Rapid Accelerator mode, and for Model blocks in Normal or Accelerator mode.
Approach 2 support the code generation, but it doesn't work as I expected:
I created operation point object based on the logged simulation: op = simscape.op.create(simlog, 5.0)

Used op here, Configuration parameters/Simscape:

The result:

I would expect the same diagram/behavior here what is on the 2nd figure.
Can anyone explain Approach 2 result? Do I misuse the feature?
Alternatively is it possible to support code generation with Approach 1?
1 Commento
Yifeng Tang
il 19 Mar 2025
I can only guess without seeing the model. Does the model contains controller? If so, does the controller have states (like integrator, transfer function, state space, PID, etc.)? There is a chance that the controller initial state doesn't match what's needed to keep the physical system starting from the intended values.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Magnetic Elements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!