Permanent magnet temperature estimation method and device based on improved particle swarm algorithm

By improving the particle swarm optimization algorithm to construct a nonlinear physical model and introducing a sinusoidal correction factor for rotational speed fluctuations and an optimizable exponential iron loss temperature rise term, combined with a λ-weighted dual-factor dynamic weight and a multi-parameter coupling compensation mechanism, the problem of insufficient accuracy and robustness in permanent magnet temperature estimation is solved, and high-precision and robust temperature estimation is achieved.

CN122242290APending Publication Date: 2026-06-19ZHONGKE TIMES (SHENZHEN) COMPUTER SYST CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHONGKE TIMES (SHENZHEN) COMPUTER SYST CO LTD
Filing Date
2026-05-20
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing permanent magnet temperature estimation technology has low accuracy and poor robustness under various operating conditions. It cannot effectively cope with the nonlinear loss characteristics caused by changes in speed and load. Furthermore, it relies on sensors or offline experimental calibration, making it difficult to adapt to different motor specifications and noise interference.

Method used

An improved particle swarm optimization algorithm is adopted. By constructing a nonlinear physical model and introducing a sinusoidal correction factor for rotational speed fluctuation and an optimizable exponential iron loss temperature rise term, combined with a λ-weighted dual-factor dynamic weight and a multi-parameter coupling compensation mechanism, the core parameters are optimized to achieve high-precision estimation of permanent magnet temperature.

Benefits of technology

Without requiring dedicated sensors or offline experimental calibration, it significantly improves the accuracy and robustness of permanent magnet temperature estimation, adapts to temperature estimation under wide speed ranges and multiple operating conditions, reduces data acquisition costs, and enhances the model's generalization ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122242290A_ABST
    Figure CN122242290A_ABST
Patent Text Reader

Abstract

This disclosure relates to the field of permanent magnet motor technology, and provides a method, device, electronic device, and computer-readable storage medium for estimating the temperature of a permanent magnet based on an improved particle swarm optimization algorithm. The method includes: acquiring a pre-constructed nonlinear physical model, which describes the relationship between the temperature of the permanent magnet and operating parameters and core parameters. The nonlinear physical model is constructed by embedding a sinusoidal correction factor for speed fluctuation as a product factor into an optimizable exponential iron loss temperature rise term based on a traditional linear model; acquiring the optimal core parameters obtained by co-optimizing the core parameters in the nonlinear physical model using an improved particle swarm optimization algorithm, wherein the improved particle swarm optimization algorithm integrates a λ-weighted dual-factor dynamic weighting mechanism and a multi-parameter coupling compensation mechanism; and substituting the real-time acquired operating parameters and the optimal core parameters into the nonlinear physical model for calculation to obtain the estimated temperature of the permanent magnet.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of permanent magnet motor technology, and in particular to a method and apparatus for estimating the temperature of permanent magnets based on an improved particle swarm optimization algorithm. Background Technology

[0002] The temperature of permanent magnets is a key parameter affecting the operational safety and performance of permanent magnet motors. Existing permanent magnet temperature estimation techniques mainly include equivalent thermal network models, data-driven models, and traditional intelligent optimization algorithms.

[0003] The scheme based on the equivalent thermal network model treats the motor components as an equivalent thermal resistance and thermal capacity network, and calculates the permanent magnet temperature through the thermal balance equation. However, its thermal network parameters mostly rely on empirical values ​​or offline experimental calibration, making it difficult to adapt to the nonlinear loss characteristics under different speeds and loads; it does not consider the coupling relationship between parameters such as air gap temperature difference, environmental compensation coefficient, and zero drift deviation, resulting in a significant increase in estimation error under wide speed conditions; and it lacks targeted suppression measures for zero drift interference, leading to serious accumulation of long-term operational deviations.

[0004] Data-driven solutions construct mapping models by collecting a large amount of operating condition and measured temperature data. However, they rely on massive amounts of labeled measured data, resulting in high acquisition costs, poor model generalization ability, and the need for retraining after changing motor specifications. The models are black-box structures, unable to explain the correlation between temperature and operating parameters, which is not conducive to error tracing. They are also sensitive to noise in the measured data and prone to overfitting.

[0005] The parameter identification scheme based on traditional intelligent optimization algorithms is used to optimize key parameters of thermal networks. It adopts general strategies such as fixed or linearly decreasing inertial weights, which are not tied to the pain points of permanent magnet motor engineering; when optimizing multiple parameters, it does not consider the coupling interference between parameters, which easily leads to the problem of mutual cancellation of parameter optimization, causing the algorithm to converge to a local optimum; it lacks a noise-resistant smoothing mechanism, the population diversity decays rapidly, and it is difficult to balance optimization accuracy and stability.

[0006] Improving the accuracy of permanent magnet temperature estimation and its anti-interference capability under multiple operating conditions is a technical problem that urgently needs to be solved. Summary of the Invention

[0007] In view of this, the present disclosure provides a method, apparatus, electronic device and computer-readable storage medium for estimating the temperature of permanent magnets based on an improved particle swarm optimization algorithm, in order to solve the technical problems of low accuracy and poor robustness in the prior art for estimating the temperature of permanent magnets.

[0008] A first aspect of this disclosure provides a method for estimating the temperature of a permanent magnet based on an improved particle swarm optimization algorithm. The method includes: acquiring a pre-constructed nonlinear physical model, which describes the relationship between the temperature of the permanent magnet and operating parameters and core parameters. The nonlinear physical model is constructed by embedding a sinusoidal correction factor for rotational speed fluctuation as a product factor into an optimizable exponential iron loss temperature rise term based on a traditional linear model; acquiring the optimal core parameters obtained in advance by co-optimizing the core parameters in the nonlinear physical model using an improved particle swarm optimization algorithm, wherein the improved particle swarm optimization algorithm integrates a λ-weighted dual-factor dynamic weighting mechanism and a multi-parameter coupling compensation mechanism; and substituting the real-time acquired operating parameters and the optimal core parameters into the nonlinear physical model for calculation to obtain the estimated temperature of the permanent magnet.

[0009] A second aspect of this disclosure provides a permanent magnet temperature estimation device based on an improved particle swarm optimization algorithm. The device includes: a model acquisition module for acquiring a pre-constructed nonlinear physical model, which describes the relationship between the permanent magnet temperature and operating parameters and core parameters. The nonlinear physical model is constructed by embedding a sinusoidal correction factor for rotational speed fluctuation as a product factor into an optimizable exponential iron loss temperature rise term based on a traditional linear model; a parameter acquisition module for acquiring the optimal core parameters obtained by co-optimizing the core parameters in the nonlinear physical model using an improved particle swarm optimization algorithm, wherein the improved particle swarm optimization algorithm integrates a λ-weighted dual-factor dynamic weighting mechanism and a multi-parameter coupling compensation mechanism; and a calculation module for substituting the real-time acquired operating parameters and the optimal core parameters into the nonlinear physical model for calculation to obtain the estimated temperature of the permanent magnet.

[0010] A third aspect of this disclosure provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.

[0011] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.

