Adaptive motor control unit software testing method based on hybrid intelligent model

The adaptive motor control unit software testing method based on a hybrid intelligent model can perceive the operating status and environmental changes of the motor control unit in real time and dynamically generate test actions, solving the problems of static testing and data scarcity in existing technologies, and realizing efficient and intelligent fault detection and diagnosis.

CN122489435APending Publication Date: 2026-07-31CHONGQING TSINGSHAN IND
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHONGQING TSINGSHAN IND
Filing Date
2026-06-02
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing software testing methods for motor control units cannot adapt to dynamic operating environments, fault data is scarce, and test generation and system diagnosis are disconnected, resulting in insufficient detection capabilities and low efficiency.

Method used

An adaptive motor control unit software testing method based on a hybrid intelligent model is adopted. By collecting data in real time, injecting fault signals, and combining reinforcement learning and fault prediction models, a closed-loop collaborative mechanism is constructed to dynamically generate test actions and perform incremental learning to optimize the test strategy.

Benefits of technology

It significantly improves the detection capabilities for edge scenarios and dynamic defects, enhances testing efficiency and intelligence, reduces reliance on real vehicle fault data, and achieves self-evolution and continuous optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122489435A_ABST
    Figure CN122489435A_ABST
Patent Text Reader

Abstract

This invention relates to the field of motor control unit software testing technology, and particularly to an adaptive motor control unit software testing method based on a hybrid intelligent model, comprising: S1, acquiring real-time operating data of the motor control unit and injecting a preset type of fault signal into the system communication bus where the motor control unit is located; S2, inputting the real-time operating data into a fault prediction model and outputting a first fault probability distribution; S3, acquiring system environmental indicators in real time, and using them together with the first fault probability distribution as a first state S. t The input is fed into a preset reinforcement learning model, which then determines the input based on the first state S. t Make a decision and output test action A t S4. Execute test action A from S3. t The system collects real-time operating data from the motor control unit; S5, the real-time operating data is input into the fault prediction model to obtain a second fault probability distribution. This invention enables dynamic adaptive optimization of the motor control unit software testing process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of motor control unit software testing technology, and in particular to an adaptive motor control unit software testing method based on a hybrid intelligent model. Background Technology

[0002] With the rapid development of vehicle electrification and intelligence, the software complexity of the Motor Control Unit (MCU), as a core component of the power system of new energy vehicles, is increasing exponentially. Modern MCU software code can reach millions of lines, and it needs to manage thousands of real-time variables and complex state transition logic simultaneously. This places unprecedented demands on the reliability, efficiency, and coverage of software testing.

[0003] In the current technological context, MCU software testing methods mainly face the following three major technical bottlenecks:

[0004] First, the static nature of the testing process makes it difficult to adapt to dynamic operating environments. Traditional testing methods primarily rely on pre-set static test cases, such as scripted tests based on tools like Vector CANoe, or fixed test sequences generated through UML / SysML models. These methods cannot adaptively adjust to the real-time operating status of the vehicle (such as dynamic environmental changes like high load conditions, network communication latency, and limited computing resources) during test execution. The fundamental reason is that traditional testing frameworks lack real-time perception of the system's operating status and intelligent decision-making mechanisms, resulting in a significantly low detection rate for edge scenarios and dynamic defects, making it difficult to meet the reliability verification requirements of modern MCU software under complex operating conditions.

[0005] Secondly, the scarcity of fault data severely restricts the training effectiveness of AI models. Data-driven testing and fault diagnosis methods heavily rely on a large number of high-quality fault data samples. However, real-world fault data in actual vehicle environments is difficult to obtain due to vehicle safety and commercial confidentiality concerns. Furthermore, simulating faults through software model modifications not only compromises model integrity but also suffers from inefficiency and incomplete coverage. This data scarcity leads to performance limitations in diagnostic models due to insufficient training samples, making it difficult to accurately identify complex fault modes and creating a vicious cycle of "insufficient data - poor model performance - low fault detection rate."

[0006] Finally, the test generation and system diagnosis phases are disconnected, resulting in insufficient overall intelligence. Currently, automated test generation (such as requirements transformation technology based on natural language processing) and system status fault diagnosis are typically two independent processes. The test generation phase cannot fully leverage the deep insights into the system's health status gained from the diagnosis phase to dynamically optimize test strategies; conversely, the diagnosis phase cannot acquire new knowledge from proactive, exploratory testing processes to achieve self-evolution. This open-loop system architecture limits the overall intelligence and efficiency of the testing process, making it difficult to achieve continuous optimization of test strategies and continuous improvement of fault diagnosis capabilities.

