Odd behavior defining operating point as initial state
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Yifeng Tang
el 19 de Mzo. de 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.
Respuestas (0)
Ver también
Categorías
Más información sobre Magnetic Elements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!