[0012] The beneficial effects of this disclosure embodiment compared with the prior art are as follows: The technical solution of this disclosure embodiment constructs a nonlinear physical model that embeds a sinusoidal correction factor for rotational speed fluctuation into an optimizable exponential form iron loss temperature rise term, accurately matching the nonlinear variation law of iron loss under different rotational speeds and loads. By integrating an improved particle swarm optimization algorithm that combines λ-weighted dual-factor dynamic weights with a multi-parameter coupled compensation mechanism, the core parameters in the nonlinear physical model, such as air gap temperature difference, environmental compensation coefficient, and zero drift deviation, are optimized collaboratively for optimization. Thus, without relying on dedicated sensors or offline experimental calibration, the accuracy of permanent magnet temperature estimation and the robustness of the algorithm under wide rotational speeds and multiple operating conditions can be significantly improved. Attached Figure Description

[0013] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0014] Figure 1 This is a flowchart illustrating the permanent magnet temperature estimation method based on the improved particle swarm optimization algorithm provided in this embodiment of the disclosure. Figure 2 This is a system overall flowchart of the permanent magnet temperature estimation method based on the improved particle swarm optimization algorithm provided in the embodiments of this disclosure; Figure 3 This is a flowchart of the improved physical model for estimating the temperature of a permanent magnet provided in an embodiment of this disclosure; Figure 4 This is a flowchart of the improved particle swarm optimization algorithm provided in the embodiments of this disclosure; Figure 5 This is a schematic diagram of the convergence curve of the improved particle swarm optimization algorithm provided in the embodiments of this disclosure; Figure 6 This is a schematic diagram of the prediction error distribution according to an embodiment of the present disclosure; Figure 7 This is a schematic diagram comparing the model performance indicators provided in the embodiments of this disclosure; Figure 8 This is a schematic diagram of the GUI functionality of an embodiment of this disclosure; Figure 9 This is a schematic diagram of the permanent magnet temperature estimation device based on the improved particle swarm optimization algorithm provided in this embodiment of the present disclosure; Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0015] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, so as to provide a thorough understanding of the embodiments of this disclosure. However, those skilled in the art will understand that this disclosure may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this disclosure with unnecessary detail.

[0016] The following will describe in detail, with reference to the accompanying drawings, a permanent magnet temperature estimation scheme based on an improved particle swarm optimization algorithm according to an embodiment of the present disclosure.

[0017] Figure 1 This is a flowchart illustrating a permanent magnet temperature estimation method based on an improved particle swarm optimization algorithm provided in this disclosure. Figure 1 As shown, the permanent magnet temperature estimation method based on the improved particle swarm optimization algorithm in this disclosure includes: Step S101: Obtain the pre-constructed nonlinear physical model. This model describes the relationship between the permanent magnet temperature and operating parameters and core parameters. It is constructed by embedding a sinusoidal correction factor for rotational speed fluctuation as a product factor into an optimizable exponential iron loss temperature rise term based on a traditional linear model. Specifically, ΔT can be used as the product factor. fe =k fe n rpm α B β (1+0.1sin(0.01n rpm )) is the iron loss temperature rise term, with (1+0.1sin(0.01n) rpm )) is the speed fluctuation correction factor, which can accurately match the nonlinear variation law of iron loss under different speeds and loads, and solve the problem of large estimation deviation of loss and temperature rise at high speeds. Where, n rpm k is the motor speed. fe α is the iron loss coefficient, which is the thermal conductivity from iron loss to permanent magnet; B is the stator magnetic flux density, or magnetic flux density for short; α and β are exponential coefficients, which are the exponential effects of rotational speed on iron loss and magnetic flux density on iron loss, respectively.

[0018] The core parameters in the nonlinear physical model include ΔTgap, kamb, bias, α, and β. These parameters are strongly coupled and their consideration can improve the model's accuracy. ΔTgap is the fixed temperature difference in the air gap, i.e., the thermal resistance temperature difference between the permanent magnet and the casing; kamb is the ambient temperature compensation coefficient, used to linearly compensate for the effect of ambient temperature deviations from 25℃; and bias is the system bias correction term, used to correct the model's inherent errors.

[0019] In addition, the input parameters on the engineering pages such as ambient temperature, shell temperature, rotational speed, magnetic flux density and iron loss coefficient are all easily measurable parameters in engineering, without relying on dedicated sensors or offline experimental calibration. They can be adapted to different models of permanent magnet motors, solving the problem of weak generalization ability of traditional models.

[0020] Step S102: Obtain the optimal core parameters obtained by co-optimizing the core parameters in the nonlinear physical model through an improved particle swarm optimization algorithm. The improved particle swarm optimization algorithm integrates a λ-weighted dual-factor dynamic weighting mechanism and a multi-parameter coupling compensation mechanism.

[0021] Step S103: Substitute the real-time collected operating parameters and optimal core parameters into the nonlinear physical model for calculation to obtain the estimated temperature of the permanent magnet.

[0022] The technical solution of this disclosure, based on the traditional linear model for estimating the temperature of permanent magnets inside a motor, introduces a nonlinear physical model with sinusoidal correction for speed fluctuations and an optimizable exponential iron loss temperature rise term. It then employs IPSO (Improved Particle Swarm Optimization) to collaboratively optimize the core parameters (ΔTgap, kamba, bias, α, β) of this model. The IPSO algorithm integrates λ-weighted dual-factor dynamic weights with a multi-parameter coupled compensation mechanism, thereby achieving high-precision and robust estimation of permanent magnet temperature under different operating conditions, while ensuring the algorithm's convergence speed and engineering practicality.

[0023] Furthermore, this solution achieves deep integration of application engineering through a GUI system. Combining the aforementioned nonlinear physical model and IPSO algorithm, it not only overcomes the four limitations of traditional temperature estimation models—simplicity, fixed parameters, zero drift, and susceptibility to local optima—but also achieves a technological leap in high precision, robustness, and ease of operation under complex operating conditions with multiple speeds and wide temperature ranges. This provides core support for permanent magnet demagnetization early warning and motor thermal management, and has significant engineering application value.

[0024] Specifically, this disclosure presents a visual interactive GUI system designed to overcome the shortcomings of poor convenience and limited functionality in engineering applications. Addressing the issues of outdated kernels and limited interactive functions in existing simple tools, this solution develops a visual temperature calculator GUI system that integrates parameter verification, rapid calculation, and result traceability.

[0025] This GUI system features three main functional panels: parameter input, calculation control, and result display. It supports convenient input of core parameters such as ambient temperature and casing temperature, and includes built-in parameter range validation. For example, it automatically identifies and prompts invalid inputs for ambient temperature ranges of -20℃ to 45℃ and speed ranges of 0 to 6000 rpm, lowering the operational threshold for engineers. The GUI system can display the estimated temperature and calculation time in real time, simultaneously showing the optimal parameters of the improved PSO algorithm, such as ΔTgap, kam, and bias, as well as RMSE error and optimization time. This ensures traceability and debuggability of the estimation results, solving the problem of the data-driven model being a black box and unexplainable. The GUI system integrates three core buttons: calculate, reset, and exit. It supports one-click reset of input parameters to default values, eliminating the need for manual coding during the calculation process. It can be directly used for rapid on-site estimation, improving the efficiency of project implementation.

[0026] like Figure 2 As shown, the workflow of the permanent magnet temperature estimation system according to this embodiment includes the following steps: Step S201: The program starts.

[0027] Step S202: PSO (Particle Swarm Optimization) parameter initialization.

[0028] Step S203, data loading.

[0029] Step S204: Extract key variables.

[0030] Step S205: Generate the actual permanent magnet temperature call.

[0031] Step S206: Define a custom statistical function.

