Simulink model of permanent magnet synchronous motor control system based on FOC directional control

Table of contents

1. Field Oriented Control (FOC)

2. Implementation steps of FOC directional control

3. Realization

4. Experimental verification

5. Core program

Six, MATLAB simulation results


      The permanent magnet synchronous motor (PMSM) control system is a high-performance motor control scheme based on field-oriented control (FOC). This control system can achieve precise torque and flux control, and has the advantages of fast response, high efficiency, and high power density, so it has been widely used in industrial automation, electric vehicles, aerospace and other fields.

1. Field Oriented Control (FOC)

      Before analyzing the FOC control system of PMSM, we first need to establish the mathematical model of PMSM. The physical equation of PMSM can be expressed by the following formula:

Te = p*λ*i*cos(θ)  
Tj = p*λ*i*sin(θ)

        Among them, Te is the electromagnetic torque, Tj is the mechanical torque, p is the number of pole pairs, λ is the flux linkage of the permanent magnet, i is the current, and θ is the angle between the motor rotor and the stator current.

        The main goal of the FOC control system is to control the motor torque and flux by controlling the current and voltage, so we need to establish a mathematical model of the current and voltage. The relationship between current and voltage can be expressed by the following formula:

V = R*i + d*λ/dt

Among them, V is the voltage, R is the resistance, i is the current, d is the differential operator, λ is the flux linkage of the permanent magnet, and dt is the time differential.

2. Implementation steps of FOC directional control

The implementation steps of FOC-based PMSM control system are as follows:

  1. Initialization: Set the parameters of the control system, including motor parameters, controller parameters, sampling period, etc.
  2. Speed ​​estimation: According to the running state of the motor, use the speed estimation algorithm to estimate the speed of the motor. Commonly used speed estimation algorithms include current method, back electromotive force method and so on.
  3. Current control: According to the difference between the output of the current controller and the actual current of the motor, the current is adjusted through the PID controller to achieve precise control of the current.
  4. Voltage control: According to the difference between the output of the voltage controller and the actual voltage of the motor, the voltage is adjusted through the PID controller to achieve precise control of the voltage.
  5. Torque and flux control: According to the operating state of the motor and the target of the control system, the torque and flux required by the motor are calculated through the FOC algorithm, and then precise control is realized through the current and voltage controllers.
  6. Sampling and feedback: The current, voltage, speed and other information of the motor are collected through the sampling circuit, and then fed back to the control system.
  7. Protection control: According to the running state of the motor and the safety protection requirements, the protection control of overheating, overcurrent, overvoltage, etc. is realized.

3. Realization

        When implementing the FOC control system, we need to choose the appropriate hardware and software platform. The hardware platform includes motors, power devices, sampling circuits, protection circuits, etc.; the software platform includes control algorithms, communication protocols, user interfaces, etc.

      On the hardware platform, we usually choose high-performance motors, power devices and sampling circuits. For example, we can choose permanent magnet synchronous motors with high power density and high efficiency, IGBT or MOSFET power devices with fast response and high switching frequency, and current and voltage sampling circuits with high precision and fast response.

       On the software platform, we usually choose a control algorithm with fast response and high precision. For example, we can choose a proportional-integral-derivative (PID) controller with fast response and high stability, and a speed estimation algorithm with fast Fourier transform (FFT). In addition, we also need to implement a communication protocol and a user interface for remote control and parameter adjustment.

4. Experimental verification

       In order to verify the performance and stability of the FOC control system, we need to conduct experimental verification. Experimental verification includes hardware-in-the-loop experiments (HIL) and actual running experiments. The HIL experiment is an experiment carried out in a simulated environment, which can simulate the actual operating state of the motor, thereby verifying the stability and performance of the control system. The actual operation experiment is an experiment carried out in a real environment, which can verify the actual operation effect of the control system.

       In the experiment, we can optimize the performance of the control system by adjusting the parameters of the control system, such as the proportion, integral, and differential coefficients of the PID controller. In addition, we can also verify the reliability and effectiveness of the control system's overheating, overcurrent, overvoltage and other protection functions through experiments.

       In a word, the permanent magnet synchronous motor control system based on FOC directional control is a high-performance, high-efficiency motor control system with broad application prospects. When realizing this kind of control system, we need to choose the appropriate hardware and software platform, and realize the precise current, voltage, torque and magnetic flux control and protection control. Through experimental verification, we can optimize the performance of the control system and verify the reliability and effectiveness of the protection function.

5. Core program

PWM_frequency 	= 30e3;             %%Hz//转换器s/w频率
T_pwm           = 1/PWM_frequency;  %s//PWM开关时间周期

%设置采样时间
Ts          	= T_pwm;        %控制器的采样时间步长
Ts_simulink     = T_pwm/2;      %模型模拟的模拟时间步长
Ts_motor        = T_pwm/2;      %模拟采样时间
Ts_inverter     = T_pwm/2;      %平均值逆变器的模拟时间步长
Ts_speed        = 30*Ts;        %速度控制器的采样时间

