A text to get to know the role of FOC ramp function ramp function and implementation

definition

x ( t ) = { 0 t < 0 A t , t 0 x(t) = \begin{cases} 0,t<0\\ At,t \ge 0\\ \end{cases}

Where A is the gain, corresponding to a given speed, at time [ 0 , t ] [0, t ] period, in accordance with the acceleration A, homogenized uniformly accelerated or decelerated to the speed reference v r e f v_{ref}

Here Insert Picture Description
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 x ( t 0 ) x(t_0)
  • The system according to A uniform position change rate, A = d x d t A = \cfrac{dx}{dt}
  • The final arrival t 0 t_0 Time, the system reaches the set position x ( t 0 ) x(t_{0})

The same also applies to the speed loop, for different controlled objects gain A A 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 T \bigtriangleup_{T} Time sampling, you can input discrete:
x ( i ) = { 0 i < 0 A i , i 0 x(i) = \begin{cases} 0,i<0\\ Ai,i \ge 0\\ \end{cases}
Here Insert Picture Description

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., x ( i ) x(i)
  • Target value, the system eventually reaches the desired value, i.e. x ( i 0 ) x(i_0)
  • Delay time, the time the system reaches the desired target value;
  • The number of steps, number of steps to reach the target system, usually i = t d e l a y T i = \cfrac{t_{delay}}{\bigtriangleup_{T}}
  • Slope, slope X t a r g e t X i n i t a l s t e p \cfrac{X_{target} - X_{inital}}{step} , 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 matlabthe 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 delaytime (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;

Here Insert Picture Description
Here Insert Picture Description

Published 103 original articles · won praise 164 · Views 100,000 +

Guess you like

Origin blog.csdn.net/u010632165/article/details/104729090