[0032] Step S207: Obtain the PSO objective function.

[0033] Step S208, population diversity calculation.

[0034] Step S209: Obtain the GUI callback function.

[0035] Step S210: Improve and optimize the PSO algorithm.

[0036] Step S211: Output the optimal parameters and optimized performance.

[0037] Step S212: Estimate the temperature using the optimal parameters.

[0038] Step S213, output performance indicators.

[0039] Step S214: Launch the PSO temperature calculator GUI.

[0040] Step S215, GUI interaction.

[0041] In this embodiment, the speed fluctuation sinusoidal correction factor is used as a product factor, multiplied by the optimizable exponent α of the speed and the optimizable exponent β of the magnetic flux density, together forming the iron loss temperature rise term in the nonlinear physical model. By multiplying the speed fluctuation sinusoidal correction factor by the speed exponent and the magnetic flux density exponent, the iron loss temperature rise term can simultaneously reflect the nonlinear influence of the speed, the exponential influence of the magnetic flux density, and the periodic deviation caused by the speed fluctuation. This solves the problem of iron loss estimation distortion in traditional linear models under varying operating conditions, and particularly improves the accuracy of temperature rise estimation during high-speed motor operation and sudden speed changes.

[0042] Specifically, during the data acquisition process prior to temperature modeling, a temperature meter can be used to measure the ambient temperature T. amb and motor housing temperature T _case The rotational speed n is collected using a servo dynamometer. rpm The sampling point for the motor housing temperature is any location on the housing.

