Reset Repeating Sequence Block

I am trying to implement a Repeating Sequence block that can be reset to its initial state based on a condition. I've attempted to use a Resettable Subsystem as this works with a Sample Based Pulse Generator, but it does not provide the same behavior for the Repeating Sequence. Anyone have any possible solutions? I need to be able to create a signal that can repeatedly ramp up and ramp down, but only start and be reset when a given condition is met, which is why I gravitated towards the Repeating Sequence block.

 Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 22 de Jun. de 2022
Editada: Fangjun Jiang el 22 de Jun. de 2022

1 voto

If you look inside the mask of the "Repeating Sequence" block, you will see it is built on top of the 1-D lookup table.
To achieve what you want, you can use an Integrator block with external reset. The input is 1 so the output is basically the simulation time t. The output is reset by
  1. The output is great or equal to the period of your repeating sequence, or
  2. Whatever condition you desire
Feed this output to a 1-D lookup table, where you specify your repeating sequence data.

3 comentarios

Jacob Rhodes
Jacob Rhodes el 29 de Jun. de 2022
I'm running into an issue that I believe is stemming from the 1-D Lookup Table. For some reason, the first sequence does not reflect that of which is in the table, however after the first cycle it behaves as it should. I've attached an image of the scope after simulation for reference. It should start at 1, go to 0 after 0.4 seconds, then return to 1 after another 0.4 seconds. However, as you can see it is not doing this in the first cycle.
Fangjun Jiang
Fangjun Jiang el 29 de Jun. de 2022
Show or log data points of the curve to debug the issue. My suspicion is that Simulink adjusts the simulation step size due to the stiffness at the tip of the curve.
If no other constraints, set the solver to be discrete with fixed step size as 0.001. The problem should disappear.
Jacob Rhodes
Jacob Rhodes el 29 de Jun. de 2022
Adjusted the fixed step size and it solved the problem, thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Versión

R2022a

Preguntada:

el 22 de Jun. de 2022

Comentada:

el 29 de Jun. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by