Ramp block having reset option

29 views (last 30 days)
Andraz
Andraz on 15 Apr 2024 at 10:05
Commented: Andraz on 24 Apr 2024 at 11:07
I would like to implement in simscape a kind of ramp block having reset option, thus that ramp would start rising from zero every time the reset is triggered. I've tried with resetable subsystem block but is of no helpfull.
Have u got any idea how to solve this?

Answers (2)

Aquatris
Aquatris on 15 Apr 2024 at 11:02
Here is one way with enabled subsystem, where the subsystem comes up with an offset (so if the ramp number gets too large it might be a problem):
  4 Comments
Aquatris
Aquatris on 16 Apr 2024 at 14:25
There is no ramp inside the resettable subsystem. it is a simple integration as below:
Andraz
Andraz on 24 Apr 2024 at 11:07
Now I'm a bit confused. In the first scheme you drew down an enabled subsystem block while in the second one a resetable subsystem block. Which option should be the right one? If I use the latter one with the integrator in then the source signal cannot be a time ramp but a step. The integral of a time ramp is not a saw.

Sign in to comment.


Sam Chak
Sam Chak on 16 Apr 2024 at 12:22
If you have a good understanding of the fundamental mathematics behind a line graph, then theoretically, you should be able to implement the mathematical formula for a Resettable Ramp in the MATLAB Function block. This way, you can avoid using any specialized blocks that require a more abstract programmatic If–Else logic to comprehend.
t = linspace(0, 10, 1001);
p = 2*(heaviside(t - 2) + heaviside(t - 4) + heaviside(t - 6) + heaviside(t - 8));
y = (t - p)/2;
plot(t, y), grid on, ylim([-0.5, 1.5])
xlabel t, ylabel y(t), title('Resettable Ramp')

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!