[0043] When performing temperature modeling, a permanent magnet temperature estimation model is constructed, which includes a sinusoidal correction factor for speed fluctuation and an exponential iron loss temperature rise term. Based on the traditional linear model for estimating the internal temperature of a motor, a nonlinear physical model with a sinusoidal correction factor for speed fluctuation and an optimizable exponential iron loss temperature rise term is introduced, combining the sinusoidal correction factor for speed fluctuation and the optimizable exponential iron loss temperature rise term. The specific model expression can be expressed as the following formula (1): T mag =T case +k fe n rpm α B β (1+0.1sin(0.01n rpm ))+ΔTgap+kamb (T amb 25) bias (1) Where, k fe n rpm α B β (1+0.1sin(0.01n rpm The iron loss temperature rise term is an optimizable index, T. mag To estimate the temperature of the permanent magnet, T case For measuring the temperature of the casing, T ambFor the actual ambient temperature, kamb (T amb 25) is the ambient temperature compensation item, used to quantify the effect of the actual ambient temperature deviating from the reference temperature, i.e., 25℃, on the temperature of the permanent magnet.

[0044] Compared with the traditional linear model for estimating the internal temperature of a motor as expressed by the following formula (2), a sinusoidal correction for speed fluctuation and an optimizable exponential iron loss temperature rise term are introduced.

[0045] T mag =T case +k fe n rpm B+ΔTgap+kamb (T amb 25) bias(2) In the above formula, parameter T mag The target output data is used for input data and setting coefficients or compensation terms. Specifically, the safe operating temperature range for the motor housing is 20°C to 120°C; the thermal conductivity from iron loss to the permanent magnet is 0.1 to 0.15; the typical speed range for the servo motor is 0 to 8000 RPM; the operating magnetic flux density range for the permanent magnet synchronous motor is 0.8 to 1.2 T; the thermal resistance temperature difference between the permanent magnet and the housing is 5.5°C to 12.5°C; the common value range for kamba is 0.18 to 0.32; T amb The common temperature range in industrial environments is -20°C to 45°C. Common values ​​for α are 0.4 to 0.8, and for β are 1.4 to 1.8. (1+0.1sin(0.01n)) rpm To correct for nonlinear deviations in iron loss due to speed fluctuations, where the motor speed fluctuation frequency is 0.01... n rpm The coefficient 0.01 is the optimal coefficient selected through a large number of dynamic operating condition experiments of servo motors, and it matches the actual operating characteristics. The model calculation value has the highest degree of agreement with the measured loss / temperature rise value, and the overall error is the smallest. 0.1 is the correction range. The additional iron loss fluctuation of servo motors is generally within ±10%. The amplitude of 0.1 covers the actual fluctuation range. It will not introduce new errors due to excessive correction range, nor will it fail to correct deviations due to insufficient amplitude. It compensates for nonlinear errors under variable operating conditions such as sudden changes in speed. The correction term is a nonlinear fitting, which avoids the estimation distortion of traditional linear models under variable speed conditions and reduces the estimation error of traditional linear models under variable speed conditions.

[0046] In this embodiment, the λ-weighted dual-factor dynamic weighting mechanism includes: calculating a zero-drift sensitivity factor reflecting the degree of deviation of the system deviation correction term; determining a speed range factor based on the average motor speed; dynamically allocating the weights of the zero-drift sensitivity factor and the speed range factor in the inertia weight calculation through λ coefficients, and applying random perturbations to generate dynamic inertia weights. Specifically, the λ-weighted dual-factor dynamic inertia weighting abandons the traditional fixed or linearly decreasing weight strategy and introduces a dual-drive mechanism of zero-drift sensitivity factor and speed range factor. The zero-drift sensitivity factor S_bias is processed by moving average filtering to suppress noise interference; the λ coefficient is dynamically allocated according to the speed range to achieve enhanced global exploration in the low-speed range to suppress zero drift and enhanced local development in the high-speed range to improve accuracy, thereby balancing the algorithm's convergence speed and optimization accuracy. The moving average filtering can be performed using the average of the first 5 iterations; the speed range can be divided into low speed <1000rpm, medium speed 1000-3000rpm, and high speed >3000rpm.

[0047] The above scheme abandons the traditional fixed or linearly decreasing inertial weight strategy. Through the dual-drive mechanism of zero drift sensitivity factor and speed range factor, the inertial weight can be dynamically adjusted according to the degree of zero drift deviation and motor operating conditions: the global exploration is strengthened in the low speed range to suppress zero drift, and the local development is strengthened in the high speed range to improve accuracy. At the same time, random perturbation avoids the weight from becoming fixed, effectively balancing the convergence speed and optimization accuracy of the algorithm.

[0048] In this embodiment, the multi-parameter coupling compensation mechanism includes: calculating a first coupling coefficient between the fixed air gap temperature difference and the system deviation correction term, and a second coupling coefficient between the ambient temperature compensation coefficient and the system deviation correction term; dynamically correcting the individual learning factor based on the first coupling coefficient, dynamically correcting the social learning factor based on the second coupling coefficient, and limiting the corrected individual learning factor and social learning factor to preset ranges respectively. Specifically, this scheme calculates the parameter deviation coupling coefficient for the coupling interference between ΔTgap and bias, and between kamb and bias, dynamically corrects the individual learning factor c1 and the social learning factor c2 based on the coupling strength, and limits the preset range, i.e., the correction range, to 1.5-2.5, to avoid mutual cancellation of parameter optimizations, and can solve the local optimum problem caused by the lack of consideration of coupling in traditional algorithms. For the coupling interference between air gap temperature difference, ambient compensation coefficient, and zero drift deviation, by calculating the coupling coefficient and dynamically correcting the individual learning factor and social learning factor, the algorithm can adaptively compensate for the interference of a certain parameter on other parameters when optimizing a certain parameter, avoiding the problem of mutual cancellation of parameter optimizations in traditional algorithms, effectively preventing getting trapped in local optima, and improving the accuracy of multi-parameter collaborative optimization.

[0049] In this embodiment, the improved particle swarm optimization algorithm employs a population diversity maintenance strategy: real-time monitoring of population diversity; when the number of iterations meets a preset period and the diversity is below a preset threshold, random particles are injected to replace some existing particles; and the particle velocity boundary is adaptively adjusted based on population diversity. This population diversity maintenance strategy includes dynamic monitoring of population diversity using the center distance method, triggering random particle injection when the diversity is below a preset threshold (0.1), and employing a bounce-back boundary handling strategy to collaboratively achieve high-precision co-optimization of core parameters such as ΔTgap, kamb, bias, α, and β, effectively avoiding local optima and enabling the physical model to accurately estimate the permanent magnet temperature. For example, population diversity can be calculated in real-time, and a random particle reset mechanism can be introduced in the later stages of every 20 iterations when the diversity is <0.1 to avoid population convergence; simultaneously, adaptive velocity boundary constraints are implemented based on adjusting the maximum velocity value according to the diversity, improving the algorithm's adaptability to environmental changes and load disturbances, and solving the problems of weak robustness and poor anti-interference ability of traditional algorithms.

[0050] By monitoring population diversity in real time and injecting random particles when it is too low, population convergence and premature convergence of the algorithm are effectively avoided. Combined with diversity-based adaptive velocity boundary adjustment, the algorithm's adaptability to environmental changes and load disturbances is enhanced, and the robustness and anti-interference ability of the optimization process are significantly improved.

[0051] In a complete optimization process, test data import and generation can begin, including data loading, format processing, and variable extraction. The loaded data includes the ambient temperature T. amb Casing temperature T case Rotational speed n rpm If the loaded data is in tabular format, it needs to be automatically converted into an array format that the algorithm can recognize. When extracting variables, extract three types of test parameters from the data separately and store them as independent variables.

[0052] After importing the data, it is necessary to define the optimization objective and bind it to the physical model. Identify the five uncertain parameters to be optimized: ΔTgap, kamba, bias, α, and β. Define reasonable engineering ranges for these five parameters to avoid them deviating from reality; for example, ΔTgap cannot be negative. The following is a set of upper and lower boundaries: Lower bounds (pso_lb): ΔTgap ≥ 5.5, kamb ≥ 0.18, bias ≥ -3.5, α ≥ 0.4, β ≥ 1.4 Upper bound (pso_ub): ΔTgap≤12.5, kam≤0.32, bias≤3.5, α≤0.8, β≤1.8 By substituting any set of candidate parameters into the physical model as particles, the estimated temperature is calculated. The traditional estimation model is then compared with the optimized model to demonstrate the effectiveness and accuracy of the optimized model, as well as the RMSE (Root Mean Square Error) between the estimated temperature and the actual temperature T_mag_real. RMSE is the fitness value; the smaller the value, the better the model's parameters. This allows us to find the set of parameters that best approximates the actual temperature calculated by the physical model within the limits allowed by electrical engineering principles; essentially, it's about finding the parameter combination with the smallest RMSE.

[0053] Next, the population is initialized, i.e., candidate parameters are generated. Fifty particles are generated, resulting in 50 parameter schemes. Each particle's five parameters (ΔTgap, kam, bias, α, β) are randomly generated within the lower-upper bound set in the aforementioned schemes. For example, ΔTgap is randomly selected between 5.5 and 12.5. Particle velocities are initialized by assigning each particle an initial movement speed, which controls the step size for parameter adjustments. The initial speed is set to 10% of the parameter range. For example, if the ΔTgap range is 7°C, the initial speed would be 0.7°C / iteration, avoiding parameter jumps due to excessively large step sizes or slow iterations due to excessively small step sizes. Optimal values ​​are initialized, i.e., initial best schemes are marked. The individual optimality is the initial optimal scheme for each particle itself. The global optimality is the scheme with the smallest RMSE among the 50 initial particles, which is used as the initial optimal scheme for the entire population. This process is equivalent to an engineer, based on experience, randomly providing 50 parameter schemes, selecting and marking the temporarily best one, laying the foundation for subsequent parameter adjustments.

[0054] After initializing the population, initial fitness calculations are performed. For each of the 50 initial particles, the following operations are performed: Substitute the five parameters of the current particle into the physics model to calculate the estimated temperature of the permanent magnet corresponding to that parameter; call the objective function to calculate the RMSE between the estimated temperature and the actual temperature. If the RMSE of the current particle is smaller than its previous RMSE, update the individual best to the current particle; if the RMSE of the current particle is smaller than the optimal RMSE of all particles, update the global best to the current particle.

[0055] After that, the main loop of IPSO iterative optimization is carried out, and each iteration will gradually bring the 50 sets of parameter schemes closer to the optimal scheme.

[0056] In traditional PSO, the inertia weight w is a fixed value, such as 0.7. w controls the degree to which the particle maintains its original adjustment direction: if w is too large, the particle will continuously search for parameters over a wide range; if w is too small, the particle will only adjust within a small range. The improvement of IPSO allows w to change dynamically according to the operating conditions and parameter states. Specific implementation steps include: Calculate the zero-drift sensitivity factor, which determines the degree of deviation of the bias parameter. Specifically, extract the bias value from the current global optimal parameter, for example, the current global optimal bias = 1.2; calculate the original zero-drift degree: S_bias_raw = |bias, and perform moving average filtering. For the first 5 iterations, use S_bias_raw directly. For the 6th iteration and thereafter, take the current value plus the average of the previous 4 values ​​to obtain S_bias; then perform normalization: f_Sbias = 0.5 + 0.5*tanh(S_bias / 0.2), mapping S_bias to the range of 0 to 1.

[0057] Calculate the speed range factor. Specifically, calculate the average motor speed n_avg, and set the factor according to the speed range: at low speed (n_avg<1000RPM): g_n=0.9, λ=0.7; at medium speed (1000≤n_avg≤4000RPM): g_n=0.65, λ=0.5; at high speed (n_avg>4000RPM): g_n=0.4, λ=0.3.

[0058] Calculate the dynamic inertia weight w. Specifically, perform the basic calculation: w = 0.7 (basic weight) * (λ * f_Sbias + (1-λ) * g_n), allocating the weights of the two factors through λ; perform random perturbation optimization: w_perturbed = w * (0.9 + 0.2 * rand()), to avoid w becoming fixed and causing the algorithm to get stuck in a local optimum. At low speeds and when the bias is severely deviated, w ≈ 0.6; at high speeds and when the bias is close to the standard value, w ≈ 0.2. The algorithm automatically adjusts the search range according to the motor operating conditions and parameter states, finding the correct direction at low speeds and optimizing precisely at high speeds.

[0059] In traditional PSO, the learning factor c1 references the degree of its own historical best; c2 references the degree of global best, and its value is fixed, for example, 2.0. However, the three parameters in the physical model interfere with each other. For example, if ΔTgap increases, the bias must be adjusted accordingly, otherwise the error will increase. Traditional PSO does not consider this interference, and adjusting one parameter will cause other parameters to deviate from their optimal values. The improvement of IPSO allows c1 and c2 to change dynamically according to the degree of parameter interference. The specific implementation steps include: Calculate the parameter coupling coefficients and extract the values ​​of ΔTgap, kamb, bias, α, and β from the current globally optimal parameters; calculate the ΔTgap-bias coupling coefficient: C_delta_Tgap_bias=|ΔTgap-8.5|; calculate the kamb-bias coupling coefficient: C_kamb_bias=|kamb current value-0.25|.

[0060] Coupling compensation modifies learning factors c1 and c2. Specifically, the compensation strength coefficients are set as follows: alpha_coupling = 0.3, beta_coupling = 0.3; the individual learning factor c1 is modified as follows: c1 = 2.0 * (1 + alpha_coupling * C_delta_Tgap_bias); the social learning factor c2 is modified as follows: c2 = 2.0 * (1 + beta_coupling * C_kamb_bias); the range is limited to c1 and c2 between 1.5 and 2.5.

[0061] Particle velocity and position updates. Specifically, the velocity and position of each particle are updated using the improved dynamic inertia weight w_perturbed after correcting the learning factor. The specific operations include: velocity update: velocity = w_perturbed × original velocity + c1 × random number × (individual optimal - current position) + c2 × random number × (global optimal - current position); adaptive velocity boundary constraint: adjust the maximum velocity according to the population diversity; position update: new parameter = current parameter + velocity.

[0062] Particle boundary constraints and rebound strategy. Specifically, if the updated parameters exceed the engineering boundaries set by the above scheme, the following operations are performed: position correction, pulling the parameters that exceed the boundary back to a reasonable range; velocity correction, reversing the velocity of the parameter to prevent the particle from exceeding the boundary again in the next iteration.

[0063] The fitness calculation for new parameters specifically uses the logic described above to score the adjusted new parameter scheme: substitute the new parameters into the physical model to calculate the estimated temperature; calculate RMSE; update the individual optimum and global optimum: if the new scheme has a lower score, update the individual optimum or global optimum, forming a closed loop of adjusting parameters → verifying good or bad → feedback update, ensuring that each iteration moves closer to a better scheme.

[0064] Population diversity monitoring and the introduction of random particles. Specifically, population diversity is calculated by measuring the dispersion of 50 particles; every 20 iterations, a check is performed: if the diversity is <0.1, a new set of parameter schemes is randomly generated to replace one of the existing schemes; the fitness of the new scheme is recalculated, and the individual optimum and global optimum are updated.

[0065] Iteration termination judgment. Specifically, check the current iteration count: if the maximum iteration count has been reached, terminate the iteration; if not, start the next iteration, thus balancing optimization accuracy and computational efficiency.

[0066] Output and verify the optimal parameters. Specifically, this includes: outputting the globally optimal parameters, which are the final result after the iteration terminates; substituting the optimal parameters into the physical model to calculate the estimated temperature T_mag_pso for the full set of test parameters; calculating the core performance index, RMSE; and outputting the results, for example, the following: optimal parameters are ΔTgap = 8.42℃, kam = 0.24, bias = 0.48; RMSE = 0.12℃.

[0067] In step S103, the IPSO-optimized online permanent magnet temperature calculation framework uses optimized ΔTgap, kamb, bias, α, and β as core parameters to achieve rapid estimation of permanent magnet temperature under multiple inputs such as ambient temperature, casing temperature, rotational speed, magnetic flux density, and iron loss coefficient. It is also equipped with a visualization comparison and GUI interactive calculation tool.

[0068] like Figure 3 As shown, the input parameters 310 of the calculation framework include ambient temperature, casing temperature, core parameters obtained after IPSO optimization, iron loss coefficient, motor speed, and stator flux density. The improved nonlinear physical temperature estimation model 320 performs operations such as ambient temperature compensation 321, iron loss temperature rise calculation 322, and output result 323 based on the above input parameters. Ambient temperature compensation 321 includes calculating the temperature difference and performing linear compensation. The iron loss temperature rise calculation includes multiplying the power term, flux term, and iron loss coefficient to obtain a product, and then applying a sine correction for speed fluctuation to the product to calculate the iron loss temperature rise. Based on the iron loss temperature rise, base temperature, and core parameters obtained after IPSO optimization, the superimposed air gap fixed temperature difference can be obtained. The superimposed air gap fixed temperature difference and the ambient temperature compensation term are then superimposed to obtain the superimposed environmental compensation term. Subtracting the system deviation yields the estimated permanent magnet temperature in the output result 323 step.

[0069] The permanent magnet temperature estimation method of this disclosure may further include zero drift correction, i.e., adaptively adjusting the bias term based on residual feedback to suppress zero drift. Specifically, the zero drift correction includes: performing closed-loop feedback based on the residual between the estimated temperature and the measured temperature of the permanent magnet, and adaptively adjusting the system bias correction term in the nonlinear physical model; wherein, the system bias correction term is increased when the residual is positive and decreased when it is negative, and the adjustment step size is set according to the dynamic inertia weight and individual learning factor in the improved particle swarm optimization algorithm. By adaptively adjusting the bias correction term bias through residual feedback closed-loop control, the estimation zero drift error caused by factors such as sensor drift, electromagnetic interference, and environmental temperature drift during long-term operation of the servo motor can be suppressed, ensuring the long-term stability of temperature estimation accuracy.

[0070] A closed-loop zero-drift correction mechanism based on residual feedback is introduced, enabling the system deviation correction term to adaptively adjust according to the direction of the estimation error. At the same time, the adjustment step size is linked with the dynamic inertia weight and individual learning factor of the improved particle swarm optimization algorithm, realizing the synergy between correction and optimization. This effectively suppresses long-term zero-drift errors caused by sensor drift, electromagnetic interference, etc., and ensures the long-term stability of temperature estimation.

[0071] In the code implementation, the residual can be estimated using temperature. The residual is defined as: Residual = Estimated permanent magnet temperature T_mag - Actual temperature baseline T_mag_real, where T_mag_real is generated by the `generate_real_temperature_improved` function and contains actual parameters and minor noise. Furthermore, using the residual as the core feedback, an adaptive adjustment mechanism for the bias term is established. The bias term, as the final correction term of the temperature estimation model, has the code logic T_mag = T_mag_base - bias. Its adjustment direction is opposite to the residual direction: when the residual is positive (i.e., the estimated value is too high), the bias increases; when the residual is negative (i.e., the estimated value is too low), the bias decreases. Simultaneously, during IPSO optimization, the zero-drift sensitivity factor S_bias is used to correlate the deviation between the bias and the steady-state baseline value in real time, achieving coordinated optimization and correction. During adjustment, S_bias correlates the current bias with the deviation from the steady-state baseline value in real time, dynamically adjusting the IPSO inertia weight w and learning factor c1 to achieve coordinated correction and optimization. If S_bias is too large, meaning the bias deviates significantly from the baseline value, then w is increased to enhance global exploration and quickly pull the bias back. If there is ΔTgap-bias coupling interference, then c1 is increased to enhance individual learning and specifically correct the bias. The steady-state baseline value is 0.5℃.

[0072] To avoid false triggering of corrections due to noise in a single sampling, the technical solution of this disclosure introduces a moving average filter to process the residual mean. The zero-drift sensitivity factor calculation in the design code uses the mean of the first 5 iterations for smoothing. A residual mean judgment threshold is set, preferably ±0.5℃, to match the noise level noise_level=0.02 in the adaptation code. If the residual mean of the data from 0.5s to 1s in a 100ms sampling period of the motor continuously deviates from zero and exceeds the threshold for 5 to 10 consecutive sampling cycles, the system is judged to have significant zero drift, and an adaptive update of the bias term is immediately triggered. The update logic aligns with the parameter optimization logic in the code, ensuring that the bias always converges to the steady-state reference value, thus improving the accuracy of temperature estimation.

[0073] During the adaptive bias update process, it is ensured that the bias always converges towards the steady-state baseline value, aligning with the IPSO parameter optimization logic in the code, i.e., optimizing with the goal of minimizing RMSE. When updating the step size, the IPSO dynamic inertia weight w calculated based on S_bias and the learning factor c1 calculated based on the ΔTgap-bias coupling coefficient are used in conjunction. The further the bias deviates from the baseline value, the larger the update step size is to quickly pull it back; the closer it deviates, the smaller the update step size is for precise fine-tuning. Throughout the process, the bias adjustment remains within the boundaries set in the code, i.e., within the range of -3.5℃ to 3.5℃, avoiding exceeding the reasonable engineering range.

[0074] The process, as shown in the diagram, incorporates an intelligent recognition switch for zero drift correction. First, it de-glitches the error to eliminate interference from momentary sensor jitter. Then, it sets an error tolerance threshold—not arbitrarily set, but five times the sensor noise at 0.02℃—ensuring only true errors are identified and not affected by minor jitter. Simultaneously, it sets a continuous observation time of 0.5s to 1s, so that only when the error consistently exceeds the tolerance threshold for 0.5s to 1s is it considered a true zero drift, not just occasional motor fluctuations. Once a true zero drift is confirmed, intelligent calibration is initiated, pulling the bias towards the ideal position at an adjusted speed based on the degree of deviation. The ±0.5℃ threshold and the 0.5s to 1s observation time are determined by considering sensor noise, motor sampling frequency, and engineering fluctuation characteristics, ensuring accurate and timely zero drift identification without blindly triggering corrections.

[0075] Furthermore, the zero drift correction uses a moving average filter to process the residual mean and employs a dual control threshold: when the residual mean of multiple consecutive sampling periods continuously deviates from zero and exceeds the preset residual mean judgment threshold, the adaptive update of the system deviation correction term is triggered, and the updated value is limited to a preset temperature range.

[0076] By processing the residual mean through moving average filtering, the interference of single sampling noise on the correction decision is eliminated; by setting a judgment condition for continuous multi-cycle deviations and exceeding the threshold, the correction is avoided due to accidental fluctuations of the motor; at the same time, the updated deviation is limited to the preset temperature range to prevent over-correction from causing estimation oscillation, thereby achieving accurate triggering and stable convergence of zero drift correction.

[0077] Specifically, to avoid frequent corrections in a short period that could cause oscillations in temperature estimation results, a dual control threshold can be set: first, the minimum correction interval for the bias term, recommended to be corrected at most once every 10 seconds, to match the sampling period and iteration frequency in the code and limit the correction frequency; second, the bias term adjustment range threshold, strictly limited to the range of [-3.5℃, 3.5℃], consistent with the bias range of pso_lb and pso_ub in the code, while limiting c1 and c2 to the range of 1.5~2.5 in the learning factor correction stage to avoid over-correction. Through dual threshold control, zero drift is effectively suppressed, and the stability of temperature estimation results is ensured, avoiding correction oscillations from affecting engineering applications. Taking a servo motor as an example, the parameter names and their implementation parameter ranges are: ΔTgap∈[6°C, 12°C]; kam∈[0.2, 0.3]; bias∈[-3°C, 3°C].

[0078] like Figure 4 As shown, the improved particle swarm optimization algorithm provided in this embodiment includes the following steps: Step S401: Initialize IPO parameters.

[0079] Step S401: Randomly initialize the particle swarm.

[0080] Step S401: Calculate the initial fitness.

[0081] Step S401: Initialize individual optimality and global optimality.

[0082] Step S401: Determine if the number of iterations is less than or equal to T_max. If not, proceed to step S406; if yes, proceed to step S407.

[0083] Step S406: Output the globally optimal parameters.

[0084] Step S407: Calculate the zero drift sensitivity factor.

[0085] Step S408: Calculate the speed range factor.

[0086] Step S409, λ-weighted two-factor dynamic inertia weight.

[0087] Step S410: Calculate the coupled system.

[0088] Step S411: Correct the learning factor.

[0089] Step S412: Calculate population diversity D using the center distance method.

[0090] Step S413: Determine if D is less than 0.1. If not, proceed to step S416; if yes, proceed to step S414.

[0091] Step S414: Randomly inject particles to replace the 20% of particles with the worst fitness.

[0092] Step S415: Update the pBest and fitness of the replaced particle.

[0093] Step S416, speed and position update.

[0094] Step S417: Update the speed according to the formula.

[0095] Step S418, adaptive velocity boundary limit.

[0096] Step S419, update location.

[0097] Step S420: Boundary handling with bounce-back.

[0098] Step S421: Calculate the new fitness.

[0099] Step S422: Determine if the new fitness is less than pBest. If not, proceed to step S424; if yes, proceed to step S423.

[0100] Step S423, update pBest.

[0101] Step S424: Determine if the new fitness is less than gBest. If not, proceed to step S425; if yes, proceed to step S426.

[0102] Step S425, update gBest.

[0103] Step S426, iteration count +1.

[0104] like Figure 5 In the comparison of predicted temperatures shown, the solid line represents the predicted temperature of the improved model, and the dashed line represents the predicted temperature of the basic model. It can be seen that the improved model has higher accuracy and is closer to the actual temperature than the traditional basic model, which demonstrates the effectiveness of the improved model.

[0105] like Figure 6 In the prediction error distribution shown, the frequency of prediction error of the improved model in the left-hand graph is smaller than that of the basic model in the right-hand graph, thus exhibiting a smaller prediction error and higher fitting accuracy.

[0106] like Figure 7 In the comparison of model performance metrics shown, the RMSE of the basic model is 8.5562, while that of the improved model is 0.212; the MAE of the basic model is 8.5562, while that of the improved model is 0.177. It can be seen that the improved model has a smaller prediction error value compared with the basic model.

[0107] The technical solutions of this disclosure embodiment develop a dedicated engineered GUI based on optimization results. For example... Figure 8 As shown, input the outer casing temperature and click "Calculate Temperature" to obtain the permanent magnet temperature.

[0108] The GUI interaction module serves as the human-computer interaction platform for the core algorithm, enabling input of operating parameters, visualization of temperature estimation results, anomaly verification, and information prompts, thus bridging the core algorithm with on-site engineering applications. The GUI module features a visual interface, supporting convenient input of operating parameters such as ambient temperature and shell temperature, rapid calculation of permanent magnet temperature, and real-time output of estimated permanent magnet temperature values. A permanent magnet temperature estimation model combining a sinusoidal correction factor for rotational speed fluctuations and an optimizable exponential iron loss temperature rise term is employed: Optimizable exponential parameters α and β are introduced to dynamically describe the nonlinear influence of rotational speed and magnetic flux density on iron loss temperature rise, and a sinusoidal rotational speed fluctuation correction term is added, significantly improving the temperature estimation accuracy under varying operating conditions.

[0109] The parameter input unit of the GUI interaction module contains two types of core input parameters, both strictly matching the range defined in the `param_ranges` parameter in the code. Specifically, among the environment variables, the ambient temperature (Tamb) ranges from [-20, 45]℃, and the shell temperature (T_case) ranges from [20, 120]℃. Among the operating parameters, the rotational speed (n_rpm) ranges from [0, 6000] RPM, the magnetic flux density (B) ranges from [0.8, 1.2]T, and the iron loss coefficient (k_fe) ranges from [0.1, 0.15]. The input controls use `uicontrol` to create text labels and edit boxes, with default values ​​set to the standard values ​​defined in `param_defaults` in the code: Tamb=25.0℃, T_case=45.0℃, n_rpm=3000 RPM, B=1.0T, k_fe=0.12. Users can also directly input numerical values.

[0110] Its input method supports direct numerical input via edit box controls. The code does not include a slider control, but it can be added as needed. Its range validation is implemented through the input_ranges judgment logic in the calculate_temp_gui function. If the input parameter exceeds the preset range, a warning message is immediately triggered to prevent invalid parameters from entering the estimation model.

[0111] The control and calculation unit includes three core function buttons, corresponding to callback function logic in the code. The "Calculate Temperature" button is bound to the "calculate_temp_gui" callback function, triggering the core process: reading user input parameters → calling the optimal parameters pso_best_params after improvement and optimization of PSO → passing in the "estimate_temperature_improved" temperature estimation model → performing zero drift correction → outputting the temperature estimation result; the "Reset Input" button is bound to the "reset_inputs_gui" callback function, restoring all input parameters to their default values ​​and clearing the result display area; the "Exit" button is bound to the "Close Window" callback function, directly closing the GUI interface and releasing control resources.

[0112] The results display unit displays information in real time through two core text controls, perfectly matching the display logic of `result_display` and `result_details` in the code. Its core result is the estimated temperature of the peripheral permanent magnet; auxiliary information includes improved core parameters after PSO optimization and the time consumed in a single calculation; the information carrier, the results display panel (`result_panel`), is titled "Calculation Results and Information".

[0113] The exception handling is based on the try-catch block and range judgment logic in the code, implementing two types of exception prompts. For input exceptions, when the parameter is out of range, `result_display` displays "Caution: Range Exceeded!", and `result_details` displays the specific warning message. For calculation exceptions, when a non-numeric parameter is input or the estimation model reports an error, `result_display` displays "Input Error!" or "Calculation Error!", and `result_details` displays the specific reason for the error.

[0114] The interaction logic between the GUI module and the core algorithm is implemented through API calls to achieve closed-loop linkage. The specific process is as follows: Parameter passing: The GUI reads the operating condition parameters input by the user and passes the optimal parameters pso_best_params after the improved PSO optimization to the estimate_temperature_improved function; Model calling: When the temperature estimation model performs calculations, it automatically embeds zero drift correction logic (T_mag=T_mag_base-bias); Result feedback: After the calculation is completed, the temperature estimate, calculation time, optimization parameters and other information are displayed back to the GUI interface, and auxiliary information is output in the MATLAB command line window to achieve dual protection of visualization and logging.

[0115] The GUI interaction module has engineering adaptation extensions. It supports adaptation to industrial control computers in engineering sites; the title panel, input panel, and result panel are distinguished by different background colors to improve ease of operation; the bottom information bar displays improved PSO optimization parameters, RMSE, and calculation time in real time, making it convenient for on-site maintenance personnel to verify algorithm performance.

[0116] Based on the above, this paper takes a 400W servo motor, SX5100 series intelligent machine, SV3 series servo motor, etc. as examples to form an electric control system and obtain relevant data.

[0117] The technical solution of this disclosure breaks through the traditional fixed weight design of PSO at the algorithm level, and innovatively achieves deep coupling between parameter optimization and zero drift control. It monitors bias stability in real time through a zero drift sensitivity factor, dynamically adjusts weight coefficients based on motor speed conditions, and intelligently switches between exploration and development strategies. Addressing the parameter coupling characteristics, a coupling coefficient correction learning factor is designed to effectively alleviate the mutual interference between ΔTgap-bias and kam-bias, significantly improving the independence and effectiveness of parameter optimization. The constructed nonlinear physical model has a higher fitting degree. Based on the traditional internal estimation model of the motor, a sinusoidal correction factor for speed fluctuation and an optimizable exponential iron loss temperature rise term are introduced. Simulation results clearly show that the temperature estimation model incorporates the nonlinear effect of iron loss and speed fluctuation correction, better reflecting the actual heating characteristics of the servo motor, resulting in a higher model fitting degree. The model exhibits high accuracy. After optimizing the core parameters using an improved particle swarm optimization algorithm, the resulting model has the following parameters: ΔTgap = 11.5781, kamb = 0.2464, bias = -3.1273, α = 0.5342, β = 1.4679, RMSE: 0.021163°C, MAE: 0.017689°C. Using the same parameters (ΔTgap = 11.5781, kamb = 0.2464, bias = -3.1273), the traditional model has the following parameters: RMSE: 8.556239°C, MAE: 8.556213°C. The comparison shows that the improved model reduces RMSE by 99.75% and MAE by 99.79% compared to the basic model. A moving average filter is used to process the zero-drift sensitivity factor, eliminating noise interference in bias evaluation and avoiding long-term estimation errors caused by accumulated zero drift. This is particularly suitable for temperature monitoring scenarios involving long-term operation of servo motors. In addition, a visual GUI interface has been developed, allowing testers to quickly output the estimated temperature of the permanent magnet by directly inputting measured parameters such as ambient temperature, shell temperature, and rotation speed without writing code. This makes it easy to integrate into the servo motor performance testing process.

[0118] Furthermore, in practical applications, a hybrid algorithm combining differential evolution and other global optimization algorithms with an improved PSO algorithm can be used to further enhance global search capabilities; multi-strategy statistical methods can be used to replace the single moving average; the temperature estimation model can be expanded to include more physical effect terms, such as copper loss temperature rise and radiative heat dissipation; this scheme can also be extended to the temperature estimation of servo motors of other power levels or speed ranges.

[0119] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.

[0120] According to the permanent magnet temperature estimation method based on the improved particle swarm optimization algorithm of this disclosure, a nonlinear physical model is constructed that embeds a sinusoidal correction factor for rotational speed fluctuation into an optimizable exponential iron loss temperature rise term. This model accurately matches the nonlinear variation law of iron loss under different rotational speeds and loads. By integrating the improved particle swarm optimization algorithm with λ-weighted dual-factor dynamic weights and multi-parameter coupling compensation mechanism, the core parameters such as air gap temperature difference, environmental compensation coefficient, and zero drift deviation in the nonlinear physical model are optimized collaboratively. Thus, the accuracy and robustness of permanent magnet temperature estimation under wide rotational speeds and multiple operating conditions can be significantly improved without relying on dedicated sensors or offline experimental calibration.

[0121] The following are embodiments of the apparatus disclosed herein, which can execute the method embodiments of this disclosure. The methods provided in the embodiments of this disclosure can be executed by any electronic device with computer processing capabilities. The permanent magnet temperature estimation apparatus based on the improved particle swarm optimization algorithm described below and the permanent magnet temperature estimation method based on the improved particle swarm optimization algorithm described above can be referred to in correspondence. For details not disclosed in the apparatus embodiments of this disclosure, please refer to the method embodiments of this disclosure.

[0122] Figure 9 This is a schematic diagram of a permanent magnet temperature estimation device based on an improved particle swarm optimization algorithm provided in an embodiment of this disclosure. Figure 9 As shown, the permanent magnet temperature estimation device based on the improved particle swarm optimization algorithm includes: The model acquisition module 901 is used to acquire a pre-built nonlinear physical model. The nonlinear physical model is used to describe the relationship between the temperature of the permanent magnet and the operating parameters and core parameters. It is constructed by embedding the rotation speed fluctuation sinusoidal correction factor as a product factor into the iron loss temperature rise term in an optimizable exponential form on the basis of the traditional linear model.

[0123] The parameter acquisition module 902 is used to acquire the optimal core parameters obtained by pre-optimizing the core parameters in the nonlinear physical model through a collaborative optimization algorithm, wherein the improved particle swarm optimization algorithm integrates a λ-weighted two-factor dynamic weighting mechanism and a multi-parameter coupling compensation mechanism.

[0124] The calculation module 903 is used to substitute the real-time collected operating parameters and the optimal core parameters into the nonlinear physical model for calculation to obtain the estimated temperature of the permanent magnet.

[0125] According to the permanent magnet temperature estimation device based on the improved particle swarm optimization algorithm of the present disclosure, a nonlinear physical model is constructed that embeds the sinusoidal correction factor of rotational speed fluctuation into an optimizable exponential iron loss temperature rise term. This model accurately matches the nonlinear variation law of iron loss under different rotational speeds and loads. By integrating the improved particle swarm optimization algorithm with λ-weighted dual-factor dynamic weights and multi-parameter coupling compensation mechanism, the core parameters such as air gap temperature difference, environmental compensation coefficient, and zero drift deviation in the nonlinear physical model are optimized for collaborative optimization. Thus, the accuracy and robustness of permanent magnet temperature estimation under wide rotational speeds and multiple operating conditions can be significantly improved without relying on dedicated sensors or offline experimental calibration.

[0126] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this disclosure.

[0127] Figure 10 This is a schematic diagram of the electronic device 10 provided in an embodiment of this disclosure. Figure 10 As shown, the electronic device 10 of this embodiment includes: a processor 1001, a memory 1002, and a computer program 1003 stored in the memory 1002 and executable on the processor 1001. When the processor 1001 executes the computer program 1003, it implements the steps in the various method embodiments described above. Alternatively, when the processor 1001 executes the computer program 1003, it implements the functions of each module in the various device embodiments described above.

[0128] Electronic device 10 may be a desktop computer, laptop, handheld computer, cloud server, or other electronic device. Electronic device 10 may include, but is not limited to, a processor 1001 and a memory 1002. Those skilled in the art will understand that... Figure 10 This is merely an example of electronic device 10 and does not constitute a limitation on electronic device 10. It may include more or fewer components than shown, or different components.

[0129] The processor 1001 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0130] The memory 1002 can be an internal storage unit of the electronic device 10, such as a hard disk or RAM of the electronic device 10. The memory 1002 can also be an external storage device of the electronic device 10, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, FlashCard, etc., equipped on the electronic device 10. The memory 1002 can also include both internal and external storage units of the electronic device 10. The memory 1002 is used to store computer programs and other programs and data required by the electronic device.

[0131] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0132] If the integrated module is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program may include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0133] The above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit it. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be included within the protection scope of this disclosure.

