Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

1.Create an empty project

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

2.Set the solver: discrete fixed step size

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

3.Open the simulation library to add components and drag them into the model

a)MotorPermanent Magnet Synchronous Machine

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

Double-click the motor model, set parameters according toPriusmotor parameters:

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

b)Three-Phase Inverter BridgeUniversal Bridge

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

c)SVPWM Generator (2-Level)

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

d)Similarly, add a DC Voltage Source, coordinate transformation modules (dq0 to Alpha-Beta-Zero, abc to dq0), demux, mux, Bus selector, gain, PID, sum, constant, and Powergui

l Among them, select the coordinate transformation with theAaxis overlap option

l Demux and mux are used for multiplexing and separating signals, used in conjunction with coordinate transformation

l Bus selector is used to extract motor measurements

l Gain is used for formula calculations or unit conversions

l PID is used for the dual-loop controller

l Sum is used for summation and subtraction

l Constant is for constants

l Powergui is required for simulating power electronic devices

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLABModeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

Connect the modules as follows:

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

4.Initialize variables

a)Assign values to the previous variables, see the code and input locations below

Tc = 1e-4;

R = 0.07;

Ld = 1.296e-3;

Lq = 2.308e-3;

p = 4;

J=0.005;

flux = 0.207;

Udc=600;

x_p=2*pi*500;

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

b)PI parameters

Current loop parameters are set according to the design results from the previous lesson, pay attention to the limits;

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLABModeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

The speed loop is similarly set, with the output limited to plus or minus100A

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLABModeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

5.Start simulation

The simulation duration is set to0.5s, with the motor load set to a40Nm step signal for0.25s, and the speed set to3000rpm, usingscope to observe the changes in speed and three-phase current:

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

Modeling and Simulation of Dual-Loop Control for PMSM Speed and Current in MATLAB

Debugging experience:

1.First, adjust the current loop: In fact, this is adjusting the torque control. It is recommended to set the motor’s mechanical port to speed load (in the PMSM motor module parameter settings under configuration-mechanical input-speed), then disconnect the speed loop and directly set it before the current regulator. After adjusting the current loop, change the motor’s mechanical port to torque load, and then reconnect the speed loop for debugging.

Leave a Comment