Odd behavior defining operating point as initial state
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Yifeng Tang
am 19 Mär. 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.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Magnetic Elements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!