How to initialize a SIMULINK simulation with initial trimmed states and control inputs?

1 view (last 30 days)
I have a SIMULINK model that basically trims an airplane and the simulation stops when the airplane is trimmed. I would like to re-start the simulation from the trimmed conditions (states and inputs) without having to re-run the model which re-trim itself. Is there a way I can trigger a simulation reset right after the model is trimmed and use the trimmed states/inputs to initialize the reset simulation?
Thanks.

Answers (1)

Vidip
Vidip on 20 Feb 2024
When you want to use final states data as the initial state for another simulation, consider selecting Save final operating point. The model operating point contains complete information about the simulation state, including block states, hidden block states, the state of the solver and execution engine, and output values for some blocks.
Also, the ‘Simulink.SimulationInput’ object allows you to make changes to a model and run simulations with those changes. These changes are temporarily applied to the model. Using a ‘Simulink.SimulationInput’ object, you can change initial state, model parameters, block parameters, external inputs, and variables. Through the ‘Simulink.SimulationInput’ object, you can also specify MATLAB® functions to run at the start and the end of each simulation by using the ‘setPreSimFcn’ function and the ‘setPostSimFcn’.
For further information, refer to the documentation links below:

Categories

Find more on Event Functions in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!