A motor control method and system based on midpoint sampling and early update

CN122801845APending Publication Date: 2026-09-22GUIZHOU AEROSPACE LINQUAN MOTOR CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202610708948.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-21
Publication Date
2026-09-22

AI Technical Summary

Technical Problem

该方法虽然将控制延迟减少到半个PWM周期,但每个周期需要执行两次完整的FOC运算,CPU运算负担增加一倍,实现复杂度高,难以应用在运算复杂的系统中

Benefits of technology

控制延迟显著减小:通过在PWM周期中点采样后立即执行电流环运算并更新PWM影子寄存器,新的控制量在当前周期结束后立即生效,将控制延迟从传统单中断方法的一个完整PWM周期减少到半个PWM周期,电流环带宽提高约33%,动态响应时间减少约42%。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122801845A_ABST
    Figure CN122801845A_ABST
Patent Text Reader

Abstract

The application discloses a motor control method and system based on midpoint sampling and early updating, and adopts a speed-current double closed loop vector control architecture. A PWM module works in up-down counting mode, and triggers ADC synchronous sampling of current and DC bus voltage at the midpoint of the period. The priority of the ADC interrupt is higher than that of the PWM interrupt, and the current loop operation is executed in the ADC interrupt, and is immediately written into the PWM shadow register after completion. The content of the shadow register is automatically loaded and takes effect at the end of the PWM period, and the control delay is reduced to half of the PWM period. At the same time, dual-path position compatible processing is realized, and the advantages of the position sensor and the observer are combined to improve the system reliability. The application significantly improves the dynamic response performance and control accuracy of the motor control system without increasing the processor burden, the current loop bandwidth is increased by about 33%, and the dynamic response time is reduced by about 42%, and is suitable for high-performance fields such as aerospace, new energy vehicles and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a motor control method and system based on midpoint sampling and advance updating. Background Technology

[0002] Permanent magnet synchronous motors (PMSMs) offer advantages such as high efficiency, high power density, and low torque ripple, making them widely used in high-performance fields such as aerospace, new energy vehicles, and industrial servo systems. In digital control systems employing field-oriented control (FOC), the timing and accuracy of the control algorithm directly determine the system's dynamic performance and stability.

[0003] Traditional single-interrupt control methods typically trigger ADC sampling at the start of the PWM cycle, perform all FOC calculations during the ADC completion interrupt, and the newly calculated duty cycle only takes effect at the start of the next PWM cycle. This method suffers from a control delay approaching that of a complete PWM cycle, severely limiting the current loop control bandwidth, reducing the system's response speed to command changes and load disturbances, and potentially even leading to system instability.

[0004] To address the control delay issue, existing technologies have proposed a dual-sampling, dual-update method. This method performs sampling and control calculations at the beginning and midpoint of the PWM cycle, and updates the duty cycle at the midpoint and end point, respectively. While this method reduces the control delay to half a PWM cycle, it requires two complete FOC operations per cycle, doubling the CPU workload and resulting in high implementation complexity, making it difficult to apply in computationally complex systems.

[0005] In terms of position detection, single-position-sensor solutions suffer from low reliability; if the sensor fails, the system will not function properly. Meanwhile, single-sensorless observer solutions exhibit poor position estimation accuracy and startup difficulties under low-speed and zero-speed conditions. Existing technologies only address medium- to high-speed switching between sensorless algorithms, failing to achieve dual-path compatibility and seamless switching between physical sensors and observers.

[0006] Furthermore, some existing technologies employ predictive compensation methods based on motor models to address control delay issues. However, these methods are highly dependent on the accuracy of motor parameters and exhibit poor robustness when parameters change. Other technologies only involve current sensor error correction based on PWM midpoint sampling, without addressing control quantity advance update mechanisms or dual-path position compatibility technology. For example, CN110943662B only addresses medium-to-high-speed switching between sensorless algorithms, failing to achieve dual-path compatibility and seamless switching between physical sensors and observers. Summary of the Invention

[0007] The purpose of this invention is to provide a motor control method and system based on midpoint sampling and advance update, which reduces the control delay from a full PWM cycle to half a PWM cycle without significantly increasing the CPU's computational burden, while achieving dual-path position compatibility processing, thereby improving the system's dynamic response performance, control accuracy, and reliability.

