Structural composition
The motor controller structure is mainly composed of: interface circuit, control motherboard, IGBT module (drive), supercapacitor, discharge resistor, current sensor, shell water channel, etc.
Hardware topology

(1) It consists of three groups of six switch bridges, D1 and D4, D3 and D6, D5 and D2 are mutually interactive, that is, one is connected and the other is disconnected;
(2) Drive: The inverter converts the DC power provided by the battery into three-phase AC power with adjustable voltage and frequency, and outputs it to the motor winding;
(3) Braking: The inverter rectifies the three-phase AC power into DC power through the freewheeling diode to charge the battery.
Vector control principle
Vector control is also called field oriented control (FOC). Its basic idea is to control the permanent magnet synchronous motor by using coordinate transformation to realize the control method of analog DC motor. The implementation steps are as follows:
(1) According to the principle of constant magnetic potential and power, the three-phase stationary coordinates are transformed into two-phase stationary coordinates through orthogonal transformation, that is, Clarke transformation. The three-phase current is first converted to the stationary coordinate system, and then the two-phase stationary coordinates are transformed into two-phase rotating coordinates through rotation transformation, that is, Park transformation. In Park transformation, the stator current vector is decomposed into two DC components id and iq oriented according to the rotor magnetic field (where id is the excitation current component and iq is the torque current component).

(2) The speed current loop is controlled by the controller. Controlling id is equivalent to controlling the magnetic flux, and controlling iq is equivalent to controlling the torque. The lq adjustment reference is given by the speed controller. After the current loop is adjusted, the voltage components on the d and q axes, namely ud and ug, are obtained.
(3) The control quantities ud and uq are transformed by Park inverse transformation.
(4) The vector control quantity output is realized according to the SVPWM space vector synthesis method to achieve the purpose of vector control.
Drive system control function
(1) High-voltage logic
After the motor controller is awakened by low voltage, it enters the initial state INITIAL, performs self-test and initialization operations, enters the STANDBY state to detect the bus voltage, and when the motor controller high-voltage pre-charge is completed, it enters the READY state to receive the vehicle controller enable command and enters the RUNNING state. In the RUNNING state, the motor controller receives the torque command or speed command from the vehicle controller and outputs power.
(2) Active discharge function
After the motor controller is powered off, there is still a certain amount of energy and voltage in the bus capacitor. It takes several minutes (300s) for natural discharge to be completely discharged to a safe voltage, so the active discharge function is required for rapid discharge (3s), otherwise it may affect the next normal power-on and may cause personal injury to maintenance personnel. After the controller is under high voltage, the active discharge function enters the current loop and gives a suitable Id value, so that the energy in the bus capacitor enters the motor. At the same time, no torque is generated, and the energy is consumed by heat, so that the controller bus voltage quickly drops below the safe voltage value.
(3) Anti-roll back function
ARB (Anti-Roll Back), a new anti-roll back system suitable for new energy vehicles, directly uses the drive motor to provide a stall torque to keep the vehicle stable on the slope.
When the vehicle speed is low, if it is in the driving gear, the vehicle will activate the anti-roll back function and control the motor to enter zero speed control to stabilize the vehicle on the road. When the driver steps on the accelerator pedal and the driving torque is sufficient to overcome the slope resistance, the ARB function will completely exit and the vehicle will smoothly enter the driving mode.
(4) Speed control algorithm and application
According to the difference between the target speed and the actual speed, the PI control algorithm is used to obtain the torque command. After torque smoothing and external characteristic limitation, the target torque is output for speed control. After the torque is looked up in the table, the control target values of the direct-axis current Id and the AC current lq are obtained, and the current loop control is performed. The speed regulation effect can adjust the size of Kp and Ki, as well as the speed step and torque step, so as to obtain the ideal control effect.

(5) Energy recovery function
During the braking and deceleration process of the permanent magnet synchronous motor, since the inertial rotor speed cannot change suddenly, and the electrical response speed is faster than the mechanical response speed, the speed of the rotating magnetic field generated by the stator winding is less than the motor rotor speed under the control of the control system, forming a slip, and the motor rotor reverses the magnetic flux lines to generate a reverse induced electromotive force on the stator winding. When the electromotive force providing the braking torque is less than the motor reverse induced electromotive force, the energy will flow from the motor side to the power side to charge the battery, realizing energy recovery. When the speed is low, the motor controller uses the BOOST boost circuit to increase the motor reverse electromotive force for energy feedback.