Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
COMP(vramp);
HAL_PIN(in) = 0.0;
HAL_PIN(vel_max) = 1.0;
HAL_PIN(acc_max) = 1.0;
HAL_PIN(out) = 0.0;
MEM(float time) = 0.0;
MEM(float last_time) = 0.0;
MEM(float o) = 0.0;
MEM(float vel) = 0.0;
FRT(
if(time >= 1.0 && time == last_time){
time = 0.0;
last_time = 0.0;
}
time += period;
);
RT_FILTER(
float dt = period;//time - last_time;
float vm = PIN(vel_max);
float am = PIN(acc_max);
float i = PIN(in);
float e = i - o;
last_time = time;
vel = CLAMP(e/dt, vel - am * dt, vel + am * dt);
vel = LIMIT(vel, vm);
o += vel * dt;
//o = mod(o);
PIN(out) = o;
);
ENDCOMP;
bcba03dbeThis file is pinned to the selected release. Download the original to open it in your design tool.