[0008] To achieve the above objectives, the present invention adopts the following technical solution: A motor control method based on midpoint sampling and advance updating employs a speed-current dual closed-loop vector control architecture and performs the following steps: S1: Initialization steps: S11: Configure the PWM module of the digital control unit to operate in up-and-down counting mode, and configure the ADC module and PWM module so that the PWM module generates an ADC synchronization trigger signal when the counter reaches its peak value, thereby triggering the ADC module to synchronously sample the current output from the current sensor and the DC bus voltage. In up-and-down counting mode, the PWM output waveform is symmetrical, and the midpoint of the period is exactly the zero-crossing point of the current ripple. At this time, the sampled current value is closest to the average current value, which can effectively reduce the impact of current ripple on sampling accuracy and improve the accuracy of current loop control.

[0009] S12: Configure the interrupt controller so that the ADC interrupt request generated when the ADC module completes sampling and conversion has a higher priority than the PWM cycle interrupt request generated when the PWM module's counter returns to zero. This interrupt priority configuration ensures that the time-critical task of the current loop can be executed immediately after sampling, without being interrupted by low-priority background tasks, thus guaranteeing real-time control.

[0010] S2: Loop control step, executed in each PWM cycle: S21: At the midpoint of the PWM cycle, the PWM module generates an ADC synchronization trigger signal to start the ADC module to synchronously sample the current and DC bus voltage. Synchronous sampling ensures the time consistency of the current and voltage sample values, avoiding control errors caused by asynchronous sampling times.

[0011] S22: After synchronous sampling and conversion are completed, the ADC interrupt service routine is entered. Current loop calculation is performed to generate the three-phase PWM duty cycle, and the duty cycle is written to the shadow register of the PWM module. Utilizing the shadow register mechanism commonly used in PWM modules, the newly calculated duty cycle does not take effect immediately, but is automatically loaded into the active register at the end of the PWM cycle, ensuring the continuity of PWM output.

[0012] S23: The d-axis and q-axis current feedback values ​​in the rotating coordinate system are obtained through coordinate transformation. The d-axis and q-axis voltages are obtained by adjusting the current based on the deviation between the given and feedback values. Then, through inverse coordinate transformation and space vector modulation, the sampled DC bus voltage is used to generate the three-phase PWM duty cycle, which is written to the shadow register of the PWM module. The complete current loop operation is executed in a high-priority ADC interrupt, ensuring the real-time performance of the control quantity calculation. This allows new control quantities to take effect immediately after the current PWM cycle ends, reducing the control delay from a full PWM cycle in the traditional method to half a PWM cycle.

[0013] S24: At the end of the PWM cycle, the PWM module automatically loads the duty cycle from the shadow register into the active register for output to the three-phase inverter bridge and generates a PWM cycle interrupt request. The automatic loading mechanism of the shadow register ensures a smooth transition of the PWM output waveform and avoids current surges and torque ripples caused by sudden changes in the duty cycle.

[0014] S25: In response to a PWM cycle interrupt request, the system enters the PWM cycle interrupt service routine, where background calculations are performed: rotor position and speed information are acquired and dual-path position compatibility processing is performed to determine the rotor electrical angle and mechanical speed for the next PWM cycle; speed adjustment is performed based on the deviation between the speed setpoint and the determined mechanical speed; and the q-axis current setpoint is updated for use in the current loop calculation of subsequent PWM cycles. By placing non-time-critical tasks such as speed loop calculation and position processing in a low-priority PWM interrupt, the real-time performance of the current loop is not affected, while CPU utilization is improved.

[0015] Furthermore, the initialization step also initializes a dual-channel position and speed acquisition unit, including: a position and speed sensor, a position and speed observer, and a position and speed selection module. The position and speed sensor is mechanically connected to the motor rotor, enabling direct detection of the rotor's mechanical position and speed, offering advantages of high accuracy and reliability. The position and speed observer is configured to estimate the rotor's electrical angle and speed based on the stationary coordinate system voltage and current output from the current loop, eliminating the need for additional hardware sensors and reducing system cost and complexity. The position and speed selection module selects the output electrical angle and mechanical speed according to switching logic, achieving complementary advantages between the two position detection methods.

[0016] Furthermore, in the PWM cycle interrupt service routine, the steps for acquiring rotor position and speed information and performing dual-path position compatibility processing are as follows: The rotor mechanical angle and mechanical speed output from the position and speed sensors are acquired, and the mechanical angle is converted into the sensor electrical angle based on the number of motor pole pairs; the rotor electrical angle and electrical speed estimated by the position and speed observer based on the stationary coordinate system voltage and current generated by the previous current loop calculation are acquired, and the electrical speed is divided by the number of pole pairs to convert it into an estimated mechanical speed; the position and speed selection module selects either the sensor electrical angle or the estimated electrical angle as the rotor electrical angle according to preset switching logic, and selects either the sensor mechanical speed or the estimated mechanical speed as the mechanical speed. Dual-path position compatibility processing enables the system to obtain high-precision position information when the sensors are working normally, and seamlessly switches to observer mode when the sensors fail, ensuring continuous system operation and significantly improving system reliability.

