A motor three-phase current sampling method, system, device and storage medium

By calculating feasible sampling windows in permanent magnet synchronous motors and performing multi-point weighted fusion, combined with deep learning prediction and online self-calibration, the problem of current sampling lag is solved, the sampling accuracy and system stability are improved, and it is suitable for motor control of new energy vehicles.

CN122026764BActive Publication Date: 2026-07-03HANGZHOU GONGSHU DISTRICT HOLOGRAPHIC INTELLIGENT TECHNOLOGY RESEARCH INSTITUTE

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU GONGSHU DISTRICT HOLOGRAPHIC INTELLIGENT TECHNOLOGY RESEARCH INSTITUTE
Filing Date
2026-04-13
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

In high-performance vector control systems for permanent magnet synchronous motors, current sampling suffers from hysteresis, leading to a decline in control performance. This is especially pronounced at high speeds or high carrier frequencies, where phase hysteresis significantly affects torque control accuracy and system stability.

Method used

By calculating feasible sampling windows, a multi-point sampling plan is generated, weighted fusion is performed in a synchronously rotating coordinate system, and current prediction is performed using a deep learning prediction network. Combined with an online self-calibration mechanism, the sampling delay is compensated and noise is suppressed.

Benefits of technology

It improves the availability and consistency of current sampling under all operating conditions, enhances the accuracy and robustness of delay compensation, reduces long-term drift caused by temperature drift and device aging, and improves the stability and dynamic response of the control system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122026764B_ABST
    Figure CN122026764B_ABST
Patent Text Reader

Abstract

The application discloses a motor three-phase current sampling method, system, device and storage medium. The method comprises the following steps: according to PWM modulation information and sampling link timing constraints, calculating a feasible sampling window and generating a sampling plan containing N sampling time points; performing multi-point sampling and transforming the sampling value to a synchronous rotating coordinate system, and performing weighted fusion to obtain dq-axis current estimation value; constructing a timing feature set based on historical data, and using a deep learning prediction network to output current prediction value and prediction confidence of the next period; and dynamically weighting and fusing the current estimation value and the prediction value according to the prediction confidence to obtain the final current. The application avoids dead zones and interference through adaptive window planning, realizes noise suppression without lag and high-precision delay compensation through dq-domain fusion and deep learning prediction, and significantly improves the dynamic performance and robustness of the motor control system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of new energy vehicle and motor control technology, and in particular to a method, system, device and storage medium for sampling three-phase current of a motor. Background Technology

[0002] In high-performance vector control systems for permanent magnet synchronous motors (PMSMs), the accuracy and real-time performance of current sampling are key factors determining control performance. The current feedback signal is the fundamental data for realizing coordinate transformations (such as Clark and Park transformations) and closed-loop regulation of the current loop (PI regulation), directly affecting the accuracy of torque control and the precision of field orientation.

[0003] However, in practical digital control systems, the current sample value acquired by the controller is often not the actual current value in the motor windings at the current moment, but rather contains a certain degree of lag. This lag mainly stems from the following aspects:

[0004] 1. Hardware delay: Current sensors (such as Hall sensors or shunts) and their signal conditioning circuits have inherent response times;

[0005] 2. Filtering delay: In order to filter out the high-frequency noise introduced by the PWM switching action, a low-pass filter is usually added to the hardware circuit or software algorithm. This inevitably introduces phase lag while filtering out noise.

[0006] 3. Handling delays: The analog-to-digital conversion (ADC) process and the MCU's reading and calculation of data require clock cycles.

[0007] The aforementioned delay factors cause deviations in amplitude and phase between the sampled current vector and the actual current vector. Especially at high motor speeds or high carrier frequencies, this phase lag significantly reduces the phase margin of the current loop, leading to slower system dynamic response and even increased torque ripple and control system instability. Existing solutions typically employ simple software prediction or hardware advance compensation, but these often struggle to balance filtering effectiveness with accurate phase compensation.