Claims

1. A method for estimating the temperature of permanent magnets based on an improved particle swarm optimization algorithm, characterized in that, The method includes: A pre-constructed nonlinear physical model is obtained. The nonlinear physical model is used to describe the relationship between the temperature of the permanent magnet and the operating parameters and core parameters. It is constructed by embedding the speed fluctuation sinusoidal correction factor as a product factor into the iron loss temperature rise term in an optimizable exponential form on the basis of the traditional linear model. The optimal core parameters are obtained by pre-optimizing the core parameters in the nonlinear physical model through a collaborative optimization algorithm using an improved particle swarm optimization algorithm, wherein the improved particle swarm optimization algorithm integrates a λ-weighted two-factor dynamic weighting mechanism and a multi-parameter coupling compensation mechanism. The real-time collected operating parameters and the optimal core parameters are substituted into the nonlinear physical model for calculation to obtain the estimated temperature of the permanent magnet.

2. The method according to claim 1, characterized in that, The sinusoidal correction factor for the rotational speed fluctuation is used as a product factor and multiplied by the optimizable exponent of the rotational speed and the optimizable exponent of the magnetic flux density to form the iron loss temperature rise term in the nonlinear physical model.

3. The method according to claim 1, characterized in that, The λ-weighted dual-factor dynamic weighting mechanism includes: calculating a zero-drift sensitivity factor that reflects the degree of deviation of the system deviation correction term; determining a speed range factor based on the average motor speed; dynamically allocating the weights of the zero-drift sensitivity factor and the speed range factor in the inertia weight calculation through the λ coefficient, and applying random perturbations to generate dynamic inertia weights.