[0007] Therefore, how to achieve dynamic adaptive optimization of the motor control unit software testing process, and significantly improve the detection capability of edge scenes and dynamic defects while ensuring testing efficiency, has become an urgent problem to be solved. Summary of the Invention

[0008] In view of the above-mentioned shortcomings of the existing technology, the purpose of this invention is to provide an adaptive motor control unit software testing method based on a hybrid intelligent model, which can realize dynamic adaptive optimization of the motor control unit software testing process, and significantly improve the detection capability of edge scenes and dynamic defects while ensuring testing efficiency.

[0009] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:

[0010] The software testing method for adaptive motor control units based on a hybrid intelligent model includes the following steps:

[0011] S1. Collect real-time operating data of the motor control unit and inject a preset type of fault signal into the system communication bus where the motor control unit is located;

[0012] S2. Input the real-time operating data of S1 into the preset fault prediction model and output the first fault probability distribution;

[0013] S3. Real-time acquisition of system environmental indicators from the motor control unit system, and combined with the first fault probability distribution in S2 as the first state S. t The input is fed into a preset reinforcement learning model, which then determines the input based on the first state S. t Make a decision and output test action A t ;

[0014] S4. Execute test action A from S3. t And collect and execute test action A t Real-time operating data of the rear motor control unit;

[0015] S5. Input the real-time operating data from S4 into the fault prediction model to obtain the second fault probability distribution;

[0016] S6. Based on the second fault probability distribution in S5, determine whether to proceed with test action A. t A new, confirmed fault was discovered, and this determination was used as the output of this test. Simultaneously, the second fault probability distribution, along with the system environment indicators newly collected after S4, were used as the second state S. t+1 ;

[0017] S7. Based on the fault detection status determined in S6, calculate the immediate reward R according to the preset multi-objective reward function. t ;

[0018] S8, utilizing the first state S from S3 t Test Action A t S7's instant reward R t And the second state S of S6 t+1 The empirical data constituted (S) t A t R t S t+1 Update the reinforcement learning model;

[0019] When S6 determines that a new, confirmed fault has been discovered, the corresponding real-time operating data collected by S4 and the fault label corresponding to the fault are added to the training set to incrementally learn and update the fault prediction model.

[0020] S9. Return to step S2 and use the updated reinforcement learning model and fault prediction model from S8 to conduct the next round of adaptive testing.

[0021] Compared with the prior art, the present invention has the following advantages:

[0022] 1. Compared with traditional static testing methods based on preset scripts, this method uses a reinforcement learning model to perceive the operating status and environmental changes of the motor control unit in real time, and dynamically generates optimal test actions. This adaptive mechanism can intelligently adjust the test intensity and direction according to the current health status and potential risks of the system, significantly improving the detection capability of edge scenarios and dynamic defects, and effectively overcoming the technical limitations of traditional testing methods that cannot adapt to complex operating conditions.

[0023] 2. This method breaks through the open-loop architecture where test generation and fault diagnosis are independent in existing technologies. It uses the output of the fault prediction model as the state input of the reinforcement learning model, enabling the testing strategy to fully utilize the deep insight into the system's health status. Simultaneously, through an incremental learning mechanism, the fault prediction model can continuously learn and evolve from new fault samples discovered during the testing process. This bidirectional closed-loop collaborative mechanism achieves deep integration of testing and diagnosis, significantly improving the overall intelligence level of the testing system.

[0024] 3. By actively injecting preset types of fault signals into the system communication bus and incorporating newly discovered fault samples into the training set in real time using an incremental learning mechanism, this method can autonomously construct a high-quality fault dataset during testing. This active learning strategy avoids excessive reliance on hard-to-obtain real-vehicle fault data while ensuring the authenticity and diversity of fault samples, providing reliable data support for the continuous optimization of the fault prediction model.

[0025] 4. Based on a multi-objective reward function-based reinforcement learning mechanism, this method comprehensively considers multiple objectives such as fault detection rate, test coverage, and resource consumption during the testing process, intelligently prioritizing the allocation of test resources to high-risk and potentially defective areas. Compared with traditional full-coverage testing, this method avoids the ineffective waste of test resources and achieves a dual improvement in testing efficiency and effectiveness.