[0017] Furthermore, the preset switching logic includes a manual switching mode, an automatic switching mode based on a rotational speed threshold, or an automatic switching mode based on position accuracy. These multiple switching logics can meet the needs of different application scenarios. For example, using a sensor to obtain higher position accuracy under low-speed conditions, using an observer under high-speed conditions to avoid the influence of high-frequency noise from the sensor; or automatically switching to observer mode when the sensor output is abnormal.

[0018] Furthermore, in the current loop operation, the d-axis current setpoint is preset during initialization, while the q-axis current setpoint is updated by the speed regulation output from the previous PWM cycle interrupt; both current regulation and speed regulation employ PI controllers. PI controllers have advantages such as simple structure, easy parameter adjustment, and good robustness, and can meet the needs of most motor control applications.

[0019] Furthermore, the trigger timing of the ADC synchronous trigger signal can be adjusted within ±5% of the midpoint of the PWM period to align with the equivalent midpoint where the current ripple is minimized. Due to signal delay and nonlinearity in actual circuits, the zero-crossing point of the current ripple may slightly deviate from the precise midpoint of the PWM period. By fine-tuning the sampling timing, the current sampling accuracy can be further improved.

[0020] Based on the same inventive concept, this invention also provides a dual-path position-compatible permanent magnet synchronous motor control system for implementing the aforementioned motor control method based on midpoint sampling and advance update. The system includes: a motor, a three-phase inverter bridge, a current sensor, a position and speed sensor, a digital control unit, and a power inverter. The input terminal of the three-phase inverter bridge is connected to the DC bus voltage, and the output terminal is connected to the three-phase stator windings of the motor. The current sensor is connected in series in at least two phase stator circuits between the three-phase inverter bridge and the motor to collect stator phase current. The position and speed sensor detects the rotor position and speed of the motor. The power inverter converts the PWM signal into a motor drive voltage. The digital control unit includes a processor, a PWM generation module, an ADC sampling module, and an interrupt controller. The PWM module is configured to operate in up-and-down counting mode. The system is configured to output an ADC synchronous trigger signal at the counter peak and a PWM periodic interrupt signal when the counter returns to zero, and has a shadow register. The ADC module is configured to synchronously sample the outputs of the current sensor and the DC bus voltage sampling unit in response to the ADC synchronous trigger signal, and generate an ADC interrupt request when the conversion is complete. The interrupt controller is configured to give the priority of the ADC interrupt request higher than that of the PWM periodic interrupt request. The processor is configured to execute a current loop operation program in response to the ADC interrupt request to generate a three-phase PWM duty cycle based on the sampled current and voltage and write it to the shadow register of the PWM module. It is also configured to execute a background operation program in response to the PWM periodic interrupt request to perform dual-path position compatibility processing and speed regulation, and update the q-axis current setpoint for the current loop.

[0021] Furthermore, the processor integrates: a Clark transform module, a Park transform module, an inverse Park transform module, an SVPWM module, a current regulator, and a speed regulator, all implemented in software or hardware within the digital control unit to perform current loop calculations and background operations; a position and speed sensor, mechanically connected to the PMSM rotor, outputting the rotor mechanical angle and mechanical speed; a position and speed observer, whose inputs acquire the stationary coordinate system voltage and current generated by the current loop calculation, used to estimate the rotor electrical angle and electrical speed; an angle conversion unit, used to convert the rotor mechanical angle to the sensor electrical angle based on the number of motor pole pairs; a speed conversion unit, used to convert the estimated electrical speed to the estimated mechanical speed based on the number of motor pole pairs; and a position and speed selection module, whose inputs receive the sensor electrical angle, mechanical speed, estimated electrical angle, and estimated mechanical speed, and outputs the rotor electrical angle for coordinate transformation and the mechanical speed for speed adjustment according to preset logic.

[0022] Furthermore, the shadow register of the PWM module automatically loads its contents into the active register when the counter returns to zero. This mechanism ensures the continuity and smoothness of the PWM output waveform, avoiding current surges and torque ripples caused by sudden changes in duty cycle.

