## Limit the chaning rate of a signal

### Klaas Albers (view profile)

on 23 Sep 2019
Latest activity Commented on by Klaas Albers

on 23 Sep 2019

### Fangjun Jiang (view profile)

Hello,
I´m working on a Simulation in Simulink for my masters degree in engineering. In this Simulation there is a valve which controlls the flow of water on one side of a plate heat exchanger based on the outlet tempreture of water on the other side of the exchanger. At the moment this valve is controlled by a thermostat, now it shall be controlled by a electrical engine so that the plant can be controlled electronicly and monitored.
My Problem is now that this engine has a maximum chaning speed e.g when the controller jumps from 0 to its maximum value the engine should need 30 seconds to adjust its position so that the valve is opened completly. I tryed many different solutions but none of them works like they are supposed to be.
function y = fcn(u, du,t)
persistent dy_alt y_alt dy
if isempty(dy_alt)
dy_alt=0;
y_alt=u;
dy=0;
end
while du~=0 || y_alt~=u
if du>0
dy=0.7;
dy_alt=dy;
elseif du<0
dy=-0.7;
dy_alt=dy;
elseif du==0
dy=dy_alt;
end
y=y_alt+dy*t;
if y==u
break
end
end
y=u;
y_alt=y;
end
This is one example of a solution for the problem but it doesent works. The Simulation runs without an error but only until a certain time is reached then it doesnt proceed further.
Has somebody an idea to solve this Problem? Maybe the Solution is easy but i dont see it :/

### Fangjun Jiang (view profile)

on 23 Sep 2019

Use the Simulink Rate Limiter block.

Klaas Albers

### Klaas Albers (view profile)

on 23 Sep 2019
It seems that it works, thanks a lot!
Sometimes you cannot see the wood for the trees. :D