m Simulink simulation of permanent magnet linear synchronous motor control system based on MPC model predictive control algorithm, MPC is designed using toolbox and S function

Table of contents

1. Algorithm simulation effect

2. Algorithms involve an overview of theoretical knowledge

3. MATLAB core program

4. Complete algorithm code file


1. Algorithm simulation effect

The matlab2022a simulation results are as follows:

  

2. Algorithms involve an overview of theoretical knowledge

      MPC (Model Predictive Control) model predictive control algorithm is an advanced control algorithm that can effectively solve the control problems of complex systems such as nonlinear, multi-variable, and constraint conditions. Permanent magnet linear synchronous motor is a high-performance, high-efficiency motor that is widely used in robotics, medical equipment, industrial automation and other fields. MPC (Model Predictive Control) model predictive control algorithm is an advanced control algorithm that can effectively solve the control problems of complex systems such as nonlinear, multi-variable, and constraint conditions. Permanent magnet linear synchronous motor is a high-performance, high-efficiency motor that is widely used in robotics, medical equipment, industrial automation and other fields. This article will introduce the Simulink simulation of the permanent magnet linear synchronous motor control system based on the MPC model predictive control algorithm, including system modeling, controller design, and simulation experiments.

       Three-phase symmetrical sinusoidal currents are fed into the three-phase windings of the linear motor, which will generate an air-gap magnetic field that is sinusoidally distributed along the extended straight line. Because the three-phase sinusoidal currents are all functions of time, the air-gap magnetic field generated will move along a straight line according to the phase sequence of A, B, and C. This magnetic field is called a traveling wave magnetic field .
      In the MPC controller, it is necessary to determine the parameters of the system, such as state quantities, control quantities, constraints and optimization objectives. In this paper, the state quantity of the system includes the position, speed and current of the motor, the control quantity is the voltage command of the motor, the constraints include the maximum and minimum values ​​of the motor voltage, and the maximum and minimum values ​​of the current, and the optimization goal is to make the motor rotate to a specified position and speed.

MPC is a multi-variable control strategy, which involves:
      the dynamic model of the inner loop of the process; the historical value of the control quantity; an optimal value equation J on the prediction interval. The optimal control quantity can be obtained from the above quantities.
      The biggest feature of MPC is that, compared with LQR control, MPC can consider various constraints of space state variables, while LQR, PID and other controls can only consider various constraints of input and output variables. MPC can be applied to both linear and nonlinear systems.

       The model predictive algorithm is an optimized control algorithm that has emerged in Europe and the United States and is applied to the industrial field. After years of development, it has been applied in industrial fields and intelligent control fields. With the improvement of the theory of the algorithm, it has become a classic algorithm frequently used in the industrial field. Although there are differences in the application of algorithms in various fields.

       But they all follow the fundamentals of predictive modeling, rolling optimization, and feedback correction. Moreover, in recent years, in the automotive industry, especially in vehicle intelligent driving technology, the application of model prediction algorithms has become more and more popular. Many scientific research institutions have used the principle of model prediction to conduct research on the trajectory tracking control of intelligent vehicles. The principle of the model prediction algorithm will be described in detail below.

(1) Predictive model
      The predictive model is the basis of model predictive control. It can predict the future state of the controlled platform through the current system state information provided by the controlled platform in the control system, coupled with future control input variables.

      There is no definite form requirement for the form of the prediction model, which can be a state space equation, a transfer function, a step response model, an impulse response model, a fuzzy model, etc. Select the appropriate prediction model according to the controlled object and the state that needs to be predicted.

For the direction of the vehicle, the model predictive control chooses the state space model is more appropriate.

(2) The optimization in rolling optimization
      predictive control is different from the usual discrete optimal control algorithm. Instead of adopting a constant global optimal goal, it adopts a rolling limited time-domain optimization strategy.

       At each sampling moment, according to the optimal performance index at that moment, the optimal control rate for a limited period from that moment is solved. Only the current value of the calculated control action sequence is actually executed, and the optimal control rate is recalculated at the next sampling time.

       That is to say, the optimization process is not completed offline once, but repeated online (that is, at each sampling moment, the optimization performance index only involves a limited time from this moment to the future, and at the next sampling moment, this optimization The time period will move forward at the same time).

       Through the rolling optimization strategy, a new optimization goal is always established on the basis of reality, taking into account the influence of ideal optimization and actual uncertainty in the limited time domain in the future. This is more practical and effective than traditional optimal control based on ideal conditions.

(3)
      The solution of feedback correction predictive control is an open-loop optimization problem. In predictive control, it is only an ideal way to use a predictive model to predict the output value of the process. For the actual process, due to uncertain factors such as nonlinearity, time variation, model mismatch and interference, the model-based prediction is not accurate. likely to be exactly as it actually is.

      Therefore, in predictive control, the forecast error of the model is obtained by comparing the measured value of the output with the forecast value of the model, and then the forecast error of the model is used to correct the forecast value of the model, so as to obtain a more accurate forecast of future output value. It is this process of model plus feedback correction that enables predictive control to have strong anti-interference and ability to overcome system uncertainty. Constantly correct the predicted output according to the actual output of the system, so that the rolling optimization is not only based on the model, but also uses the feedback information to construct a closed-loop optimization control.

Its internal structure block diagram is as follows:

3. MATLAB core program

.......................................................................
function u = MPC_set(M_Ref,ref)
    %更新
    x0      = A*x0 + B*u0;%no noise
    y       = C*x0;
    %加入约束%速度约束
    for ii = 1:Ra
        if x0(ii) >=0.5;
           x0(ii) = 0.5;
        end
    end
    %差值
    Error = (M_Ref(:) - y);

    u     = 15*(Pmpc*reshape(ref - Error(:,ones(P,1)),[],1) - Kmpc*x0);
    %sat范围限制
    if u > 250
       u = 250;
    end
    if u < -250
       u = -250;
    end  
end

end

...............................................................................

P = Pmatrix1;
M = zeros(Cb,Rc);

for i=1
    Row2         =(i-1)*Cb+1:i*Cb;
    Cow2         =(i-1)*Rc+1:i*Rc;
    M(Row2,Cow2) = Gm1;
end

H_matrix = zeros(Rc,Cb);
for k=1:Cb;
    H_matrix(:,k) = sum(Pmatrix2(:,k:Cb:end),2);
end

%J = min Y'QY + U'RU
H  = H_matrix;
Hs = H'*Qmatrix*H+Rmatrix;
Hs =(Hs+Hs')/2;
 
K0 = inv(Hs)*( H'*Qmatrix*P);
P0 =-inv(Hs)*(-H'*Qmatrix*L-Rmatrix*M);

Kmpc = K0(1:Cd,:);
Pmpc = P0(1:Cd,:);
end
08_066_m

4. Complete algorithm code file

V

Guess you like

Origin blog.csdn.net/hlayumi1234567/article/details/130735769