[0023] Furthermore, the position and speed sensors are incremental photoelectric encoders, absolute encoders, or rotary transformers; the current sensor is a Hall current sensor or a shunt resistor sampling circuit; and the processor is a digital signal processor (DSP), a microcontroller (MCU), or a field-programmable gate array (FPGA). This invention has good versatility and scalability, and can be adapted to different types of hardware platforms and sensors.

[0024] The beneficial effects of this invention are: Control delay is significantly reduced: By performing current loop operation and updating the PWM shadow register immediately after sampling at the midpoint of the PWM cycle, the new control quantity takes effect immediately after the end of the current cycle, reducing the control delay from a full PWM cycle in the traditional single interrupt method to half a PWM cycle. The current loop bandwidth is increased by about 33%, and the dynamic response time is reduced by about 42%.

[0025] High current sampling accuracy: Sampling is performed at the midpoint of the PWM cycle, which can obtain the sample value closest to the average current value, effectively reducing the impact of current ripple on sampling accuracy, reducing total harmonic distortion of current by about 5%, and reducing the maximum tracking error by about 47%.

[0026] The system reliability is greatly improved: the dual-path position compatible processing mechanism combines the high precision of physical position sensors with the high reliability of sensorless observers. When a sensor fails, it can seamlessly switch to observer mode to ensure the continuous operation of the system. It is particularly suitable for fields with extremely high reliability requirements, such as aerospace and new energy vehicles.

[0027] Simple to implement and low CPU burden: Compared with the double sampling and double update method, this invention only performs a complete current loop operation once per PWM cycle. The CPU computational burden is comparable to that of the traditional single interrupt method. It has low implementation complexity, high reliability, and is easy to port and promote on existing hardware platforms.

[0028] Good system stability: Accurate current sampling and small control delay enable the control system to respond to command changes and load disturbances more quickly and accurately, improving the system's stability margin and reducing the occurrence of oscillations and overshoot. Attached Figure Description

[0029] Figure 1 This is a software structure block diagram of the present invention.

[0030] Figure 2 This is a system structure block diagram of the present invention.

[0031] Figure 3 This is a flowchart of the method of the present invention.

[0032] Figure 4 This is a timing diagram for a traditional single interrupt control method.

[0033] Figure 5 This is the control timing diagram for the present invention. Detailed Implementation

[0034] Example 1: Implementation based on TMS320F28335 DSP like Figure 5 As shown, the operating timing of the method of the present invention within one PWM cycle (e.g., 50μs@20kHz) is as follows: a) At the start of the PWM cycle (0μs), the PWM module automatically loads the PWM duty cycle calculated in the previous cycle and stored in the shadow register into the active register and starts outputting a new PWM waveform; b) At the midpoint of the PWM (25μs), the PWM counter reaches its peak value (CTR=PRD), generating the first trigger signal and starting the ADC module to synchronously sample the two-phase current of the motor and the DC bus voltage. c) After the ADC conversion is completed (approximately 25.5μs), an ADC interrupt request is generated. Since the ADC interrupt has a higher priority than the PWM interrupt, the processor responds immediately and enters the ADC interrupt service routine. d) In the ADC interrupt, the processor reads the ADC sampling result, performs a complete current loop calculation (including Clarke transformation, Park transformation, PI regulation, inverse Park transformation and SVPWM modulation, about 2-5μs), and writes the calculated new PWM duty cycle data into the shadow register corresponding to the PWM compare register; e) At the end of the PWM cycle (50μs), the PWM counter returns to zero (CTR=0), the new duty cycle in the shadow register is automatically loaded into the active register, and the new PWM duty cycle takes effect; at the same time, the PWM module generates a PWM cycle interrupt request.