[0026] 5. Through continuous accumulation of experience data and incremental updates to the model, this method can continuously optimize testing strategies and fault diagnosis capabilities as the number of testing rounds increases. This self-evolving characteristic enables the testing system to adapt to iterative upgrades of the motor control unit software, maintaining long-term testing effectiveness and advancement, and significantly reducing the maintenance cost and update difficulty of the testing system.

[0027] In summary, this method can achieve dynamic adaptive optimization of the motor control unit software testing process, significantly improving the detection capability of edge scenarios and dynamic defects while ensuring testing efficiency. Through a closed-loop collaborative mechanism of testing and diagnosis, it constructs an intelligent testing system that can continuously self-evolve, effectively solving the core problems of static testing, data scarcity, and low level of intelligence in existing technologies.

[0028] Preferably, the fault prediction model is a hybrid deep learning model based on a one-dimensional convolutional neural network and a long short-term memory network connected in series.

[0029] Preferably, the real-time running data is a multivariate time series containing 30 time steps and 5 dimensions of system variable data;

[0030] The fault prediction model outputs a 9-dimensional fault probability distribution that includes 8 preset fault types and health statuses, and the first fault probability distribution is one of the 9-dimensional fault probability distributions.

[0031] Preferably, the one-dimensional convolutional neural network contains 5 convolutional layers, the long short-term memory network contains 4 LSTM layers, and the fault prediction model outputs a first fault probability distribution or a second fault probability distribution through a Softmax layer.

[0032] With this setup, the hybrid deep learning model, by deeply integrating the spatial feature extraction capability of convolutional neural networks and the temporal modeling capability of long short-term memory networks, constructs an intelligent diagnostic core capable of accurately perceiving the health status of the system and effectively identifying multiple fault modes, providing a reliable state perception foundation and decision-making basis for the entire adaptive testing system.

[0033] Preferably, in step S7, the multi-objective reward function includes a defect detection reward item, a system stability reward item, and a curiosity exploration reward item.

[0034] Preferably, in step S7, the instant reward R t The formula for calculation is:

[0035] R t =0.4R detection +0.3R stability +0.15R efficiency +0.15R curiosity ;

[0036] Among them, R detection For defect detection rewards, R stability As a system stability reward item, R efficiency y represents the test efficiency reward item, R curiosity Rewards for exploring out of curiosity.

[0037] Preferably, the detection reward R detection The calculation method is as follows: if step S6 determines that a new, confirmed fault was discovered by executing test action At, then R... detection =+10;

[0038] Stability Reward R stability The calculation method is as follows: if the motor speed, motor temperature, bus voltage, motor torque, or current fluctuation rate exceeds the preset safety threshold, then R stability =-5, otherwise R stability =+0.1;

[0039] Curiosity Exploration Reward R curiosityThe calculation method is as follows: Based on the Shannon entropy of the second fault probability distribution output by the fault prediction model in step S5, the larger the Shannon entropy, the higher the R... curiosity The larger the value.

[0040] This multi-objective reward function, through the organic combination of defect detection rewards, system stability rewards, testing efficiency rewards, and curiosity exploration rewards, constructs an intelligent decision-making mechanism that balances multiple objectives. Compared to traditional single-objective testing strategies, this multi-objective reward function not only focuses on the core objective of fault detection but also comprehensively considers system security, resource utilization efficiency, and the ability to proactively explore unknown states during the testing process. In particular, the curiosity exploration reward, based on Shannon entropy calculation of the fault probability distribution, can effectively guide the reinforcement learning model to proactively explore areas with high uncertainty in the system state, thereby significantly improving the ability to discover edge scenarios and potential defects. At the same time, the system stability reward ensures that the testing process does not cause excessive damage to the system while exploring efficiently by monitoring the safety thresholds of key parameters in real time. This multi-objective collaborative optimization mechanism enables the testing strategy to achieve a dynamic balance between fault detection, system security, testing efficiency, and exploration capabilities, avoiding the problems of overtesting or undertesting that may occur in traditional testing methods.

[0041] Preferably, the reinforcement learning model is a model trained based on a proximal policy optimization algorithm, used in step S3 according to the first state S t Make a decision and output test action A t In step S8, the strategy is updated using the empirical data.

[0042] Among them, test action A t The action space is defined as: selecting a test case from a predefined set of 60 test cases, and continuously adjusting one or more parameters of the test case within the range of [-20%, +20%].

