How can a Simulink State Space block state be periodically reset?

조회 수: 8 (최근 30일)
John
John 2024년 2월 24일
댓글: Paul 2024년 3월 8일
In Simulink, can a State Space block's states be periodically reset, ie not just set on startup?
If not, what alternative is there to accomplish the same thing?
I'm looking to periodically (every T sec) reset the states of a State Space block (say, called "R" for reset), and reset them to a set of passed parameters (states); ie not static constants from the workspace that only act on sim initialization.
These passed reset-value states might come from another continuously-run State Space block (say, the block is "C" for continuous, and its states are the "Good" states), as one example...
At each n*T tick i'd look to update the states of R to the Good states, so that R somewhat matches C as time goes on. Yes, these updates could lead to discontinuous behavior from R, but that's okay.
The question is, how can I periodically update R's states?
  댓글 수: 7
Sam Chak
Sam Chak 2024년 2월 25일
Hey @John, I can only see the programmatic state-resettable approach being useful when both systems R and C are asymptotically stable. Plus, the designer doesn't necessarily need to be mathematically skilled with this approach.
John
John 2024년 3월 8일
Thanks @Sam Chak for your ideas :)
The two systems will be close, so it wouldn't be like your example that doesn't address the underlying examples. But, the update period will be short enough that even if the dynamics aren't addressed, the divergence won't be large.
So this could be a way to go. I'll check out Paul's thoughts as well now, and then see what might work best for this specific situation. Thanks for your examples!

댓글을 달려면 로그인하십시오.

답변 (1개)

Paul
Paul 2024년 2월 24일
편집: Paul 2024년 2월 24일
i think you'll have to use an Integrator and other native blocks to implement
xdot = A*x + B*u
y = C*x + D*u
Use the external initial condition option and the external reset option to reset the integrator states to the signal on the initial condition line based on whatever your reset logic is. The signal on the IC line should be the IC of the integrator at t = 0 and then the values to reset to at the resets as t moves forward.
Make sure to have appropriate solver settings (solver type, zero crossing detection).
Here's an example that resets the state of the integrator to 1 every time the sine wave crosses zero in either direction, i.e., every pi seconds.
  댓글 수: 3
John
John 2024년 3월 8일
Interesting on both -- thanks @Paul.
Regarding "it may be of interest that the states of State Space block and can be reset to the Initial Conditions block parameter if the state space block is inside a Resettable Subsystem", is there a way to make state space block intitial conditions a variable, vs constants?
"i think you'll have to use an Integrator and other native blocks to implement"
Good point -- this may be a good solution. I'll look into it and see which approach makes the most sense for this application.
Paul
Paul 2024년 3월 8일
Just like any other block parameter, the Initial Conditions parameter of the State Space block can be any expression that evaluates to a valid value for the parameter, in this can a vector (of initial conditions). So you can use, for example, X0 as the parameter value, and then Simulink will evaluate X0 using the normal workspace hierarchy. I assume that works the same way at the resets if the State Space block resides inside a Resettable Subsystem, but I didn't test it.
Based on the context of this thread I assume you're considering putting the State Space block inside a Resettable Subsystem, using a variable, e.g., X0, for the Initial Condition, and then changing the value of X0 in the workspace in which it resides while the simuluation is running (or paused) before the next reset. I don't know if that's feasible, particularly if the new value of X0 isn't known until the time of the reset. It might be feasible, but I just don't know.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Classical Control Design에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by