[0035] like Figure 3 As shown, the control flow of the method of the present invention includes the following steps: Steps: Initialize the system, configure the PWM module to work in up-and-down counting mode, and set the period value to 2500 (corresponding to a 20kHz PWM frequency); configure the ADC module to synchronous sampling mode, and the sampling channels are two-phase current and DC bus voltage; configure the interrupt controller, set the ADC interrupt priority to 7 (highest), and the PWM period interrupt priority to 3; initialize the dual-channel position and speed acquisition unit, including an incremental photoelectric encoder and a sliding mode observer; Step 1: Start the PWM module to begin motor control; Step 2: Wait for the PWM midpoint to trigger ADC sampling; Step 3: The ADC completes sampling and triggers an ADC interrupt; Step 4: In the ADC interrupt, read the current sampling value and the DC bus voltage value; Step 5: Perform Clarke transformation to convert the three-phase currents into two-phase stationary coordinate system currents iα and iβ; Step 6: Perform the Park transformation to convert the two-phase stationary coordinate system currents into two-phase rotating coordinate system currents id and iq; Step 7: Perform current loop PI regulation, and calculate the voltage control quantities ud and uq based on the deviations between the d-axis and q-axis current setpoints and feedback values; Step 8: Perform inverse Park transformation to convert the voltage control quantities back to the two-phase stationary coordinate system uα, uβ; Step 9: Perform SVPWM calculation and generate the three-phase PWM duty cycle based on the DC bus voltage; Step 10: Update the shadow register of the PWM compare register; Step 11: Exit ADC interrupt; Step 12: Wait for the PWM cycle to end and then interrupt; Step 13: In the PWM interrupt, obtain the rotor mechanical angle and mechanical speed output by the incremental photoelectric encoder and convert them into sensor electrical angle; at the same time, obtain the rotor electrical angle and electrical speed estimated by the sliding mode observer and convert them into estimated mechanical speed. Step 14: The position & speed selection module selects the appropriate rotor electrical angle and mechanical speed according to the preset automatic switching logic based on speed threshold; Step 15: Execute speed loop PI regulation and calculate the q-axis current setpoint based on the deviation between the speed setpoint and the feedback value; Step 16: Update the current loop reference value; Step 17: Exit the PWM interrupt, return to step 303, and start the next control cycle.

[0036] like Figure 1 As shown, this invention adopts a layered and modular software architecture, which is divided into three layers: hardware driver layer, core algorithm layer and application layer. The modules communicate with each other through standardized data interfaces, ensuring the portability and maintainability of the software.

[0037] The hardware driver layer interacts directly with the on-chip peripherals of the digital control unit, providing a unified hardware access interface for upper-layer algorithms. This mainly includes: The ADC driver module is responsible for configuring the ADC's sampling channel, sampling timing, and triggering mode to achieve synchronous sampling of the motor's two-phase current and DC bus voltage, and converting the sampling results into digital quantities stored in a designated memory buffer. In this invention, the ADC driver module is configured to automatically initiate sampling conversion in response to the trigger signal generated by the PWM module at the midpoint of the cycle, and trigger a high-priority ADC interrupt after the conversion is completed.

[0038] The PWM driver module is responsible for configuring the PWM operating mode (up and down counting mode), period value, dead time, and shadow register loading method to generate a three-phase six-channel complementary PWM signal. In this invention, the PWM driver module is configured to output an ADC trigger signal at the counter peak (midpoint of the period), output a PWM period interrupt signal when the counter returns to zero (end of the period), and automatically load the duty cycle value in the shadow register into the active register when the counter returns to zero.

[0039] Position sensor drive module: This module is responsible for communicating with position sensors such as incremental photoelectric encoders, absolute encoders, or rotary transformers to obtain the rotor's mechanical angle and speed information. For incremental photoelectric encoders, this module implements orthogonal decoding, counting, and speed calculation functions; for rotary transformers, this module implements excitation signal generation and sine / cosine signal decoding functions.

[0040] Interrupt Management Module: Responsible for configuring the interrupt priority and interrupt vector table of the interrupt controller, realizing unified management of various interrupts such as ADC interrupts, PWM cycle interrupts, and fault interrupts. In this invention, the interrupt management module sets the ADC interrupt to the highest priority to ensure that the current loop calculation can be executed in a timely manner; and sets the PWM cycle interrupt to a lower priority for performing background tasks such as speed loop calculation and position processing.

[0041] The core algorithm layer is the core of this invention, implementing all the functions of speed-current dual closed-loop vector control, mainly including: The coordinate transformation module comprises three sub-modules: Clarke transformation, Park transformation, and inverse Park transformation. The Clarke transformation converts the currents ia and ib in the three-phase stationary coordinate system into currents iα and iβ in the two-phase stationary coordinate system. The Park transformation uses the rotor electrical angle θe to convert the currents iα and iβ in the two-phase stationary coordinate system into currents id and iq in the two-phase rotating coordinate system. The inverse Park transformation converts the voltages ud and uq in the two-phase rotating coordinate system back into voltages uα and uβ in the two-phase stationary coordinate system. Coordinate transformation is fundamental to achieving field-oriented control. By converting AC quantities into DC quantities, high-performance control can be achieved using a simple PI controller.