[0008] Therefore, designing a current sampling scheme that can accurately filter out switching frequency harmonics, effectively compensate for sampling delay, and has appropriate computational overhead is a technical problem that urgently needs to be solved in the field of motor control. Summary of the Invention

[0009] The present invention aims to provide a method for sampling three-phase current of a motor, comprising: calculating a feasible sampling window for the current control cycle based on PWM modulation information and sampling link timing constraints, and generating a sampling plan containing N sampling moments within the feasible sampling window based on preset principles; performing multi-point sampling according to the sampling plan, and transforming the acquired sampling values ​​to a synchronous rotating coordinate system to obtain N sets of dq-axis sample sequences; performing weighted fusion of the N sets of dq-axis sample sequences in the synchronous rotating coordinate system to obtain the dq-axis current estimate for the current cycle; constructing a timing feature set based on the dq-axis current estimates of historical cycles, and mapping the timing feature set to a multi-dimensional input tensor; inputting the multi-dimensional input tensor into a pre-trained deep learning prediction network to output the current prediction value and prediction confidence for the next cycle; and performing dynamic weighted fusion of the dq-axis current estimate and the current prediction value based on the prediction confidence to obtain the final current for current loop control.

[0010] Preferably, the above calculation of the feasible sampling window for the current control cycle includes: obtaining the sector number, effective vector duration, carrier phase, duty cycle, and dead-time parameters of the current cycle; determining the minimum window width that satisfies the current stable establishment condition by combining the operational amplifier setup time, ADC sampling and holding time, trigger delay, and safety margin of the sampling link; eliminating the dead-time influence region and the switching transient interference region within the PWM carrier cycle to obtain the above feasible sampling window; the above preset principle includes at least one of the following: all sampling times fall within the feasible sampling window, the electrical angle error sensitivity corresponding to the sampling time is minimized, or the window quality index corresponding to the sampling time is maximized.

[0011] Preferably, the weighted fusion of the above N groups of dq-axis sample sequences in a synchronously rotating coordinate system includes: calculating the corresponding fusion weight for each group of samples in the above N groups of dq-axis sample sequences; the generation of the above fusion weight is based on: sample variance, inter-sample differential energy, sampling window quality index, or suppression target for a specific switching frequency and its sidebands; the above N groups of dq-axis sample sequences are weighted and summed according to the above fusion weight, and the sum of all fusion weights is 1.

[0012] Preferably, the above-mentioned mapping of the time-series feature set into a multi-dimensional input tensor includes: selecting the dq-axis current estimates, first-order differences, second-order differences, noise level estimates, and the sector number, duty cycle, bus voltage, and electric angular velocity of the current period as feature dimensions; using a feature-time grayscale matrix mapping method, arranging each feature dimension on the time axis to construct a two-dimensional matrix; or using a grouped multi-channel image mapping method, dividing the features into a current base group, a difference group, a quality group, and a modulation group, constructing matrices for each group, and superimposing them to form a multi-channel tensor; normalizing the current-type features in the above-mentioned multi-dimensional input tensor, and embedding the sector number using one-hot encoding or numerical encoding.

[0013] Preferably, the deep learning prediction network includes a feature extraction subnetwork, a temporal aggregation subnetwork, and a multi-head output layer; the feature extraction subnetwork is used to extract local morphological features from the multidimensional input tensor; the temporal aggregation subnetwork is used to capture the long-term dependence of current changes; the multi-head output layer outputs at least the predicted current value and the prediction confidence; the prediction confidence characterizes the network's uncertainty estimate of the current prediction result and is used to determine the weight coefficients during fusion.

[0014] Preferably, the method further includes a fallback protection step: parallel computation of linear prediction values ​​based on traditional second-order difference; when the prediction confidence of the deep learning prediction network output is lower than a preset threshold, or the prediction residual exceeds the safe range, or the network outputs an abnormal flag, the linear prediction value is used to replace the current prediction value, or the weight of the linear prediction value in the fusion is increased.

