LCRRamp function


HI, This is a simple logic for LCRRamp block. The green color is the input. And the function follows it. We have two limits, upper and lower. On which the output is limited. But there is one thing that is strange. The blue graph is the output, which is trying to reach green. I set dy_up to 50 and dy_down to 20.

That is, I expected it to have a steep slope when it goes up and a gentle slope when it goes down. But as you can see, after passing through 0, when the output crosses 0, it seems like the two slopes are swapped and the slope of the line breaks. I’m a little confused. I’ve tested this many times. The result is the same.

When entering the negative region, the behavior of the slopes reverses. Have you experienced this? Unfortunately, there is no explanation in the manual.

TestRamp(
enable := enable,
x:=yset,
dy_up := dyup,
dy_down := dydn,
y_max := ymax,
y_min := ymin,
y_set := 0.0,
set := set,
);
OUT1 := Dualramp.y;

This behaviour is exactly as described iņ the help: B&R Online Help

An output value y starting from 0 (in positive or negative direction) is always calculated with the ramp time tup.
An output value y aiming for 0 (from positive or negative direction) is always calculated with the ramp time tdown.

Or simpler:

  • Moving away from 0 → It uses dy_up
  • Moving toward 0 → It uses dy_down

Maybe you have to work with an offset in your usecase that makes sure the value is never below 0. After LCRRamp apply the offset again to get back to the value range you need.

thanks. case closed.