[0043] Compared with existing technologies that can only select fixed test cases or adjust discrete parameters, this solution can dynamically generate more refined and targeted test actions based on the real-time status of the system, significantly improving the expressive power and optimization potential of the test strategy, while ensuring the training efficiency and strategy stability of the reinforcement learning process.

[0044] Preferably, in step S8, the method of updating the model includes at least one of the following:

[0045] 1) Update the reinforcement learning model, including by changing the state from the first state S. t Test Action A t Instant Rewards R t and the second state St+1 The empirical data constituted (S) t A t R t S t+1 The data is stored in the experience replay buffer and a batch of data is sampled from the experience replay buffer to update the Actor network and Critic network of the reinforcement learning model.

[0046] 2) Incremental learning and updating of the fault prediction model, including:

[0047] a. In step S8, when a new, confirmed fault is discovered, the corresponding real-time running data and fault label are added to an incremental learning cache pool;

[0048] b. When the number of labeled data samples accumulated in the incremental learning cache pool reaches a preset threshold, the fault prediction model is fine-tuned through incremental learning using all the data samples in the cache pool.

[0049] c. After fine-tuning is complete, clear or update the incremental learning cache pool.

[0050] This setup, through the organic combination of experience replay and incremental learning, constructs an efficient and stable dual-model co-evolutionary system. In terms of reinforcement learning model updates, an experience replay buffer mechanism is employed. By storing and randomly sampling historical experience data, it effectively breaks the temporal correlation between samples, significantly improving the stability of the training process and the efficiency of sample utilization, and avoiding the policy oscillation problem that easily occurs in traditional online learning. In terms of fault prediction model updates, an innovative incremental learning cache pool mechanism is introduced. Through a threshold-triggered batch fine-tuning strategy, it ensures that the model can absorb newly discovered fault knowledge in a timely manner, while avoiding the computational overhead and model instability risks caused by frequent updates.

[0051] Preferably, in step S1, the preset type of fault signal includes gain fault, offset fault and / or jamming fault, and is injected into the controller local area network bus in a non-intrusive manner. Attached Figure Description

[0052] To make the objectives, technical solutions, and advantages of the invention clearer, the invention will now be described in further detail with reference to the accompanying drawings, wherein:

[0053] Figure 1 This is a flowchart of the method;

[0054] Figure 2 This is a schematic diagram of the system architecture in Example 2. Detailed Implementation

[0055] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0056] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to represent selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0057] Example 1

[0058] like Figure 1 As shown, this invention provides a software testing method for an adaptive motor control unit based on a hybrid intelligent model, comprising the following steps:

[0059] S1. Collect real-time operating data of the motor control unit and inject a preset type of fault signal into the system communication bus where the motor control unit is located;

[0060] In practice, the real-time running data is a multivariate time series containing 30 time steps and 5 dimensions of system variable data.

[0061] The preset fault signals include gain faults, offset faults, and / or jamming faults, and are injected into the controller local area network bus in a non-intrusive manner.

[0062] S2. Input the real-time operating data of S1 into the preset fault prediction model and output the first fault probability distribution.

[0063] In specific implementation, the fault prediction model is a hybrid deep learning model based on a one-dimensional convolutional neural network and a long short-term memory network connected in series. The one-dimensional convolutional neural network contains 5 convolutional layers, and the long short-term memory network contains 4 LSTM layers. The fault prediction model outputs a first fault probability distribution or a second fault probability distribution through a softmax layer.

[0064] The fault prediction model outputs a 9-dimensional fault probability distribution that includes 8 preset fault types and health statuses, and the first fault probability distribution is one of the 9-dimensional fault probability distributions.

[0065] In this way, by deeply integrating the spatial feature extraction capability of convolutional neural networks and the temporal modeling capability of long short-term memory networks, this hybrid deep learning model constructs an intelligent diagnostic core that can accurately perceive the health status of the system and effectively identify multiple fault modes, providing a reliable state perception foundation and decision-making basis for the entire adaptive testing system.

[0066] S3. Real-time acquisition of system environmental indicators from the motor control unit system, and combined with the first fault probability distribution in S2 as the first state S. t The input is fed into a preset reinforcement learning model, which then determines the input based on the first state S. t Make a decision and output test action A t (For example, "Execute test cases TC") 018 (During rapid acceleration, the torque request parameter is increased by 15%).

[0067] S4. Execute test action A from S3. t And collect and execute test action A t Real-time operating data of the rear motor control unit;