[0042] Current Regulator (ACR): Employs a PI controller structure to perform closed-loop control of the d-axis and q-axis currents separately. The d-axis current setpoint idref is typically set to 0 (for surface-mounted permanent magnet synchronous motors) to achieve maximum torque-to-current ratio control; the q-axis current setpoint iqref is updated by the output of the speed regulator. Based on the deviation between the current setpoint and the feedback value, the current regulator calculates the corresponding voltage control quantities ud and uq, achieving fast and accurate tracking of the stator current.

[0043] Speed ​​Regulator (ASR): Also employing a PI regulator structure, it performs closed-loop control of the motor speed. The speed setpoint nref is input from the upper-level application or the user, while the speed feedback value n is provided by the dual-channel position and speed acquisition unit. Based on the deviation between the speed setpoint and the feedback value, the speed regulator calculates the q-axis current setpoint iqref, which serves as the input to the current regulator, achieving precise control of the motor speed.

[0044] SVPWM modulation module: Based on the voltages uα and uβ in the two-phase stationary coordinate system and the DC bus voltage Udc, the duty cycles Ta, Tb, and Tc of the three-phase PWM signal are calculated. By appropriately selecting the voltage space vector and the duration of action, SVPWM modulation can produce a higher DC bus voltage utilization rate (approximately 15% improvement) and lower current harmonic distortion than traditional SPWM modulation.

[0045] Position & velocity observer: Employing algorithms such as sliding mode observer or extended Kalman filter, it estimates the rotor's electrical angle θe_est and electrical speed ωe_est in real time based on the stationary coordinate system voltages uα and uβ and currents iα and iβ output from the current loop. The position & velocity observer does not require additional hardware sensors and can provide backup position and velocity information in case of sensor failure, improving system reliability.

[0046] The dual-path position selection module is one of the key innovations of this invention. It is responsible for fusing and selecting the position information output by the position sensor and the position information estimated by the observer. This module first converts the mechanical angle θm output by the position sensor into the electrical angle θe_sen, and the electrical rotational speed ωe_est output by the observer into the mechanical rotational speed n_est. Then, according to the preset switching logic (such as automatic switching logic based on rotational speed threshold), it selects the appropriate electrical angle θe and mechanical rotational speed n and outputs them to the coordinate transformation module and the speed regulator.

[0047] The application layer, located at the top of the software architecture, primarily implements system state management, fault diagnosis, and protection functions, including: System status management module: responsible for managing the operating status of the motor control system, such as initialization status, standby status, running status, fault status, etc., and realizing smooth switching between each status.

[0048] Fault diagnosis and protection module: Real-time monitoring of system operating parameters, such as overcurrent, overvoltage, undervoltage, overheating, position sensor failure, etc., and taking corresponding protection measures when a fault is detected, such as immediately blocking PWM output and stopping alarm, to ensure the safe operation of the system.

[0049] Communication interface module: Enables communication with the host computer or other devices, such as CAN bus, RS485, Ethernet, etc., for receiving control commands and uploading system operation status data.

[0050] The control data flow of this invention strictly follows the sequence of "sampling-calculation-output", and the real-time performance of the control is guaranteed through interrupt priority configuration. Midpoint of PWM cycle: The PWM module triggers ADC sampling, and the ADC driver module completes synchronous sampling of current and voltage; After ADC conversion is complete: a high-priority ADC interrupt is triggered, and the current loop operation begins. Read the current sample values ​​ia, ib and the DC bus voltage Udc from the ADC buffer; Perform the Clarke transform to obtain iα and iβ; Perform the Park transformation (using the rotor electrical angle θe determined in the previous PWM cycle) to obtain id and iq; The current regulator calculates ud and uq based on idref, iqref, id, and iq. Perform the inverse Park transform to obtain uα and uβ; The SVPWM modulation module calculates the three-phase PWM duty cycles Ta, Tb, and Tc based on uα, uβ, and Udc. Write Ta, Tb, and Tc into the PWM shadow register; Store uα, uβ and iα, iβ into the specified memory for use by the position & velocity observer; Exit ADC interrupt.

[0051] PWM cycle ends: The PWM module automatically loads the duty cycle from the shadow register into the active register, and a new PWM waveform begins to be output; simultaneously, a low-priority PWM interrupt is triggered, and background operations begin execution. The position sensor drive module reads the rotor mechanical angle θm and mechanical speed n_sen; The angle conversion unit converts θm into electrical angle θe_sen; The position and velocity observers estimate θe_est and ωe_est based on uα, uβ and iα, iβ from the previous cycle; The speed conversion unit converts ωe_est into mechanical speed n_est; The dual-path position selection module selects θe and nr according to preset logic; Speed ​​regulator based on n ref And nr calculate i qref ; Update the current setpoints idref and iqref of the current loop; Perform system status management and fault diagnosis; Exit the PWM interrupt and wait for the next PWM cycle.

