MATLAB Answers

Simstate and the Memory Block

1 view (last 30 days)
Nathan Fitzgerald
Nathan Fitzgerald on 14 Jul 2016
I'm trying to understand how to access and/or change the SimState of Simulink's Memory block. For example, I opened up the built-in simulink demo "sldemo_bounce" and turned on the options for saving the complete SimState in the final state. I used the default variable name xFinal.
After running the simulation, xFinal.loggedStates is a 2x1 struct array. Both items refer to the blockName 'sldemo_bounce/Second-Order Integrator' and refer to the velocity and position integrators. I can't seem to find any indication of the saved state of the Memory block from that block diagram, although it definitely has a state.
The reason why I care is that I have a different model that uses a memory block where I'd like to restart the simulation using SimState for all of the other states except that memory block. For the memory block needs to be reinitialized before restarting the simulation, but I can't find a good way to do it. For my application, I'm simulating a feedback controller on a plant model and trying to assess how the control responds to "failures" in the plant. The intent was to simulate the model for a "long" time to get rid of all of the startup transients in the control, save the SimState, then execute a series of failure simulations that all start from the "steady" condition as saved by the SimState. The problem is that there are 1 or 2 states in the model that are controlled by Memory blocks that I would like to reset before running my failure simulations, and I can't figure out how to access them.
Thanks,

Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!

Translated by