4. The method according to claim 1, characterized in that, The multi-parameter coupling compensation mechanism includes: calculating a first coupling coefficient between the fixed temperature difference in the air gap and the system deviation correction term, and a second coupling coefficient between the ambient temperature compensation coefficient and the system deviation correction term; dynamically correcting the individual learning factor based on the first coupling coefficient, dynamically correcting the social learning factor based on the second coupling coefficient, and limiting the corrected individual learning factor and the social learning factor to preset ranges respectively.

5. The method according to claim 1, characterized in that, The improved particle swarm optimization algorithm adopts a population diversity maintenance strategy: real-time monitoring of population diversity, and when the number of iterations meets the preset period and the diversity is lower than the preset threshold, random particles are injected to replace some existing particles. The particle velocity boundary is adaptively adjusted based on population diversity.

6. The method according to claim 1, characterized in that, The method further includes zero drift correction, which includes: performing closed-loop feedback based on the residual between the estimated temperature and the measured temperature of the permanent magnet, and adaptively adjusting the system deviation correction term in the nonlinear physical model; wherein, when the residual is positive, the system deviation correction term is increased, and when it is negative, the system deviation correction term is decreased, and the adjustment step size is set according to the dynamic inertia weight and individual learning factor in the improved particle swarm optimization algorithm.

7. The method according to claim 6, characterized in that, The zero drift correction uses a moving average filter to process the residual mean. When the residual mean of multiple consecutive sampling periods deviates from zero and exceeds the preset residual mean judgment threshold, the adaptive update of the system deviation correction term is triggered, and the updated value is limited to a preset temperature range.

8. A permanent magnet temperature estimation device based on an improved particle swarm optimization algorithm, characterized in that, The device includes: The model acquisition module is used to acquire a pre-built nonlinear physical model. The nonlinear physical model is used to describe the relationship between the temperature of the permanent magnet and the operating parameters and core parameters. It is constructed by embedding the rotational speed fluctuation sinusoidal correction factor as a product factor into the iron loss temperature rise term in an optimizable exponential form on the basis of the traditional linear model. The parameter acquisition module is used to acquire the optimal core parameters obtained by coordinating the optimization of the core parameters in the nonlinear physical model through an improved particle swarm optimization algorithm, wherein the improved particle swarm optimization algorithm integrates a λ-weighted two-factor dynamic weighting mechanism and a multi-parameter coupling compensation mechanism. The calculation module is used to input the real-time collected operating parameters and the optimal core parameters into the nonlinear physical model to calculate the estimated temperature of the permanent magnet.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 7.

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