[0052] like Figure 5 As shown, the system of the present invention includes the following main components: Motor: 76kW permanent magnet synchronous motor; Power inverter: Three-phase IGBT inverter bridge, DC bus voltage 540V; Current sensor: Hall current sensor, connected in series in the stator circuits of phase U and phase V; Position sensor: 2500-line incremental photoelectric encoder, coaxially connected to the motor rotor; ADC module: 12-bit synchronous sampling ADC, sampling rate 1MSPS; PWM module: 6-channel PWM generator, operating in up-and-down counting mode; Processor: TITMS320F28335 floating-point DSP, 150MHz; Interrupt controller: Integrated into the DSP, supporting 16 interrupt priority levels; Memory: 256KB on-chip Flash, 68KB on-chip RAM.

[0053] Performance test results: The method of this invention was used to test a 76kW permanent magnet synchronous motor under the following test conditions: a) PWM frequency: 4kHz, b) DC bus voltage: 540V. c) Load: Step change of rated torque from 0-100% d) Control platform: TMS320F28335DSP.

[0054] The test results are compared in the table below:

Claims

1. A motor control method based on midpoint sampling and advance updating, characterized in that, The speed-current dual closed-loop vector control is adopted, and the following steps are performed: S1: Initialization steps: S11: Configure the PWM module of the digital control unit to work in up-and-down counting mode, and configure the ADC module and the PWM module so that the PWM module generates an ADC synchronous trigger signal when the counter reaches the peak value, so as to trigger the ADC module to synchronously sample the current output by the current sensor and the DC bus voltage. S12: Configure the interrupt controller so that the priority of the ADC interrupt request generated when the ADC module completes the sampling conversion is higher than the priority of the PWM period interrupt request generated by the PWM module when the counter returns to zero. S2: Loop control step, executed in each PWM cycle: S21: At the midpoint of the PWM cycle, the PWM module generates an ADC synchronization trigger signal to start the ADC module to synchronously sample the current and DC bus voltage. S22: After synchronous sampling and conversion are completed, the ADC interrupt service routine is entered, the current loop operation is performed to generate the three-phase PWM duty cycle, and the duty cycle is written to the shadow register of the PWM module. S23: The d and q axis current feedback values ​​in the rotating coordinate system are obtained through coordinate transformation. The current is adjusted according to the deviation between the given and feedback values ​​of the d and q axis currents to obtain the d and q axis voltages. Then, the three-phase PWM duty cycle is generated by inverse coordinate transformation and space vector modulation and the sampled DC bus voltage is used. The duty cycle is written into the shadow register of the PWM module. S24: At the end of the PWM cycle, the PWM module automatically loads the duty cycle in the shadow register into the active register to output to the three-phase inverter bridge and generates a PWM cycle interrupt request. S25: In response to the PWM cycle interrupt request, enter the PWM cycle interrupt service routine, where background calculations are performed: obtain rotor position and speed information and perform dual-path position compatibility processing to determine the rotor electrical angle and mechanical speed for the next PWM cycle; and adjust the speed according to the deviation between the speed setpoint and the determined mechanical speed, and update the q-axis current setpoint for use in the current loop calculation of subsequent PWM cycles.

2. The motor control method based on midpoint sampling and advance update according to claim 1, characterized in that, The initialization step also initializes the dual-channel position and velocity acquisition unit, including: position & velocity sensor, position & velocity observer and position & speed selection module; The position and speed sensors are mechanically connected to the motor rotor. The position and speed observer is configured to estimate the rotor's electrical angle and electrical speed based on the stationary coordinate system voltage and current output by the current loop. The position and speed selection module selects the output electrical angle and mechanical speed according to the switching logic.

