Looping velocity logic

Hello, I have been trying to loop a velocity logic that I made recently but I cant seem to make it work. The velocity starts at 5/s and then after 25m, the velocity changes to 0, then when it becomes 0, it stays there for 3 sec, after the 3 sec delay it moves back with a speed of-5m/s until it goes back to the original position then once it reaches the original position, the velocity becomes 0 then i want it to loop. The attached below is the screenshot as well as the file for the velocity logic. It would help me greatly if someone could give me an insight on how to fix it. I am still new to xcos so I still have dificulties operating.

velocity logic .zcos (5.6 KB)

Hello,

Seeing your diagram (why make it so complicated when a simple solution exists), you are still using unappropriate methods (I gave you some advice some time ago, see https://scilab.discourse.group/t/piecewise-velocity-over-time-scilab-xcos). If you want some help, you should first describe things precisely (you have some typos, e.g. does “5/s” mean “5m/s” ?).

The velocity starts at 5/s and then after 25m, the velocity changes to 0, then when it becomes 0, it stays there for 3 sec, after the 3 sec delay it moves back with a speed of-5m/s until it goes back to the original position then once it reaches the original position, the velocity becomes 0 then i want it to loop

Are you considering a point which is moving along a linear axis, initially at x=0, whose speed profile is defined on [0,t_3] by

x'(t)=\left\{ \begin{array}{rr} 5 & \mbox{ for } t\leq t_1,\\ 0 & \mbox{ for } t \in ]t_1,t_2],\\ -5 & \mbox{ for } t \in ]t_2,t_3] \end{array} \right.

with t_2=t_1+3 and such that x'(t) is periodic and has period t_3 ? if the answer is yes, you have t_1=5s, t_2=8s and t_3=13s and it is easy to generate x(t) in Xcos (and even make it periodic) by using the signal builder block:

speedprofile.zcos (3.6 KB)