Simulink integrator block reset and integrate at single time step
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jaewon Park
am 12 Dez. 2023
Kommentiert: Jaewon Park
am 18 Jan. 2024
Hello,
I am working on a system where I have two state variables, one of which is to be activated (becomes nonzero) in the middle of simulation.
I am using the "reset" feature of the integrator block to model the appearance of the state variable by feeding appropriate initial state value and triggering reset.
I noticed that when reset is triggered, the integrator block does only the reset part and skips integration, thus spending one timestep without integrating.
I was wondering whether it would be possible to do the reset and then integrate the variable all in one time step when reset is triggered.
Thank you!
---------This is additional information -------
I hope this is somewhat more helpful for understanding my situation.
Let's say I have a system with two modes. For each mode, the number of state variable is different. For example...
Mode 1 (only
is active)
where u is an external input.
Mode 2 (
and
are active)
The simulation would start at mode 1 in the beginning. Mode 2 is triggered with a condition
, with some threshold value. When mode 2 is triggered,
would get a very small value.
From mode 2, if a condition
is met, the system goes back to mode 1.
For this, what I am curious about is during mode 1 --> mode 2 transition, where I am turning
into existence and assigning a very small initial value, whether I could integrate it at the same time step.
As of now, when the transition is to happen, I would spend the timestep just to assign initial value to the newly activated state variable
and passing it to other subsystems. But, I feel like it would be more accurate for the simulation result, if I could assign initial value and integrate it based on the inputs/conditions of current timestep.
I am open to other creative solutions rather than sticking with the integrator block.
I appreciate your help.
2 Kommentare
madhan ravi
am 12 Dez. 2023
Please illustrate with an example what you want to achieve and why is the current method different than the expected.
Akzeptierte Antwort
Paul
am 13 Dez. 2023
Bearbeitet: Paul
am 13 Dez. 2023
Hi Jaewon,
If I understand correctly, the short answer is no.
The whole purpose of using the iuntegrator reset to is step the solver to the time that the it detects the reset condition and then reset the integrator to the specified intial state at that time. The integrator then continues to integrate and we see the result of that integration at the end of the the next major time step after the reset, which is exactly the same thing that happens at simulation time = 0. So it doesn't really work to reset the integrator and take an integration step "all in one time step."
The details of how that works will depend on local and global settings of zero crossing detection and type of solver.
Just out of curiosity, what is the input to the integrator prior to the reset? Zero?
You may want to consider putting the integrator inside an Enabled Subsystem to "activate" it in the middle of the simulation.
But I think we need a bit more info on what you're trying to accomplish to offer any other options.
3 Kommentare
Paul
am 16 Dez. 2023
Is x1 in Mode 2 supposed to represent the same physical quantity as x1 in Mode 1? If not, how is x1 in Mode2 initialized at the transition from Mode 1 to Mode 2?
Regardless, at the time of the transition from Mode 1 to Mode 2 there is no integration step. At the time of the transition, x2 (and x1?) in Mode 2 will be set to its initial condition at that time, and then the solver proceeds from there.
Think of it this way. Let t2 be the time of the transitiion from Mode 1 to Mode 2. From t2 going forward, the solver is solving the differential equation:
x2dot = f(x1,x2,u) x2(t2) = x2initial
At time t2, the value of x2(t2) is x2initial by definition.
The effect of integrating x2dot to change x2 from its value x2(t2) should only be seen for t > t2.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu General Applications 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!