[0068] S5. Input the real-time operating data from S4 into the fault prediction model to obtain the second fault probability distribution;

[0069] S6. Based on the second fault probability distribution in S5, determine whether to proceed with test action A. t A new, confirmed fault was discovered, and this determination was used as the output of this test. Simultaneously, the second fault probability distribution, along with the system environment indicators newly collected after S4, were used as the second state S. t+1 ;

[0070] S7. Based on the fault detection status determined in S6, calculate the immediate reward R according to the preset multi-objective reward function. t .

[0071] In practice, the multi-objective reward function includes a defect detection reward, a system stability reward, and a curiosity exploration reward.

[0072] Instant Rewards R t The formula for calculation is:

[0073] R t =0.4R detection +0.3R stability +0.15R efficiency +0.15R curiosity ;

[0074] Among them, R detection For defect detection rewards, R stability As a system stability reward item, Refficiency y represents the test efficiency reward item, R curiosity Rewards for exploring out of curiosity.

[0075] Detection reward R detection The calculation method is as follows: if step S6 determines that a new, confirmed fault was discovered by executing test action At, then R... detection =+10;

[0076] Stability Reward R stability The calculation method is as follows: if the motor speed, motor temperature, bus voltage, motor torque, or current fluctuation rate exceeds the preset safety threshold, then R stability =-5, otherwise R stability =+0.1;

[0077] Curiosity Exploration Reward R curiosity The calculation method is as follows: Based on the Shannon entropy of the second fault probability distribution output by the fault prediction model in step S5, the larger the Shannon entropy, the higher the R... curiosity The larger the value.

[0078] Compared to traditional single-objective testing strategies, this multi-objective reward function not only focuses on the core objective of fault detection but also comprehensively considers system security, resource utilization efficiency, and the ability to proactively explore unknown states during the testing process. In particular, the curiosity-based exploration reward, calculated using Shannon entropy based on the fault probability distribution, effectively guides the reinforcement learning model to actively explore regions with high system state uncertainty, thereby significantly improving the ability to discover edge scenarios and potential defects. Simultaneously, the system stability reward ensures that the testing process, while efficiently exploring, does not cause excessive damage to the system by monitoring the safety thresholds of key parameters in real time. This multi-objective collaborative optimization mechanism enables the testing strategy to achieve a dynamic balance between fault detection, system security, testing efficiency, and exploration capabilities, avoiding the overtesting or undertesting problems that may occur in traditional testing methods.

[0079] S8, utilizing the first state S from S3 t Test Action A t S7's instant reward R t And the second state S of S6 t+1 The empirical data constituted (S) t A t R t S t+1 Update the reinforcement learning model;

[0080] When S6 determines that a new, confirmed fault has been discovered, it adds the corresponding real-time operating data collected by S4 and the fault label corresponding to the fault to the training set, and performs incremental learning and updates on the fault prediction model.

[0081] In practice, updating the model can be done in at least one of the following ways:

[0082] 1) Update the reinforcement learning model, including by changing the state from the first state S. t Test Action A t Instant Rewards R t and the second state S t+1 The empirical data constituted (S) t A t R t S t+1 The data is stored in the experience replay buffer and a batch of data is sampled from the experience replay buffer to update the Actor network and Critic network of the reinforcement learning model.

[0083] 2) Incremental learning and updating of the fault prediction model, including:

[0084] a. In step S8, when a new, confirmed fault is discovered, the corresponding real-time running data and fault label are added to an incremental learning cache pool;

[0085] b. When the number of labeled data samples accumulated in the incremental learning cache pool reaches a preset threshold, the fault prediction model is fine-tuned through incremental learning using all the data samples in the cache pool.

[0086] c. After fine-tuning is complete, clear or update the incremental learning cache pool.

[0087] By organically combining experience replay and incremental learning, a highly efficient and stable dual-model co-evolutionary system was constructed. For reinforcement learning model updates, an experience replay buffer mechanism was adopted. By storing and randomly sampling historical experience data, the temporal correlation between samples was effectively broken, significantly improving the stability of the training process and the efficiency of sample utilization, thus avoiding the policy oscillation problem that easily occurs in traditional online learning. For fault prediction model updates, an innovative incremental learning cache pool mechanism was introduced. Through a threshold-triggered batch fine-tuning strategy, this ensured that the model could absorb newly discovered fault knowledge in a timely manner while avoiding the computational overhead and model instability risks associated with frequent updates.