[0015] Preferably, the method further includes an online self-calibration step for the sampling link: when the zero vector duration is detected to meet a preset length, or when the dq axis reference current is close to zero and in a steady state, current samples are collected to estimate the bias error of the sampling link; under preset stable operating conditions, the gain error of the sampling link is estimated by injecting a reference signal or comparing it with a theoretical model; and the estimated bias error and gain error are used to compensate subsequent sampling values ​​online.

[0016] This invention also provides a three-phase current sampling system for a motor, comprising: a sampling plan generation module 101, used to calculate a feasible sampling window based on PWM modulation information and sampling link timing constraints, and generate a sampling plan containing N sampling times; a multi-point sampling and transformation module 102, used to perform multi-point sampling and transform the sampled values ​​to a synchronous rotating coordinate system to obtain N sets of dq-axis sample sequences; a weighted fusion module 103, used to perform weighted fusion of the sample sequences in a synchronous rotating coordinate system to obtain dq-axis current estimates; a feature construction and imaging module 104, used to construct a time-series feature set and map it to a multi-dimensional input tensor; a deep learning prediction module 105, used to output the current prediction value and prediction confidence of the next cycle through a deep learning prediction network; and a fusion control module 106, used to fuse and generate the final current based on the prediction confidence.

[0017] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.

[0018] The present invention also provides an electronic device, including a memory 202 and a processor 201, wherein the memory 202 stores a computer program, and the processor 201 executes the computer program to implement the above-described method.

[0019] The technical solution provided by this invention has the following beneficial effects:

[0020] 1. Significantly improved sampling availability and consistency across all operating conditions: Through the mechanism of "feasible sampling window set + timing constraints + sampling plan generation", the sampling time avoids the unsampled area and the current not established area, reducing the risk of sampling distortion and jitter caused by low modulation ratio, sector boundary, dead zone and establishment time.

[0021] 2. Stronger and more controllable suppression of target noise frequency bands: Weights are generated based on noise estimation or sampling quality information and weighted fusion is performed in a synchronous rotating coordinate system (dq). This enables targeted suppression of specific frequency bands such as switching noise. Compared with simple arithmetic average, it has stronger controllability and can exclude inferior samples by combining anomaly markers.

[0022] 3. Significantly improved accuracy and robustness of delay compensation: By combining “differential feature construction + imaging mapping + deep learning prediction + confidence output + fusion / back-off control”, the powerful nonlinear fitting capability of deep neural networks is utilized to enable prediction compensation to be more than limited to one-step linear extrapolation, and to maintain more stable and accurate compensation output under peak, strong disturbance and high noise conditions.

[0023] 4. Enhanced long-term stability: By estimating and compensating for the sampling link bias and gain through the online self-calibration module, long-term drift caused by temperature drift, device aging, etc., can be reduced, thus improving long-term consistency. Attached Figure Description

[0024] Figure 1 This is a schematic diagram of the overall architecture of the three-phase current sampling system for motors provided in an embodiment of the present invention.

[0025] Figure 2 A flowchart of a three-phase current sampling method for a motor provided in an embodiment of the present invention.

[0026] Figure 3 This is a schematic diagram illustrating the PWM timing, dead-time effects, and feasible sampling window calculation in an embodiment of the present invention.

[0027] Figure 4 This is a schematic diagram of the structure of the feature imaging and deep learning prediction network in an embodiment of the present invention.

[0028] Figure 5 This is a logical block diagram of the fusion of deep learning prediction and traditional prediction and the backoff strategy in an embodiment of the present invention.

[0029] Figure 6 This is a state transition diagram for online self-calibration of the sampling link in an embodiment of the present invention.

[0030] Figure 7 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention.

[0031] Figure 8 This is a schematic diagram of the actual current harmonic distribution and sampling principle in the three-phase current sampling method for motors provided in this embodiment of the invention. Detailed Implementation