3. The motor control method based on midpoint sampling and advance update according to claim 1, characterized in that, In the PWM cycle interrupt service routine, the specific steps for obtaining rotor position and speed information and performing dual-path position compatibility processing are as follows: S251: Acquire the rotor mechanical angle and mechanical speed output from the position & speed sensor, and convert the mechanical angle into sensor electrical angle based on the number of motor pole pairs; S252: The position & velocity observer estimates the rotor electrical angle and electrical speed based on the stationary coordinate system voltage and current generated by the previous current loop calculation, and divides the electrical speed by the number of pole pairs to convert it into an estimated mechanical speed. S253: The position & speed selection module selects the sensor electrical angle or estimated electrical angle as the rotor electrical angle according to the preset switching logic, and selects the sensor mechanical speed or estimated mechanical speed as the mechanical speed.

4. The motor control method based on midpoint sampling and advance update according to claim 3, characterized in that, The preset switching logic includes a manual switching mode, an automatic switching mode based on a rotation speed threshold, or an automatic switching mode based on position accuracy.

5. The motor control method based on midpoint sampling and advance update according to claim 1, characterized in that, In the current loop operation, the d-axis current setpoint is preset during initialization, and the q-axis current setpoint is updated by the output of the speed regulation in the previous PWM cycle interruption; both the current regulation and the speed regulation adopt PI regulators.

6. The motor control method based on midpoint sampling and advance update according to claim 1, characterized in that, The triggering time of the ADC synchronous trigger signal can be adjusted within ±5% of the midpoint of the PWM cycle to align with the equivalent midpoint with the minimum current ripple.

7. A dual-path position-compatible permanent magnet synchronous motor control system, used to implement the motor control method based on midpoint sampling and advance updating as described in any one of claims 1-9, characterized in that, include: Includes motor, three-phase inverter bridge, current sensor, position and speed sensor, digital control unit, and power inverter; The input terminal of the three-phase inverter bridge is connected to the DC bus voltage, and the output terminal is connected to the three-phase stator winding of the motor. The current sensor is connected in series in at least two phase stator circuits between the three-phase inverter bridge and the motor to collect stator phase current. Position and speed sensors detect the position and speed of the motor rotor; A power inverter converts PWM signals into motor drive voltage; The digital control unit includes a processor, a PWM generation module, an ADC sampling module, and an interrupt controller. The PWM module is configured to operate in up-and-down counting mode, outputting an ADC synchronous trigger signal when the counter reaches its peak value, and outputting a PWM periodic interrupt signal when the counter returns to zero, and also has a shadow register. The ADC module is configured to synchronously sample the outputs of the current sensor and the DC bus voltage sampling unit in response to the ADC synchronization trigger signal, and generate an ADC interrupt request when the conversion is completed. The interrupt controller is configured to give ADC interrupt requests a higher priority than PWM cycle interrupt requests. The processor is configured to execute a current loop operation program in response to an ADC interrupt request to generate a three-phase PWM duty cycle based on the sampled current and voltage and write it into the shadow register of the PWM module. In response to a PWM cycle interrupt request, a background computation program is executed to perform dual-path position compatibility processing and speed regulation, and to update the q-axis current setpoint for the current loop.

8. The motor control system based on midpoint sampling and advance updating according to claim 1, characterized in that, The processor integrates: The Clark transform module, Park transform module, inverse Park transform module, SVPWM module, current regulator, and speed regulator are all implemented in the digital control unit in software or hardware form to realize current loop operation and background operation. Position and speed sensors are mechanically connected to the rotor of the PMSM, outputting the rotor's mechanical angle and mechanical speed; The position and velocity observer, whose input terminal acquires the stationary coordinate system voltage and current generated by the current loop operation, is used to estimate the rotor electrical angle and electrical speed; An angle conversion unit is used to convert the rotor mechanical angle into a sensor electrical angle based on the number of motor pole pairs. A speed conversion unit is used to convert the estimated electrical speed into the estimated mechanical speed based on the number of motor pole pairs. The position & speed selection module receives sensor electrical angle, mechanical speed, estimated electrical angle and estimated mechanical speed at its input terminal, and outputs rotor electrical angle for coordinate transformation and mechanical speed for speed adjustment according to preset logic.

9. The motor control system based on midpoint sampling and advance updating according to claim 7, characterized in that, The shadow register of the PWM module automatically loads its contents into the active register when the counter returns to zero.

10. The motor control system based on midpoint sampling and advance updating according to claim 7, characterized in that, The position and speed sensors are incremental photoelectric encoders, absolute encoders, or rotary transformers; the current sensors are Hall current sensors or shunt resistor sampling circuits; and the processor is a digital signal processor (DSP), a microcontroller (MCU), or a field-programmable gate array (FPGA).

Citation Information

Patent Citations

  • A high-speed switching method for sensorless vector control of permanent magnet synchronous motors

    CN110943662B