[0088] In specific implementation, the reinforcement learning model is a model trained based on the proximal policy optimization algorithm, used in step S3 according to the first state S t Make a decision and output test action A t In step S8, the strategy is updated using the empirical data.

[0089] Among them, test action A tThe action space is defined as: selecting a test case from a predefined set of 60 test cases, and continuously adjusting one or more parameters of the test case within the range of [-20%, +20%].

[0090] Compared with existing technologies that can only select fixed test cases or adjust discrete parameters, this solution can dynamically generate more refined and targeted test actions based on the real-time status of the system, significantly improving the expressive power and optimization potential of the test strategy, while ensuring the training efficiency and strategy stability of the reinforcement learning process.

[0091] S9. Return to step S2 and use the updated reinforcement learning model and fault prediction model from S8 to conduct the next round of adaptive testing.

[0092] Compared to traditional static testing methods based on pre-set scripts, this method uses a reinforcement learning model to perceive the operating status and environmental changes of the motor control unit in real time, dynamically generating optimal test actions. This adaptive mechanism can intelligently adjust the test intensity and direction according to the current health status and potential risks of the system, significantly improving the detection capability for edge scenarios and dynamic defects, effectively overcoming the technical limitations of traditional testing methods that cannot adapt to complex operating conditions. Furthermore, it breaks through the open-loop architecture where test generation and fault diagnosis are independent in existing technologies. This method uses the output of the fault prediction model as the state input of the reinforcement learning model, enabling the testing strategy to fully utilize the deep insight into the system's health status. Simultaneously, through an incremental learning mechanism, the fault prediction model can continuously learn and evolve from new fault samples discovered during the testing process. This bidirectional closed-loop collaborative mechanism achieves deep integration of testing and diagnosis, significantly improving the overall intelligence level of the testing system.

[0093] By actively injecting preset fault signals into the system communication bus and incorporating newly discovered fault samples into the training set in real time using an incremental learning mechanism, this method can autonomously construct a high-quality fault dataset during testing. This proactive learning strategy avoids excessive reliance on hard-to-obtain real-vehicle fault data while ensuring the authenticity and diversity of fault samples, providing reliable data support for the continuous optimization of the fault prediction model. Furthermore, the reinforcement learning mechanism based on a multi-objective reward function can comprehensively consider multiple objectives such as fault detection rate, test coverage, and resource consumption during testing, intelligently prioritizing the allocation of test resources to high-risk and potentially defective areas. Compared to traditional full-coverage testing, this method avoids the ineffective waste of test resources, achieving a dual improvement in testing efficiency and effectiveness. Moreover, through the continuous accumulation of empirical data and incremental model updates, this method can continuously optimize testing strategies and fault diagnosis capabilities with each test round. This self-evolving characteristic enables the testing system to adapt to iterative upgrades of the motor control unit software, maintaining long-term testing effectiveness and advancement, and significantly reducing the maintenance cost and update difficulty of the testing system.

[0094] This method enables dynamic adaptive optimization of the motor control unit software testing process, significantly improving the detection capability for edge scenarios and dynamic defects while ensuring testing efficiency. Through a closed-loop collaborative mechanism of testing and diagnosis, it constructs an intelligent testing system that can continuously self-evolve, effectively solving the core problems of static testing, data scarcity, and low level of intelligence in existing technologies.

[0095] Example 2

[0096] To better illustrate this method, the following application example is provided.

[0097] In this example, the method is implemented based on an adaptive motor controller software testing system, and is carried out on a hardware-in-the-loop simulation platform. For example... Figure 2 As shown, the system includes a data perception and injection module, a hybrid intelligent processing module, and a test execution and output module.

[0098] 1) The data sensing and injection module is used to collect real-time operating data of the MCU and form a multivariate time series; it is also used to inject preset type fault signals into the system signal bus non-intrusively during simulation testing.

[0099] Specifically, the data sensing and injection module acquires signals such as speed and torque from the MCU in real time through the dSPACE SCALEXIO system. Its built-in fault injection unit can programmatically inject eight types of sensor faults, such as gain, offset, and jamming, on the CAN bus through configuration scripts.

[0100] The data perception and injection module also includes a variable knowledge graph unit, which is used to integrate variable definitions from multiple data sources and achieve accurate matching between natural language requirements and system variables through hybrid semantic fingerprinting technology.

[0101] 2) The hybrid intelligent processing module includes a fault prediction unit and a test strategy generation unit, which are coupled through an internal feedback loop.

