Article Directory
definition
Where A is the gain, corresponding to a given speed, at time period, in accordance with the acceleration A, homogenized uniformly accelerated or decelerated to the speed reference
As shown above, this function is equivalent to the position control system are speed signal conversion, the position loop control, the equivalent of such a process;
- The final amount is set to position ;
- The system according to A uniform position change rate, ;
- The final arrival Time, the system reaches the set position ;
The same also applies to the speed loop, for different controlled objects gain physical meaning is different, but the ultimate goal is to make a ramp function of the input signal becomes more gradual, reducing the overshoot, in order to optimize the response time of the system.
Discretize
the equation is discretized in accordance with
Time sampling, you can input discrete:
Implement the program
First of all here to talk about the idea of simple ramp function implementation:
- Sampling time, we need to be more discrete sampling time of the system;
- The current state of the current value, the value of the amount of the controlled system, i.e., ;
- Target value, the system eventually reaches the desired value, i.e. ;
- Delay time, the time the system reaches the desired target value;
- The number of steps, number of steps to reach the target system, usually ;
- Slope, slope , Which is the need to increase the value of each step, the final step by step to the target value;
Usually in the actual control system, the timer interrupt function or event,The need for the current value of the system , the target value , and the delay time calculated once, the number of steps to obtain the slope of the ramp function and a ramp function to be executed。
Here with matlab
the first analog at the generated ramp function, in addition to the actual test it on the operation of the C language in the actual hardware.
matlab program
The following program simulates the sampling time is 1, and the delay
time (delay is an integer multiple of sample_time) after reaching the final target
, specific procedures as follows;
function ramp_func()
%采样时间为1
sample_time = 1;
current = 0;
%到达目标值期望的时间
delay = 10;
%需要步数
step = delay/sample_time;
fprintf('step:%d\n',step);
%目标值
target = 20;
%斜率 增益A
inc_dec = (target - current)/step;
output = 1:1:step;
i=1;
while i <= step
output(i) = current + inc_dec;
current = output(i);
fprintf('output(%d):%d\n',i,output(i));
i = i+1;
end
plot(output);
end
The final results are as follows;