%设置控制器的数据类型和代码生成
dataType = 'single';            %浮点代码生成

%系统参数//硬件参数

%设置目标参数
target.CPU_frequency        = 84e6;					%时钟频率
target.PWM_frequency        = PWM_frequency;   		%PWM频率
target.PWM_Counter_Period   = round(target.CPU_frequency/target.PWM_frequency/2); % 上下计数器的PWM计时器计数
target.ADC_Vref             = 3.3;					%V		ADC参考电压
target.ADC_MaxCount         = 4095;					%12位ADC的最大计数

%电机参数
pmsm.p      = 4;                %电机极对数
pmsm.Rs     = 0.4;              %欧姆//定子电阻器
pmsm.Ld     = 0.6e-3;           %D轴电感值
pmsm.Lq     = 0.6e-3;           %Q轴电感值
pmsm.J      = 4.8018552467e-06; %惯性
pmsm.B      = 9.6037104933e-06; %摩擦系数
pmsm.Ke     = 4;                %扭矩常数
pmsm.Kt     = 0.04103;          %额定电流
pmsm.I_rated= 3.5;              %最大速度
pmsm.N_max  = 10000;            %位置偏移
pmsm.PositionOffset = 0.1712;	%QEP编码器狭缝
pmsm.QEPSlits       = 1250;     %根据Ke计算的PM通量
pmsm.FluxPM     = (pmsm.Ke)/(sqrt(3)*2*pi*1000*pmsm.p/60); % 
pmsm.T_rated    = (3/2)*pmsm.p*pmsm.FluxPM*pmsm.I_rated;   %从I_rated获取T_rated

pmsm.N_base = 4000; %电机基本速度
pmsm.PositionOffset = 0.1917; % 不需要无传感器

%设置逆变器详细信息 

inverter.V_dc          = 24;       				%设置逆变器详细信息(X-NUCLEO-IHM07M)
inverter.I_trip        = 3.55;       			%安培//跳闸的最大电流
inverter.Rds_on        = 2e-3;     				%欧姆//Rds ON(来自电机驱动芯片)
inverter.Rshunt        = 0.33;    				%欧姆
inverter.CtSensAOffset = 1665;        			%计数//ADC偏移
inverter.CtSensBOffset = 1943;        			%计数//ADC偏移
inverter.ADCGain       = 1;                     %通过SPI缩放的ADC增益因子(不可能进行板载放大)
inverter.EnableLogic   = 1;    					% X-NUCLEO-IHM07M1使能引脚(EN_GATE)的激活高电
inverter.invertingAmp  = -1;   					% 非反相电流测量放大器
inverter.ISenseVref    = 3.3;					%V/逆变器电流检测电路的电压参考
inverter.ISenseVoltPerAmp = 0.505; 				%V每1A电流的电流感应电压输出(Rshunt*iSense运算放大器增益)
inverter.ISenseMax     = inverter.ISenseVref/(2*inverter.ISenseVoltPerAmp); %Amp%Amps//可通过逆变器电流感应测量的最大峰值中性点电流
inverter.R_board       = inverter.Rds_on + inverter.Rshunt/3;  %Ohms
inverter.ADCOffsetCalibEnable = false;

%%PU系统详细信息//设置PU转换的基本值
PU_System.V_base   = (inverter.V_dc/sqrt(3));
PU_System.I_base   = inverter.ISenseMax;
PU_System.N_base   = pmsm.N_base;
PU_System.T_base   = (3/2)*pmsm.p*pmsm.FluxPM*PU_System.I_base;
PU_System.P_base   = (3/2)*PU_System.V_base*PU_System.I_base;

acceleration = 20000/PU_System.N_base;                  % P.U/Sec//最大允许加速度

%%开环参考值
T_Ref_openLoop          = 1;                    %开环启动时间
Speed_openLoop_PU       = 0.1;                  %开环启动的单位速度参考
Vd_Ref_openLoop_PU      = Speed_openLoop_PU*2;  %Dyno设置使用1.2倍,其他设置使用2倍

%控制器设计
PI_params = mcb.internal.SetControllerParameters(pmsm,inverter,PU_System,T_pwm,2*Ts,Ts_speed);

%更新模拟延迟
PI_params.delay_Currents    = int32(Ts/Ts_simulink);
PI_params.delay_Position    = int32(Ts/Ts_simulink);
PI_params.delay_Speed       = int32(Ts_speed/Ts_simulink);
PI_params.delay_Speed1      = (PI_params.delay_IIR + 0.5*Ts)/Ts_speed;

%将数据类型double的所有参数转换为single
disp(pmsm);
disp(inverter);
disp(target);
up3037

Six, MATLAB simulation results

Guess you like

Origin blog.csdn.net/ccsss22/article/details/132677940
Recommended