[0102] Specifically, the fault prediction unit, based on a hybrid deep learning model constructed from a one-dimensional convolutional neural network and a long short-term memory network, receives the real-time operating data and outputs the fault probability distribution of the current system state.

[0103] The fault prediction unit employs a hybrid model combining 1D-CNN (5 convolutional layers) and LSTM (4 layers). The input consists of system variable data with 30 time steps and 5 dimensions, and the final output is a probability of 9 categories (8 types of faults + healthy) through a Softmax layer.

[0104] The test strategy generation unit, built upon a reinforcement learning model, has a state space that includes at least the aforementioned fault probability distribution and system environment indicators; an action space that includes test case selection or parameter adjustment; and a reward function that is a multi-objective function integrating defect detection rate, system stability, and test efficiency. This unit outputs an optimized test strategy based on the current state.

[0105] Test strategy generation unit: Employs a near-end policy optimization algorithm. The state space consists of a fault probability distribution (9 dimensions), system CPU load, and memory utilization. The action space allows selection from 60 pre-set test cases, or continuous adjustment of the selected case's parameters (e.g., signal amplitude) within ±20%. The reward function is the same as in Example 1 and will not be repeated here.

[0106] 3) Test execution and output module, used to execute the test instructions issued by the test strategy generation unit and output test results and diagnostic reports.

[0107] Specifically, the test execution and output module executes the generated test scripts through the ControlDesk tool, records the results, and generates a diagnostic report that includes the fault type and confidence level.

[0108] Experiments show that the patented method achieves a defect detection rate of 95.6% in adversarial testing environments, which is about 46% higher than traditional static testing methods. The test case efficiency is increased to 87%, and invalid test cases are reduced by 64%.

[0109] The usage process of this system is the same as in Example 1, and will not be repeated here.

[0110] Compared with existing technologies, it achieves closed-loop adaptive and precise testing. By deeply integrating fault prediction into the test strategy generation process, test resources can be dynamically and accurately deployed to high-risk and uncertain areas of the system, greatly improving testing efficiency and defect detection rate, and is particularly adept at discovering edge case defects in dynamic environments.

[0111] It also effectively solves the problem of scarce fault data. By combining programmatic fault injection with a reinforcement learning curiosity exploration mechanism, it can proactively and automatically generate rich and diverse fault and edge scenario data, providing fuel for continuous optimization of deep learning models and reducing dependence on historical fault data.

[0112] In addition, it possesses system-level collaborative evolution capabilities. The fault prediction unit and the test strategy generation unit are no longer isolated modules, but constitute a mutually reinforcing intelligent whole. The test strategy drives the system to explore unknown areas, providing new data for the prediction model; the evolution of the prediction model, in turn, guides the test strategy to become more intelligent, forming a virtuous cycle of self-reinforcing change.

[0113] Furthermore, the safety and reliability of the testing process are guaranteed. By introducing system stability constraints into the multi-objective reward function, the reinforcement learning agent learns to avoid executing destructive tests that could lead to system crashes while pursuing a high defect detection rate, thus achieving the optimal balance between testing intensity and system safety.