[0032] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0033] Example 1: Three-phase current sampling method for motors

[0034] This embodiment provides a method for sampling three-phase current of a motor, which can be run in a control unit composed of a digital signal processor (DSP), a microcontroller (MCU), a field-programmable gate array (FPGA), or a combination thereof. Figure 2 As shown, the method includes the following steps:

[0035] Step S101: Adaptive sampling window calculation and sampling plan generation

[0036] like Figure 3 As shown, at the beginning of each PWM control cycle (denoted as the kth cycle), the controller first obtains the current PWM modulation information and the timing constraint parameters of the sampling link.

[0037] The PWM modulation information includes, but is not limited to: the sector number of space vector pulse width modulation (SVPWM), the effective vector duration of the current period, and so on. T 1 , T 2 ), zero vector duration ( T 0 ), carrier phase, duty cycle and dead time parameters ( T dt This information is typically provided by the output of the current loop controller and the SVPWM generation module.

[0038] The timing constraint parameters of the sampling link are predetermined or set based on hardware characteristics, and include at least:

[0039] ADC sample hold time ( T s / h The shortest time required for the internal capacitor of an ADC to fully charge is typically tens to hundreds of nanoseconds, depending on the number of bits and impedance of the ADC. Figure 8 As shown.

[0040] Op-amp setup time ( T op The time required for the output of the signal conditioning circuit to stabilize within the error band after a step change in the input may be limited by the bandwidth of the isolation operational amplifier for high-voltage, high-power systems.

[0041] Sampling trigger delay ( T trig ): The hardware delay from the issuance of the trigger signal to the actual start of the ADC conversion;

[0042] Safety margin ( T g ): A time margin reserved to deal with clock jitter and parameter drift.

[0043] Based on the above information, the controller calculates the set of feasible sampling windows W(k) for the current period. A feasible sampling window must satisfy the following condition:

[0044] 1. Window width ;

[0045] 2. The window must be located within the range where the current can be stably established, i.e., avoiding the ringing area after the power switch operates;

[0046] 3. The window should avoid areas where the dead zone has a significant impact. For example, during the dead zone, the actual voltage vector may not match the command vector, leading to an abnormal rate of change of current. In this case, sampling will introduce a large error.

[0047] Specifically, the controller, based on the current duty cycle and sector number, during the PWM carrier cycle ( T pwm Plan all possible switching times within the specified timeframe. t sw ) and subsequent stabilization time ( T settle The time period is defined as follows. For example, if the current phase is in the first sector of SVPWM and the conduction time of the upper arm of phase A is short (small duty cycle), the sampling window of phase A current at the top of the carrier wave may be compressed or even disappear. In this case, the controller will search for other positions in the carrier cycle, such as the bottom or middle of the carrier wave, to find the time period that satisfies the conditions. W width The required range.

[0048] After determining the feasible sampling window set W(k), the controller generates a sampling plan containing N sampling times. Where N≥3. The selection of sampling time follows one or a combination of the following preset principles:

[0049] Principle A (Feasibility First): Ensure all t n All fall within W(k).

[0050] Principle B (Minimum Error Sensitivity): Select a sampling time that minimizes the sensitivity of the current value at that moment to rotor position error or sampling time error. For example, select a flat region with a small rate of change of current, or the point where the derivative of the position angle θ is minimized in the dq coordinate system.

[0051] Principle C (Maximizing Quality Indicators): Based on Window Quality Indicators Q w Select sampling points. Q w This can be defined as the time distance between the sampling point and the nearest switching edge; the greater the distance, the more... Q w The higher the value, the less affected by switching noise, and an evaluation function can be constructed. To find the best option.

[0052] Step S102: Multi-point sampling and coordinate transformation

[0053] Based on the generated sampling plan Plan(k), the current sampling module triggers the ADC at time... t 1 , ..., t N Sampling is performed. If the hardware uses a three-resistor shunt sampling method, the three-phase current is directly obtained. i a , i b , i cIf the hardware uses dual-resistor sampling, it acquires the two-phase current and applies Kirchhoff's laws. i a + i b + i c = 0 Reconstruct the third-phase current. If the hardware uses single-resistor sampling, the phase current needs to be reconstructed based on the current switch state and the bus current. In the single-resistor scheme, the sampling time must be strictly aligned to a specific effective vector interval.

[0054] For each set of three-phase sampled values ​​acquired The controller immediately executes the Clark and Park transformations, projecting them onto a synchronously rotating coordinate system to obtain N sets of dq-axis sample sequences. In this process, the electrical angle θ used in the Park transform can be the predicted angle of the current control cycle, or it can be the angle corresponding to the sampling time t. n The interpolation angle is adjusted to further improve accuracy.

[0055] Steps S103 & S104: Weighted fusion of dq domains

[0056] In a synchronously rotating coordinate system, the controller performs weighted fusion on these N sets of dq-axis sample sequences to obtain the estimated dq-axis current value for the current period. The calculation formula is as follows:

[0057]

[0058]

[0059] Among them, weight w n Satisfy normalization conditions .

[0060] Weight w n The generation mechanism is one of the core elements of this invention, aiming to achieve controllable suppression of target frequency band noise. The weight generation is based on:

[0061] 1. Noise level estimation: Calculate the variance of N samples. The larger the variance, the lower the signal-to-noise ratio of the sample, and its weight should be reduced.

[0062] 2. Sampling window quality: Directly use the quality index calculated in step S101. The higher the quality of the window, the greater the weight of the sampled value.

[0063] 3. Target bandwidth suppression: based on PWM switching frequencyf sw And its sidebands, construct the objective function, so that the frequency response after weighted fusion is in f sw These features include poles or high attenuation characteristics. For example, a set of weight vectors can be solved offline and then retrieved online, similar to the coefficient design of an FIR filter.

[0064] 4. Outlier Removal: If a sample value deviates from the mean by more than a preset threshold (e.g., 3 times the standard deviation), it is identified as an outlier (possibly caused by ADC glitches or EMC interference), and its weight is adjusted accordingly. w n Force the weights to zero and renormalize the remaining weights.

[0065] Step S106: Feature Imaging and Deep Learning Prediction

[0066] To compensate for the one-beat delay of digital control systems and address the failure problem of traditional linear prediction under nonlinear conditions, this invention introduces a prediction mechanism of "feature imaging + deep learning," such as... Figure 5 As shown.

[0067] Sub-step S106-1: Constructing a timing feature set. The controller maintains a historical data buffer queue of length W (e.g., W=8 or 16). The feature set includes not only the current itself but also physical quantities strongly correlated with current changes. Specific features include:

[0068] Basic quantity: Estimated dq-axis current over W historical periods ;

[0069] Difference components: First-order difference and second-order difference It is used to reflect the changing trend of current and acceleration;

[0070] Control variables: duty cycle D (km) and sector number (km) from the historical period. The duty cycle directly determines the duration of the voltage vector, which in turn determines the rise / fall slope of the current; the sector number determines the direction of the voltage vector. By using these control variables as inputs, the network can learn a causal model of "control action -> current response," rather than simply extrapolating from the time series.

[0071] State quantity: Bus voltage and electric angular velocity Bus voltage fluctuations directly affect the current slope; rotational speed determines the magnitude of the back electromotive force, which in turn affects the dynamic response of the current.

[0072] Quality characteristics: Noise level estimate (Noise(km)) is used to inform the network of the reliability of the current data.

[0073] Sub-step S106-2: Feature Mapping to a Multidimensional Input Tensor. To adapt to the input requirements of deep learning networks (especially convolutional neural networks CNN), the above one-dimensional feature sequence needs to be mapped to a two-dimensional matrix or a multidimensional tensor. Mapping Method A (Feature × Time Gray Matrix): Construct a matrix with dimension... A two-dimensional matrix M, where F is the total number of features and W is the length of the time window. Each row of the matrix corresponds to the expansion of one feature along the time axis. For example, the first row is... I d The historical sequence, the second line is I q The historical sequence, line 3 is V dc Historical sequence, etc. Normalization: To accelerate network convergence, physical quantities such as current and voltage are normalized so that their values ​​are distributed between [-1, 1] or [0, 1]. For example, the current is divided by the maximum rated current. I max Voltage divided by rated bus voltage Encoding process: For discrete category features such as sector number (1-6), one-hot encoding or embedding vector representation is used to expand the feature dimension.

[0074] Sub-step S106-3: Deep learning prediction network inference inputs the constructed multi-dimensional input tensor into the pre-trained deep learning prediction network. For example... Figure 4 As shown, the network structure includes:

[0075] (1) Feature extraction sub-network: One-dimensional convolutional layers (Conv1D) or two-dimensional convolutional layers (Conv2D) are used to extract local temporal morphological features (such as the rapid rising edge of the current and oscillation mode). The kernel size can be set to 3 or 5, and an odd number of kernels is generally used.

[0076] (2) Temporal aggregation sub-network: Long Short-Term Memory (LSTM), Gated Recurrent Unit (GRU), or Temporal Convolutional Network (TCN) are used. The role of this layer is to capture the long-term dependence of current changes, such as the effect of load periodic fluctuations on the current.

[0077] (3) Attention mechanism layer: assign different weights to features at different time steps, so that the network pays more attention to information in the near future or at specific key moments (such as sector switching points).

[0078] (4) Multi-Head Output: The fully connected layer (Dense) is divided into two branches.

[0079] Branch 1: Output the predicted current value for the next cycle (k+1). .

[0080] Branch 2: Output prediction confidence . It is a scalar between 0 and 1, representing the network's "confidence" in the current prediction. During training, the confidence branch can be supervised by the magnitude of the prediction error, or the variance output of the Bayesian neural network can be used to represent uncertainty.

[0081] Sub-step S106-4: The dynamic weighted fusion controller calculates the prediction confidence level. Calculate the fusion coefficient .

[0082]

[0083] in It is a monotonically increasing function. When the confidence level is high, When the confidence level is close to 1, the final output relies more on the deep learning prediction; when the confidence level is low (e.g., encountering unseen extreme conditions), When the value approaches zero, the system reverts to the conventional method or the current measurement. The final current used for current loop control... The calculation is as follows:

[0084]

[0085] Alternatively, compared to traditional second-order linear predictions To merge:

[0086]

[0087] Step S107: Online self-calibration of the sampling link

[0088] like Figure 6 As shown, to eliminate hardware errors, the system runs an online self-calibrating state machine in the background. Offset Calibration: This occurs when the motor is detected to be stopped, or when the SVPWM outputs a zero vector for a sufficiently long duration. Theoretically, the phase current should be zero (or remain at its original value). The current value acquired at this time is the bias error. The controller performs low-pass filtering on the multiple acquired bias values ​​and updates the bias register. Gain Calibration: Under specific stable operating conditions (such as constant speed and constant load), the controller injects a small, known-amplitude high-frequency probe signal (d-axis injection). By comparing the response amplitude of the probe signal with the amplitude calculated by the theoretical model, the gain error of the sampling link is estimated. The calibrated current value is:

[0089]

[0090] This step ensures that the data input to the deep learning network is calibrated and of high quality, further improving prediction accuracy.

[0091] Example 2: Three-phase current sampling system for motors

[0092] This embodiment provides a three-phase current sampling system for a motor, which can be integrated into the main control chip of the motor controller. For example... Figure 1 As shown, the system includes:

[0093] 1. Sampling plan generation module 101: Responsible for executing step S101. It receives the timer count value and the comparison register value from the PWM module and calculates the feasible window in real time.

[0094] 2. Multi-point sampling and transformation module 102: Responsible for executing step S102. It contains ADC interface logic and coordinate transformation accelerator (such as CORDIC unit) for quickly completing sampling and dq transformation.

[0095] 3. Weighted fusion module 103: Responsible for executing steps S103 and S104. It contains a multiply-accumulate array for parallel calculation of the weighted average.

[0096] 4. Feature Construction and Imaging Module 104: Responsible for executing steps S106-1 and S106-2. It contains a circular buffer for storing historical data and has DMA (Direct Memory Access) functionality to efficiently construct the input tensor.

[0097] 5. Deep Learning Prediction Module 105: Responsible for executing steps S106-3. It is an embedded neural network accelerator (NPU) or optimized DSP software library used to perform matrix multiplication and activation function operations.

[0098] 6. Fusion Control Module 106: Responsible for executing step S106-4. Outputs the final control current based on the confidence level.

[0099] 7. Online self-calibration module 107: Responsible for executing step S107. Monitors system status and automatically triggers the calibration process.

[0100] Example 3: Electronic Equipment

[0101] This embodiment provides an electronic device, such as... Figure 7 As shown, the device includes a processor 201 and a memory 202. The processor 201 can be a general-purpose microprocessor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices. The memory (202) can be a read-only memory (ROM), random access memory (RAM), flash memory, or a combination thereof. The memory (202) stores a computer program, and when the processor 201 executes the computer program, it implements the three-phase current sampling method for motors described in Embodiment 1. Specifically, this electronic device can be a frequency converter, a servo driver, an electric vehicle motor controller (MCU), an air conditioning compressor controller, etc.

[0102] Example 4: Computer-readable storage medium

[0103] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, it implements the method described in Embodiment 1 above. The storage medium includes, but is not limited to, USB flash drives, portable hard drives, optical discs, and magnetic disks.

[0104] In summary, this invention solves the sampling challenges under dead zones and narrow pulses through adaptive sampling window planning, achieves hysteresis-free noise suppression through dq-domain weighted fusion, and significantly improves the dynamic performance and robustness of current sampling through a deep learning prediction and confidence fusion mechanism. Meanwhile, the online self-calibration mechanism ensures the long-term accuracy of the system. This solution completely addresses the pain points of existing technologies—"difficult sampling, slow filtering, and inaccurate prediction"—and has extremely high engineering application value.

[0105] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for sampling three-phase current of a motor, characterized in that, include: Based on the PWM modulation information and sampling link timing constraints, calculate the feasible sampling window for the current control cycle, and generate a sampling plan containing N sampling times within the feasible sampling window based on preset principles. Multi-point sampling is performed according to the sampling plan, and the obtained sampled values ​​are transformed to a synchronously rotating coordinate system to obtain N sets of dq axis sample sequences; The N sets of dq-axis sample sequences are weighted and fused in a synchronous rotating coordinate system to obtain the estimated value of the dq-axis current in the current period; A time-series feature set is constructed based on the dq-axis current estimates of historical periods, and the time-series feature set is mapped to a multi-dimensional input tensor; The multidimensional input tensor is input into a pre-trained deep learning prediction network, which outputs the current prediction value and prediction confidence for the next cycle. Based on the prediction confidence level, the estimated dq-axis current value and the predicted current value are dynamically weighted and fused to obtain the final current used for current loop control.

2. The method according to claim 1, characterized in that, The calculation of the feasible sampling window for the current control cycle includes: Obtain the sector number, effective vector duration, carrier phase, duty cycle, and dead zone parameters for the current period; By combining the operational amplifier setup time of the sampling link, the ADC sampling and holding time, the trigger delay, and the safety margin, the minimum window width that satisfies the current stability setup condition is determined. The feasible sampling window is obtained by removing the dead zone and switching transient interference regions within the PWM carrier cycle; The preset principles include at least one of the following: all sampling times fall within a feasible sampling window, the electrical angle error sensitivity corresponding to the sampling time is minimized, or the window quality index corresponding to the sampling time is maximized.

3. The method according to claim 1, characterized in that, The weighted fusion of the N sets of dq-axis sample sequences in a synchronously rotating coordinate system includes: calculating the corresponding fusion weight for each set of samples in the N sets of dq-axis sample sequences; the fusion weight is generated based on at least one of the following: sample variance, inter-sample differential energy, sampling window quality index, and suppression target for a specific switching frequency and its sidebands; and the N sets of dq-axis sample sequences are weighted and summed according to the fusion weight, and the sum of all fusion weights is 1.

4. The method according to claim 1, characterized in that, The step of mapping the temporal feature set into a multidimensional input tensor includes: The dq-axis current estimates, first-order difference, second-order difference, noise level estimates, sector number, duty cycle, bus voltage, and electric angular velocity of the current period are selected as feature dimensions for the historical W periods. By using a feature-time grayscale matrix mapping method, each feature dimension is arranged on the time axis to construct a two-dimensional matrix; Alternatively, a grouped multi-channel image mapping method can be used, dividing the features into current-based groups, difference groups, quality groups, and modulation groups, constructing matrices for each group, and superimposing them to form a multi-channel tensor. The current-type features in the multidimensional input tensor are normalized, and the sector numbers are embedded using one-hot encoding or numerical encoding.

5. The method according to claim 1, characterized in that, The deep learning prediction network includes a feature extraction subnetwork, a temporal aggregation subnetwork, and a multi-head output layer; The feature extraction subnetwork is used to extract local morphological features from the multidimensional input tensor; The time-series aggregation subnetwork is used to capture long-term dependencies of current variations; The multi-head output layer outputs at least the predicted current value and the prediction confidence level; The prediction confidence level represents the network's estimate of the uncertainty of the current prediction result and is used to determine the weight coefficients during fusion.

6. The method according to claim 1, characterized in that, It also includes a rollback protection step: Parallel computing is based on linear predictions using traditional second-order difference methods; When the prediction confidence of the deep learning prediction network output is lower than a preset threshold, or the prediction residual exceeds the safety range, or the network outputs an abnormal flag, the linear prediction value is used to replace the current prediction value, or the weight of the linear prediction value in the fusion is increased.

7. The method according to claim 1, characterized in that, It also includes an online self-calibration step for the sampling link: When the zero vector duration is detected to meet the preset length, or when the dq axis reference current is close to zero and in a steady state, current samples are collected to estimate the bias error of the sampling link. Under preset stable operating conditions, the gain error of the sampling link is estimated by injecting a reference signal or comparing it with the theoretical model. The estimated bias error and gain error are used to compensate for subsequent sampled values ​​online.

8. A three-phase current sampling system for a motor, characterized in that, include: The sampling plan generation module (101) is used to calculate the feasible sampling window based on the PWM modulation information and the sampling link timing constraints, and generate a sampling plan containing N sampling times; The multi-point sampling and transformation module (102) is used to perform multi-point sampling and transform the sampled values ​​to a synchronous rotating coordinate system to obtain N sets of dq axis sample sequences; The weighted fusion module (103) is used to perform weighted fusion on the sample sequence in a synchronously rotating coordinate system to obtain the dq axis current estimate; The feature construction and imaging module (104) is used to construct a temporal feature set and map it into a multidimensional input tensor; A deep learning prediction module (105) is used to output the current prediction value and prediction confidence of the next cycle through a deep learning prediction network; A fusion control module (106) is used to fuse and generate the final current based on the predicted confidence level.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 7.

10. An electronic device comprising a memory (202) and a processor (201), wherein the memory (202) stores a computer program, characterized in that, When the processor (201) executes the computer program, it implements the method as described in any one of claims 1 to 7.