[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit the technical solutions. Those skilled in the art should understand that any modifications or equivalent substitutions to the technical solutions of the present invention without departing from the spirit and scope of the present invention should be covered within the scope of the claims of the present invention.

Claims

1. A software testing method for an adaptive motor control unit based on a hybrid intelligent model, characterized in that, Includes the following steps: S1. Collect real-time operating data of the motor control unit and inject a preset type of fault signal into the system communication bus where the motor control unit is located; S2. Input the real-time operating data of S1 into the preset fault prediction model and output the first fault probability distribution; S3, real-time collection of system environment indicators from the motor control unit system, and the first fault probability distribution of S2 as the first state S t , input to the preset reinforcement learning model, and the reinforcement learning model decides and outputs the test action A t according to the first state S t ; S4, performing the test action A of S3 t and collecting real-time operational data of the post-motor control unit t real-time operational data of the post-motor control unit S5. Input the real-time operating data from S4 into the fault prediction model to obtain the second fault probability distribution; S6. Based on the second fault probability distribution in S5, determine whether to proceed with test action A. t A new, confirmed fault was discovered, and this determination was used as the output of this test. Simultaneously, the second fault probability distribution, along with the system environment indicators newly collected after S4, were used as the second state S. t+1 ; S7. Based on the fault detection status determined in S6, calculate the immediate reward R according to the preset multi-objective reward function. t ; S8, utilizing the first state S from S3 t Test Action A t S7's instant reward R t And the second state S of S6 t+1 The empirical data constituted (S) t A t R t S t+1 Update the reinforcement learning model; When S6 determines that a new, confirmed fault has been discovered, the corresponding real-time operating data collected by S4 and the fault label corresponding to the fault are added to the training set to incrementally learn and update the fault prediction model. S9. Return to step S2 and use the updated reinforcement learning model and fault prediction model from S8 to conduct the next round of adaptive testing.

2. The software testing method for adaptive motor control unit based on a hybrid intelligent model as described in claim 1, characterized in that, The fault prediction model is a hybrid deep learning model based on a one-dimensional convolutional neural network and a long short-term memory network connected in series.

3. The software testing method for adaptive motor control unit based on a hybrid intelligent model as described in claim 2, characterized in that, The real-time operational data is a multivariate time series containing 30 time steps and 5 dimensions of system variable data; The fault prediction model outputs a 9-dimensional fault probability distribution that includes 8 preset fault types and health statuses, and the first fault probability distribution is one of the 9-dimensional fault probability distributions.

4. The software testing method for adaptive motor control unit based on a hybrid intelligent model as described in claim 2, characterized in that, The one-dimensional convolutional neural network contains 5 convolutional layers, the long short-term memory network contains 4 LSTM layers, and the fault prediction model outputs a first fault probability distribution or a second fault probability distribution through a softmax layer.

5. The software testing method for adaptive motor control unit based on a hybrid intelligent model as described in claim 1, characterized in that, In step S7, the multi-objective reward function includes a defect detection reward item, a system stability reward item, and a curiosity exploration reward item.

6. The software testing method for adaptive motor control unit based on a hybrid intelligent model as described in claim 5, characterized in that, In step S7, the instant reward R t The formula for calculation is: R t =0.4R detection +0.3R stability +0.15R efficiency +0.15R curiosity ; Among them, R detection For defect detection rewards, R stability As a system stability reward item, R efficiency y represents the test efficiency reward item, R curiosity Rewards for exploring out of curiosity.

7. The software testing method for adaptive motor control unit based on a hybrid intelligent model as described in claim 6, characterized in that, Detection reward R detection The calculation method is as follows: if step S6 determines that a new, confirmed fault was discovered by executing test action At, then R... detection =+10; Stability Bonus R stability The calculation method is as follows: if the motor speed, motor temperature, bus voltage, motor torque, or current fluctuation rate exceeds the preset safety threshold, then R stability =-5, otherwise R stability =+0.1; Curiosity Exploration Reward R curiosity The calculation method is as follows: Based on the Shannon entropy of the second fault probability distribution output by the fault prediction model in step S5, the larger the Shannon entropy, the higher the R... curiosity The larger the value.

8. The software testing method for adaptive motor control unit based on a hybrid intelligent model as described in claim 1, characterized in that, The reinforcement learning model is a model trained based on the proximal policy optimization algorithm, used in step S3 according to the first state S t Make a decision and output test action A t In step S8, the strategy is updated using the empirical data. Among them, test action A t The action space is defined as: selecting a test case from a predefined set of 60 test cases, and continuously adjusting one or more parameters of the test case within the range of [-20%, +20%].

9. The software testing method for adaptive motor control unit based on a hybrid intelligent model as described in claim 1, characterized in that, In step S8, the model is updated in at least one of the following ways: 1) Update the reinforcement learning model, including by changing the state from the first state S. t Test Action A t Instant Rewards R t and the second state S t+1 The empirical data constituted (S) t A t R t S t+1 The data is stored in the experience replay buffer and a batch of data is sampled from the experience replay buffer to update the Actor network and Critic network of the reinforcement learning model. 2) Incremental learning and updating of the fault prediction model, including: a. In step S8, when a new, confirmed fault is discovered, the corresponding real-time running data and fault label are added to an incremental learning cache pool; b. When the number of labeled data samples accumulated in the incremental learning cache pool reaches a preset threshold, the fault prediction model is fine-tuned through incremental learning using all the data samples in the cache pool. c. After fine-tuning is complete, clear or update the incremental learning cache pool.

10. The software testing method for an adaptive motor control unit based on a hybrid intelligent model as described in claim 1, characterized in that, In step S1, the preset type of fault signal includes gain fault, offset fault and / or jamming fault, and is injected into the controller local area network bus in a non-intrusive manner.