Methods for building a hardware-in-the-loop testing environment, as well as the system and devices for doing so.
By parsing test requirements to generate structured elements, and using template libraries and constraints to satisfy problem models for resource orchestration, the HiL test environment can be automatically configured, solving the problem of unreasonable resource allocation and improving test efficiency and result consistency.
Patent Information
- Application Number
- CN202611263589.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-11-17
AI Technical Summary
The existing HiL testing environment suffers from unreasonable resource allocation and fails to consider multi-dimensional constraints, resulting in poor testing performance and low efficiency.
By analyzing test requirements, structured test elements are generated. Resources are orchestrated using a pre-built template library and constraints to satisfy the problem model, enabling parallel configuration and automated debugging, and generating an executable test project.
It improved the rationality and efficiency of resource allocation, shortened the test environment setup time, enhanced the validity and consistency of test results, and eliminated manual configuration errors.
Smart Images

Figure CN123114992A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of vehicle performance testing technology, for example to a method, system, and apparatus for building a hardware-in-the-loop testing environment. Background Technology
[0002] In the development and verification of automotive chassis, powertrain, and cross-domain electronic control systems, hardware-in-the-loop (HiL) testing is a crucial step in verifying the functionality, performance, and reliability of the controller's hardware and software. A typical HiL testing environment usually includes a real-time simulation model, I / O interface configuration, fault injection unit (FIU), load simulation unit, and host computer software.
[0003] With the continuous development of automotive electronic and electrical architecture, HiL test environments require more types of integrated hardware devices, a surge in the number of signal channels, and a wide variety of communication protocols, making the construction and debugging of test environments increasingly complex and cumbersome.
[0004] In related technologies, a test environment deployment method has been proposed. This method obtains test requirements and a template library, generates an environment configuration based on these requirements and the template library, including operating system version, network parameters, and resource allocation parameters, and then deploys the test environment according to the configuration. This solution automates test environment deployment to a certain extent through template-based deployment and intelligent parameter configuration, reducing the workload of manual configuration.
[0005] However, the following problems still exist in the process of implementing the above plan: This solution matches the target template according to the test requirements and then adjusts the resource allocation parameters based on preset resource allocation rules. However, its resource allocation only considers simple proportional adjustments to general computing resources such as CPU and memory, without taking into account the multi-dimensional constraints unique to HiL testing. Therefore, when facing complex HiL testing environments, the resource allocation may not meet the requirements of the testing environment, thus affecting the test results.
[0006] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0007] To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments, but rather as a prelude to the detailed description that follows.
[0008] This disclosure provides a method, system, and apparatus for building a hardware-in-the-loop testing environment to address the problem of unreasonable resource allocation.
[0009] In some embodiments, a method for building a hardware-in-the-loop test environment is provided, comprising: acquiring test requirements, parsing the test requirements, and extracting test elements; matching the test elements in a pre-set template library to generate an initial environment configuration scheme; orchestrating resources in an established hardware resource pool based on the initial environment configuration scheme and preset constraints to generate a resource binding list; executing model deployment, I / O (Input / Output) configuration, communication configuration, and fault injection configuration in parallel according to the resource binding list to generate an executable test project; deploying the executable test project on a target machine, debugging it, and then generating an environment configuration file.
[0010] The hardware-in-the-loop testing environment setup method disclosed herein decomposes the user-inputted raw test requirements into standardized test elements that can be used in subsequent processes through a parsing engine. This transforms unstructured requirement information into structured, machine-readable data, providing a precise input foundation for subsequent template matching and configuration generation, thereby improving the data accuracy and consistency of the entire automated process. The parsed test elements are matched with templates in a pre-built template library to automatically generate an initial environment configuration scheme. This allows the system to automatically reuse mature project configuration schemes, avoiding manual configuration from scratch each time. Simultaneously, the template-based configuration generation method ensures a high degree of consistency between test environments built by different projects and different engineers, eliminating configuration differences and errors caused by human factors. Based on the resource requirements in the environment configuration plan and combined with preset multi-dimensional constraints, various resources in the hardware resource pool are orchestrated and planned to generate a resource binding list. This transforms the complex task of manually consulting hardware status tables and manually determining channel allocation into an automated orchestration process based on constraint solving. By simultaneously performing global optimization under multi-dimensional constraints, resource conflicts can be effectively avoided, and real-time and physical connectivity requirements can be met. Compared to the manual, step-by-step trial-and-error allocation method, this significantly improves the rationality, utilization, and efficiency of resource allocation. Based on the resource binding list, subtasks such as model deployment, I / O configuration, communication configuration, and fault injection configuration, which were originally executed sequentially, are changed to be executed in parallel. After all subtasks are completed, they are merged to generate a complete executable test project. In this way, the execution dependencies and timing constraints between configuration subtasks are broken, and the parallel processing capabilities of computing resources are fully utilized. Compared to the serial method of manually completing each configuration step, the test project construction time is significantly shortened, and the overall construction efficiency is improved. The executable test project is automatically downloaded and deployed to the target real-time simulator. After deployment, an automated debugging process is executed, and finally an environment configuration file that can be used directly is generated. This realizes the fully automated conversion from configuration scheme to physical executable environment, eliminates the manual power-on deployment and manual debugging steps, and shortens the waiting time between environment setup and actual test execution.
[0011] By adopting the setup method disclosed herein, the process of setting up the HiL test environment from requirement input to executable environment delivery is automated, which significantly shortens the environment preparation time, eliminates manual configuration errors, improves the quality consistency of the delivered environment, and thus enhances the effectiveness of test results.
[0012] Optionally, the test elements include at least one of the following: type of controller under test, type of test scenario, simulation model requirements and version requirements, number and type of I / O channels, type and baud rate of communication bus, and fault injection requirements.
[0013] In this embodiment, by limiting the test elements to at least one of the following: type of controller under test, test scenario category, simulation model requirements and version requirements, number and type of I / O channels, communication bus type and baud rate, and fault injection requirements, a precise structured characterization of hardware-in-the-loop test requirements is achieved.
[0014] Specifically, the aforementioned test elements cover the core information dimensions required to build a complete HiL test environment: the type of controller under test determines the hardware interface characteristics and communication protocol family of the object under test; the test scenario category, such as functional testing, fault testing, and network testing, determines the focus of the environment configuration and the required combination of capabilities; simulation model requirements and version requirements ensure the compatibility and traceability of the controlled object model and the version of the software under test; the number and type of I / O channels precisely describe the physical signal interface resources required for interaction with the controller under test; the communication bus type and baud rate clarify the network communication specifications of the controller under test; and the fault injection requirements define the boundaries of the fault simulation capabilities that the environment must possess.
[0015] By extracting the above-mentioned multi-dimensional elements in a structured manner, the system can obtain the key parameters required to build the HiL test environment, enabling subsequent template matching to be accurately located based on the test requirement characteristics, rather than relying on the subjective judgment of engineers or scattered information. At the same time, the structured element representation method eliminates the ambiguity and omissions that may exist in the natural language requirement description, so that the environment configuration scheme fully covers all the capabilities required for testing from the beginning of generation, avoiding configuration rework and environment reconstruction due to missing requirement information.
[0016] Optionally, the pre-built template library includes at least one of vehicle platform templates, controller templates, and general I / O mapping templates.
[0017] In this embodiment, by limiting the pre-built template library to include at least one of vehicle platform templates, controller templates, and general I / O mapping templates, a hierarchical and modular encapsulation of hardware-in-the-loop test environment configuration knowledge is achieved.
[0018] Specifically, the three types of templates each serve different reuse levels: The vehicle platform template encapsulates the overall test environment architecture of a specific vehicle platform, including the platform's common suspension topology, sensor layout matrix, bus topology, etc., suitable for test scenarios with different controllers on the same platform. The controller template encapsulates the specific configurations for controller types, such as BMS (Battery Management System), EPS (Electronic Power Steering), and SCM (Suspension Control Module), including the controller's unique signal-port mapping relationships, communication matrices, fault injection point definitions, etc., suitable for test reuse of the same controller across different vehicle models or versions. The general I / O mapping template encapsulates standardized mapping rules between signal types and physical channels, such as accelerometer → high-frequency AI channel, solenoid valve drive → PWM output channel, etc., suitable for general signal configuration scenarios across vehicle models and controllers.
[0019] Through a three-tiered template reuse mechanism, the system can match the closest historical configuration experience at different levels when facing new testing requirements. Vehicle platform templates address general configurations at the vehicle architecture level, controller templates address controller-level specific configurations, and general I / O mapping templates address standardized signal-level configurations. This layered reuse architecture maximizes the reuse of knowledge assets in the template library, significantly improving the success rate of template matching and the efficiency of configuration scheme generation. Furthermore, when a configuration at a certain level needs updating, such as adding a new vehicle platform, only the corresponding template level needs to be maintained, without reconstructing the entire template library, thus reducing the maintenance cost of the template library.
[0020] Optionally, based on the initial environment configuration scheme and preset constraints, the resources in the established hardware resource pool are orchestrated to generate a resource binding list, including: establishing a digital mirror of the hardware resource pool, which includes at least one of real-time simulator computing power resources, I / O board resources, bus interface resources, fault injection unit resources, and load cell resources; modeling the resource allocation problem as a constraint satisfaction problem, using the resource requirements in the initial environment configuration scheme as variables, the available resources in the hardware resource pool as the value domain, and the preset constraints as constraints; and using a preset orchestration algorithm to generate the resource binding list; wherein the preset constraints include at least one of real-time constraints, physical connection constraints, and resource conflict constraints.
[0021] In this embodiment, various hardware resources, such as computing power, boards, buses, FIUs (Fault Injection Units), and load cells, are uniformly abstracted into digital images. This allows the system to perceive the model, quantity, capacity, channel status, and electrical characteristics of each type of resource in real time. It integrates heterogeneous hardware resources, originally scattered across different devices, boards, and slots, into a unified resource view, providing a data foundation for subsequent automated orchestration. Simultaneously, the digital image method enables the system to complete resource querying, filtering, and allocation decisions without physical contact with the hardware, eliminating information lag and recording errors caused by manually consulting hardware manuals and manually recording channel occupancy status. The engineering problem of resource allocation is transformed into a mathematical model of constraint satisfaction (CSP). Each resource requirement in the configuration scheme corresponds to a variable, each available physical resource in the hardware resource pool corresponds to a candidate value of this variable, and preset constraints limit the legal combinations of variable values. This transforms the resource allocation process, which originally relied on subjective judgment and trial-and-error verification by engineers, into a mathematical problem that can be precisely solved on a computer. Formal modeling of constraint satisfaction problems allows for precise definition of all feasible and infeasible solutions, avoiding the uncertainties caused by manual allocation. This ensures that the final resource binding list mathematically satisfies all pre-defined constraints. Based on this modeling, pre-defined orchestration algorithms are invoked, such as backtracking search combined with constraint propagation, or heuristic algorithms like genetic algorithms / simulated annealing, to search a vast search space for resource allocation schemes that satisfy all constraints. Scheme optimization aims to maximize resource utilization and optimize constraint satisfaction. Thus, when faced with resource allocation problems involving dozens of signal requirements, hundreds of available channels, and complex constraint combinations, the algorithm can provide optimal or near-optimal allocation schemes within an acceptable timeframe. Compared to manual trial and error and conflict checking across numerous boards and channels, this significantly improves the efficiency and quality of resource allocation, avoiding suboptimal allocations or resource waste caused by the inability of manual exploration of all combinations. Among these constraints, real-time constraints ensure that the computational step size, multi-core allocation, and FPGA (Field-Programmable Gate Array) resources of the simulation model meet deterministic latency requirements; physical connectivity constraints ensure the feasibility of physical aspects such as board slot adjacency, wiring harness length, and signal isolation; and resource conflict constraints ensure that the same channel is not repeatedly occupied and the total power of the same board does not exceed the limit. In this way, the system can automatically eliminate allocation schemes that do not meet the above constraints during the resource orchestration stage, avoiding problems such as simulation interruptions due to insufficient real-time performance, signal quality degradation due to unreasonable physical connections, and equipment damage due to resource conflicts after actual deployment, thus improving the stability and reliability of the testing environment from the source.
[0022] Optionally, after the target machine is deployed, the debugging steps include: sequentially performing signal mapping verification, analog quantity calibration, bus handshake verification, and fault injection verification; wherein, the signal mapping verification includes: injecting a standard excitation signal into the deployed model port, the standard excitation signal including a sine wave signal, a step signal, or a frequency sweep signal; acquiring the actual output signal through the I / O retrieval channel; calculating the correlation between the theoretical output and the actual output of the model port; when the correlation meets the correlation threshold, the signal mapping is determined to be correct.
[0023] In this embodiment, the debugging operations that previously relied on engineers' individual experience and fragmented responses to problem symptoms are solidified into a standardized debugging sequence executed sequentially. Signal mapping verification confirms the correctness of physical connections, analog calibration corrects channel accuracy deviations, bus handshake verification verifies the availability of the communication link, and fault injection verification confirms the effectiveness of the fault simulation function. These four verification steps are executed sequentially according to logical dependencies; the success of one verification is a prerequisite for the success of the next. This structured debugging process prevents engineers from overlooking key verification steps due to lack of experience or skipping pre-checks due to misjudgment, thus ensuring the completeness and logical rigor of the debugging work.
[0024] The signal mapping verification specifically includes: injecting standard excitation signals with defined mathematical characteristics into the output port of the simulation model; sine waves have fixed frequency and amplitude, step signals have defined amplitude changes, and sweep signals cover a continuous frequency range; and acquiring the actual output signals through the physical I / O acquisition channel, which pass through the complete transmission link, i.e., model output, physical board output, wiring harness transmission, physical board input, and back to model acquisition. The mathematical characteristics of the standard excitation signals are known and precisely controllable, allowing the theoretical output value to be accurately calculated in advance, and the acquired actual output value to be accurately compared with it. Simultaneously, different types of standard excitation signals can detect different types of mapping errors. For example, sine waves and sweep signals are suitable for detecting signal amplitude deviation, phase shift, and frequency response anomalies, while step signals are suitable for detecting signal polarity reversal and response delay, thus achieving a comprehensive verification of the signal mapping correctness.
[0025] Furthermore, the correlation between the theoretical output signal sequence and the actual acquired signal sequence is calculated, for example, by calculating the Pearson correlation coefficient, to obtain a quantitative index between -1 and 1. When this index is higher than a preset threshold, the mapping is considered correct. Correlation analysis can comprehensively evaluate the similarity between the two sets of signals in multiple dimensions such as amplitude variation trend, phase consistency, and waveform morphology, eliminating the uncertainty of subjective judgment.
[0026] Optionally, the analog calibration includes: controlling the deployed model to output known voltage or current values covering the entire range; acquiring measured values through I / O sampling channels; fitting the transfer function between the known values and the measured values using the least squares method; generating calibration coefficients based on the fitting results; and writing the calibration coefficients into a configuration file.
[0027] In this embodiment, the control simulation model sequentially outputs known voltage or current values covering the entire operating range, from the lower to the upper limit, as standard reference signals for calibration. By systematically sampling multiple calibration points across the entire range, the subsequently fitted transfer function accurately reflects the channel's input-output characteristics throughout the entire operating interval, avoiding potential local calibration deviations that may occur when relying on single or a small number of calibration points. The actual signal values reaching the controller under test are acquired through physical I / O sampling channels. End-to-end measured value acquisition accurately reflects the signal quality actually acting on the controller under test, ensuring that the calibrated signal accuracy meets actual testing requirements. Using known and measured data pairs from multiple calibration points across the entire range, the actual transfer function is fitted using the least squares method. The least squares method fully utilizes data from all calibration points to find the transfer function parameters that minimize the sum of squared overall fitting errors across the entire measurement range. This avoids the problem of excessive deviation in the intermediate range that may occur when performing linear calibration based solely on endpoint values. Simultaneously, the fitted transfer function can accurately describe the channel's nonlinear characteristics and gain / offset deviation using precise mathematical expressions, providing an accurate mathematical model foundation for the subsequent precise calculation of calibration coefficients. Based on the fitted transfer function, calibration coefficients that precisely correspond to the command output values, such as gain correction coefficients and offset compensation values, are calculated and automatically written to the environment configuration file. Once the calibration coefficients are written to the configuration file, the correction parameters can be automatically applied in subsequent tests without repeating the calibration, further improving the reusability of the test environment and calibration efficiency.
[0028] Optionally, the bus handshake verification includes: monitoring bus messages, extracting message period, message ID sequence, ACK response status, and service discovery status; calculating a communication health score based on the deviation between the message period and a preset period, the ACK response status, and the service discovery status; and determining that the communication link is abnormal when the communication health score is less than a score threshold.
[0029] In this embodiment, communication messages on the bus are monitored in real time, and four key communication features are extracted from the original message stream: message period reflects whether each node sends messages normally according to the preset time interval; message ID order reflects whether message scheduling on the bus follows the predetermined priority or timetable; ACK response status reflects whether the receiving node correctly acknowledges receiving the message; and service discovery status reflects whether the service provider has registered normally and whether the service consumer can discover the required service normally in service-based communication. By simultaneously monitoring and extracting features from multiple dimensions, the system can comprehensively capture the operating status of the bus communication link, avoiding other types of communication anomalies that may be missed when monitoring only a single dimension, and providing multi-dimensional feature data support for subsequent communication health assessment.
[0030] The extracted multidimensional communication features are comprehensively calculated into a quantitative communication health score according to preset scoring rules and weights. This quantitative scoring method allows the health status of the communication link to be accurately expressed by a definite numerical value, such as 0-100, eliminating the ambiguity and uncertainty of subjective judgment.
[0031] The calculated health score is compared with a preset score threshold. When the score is below the threshold, the communication link is automatically identified as abnormal. Compared to the passive discovery of communication problems by manually observing message windows or waiting for test cases to fail, the automatic judgment mechanism can issue an indication at an early stage of the problem, buying time for subsequent diagnosis and repair processes and preventing communication anomalies from interfering with subsequent debugging and testing processes if they are not detected.
[0032] Optionally, the fault injection verification includes: sequentially triggering each fault injection channel, wherein the injected fault type includes at least one of hard short circuit, soft short circuit, open circuit, signal crosstalk, and signal drift; monitoring the diagnostic fault code or model feedback signal reported by the controller under test; and verifying whether the diagnostic fault code or model feedback signal matches the injected fault type.
[0033] In this embodiment, each fault injection channel is triggered sequentially, and the injected fault types cover common fault modes in HiL testing: hard short circuit, soft short circuit, open circuit, signal crosstalk, and signal drift. By programmatically controlling the traversal of all fault injection channels, automated testing of each fault injection point can be completed without human intervention, avoiding repetitive manual operations of manually setting, triggering, and restoring faults one by one. Simultaneously, the comprehensive coverage of multiple fault types ensures that the functional integrity of each channel and fault mode of the fault injection unit is systematically verified, avoiding test blind spots caused by the failure to detect a certain fault type.
[0034] The system monitors the response to injected faults on either the controller under test (DUT) or the model side. Diagnostic fault codes reported by the controller are read via diagnostic communication, or the state feedback signals within the model are monitored. This establishes a closed-loop monitoring link from fault injection to fault response, enabling the system to objectively determine whether the DUT has sensed the simulated fault state. Compared to a crude verification method that only verifies the electrical continuity of the fault injection channel while ignoring the actual response of the controller, the closed-loop monitoring method disclosed herein truly reflects the effectiveness of the fault injection configuration in actual testing.
[0035] Furthermore, the detected diagnostic fault codes or model feedback signals are matched and verified with the injected fault types. For example, when an accelerometer drift fault is injected, the controller is expected to report a corresponding reasonable fault code; when an open circuit fault is injected, a circuit abnormality fault code is expected to be reported. In this way, the verification process, which originally required engineers to consult fault code tables and make manual comparisons, is transformed into a pattern matching judgment automatically completed by the system; and the quantitative matching results eliminate the subjectivity and possible misjudgment of manual judgment.
[0036] Optionally, the debugging steps also include: when a debugging anomaly is detected, retrieving records in the historical problem knowledge base that match the current anomaly features; if the match is successful, obtaining the root cause and solution; when the match is unsuccessful, vectorizing the current anomaly features and comparing their similarity with historical cases in the historical problem knowledge base, returning a preset number of records with the highest similarity as suspected causes.
[0037] In this embodiment, when a debugging anomaly occurs, the system uses the characteristics of the current anomaly, such as error codes, anomaly signal characteristics, and error keywords, as search criteria to perform a precise matching search in the historical problem knowledge base. This allows for rapid identification of the root cause and acquisition of verified solutions, significantly improving the efficiency of problem investigation.
[0038] When exact matching yields no results (i.e., the error code and keywords of the current problem are different from any problem in the history), the abnormal features are transformed into high-dimensional vectors (e.g., using TF-IDF weighted or semantic embedding models, and their similarity is calculated one by one with the feature vectors of each historical case in the knowledge base). From these, a predetermined number of records with the highest similarity are selected and recommended to engineers as a reference for troubleshooting. Thus, even when exact matching fails, the system can still extract historical cases with similar features from the knowledge base through semantic-level similarity analysis of fault symptom text, error log patterns, and abnormal signal characteristics. This provides engineers with valuable troubleshooting directions and solutions, significantly narrowing the scope of troubleshooting when facing unknown problems.
[0039] Optionally, after debugging is complete, the process also includes performing integrity checks and smoke tests.
[0040] In this embodiment, after debugging and before environment delivery, a comprehensive verification is performed on all configuration items of the test environment. This includes verifying whether all model input ports are fully bound, whether there are conflicts in I / O channels, whether the fault injection security interlock strategy is effective, and the integrity and correctness of communication messages. This systematic review of all configuration items before the environment configuration file is officially put into use ensures that any repairs or adjustments made during debugging do not introduce new configuration omissions or conflicts, thus improving the reliability of the delivered environment.
[0041] After the integrity verification is passed, a set of preset smoke test cases are executed. For example, power-on self-test cases verify the communication and initialization status of the device, static function verification cases check whether the signal injection and acquisition links are normal, and basic dynamic function verification cases check whether the closed-loop control loop is working. These are used to quickly verify whether the core functions of the test environment are normal and usable, so as to discover and intercept integration problems that were not exposed during the debugging phase before the environment is delivered.
[0042] Integrity verification and smoke testing are performed as two sequential verification phases. Integrity verification precedes it, confirming from a static perspective that all configuration items meet expectations; smoke testing follows, confirming from a dynamic operational perspective that the environment functions normally under real-world working conditions. In this way, integrity verification quickly identifies configuration defects, while smoke testing further verifies the performance of the configuration in real-world operating scenarios. The two layers of verification complement each other, jointly providing comprehensive assurance for environment quality and improving the reliability and availability of the delivered test environment.
[0043] Optionally, the environment configuration file includes: a dynamic model file, I / O configuration parameters, a communication database file, a calibration parameter file, a fault injection strategy matrix, and a harness definition file.
[0044] In this embodiment, all configuration content involved in the constructed HiL test environment is classified and archived according to file type. Specifically: the dynamics model file contains the executable programs and related parameters of the simulation models of vehicle dynamics, subsystems, etc., and is the core of the environment simulation capability; the I / O configuration parameters record the mapping relationship between all physical channels and model signals, as well as the channel electrical characteristic settings, and are the basis for signal interconnection; the communication database file contains all the protocol definitions for bus communication and is the basis for communication interaction; the calibration parameter file records the accuracy correction data such as channel calibration coefficients, ensuring signal accuracy; the fault injection strategy matrix defines the fault type, parameters, and triggering conditions of each fault channel, and is the configuration carrier for fault simulation capability; the harness definition file records the physical harness labels and electrical connection definitions corresponding to each signal, and is the standard basis for hardware wiring.
[0045] The environment configuration file fully records all configuration information used in the test, including the model version, mapping relationship, communication protocol, calibration parameters, etc., so that the environment configuration corresponding to any test can be traced and reviewed, meeting the compliance requirements of functional safety audit for reproducible and traceable environment configuration.
[0046] In some embodiments, a hardware-in-the-loop testing environment construction system is provided, comprising: a parsing module configured to acquire test requirements, parse the test requirements, and extract test elements; a template management module configured to match the test elements in a preset template library to generate an initial environment configuration scheme; a resource allocation module configured to orchestrate resources in an established hardware resource pool based on the initial environment configuration scheme and preset constraints to generate a resource binding list; a test project generation module configured to execute model deployment, I / O configuration, communication configuration, and fault injection configuration in parallel according to the resource binding list to generate an executable test project; and a verification module configured to deploy the executable test project on a target machine, debug it, and then generate an environment configuration file.
[0047] In some embodiments, an apparatus for building a hardware-in-the-loop test environment is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the hardware-in-the-loop test environment building method as described in any of the above embodiments.
[0048] The hardware-in-the-loop testing environment construction method, system, and apparatus provided in this disclosure can achieve the following technical effects: By automatically parsing test requirements, automatically matching templates, automatically orchestrating resources, executing deployment tasks in parallel, and quickly retrieving and reusing the knowledge base when debugging exceptions, the HiL test environment achieves full automation from requirement input to executable environment delivery. This eliminates inefficient steps such as manual configuration, manual resource lookup, sequential deployment, and repeated trial and error troubleshooting, thereby improving the efficiency of environment setup.
[0049] By extracting test elements in a structured manner, reusing knowledge from a hierarchical template library, automating resource orchestration under multiple constraints, systematically reviewing all configuration items through integrity checks, and rapidly verifying basic functions through smoke testing, the environment configuration scheme fully covers test requirements. Hardware resource allocation meets multi-dimensional constraints such as real-time performance, physical connectivity, and resource conflict avoidance. The delivered environment configuration is correct, complete, and usable, eliminating random errors and individual differences caused by manual operation, and ensuring high consistency and reliability of test environments built by different projects and engineers.
[0050] The debugging engine automates the verification and calibration of signal mapping correctness, analog quantity accuracy, bus communication health, and fault injection function effectiveness. It transforms the qualitative debugging process, which originally relied on engineers manually using tools such as multimeters and oscilloscopes, into a quantitative judgment process that is automatically completed by the computer. Through a two-level intelligent analysis strategy, it retrieves the root causes and solutions of known problems from the historical knowledge base, or recommends similar cases as troubleshooting references for unknown problems. It systematically precipitates successful experiences into reusable knowledge assets, reduces reliance on the personal experience of senior engineers, shortens the problem troubleshooting cycle, and enables the continuous accumulation and team sharing of debugging knowledge.
[0051] The dynamic model file, I / O configuration parameters, communication database file, calibration parameter file, fault injection strategy matrix, and harness definition file are all archived into an environment configuration file, which fully records all configuration information of the test environment. This allows the test environment to be accurately restored at any point in time, ensuring that the same test case faces a completely consistent environment configuration when executed at different times. At the same time, it provides a complete chain of configuration evidence for compliance with functional safety standards' requirements for test traceability.
[0052] The above general description and the description below are exemplary and illustrative only and are not intended to limit this application. Attached Figure Description
[0053] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations and drawings do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are shown as similar elements. The drawings are not to be scaled. And wherein: Figure 1 This is a schematic diagram of a method for building a hardware-in-the-loop testing environment according to an embodiment of this disclosure; Figure 2 This is a schematic diagram of a method for building a hardware-in-the-loop testing environment according to another embodiment of this disclosure; Figure 3 This is a schematic diagram of the hardware-in-the-loop testing environment construction system provided in the embodiments of this disclosure; Figure 4 This is a schematic diagram of a hardware-in-the-loop testing environment setup device provided in an embodiment of this disclosure. Detailed Implementation
[0054] To provide a more detailed understanding of the features and technical content of the embodiments of this disclosure, the implementation of the embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for illustrative purposes only and are not intended to limit the embodiments of this disclosure. In the following technical description, for ease of explanation, several details are used to provide a full understanding of the disclosed embodiments. However, one or more embodiments may still be implemented without these details. In other cases, well-known structures and devices may be simplified in their depiction to simplify the drawings.
[0055] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this disclosure described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.
[0056] Unless otherwise stated, the term "multiple" means two or more.
[0057] In this embodiment of the disclosure, the character " / " indicates that the objects before and after it are in an "or" relationship. For example, A / B means: A or B.
[0058] The term "and / or" describes an association between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or A and B.
[0059] The term "correspondence" can refer to an association or binding relationship. The correspondence between A and B means that there is an association or binding relationship between A and B.
[0060] In some embodiments, combined with Figure 1 As shown, a method for setting up a hardware-in-the-loop test environment is provided, including: S101, Obtain test requirements, analyze test requirements, and extract test elements.
[0061] In this process, test engineers input structured requirements through an interactive interface and extract key test elements using a built-in parsing engine. Test elements include at least one of the following: type of controller under test, test scenario category, simulation model requirements and version requirements, number and type of I / O channels, communication bus type and baud rate, and fault injection requirements.
[0062] The type of controller under test is such as a suspension control module. Side-test scenarios include, but are not limited to, functional testing, fault diagnosis testing, and performance calibration testing. Simulation model requirements include, but are not limited to, vehicle dynamics, air spring thermodynamics, and road surface unevenness generation. Fault injection requirements include, but are not limited to, fault type, triggering conditions, and duration.
[0063] S102, based on the test elements, matches them in the pre-set template library to generate an initial environment configuration scheme.
[0064] In this step, the matching degree between the parsed test elements and the feature vectors of each template in the pre-set template library is calculated; the template with the highest matching degree is selected as the benchmark template; when the matching degree is lower than a preset threshold, the template adaptive adjustment process is triggered, and configuration parameters are recommended based on historical similar project data to adaptively adjust the benchmark template and generate an initial environment configuration scheme. The initial environment configuration scheme includes a complete signal-port mapping table.
[0065] The pre-built template library includes at least one of the following: vehicle platform templates, controller-specific templates, and general I / O mapping templates.
[0066] For example, based on the interface control file (ICD) of SCM version V1.8, the altitude sensor signal is updated from "analog voltage type" in the original template to "PSI5 digital type", a LIN bus configuration is added, the air spring air circuit parameters are adjusted to match the air tank volume of the new model, and finally an initial environment configuration scheme containing a complete signal-port mapping table is generated.
[0067] S103, based on the initial environment configuration scheme and preset constraints, arranges the resources in the established hardware resource pool and generates a resource binding list.
[0068] Optionally, based on the initial environment configuration scheme and preset constraints, the resources in the established hardware resource pool are orchestrated to generate a resource binding list, including: establishing a digital mirror of the hardware resource pool, which includes at least one of real-time simulator computing power resources, I / O board resources, bus interface resources, fault injection unit resources, and load box resources; modeling the resource allocation problem as a constraint satisfaction problem, using the resource requirements in the initial environment configuration scheme as variables, the available resources in the hardware resource pool as the value domain, and preset constraints as constraints; and using a preset orchestration algorithm to generate a resource binding list; wherein the preset constraints include at least one of real-time constraints, physical connection constraints, and resource conflict constraints.
[0069] In this embodiment, resources in the established hardware resource pool are orchestrated based on the initial environment configuration scheme and preset constraints. Specifically: Establish a digital mirror of the hardware resource pool, including: real-time emulator computing resources, such as the number of CPU cores, memory, and FPGA resources; I / O board resources, such as model, number of channels, and occupied / idle status; bus interface resources, such as the number of CAN channels and Ethernet ports; fault injection unit resources, load cell resources, etc.
[0070] The resource allocation problem is modeled as a constraint satisfaction problem (CSP), with the resource requirements in the initial environment configuration scheme as variables, the available resources in the hardware resource pool as the value domain, and preset constraints as constraints. The preset constraints include at least one of the following: real-time constraints, physical connectivity constraints, and resource conflict constraints.
[0071] Among them, the real-time constraint refers to the requirement that the calculation step size of the dynamic model must be ≤0.5ms, a dedicated CPU core must be allocated, and the upper limit of FPGA resource capacity.
[0072] Physical connection constraints refer to the requirement that the length of the accelerometer harness be less than 3m, and that the board be assigned to a slot close to the harness interface; the high-frequency I / O board should be kept at a distance from the FIU board to avoid crosstalk.
[0073] Resource conflict constraints refer to the prohibition of multiple signals occupying the same channel at the same time; and the total power of the same board not exceeding the rated value.
[0074] The algorithm selection process employs either backtracking search combined with constraint propagation or genetic algorithm / simulated annealing.
[0075] One example employs a backtracking search combined with a constraint propagation algorithm to solve the problem, aiming to maximize resource utilization and optimize constraint satisfaction, thereby generating a resource binding list. For instance, the orchestration result is as follows: CPU cores 0-2 run suspension dynamics, core 3 runs the air path model and LIN protocol stack; the IO135 board is allocated 8 channels of high-frequency AI acceleration signals; and the FIU board is allocated a fault injection channel.
[0076] S104, based on the resource binding list, executes model deployment, I / O configuration, communication configuration and fault injection configuration in parallel to generate an executable test project.
[0077] In this embodiment, each configuration subtask synchronizes its execution status via a message bus. When any subtask fails, a compensation mechanism is triggered to automatically roll back the completed associated configurations.
[0078] Specifically, model deployment includes: pulling matching simulation models, such as suspension models and air spring thermodynamic models, from a Git repository (version control repository) or automatically pulling them from a model library. Model parameters are then populated according to testing requirements. The Simulink / FMU (Functional Mock-up Unit) model is compiled into a real-time simulator executable file, and static validation is performed.
[0079] I / O configuration includes: automatically processing interface definition files, such as DBC (DatabaseContainer) and ARXML files, through a built-in parser to extract signal information and form a unified dictionary; using an intelligent mapping algorithm to automatically match model ports with physical channels in the resource binding table; and generating harness labels and marking electrical characteristics.
[0080] Communication configuration includes: automatically importing the DBC database, configuring message transmission and reception cycles, initial signal values, and gateway routing relationships; configuring LIN slave addresses, synchronization break field lengths, and verification methods; and configuring UDS (Unified Diagnostic Services) session layer parameters.
[0081] Fault injection configuration includes: configuring the FIU matrix, specifically automatically configuring fault types according to fault requirements, including but not limited to hard short circuit / soft short circuit, open circuit, signal drift, and bus fault; configuring fault parameters; and configuring safety interlocking policies.
[0082] S105 deploys the executable test project to the target machine, and after debugging, generates an environment configuration file.
[0083] In this embodiment, the target machine is deployed based on the executable test project. After the model is downloaded, multi-core allocation is completed, step size is configured, and power-on deployment is completed, the debugging process is automatically triggered, and signal mapping verification, analog quantity calibration, bus handshake verification, and fault injection verification are executed in sequence.
[0084] Optionally, after the target machine is deployed, the debugging steps include: sequentially performing signal mapping verification, analog quantity calibration, bus handshake verification, and fault injection verification; The signal mapping verification includes: injecting standard excitation signals into the deployed model ports, including sine wave signals, step signals, or frequency sweep signals; acquiring actual output signals through I / O retrieval channels; calculating the correlation between the theoretical output and the actual output of the model ports; and determining that the signal mapping is correct when the correlation meets the correlation threshold.
[0085] In this embodiment, injecting a standard excitation signal into the model port of the deployed simulation model means that the system actively controls the model port to output a signal waveform with deterministic mathematical characteristics. The standard excitation signal includes a sine wave signal, a step signal, or a swept-frequency signal. The sine wave signal has a known frequency, amplitude, and phase, used to detect amplitude deviation and phase shift. The step signal has a known amplitude change and change time, used to detect the polarity and response time of the signal. The swept-frequency signal has a frequency that changes linearly with time, used to detect the amplitude / phase response of the signal at different frequencies. The standard excitation signal output by the model is collected back to the system by the I / O sampling channel after a complete physical transmission link. The correlation between the theoretical output and the actual output of the model port is calculated. That is, when the characteristic change trends of the two signals are consistent, such as rising simultaneously, falling simultaneously, or reaching peak values simultaneously, their correlation coefficient is close to 1; when the change trends of the two signals are completely opposite, such as the theoretical output rising but the actual output falling, the correlation coefficient is close to -1; when the two signals are completely unrelated, the correlation coefficient is close to 0. For sinusoidal or swept-frequency signals, the correlation coefficient assesses the overall matching degree of amplitude ratio, phase shift, and waveform shape. For step signals, the correlation coefficient mainly reflects whether the polarity is correct; if correct, the correlation coefficient > 0, and if the polarity is reversed, the correlation coefficient < 0. The specific setting of the correlation threshold depends on the specific signal type and is not specifically limited here.
[0086] Optionally, analog calibration includes: controlling the deployed model to output known voltage or current values covering the entire range; acquiring measured values through I / O sampling channels; fitting the transfer function between known and measured values using the least squares method; generating calibration coefficients based on the fitting results; and writing the calibration coefficients into a configuration file.
[0087] In this embodiment, the deployed simulation model is controlled to output known voltage or current values covering the entire range point by point, for example, the PWM duty cycle gradually increases from 0% to 100%. Each set of theoretical output values and the corresponding channel's actual physical quantity value constitutes a calibration point data pair. Using all calibration point data pairs collected across the entire range as input, the least squares method is used to fit the actual transfer function, thus establishing a precise mathematical relationship between the command value and the actual output value. During the fitting process, the system automatically identifies the nonlinear characteristics of the channel. For example, when the command value is less than 10% of the range, the actual output change is disproportionate to the command value change, which is called the "dead zone"; when the command value is greater than 90% of the range, the actual output tends to saturate and no longer increases with the command value, which is called the "saturation zone". After obtaining the accurate transfer function, the system reverse-engineers the calibration coefficients required to make the actual output value exactly equal to the command value, including the gain correction coefficient and the offset compensation value, and writes the calibration coefficients into the environment configuration file in a lookup table format.
[0088] Optionally, bus handshake verification includes: monitoring bus messages, extracting message period, message ID sequence, ACK response status and service discovery status; calculating a communication health score based on the deviation between the message period and a preset period, the ACK response status and the service discovery status; and determining that the communication link is abnormal when the communication health score is less than the score threshold.
[0089] In this embodiment, after the target machine is deployed, handshake verification is automatically performed on various buses. For the LIN bus, the system, acting as the LIN master node, sends a header to verify whether the slave node responds within a preset time period, such as 150μs, and whether the data field checksum is correct. For the CAN FD bus, the system monitors the life signals periodically sent by the controller under test, verifies whether the actual message transmission period deviates from the preset period, such as 20ms, within ±2%, and checks whether the BRS bit of the CAN FD is correctly set to confirm that the bit rate switching function is normal. For UDS diagnostic communication, the system automatically sends a diagnostic request to verify whether the controller under test responds with an acknowledgment message within the P2 time, such as 50ms, confirming that the diagnostic link is available. During the above verification process, the system simultaneously evaluates the bus communication status from multiple dimensions, including message period stability, ID sequence correctness, ACK response status, and service discovery status, and calculates a comprehensive communication health score.
[0090] Optionally, fault injection verification includes: sequentially triggering each fault injection channel, injecting fault types including at least one of hard short circuit, soft short circuit, open circuit, signal crosstalk, and signal drift, monitoring the diagnostic fault code or model feedback signal reported by the controller under test; and verifying whether the diagnostic fault code or model feedback signal matches the injected fault type.
[0091] In this embodiment, each fault injection channel is triggered sequentially according to the configuration of the fault injection strategy matrix. The injected fault types include hard short circuit (signal line directly shorted to power supply or ground), soft short circuit (short-circuited through a certain impedance), open circuit (signal line completely disconnected), signal crosstalk (coupling interference between adjacent signal lines), and signal drift (signal value slowly deviating from the normal range). For each fault injection, after the fault injection operation is performed, the diagnostic fault code reported by the controller under test is read through diagnostic communication, or the status feedback signal inside the model is monitored to check whether the monitoring results match the injected fault type. For example, when injecting an accelerometer drift of +0.5g, the controller is expected to report the longitudinal accelerometer rationality fault code C0154 within 100ms; when injecting an open circuit in the damping valve drive, the PWM drive current sampling value is expected to drop to 0A and the controller is expected to report the solenoid valve open circuit fault code C1A20 within 20ms.
[0092] Optionally, the debugging steps also include: when a debugging anomaly is detected, retrieving records in the historical problem knowledge base that match the current anomaly features; if a match is successful, obtaining the root cause and solution; if no match is found, vectorizing the current anomaly features and comparing their similarity with historical cases in the historical problem knowledge base, returning a preset number of records with the highest similarity as suspected causes.
[0093] In this embodiment, during the verification process described above, a diagnostic and repair process is triggered when any debugging anomaly is detected. The diagnostic process employs a two-level intelligent analysis strategy: the first level is precise matching, where the system uses the error code, anomaly signal characteristics, or key error keywords of the current anomaly as search criteria to perform a precise search in the historical problem knowledge base. If a precise match is successful, the root cause analysis results and verified solutions for that historical record are directly returned. If no precise match is found, the second level of fuzzy inference is initiated: the complete features of the current anomaly, including error log text, anomaly signal patterns, and contextual information, are converted into high-dimensional feature vectors using TF-IDF weighted or BERT semantic embedding models, and their cosine similarity is calculated with the feature vectors of each historical case in the historical knowledge base. A preset number of records with the highest similarity are selected and recommended to engineers as a reference for troubleshooting. After the diagnosis is completed, if the matched historical case is associated with a repair script, such as "reset controller configuration," "reload model parameters," or "modify a line of parameters in the configuration file," the system automatically executes the repair script after obtaining user authorization, attempting to restore the environment to a normal state.
[0094] In some embodiments, combined with Figure 2 As shown, a method for setting up a hardware-in-the-loop test environment is provided, including: S201, Obtain test requirements, analyze test requirements, and extract test elements.
[0095] S202, based on test elements, matches them in the pre-set template library to generate an initial environment configuration scheme.
[0096] S203, based on the initial environment configuration scheme and preset constraints, orchestrates the resources in the established hardware resource pool and generates a resource binding list.
[0097] S204, based on the resource binding list, executes model deployment, I / O configuration, communication configuration and fault injection configuration in parallel to generate an executable test project.
[0098] S205 is used to deploy and debug the target machine based on the executable test project.
[0099] S206, after performing integrity verification and smoke test, generates environment configuration file.
[0100] Optionally, integrity checks are performed, including: performing multiple integrity checks based on a predefined checklist; specifically, checking whether all model input ports are fully bound to physical channels without omissions; checking whether all I / O channels are independently allocated, with no conflict of two signals being assigned to the same channel; checking whether the fault injection safety interlock strategy is configured and logically correct, for example, preventing the inflation and deflation valves of the same air spring from opening simultaneously; and checking whether each message and signal defined in the communication database has a corresponding configuration record. If any check fails, the corresponding configuration defect is marked and an error report is generated, prompting engineers to correct it and re-execute the debugging process. Compared to manual checklist checks, this eliminates the risk of missed configuration errors due to oversights. Furthermore, it allows for early detection of problems during the verification phase rather than waiting until the test execution phase, significantly shortening the feedback cycle between problem discovery and correction, and reducing the cost of test interruptions due to configuration issues.
[0101] Optionally, a smoke test is performed, including: after the integrity verification passes, executing a preset set of smoke test cases. The smoke test is divided into two phases: the static test phase, which executes power-on self-test cases to verify whether the readings of each sensor after the controller under test are within the expected tolerance range, such as zero bias of the accelerometer <0.05g and height sensor reading tolerance ±2mm, verifying that the basic signal link of the environment and the communication status of the controller are normal. The dynamic test phase, which executes preset basic dynamic test cases, such as driving the whole vehicle dynamics model at a constant speed of 60km / h on a Class C road for 30 seconds to verify that the root mean square value of the vehicle body acceleration is less than 0.8m / s²; triggering the welcome mode, such as verifying that the time required for the vehicle body height to adjust from the normal mode to the welcome mode is less than 5 seconds, and the synchronization error of the front and rear axle attitudes is less than 5mm. The smoke test quickly verifies the usability of the environment with minimal time cost, confirming that the environment has the basic capability to be put into actual testing, rather than waiting until the complete regression test passes to know whether the environment is functioning normally. Static testing verifies the basic connectivity of the signal link and the normal initial state of the controller; dynamic testing verifies that the closed-loop control loop can work normally under actual operating conditions. The two together constitute a complete availability verification.
[0102] Optionally, the environment configuration file includes: a dynamic model file, I / O configuration parameters, a communication database file, a calibration parameter file, a fault injection strategy matrix, and a harness definition file.
[0103] In this embodiment, after all smoke tests pass, the following content is packaged into a single, immutable environment image file: vehicle dynamics model, I / O configuration parameters, communication database file, calibration parameter file, fault injection strategy matrix, and wiring harness definition file. The system attaches a digital signature to the image to verify its integrity and authenticity, ensuring the image content has not been tampered with and that the version number is correct. An environment configuration file is then generated and stored in an environment repository for unified management. By archiving the scattered configuration files, the system ensures that all configuration information of the environment is completely preserved, searchable, and accessible, avoiding version confusion and loss issues caused by scattered configuration files. The immutable image ensures that the environment is locked once generated and cannot be modified or overwritten by subsequent operations. This guarantees complete consistency of the environment state when the same image is accessed at different times, improving the comparability of test results.
[0104] Optionally, after the environment image is successfully stored in the environment repository, an environment configuration file is sent to the test execution system, such as a TMS (Test Management System), TestStand, or other continuous integration platform, via an API (Application Programming Interface). This configuration file carries key information such as the environment image version number, storage path, and applicable test case scope. Upon receiving the environment configuration file, the test execution system can either initiate subsequent automated testing processes or wait for test engineers to manually invoke the environment image for testing within the system.
[0105] In some examples, the hardware-in-the-loop (HIL) test environment construction method described in any of the above embodiments is used to automate the construction of the HIL test environment for the electronic suspension controller. The vehicle model used in this embodiment is equipped with a combined air spring and continuously damped control shock absorber suspension system, requiring hardware-in-the-loop testing of the suspension control module. The test verification objectives include: verification of the roof damping control algorithm, automatic vehicle height adjustment, adaptive filtering of road unevenness, and verification of sensor and actuator fault diagnosis functions. The steps for building the HIL test environment for the electronic suspension controller include: Test engineers input structured test requirements through the system's web interface, which specifically include the following aspects: Test component specifications: SCM_V1.8 suspension control module, supporting 4-channel CAN FD communication and 2-channel LIN communication.
[0106] Test types: functional testing, fault diagnosis testing, and objective evaluation of comfort.
[0107] The simulation model requirements include: a whole vehicle dynamics model, including an air spring thermodynamic sub-model and a CDC (Continuous Damping Control) solenoid valve hydraulic sub-model; a road surface unevenness generation model, supporting Class C road surfaces, speed bumps, and sinusoidal sweep frequency input; and a vehicle height adjustment air circuit model, including a compressor, air tank, and inflation / deflation valve.
[0108] Version and computing power requirements: The model version must be no lower than v3.5, supporting real-time multi-core parallel computing, with no less than 3 CPU cores.
[0109] I / O interface requirements: 8 high-frequency analog inputs; 4 general analog inputs; 4 PWM outputs; 8 digital outputs, namely 4 air spring charging / discharging solenoid valves, 2 compressor relays, and 2 pressure relief valves; 2 resistance simulations for simulating grounding faults of the altitude sensor; 4 CAN FDs, namely chassis CAN, comfort CAN, diagnostic CAN, and private sensor CAN; 2 LINs for the altitude sensor local bus.
[0110] Fault injection requirements: Vehicle acceleration signal drift, used to simulate sensor aging, offset ±0.5g; height sensor open circuit / short circuit to ground; CDC damping valve drive open circuit; air spring inflation valve stuck; chassis CAN bus Bus-Off fault.
[0111] Furthermore, after completing the requirements analysis, the system uses the analyzed test elements as matching conditions to search the pre-set template library. The system matched the "Intelligent Suspension_SCM_HIL_Advanced" template, with a matching degree of 88%. This template predefines the following: the vehicle suspension topology; the standard sensor layout matrix, with a symmetrical layout of four channels: front left / front right / rear left / rear right; the basic PWM mapping relationship, and the control channel allocation for the damping valves of the four wheels: front left / front right / rear left / rear right; standard fault injection points, acceleration channel FIU access point, height sensor power supply monitoring point, and solenoid valve current sampling point.
[0112] Since the template is built based on a historical version, the system performs adaptive adjustments to the template according to the interface control file of the current V1.8 version SCM, including: updating the altitude sensor signal type from "analog voltage type" to "PSI5 digital type"; adding LIN bus configuration; and adjusting the air spring air circuit model parameters.
[0113] After adaptive adjustment, an initial environment configuration scheme containing a complete signal-port mapping table is generated.
[0114] Furthermore, query the current hardware resource pool status to obtain availability information for various resources, including: Real-time emulator: Currently, 6 CPU cores are idle; High-frequency I / O: High-frequency synchronous sampling board, supporting 8-channel synchronous sampling, 16-bit resolution, and a maximum sampling rate of 50kHz, located in slot 3, completely idle; General I / O: General-purpose hybrid I / O board, located in slot 4, with ample free channels; Bus resources: CAN FD (CAN with Flexible Data-Rate) board, supporting up to 8Mbps, located in slot 6, with 4 channels available; LIN board located in slot 7; Fault injection unit: with current / voltage feedback function, located in slot 9, with 32 available channels; Special resource: Resistance simulation board, located in slot 11, used for simulating grounding faults of height sensors.
[0115] Based on the resource status and requirements in the initial plan, the resource orchestration algorithm performs multi-dimensional constraint checks and solves for the optimal allocation scheme, including: Real-time constraint processing: The calculation step size of the dynamic model is required to be ≤0.5ms. The algorithm allocates CPU cores 0-2 to the suspension dynamics calculation. Specifically, core 0 is responsible for the front axle, core 1 is responsible for the rear axle, core 2 is responsible for the vehicle body and road surface model, and core 3 is allocated to the air circuit model and LIN communication protocol stack.
[0116] Sampling synchronization constraint processing: The 8-channel acceleration signals must be sampled synchronously with a phase difference of <1μs. The algorithm detects that the IO135 board supports hardware synchronization triggering function, which satisfies the constraint condition, and binds all 8-channel acceleration signals to the board.
[0117] Physical connection constraint handling: The length of the accelerometer harness is required to be less than 3m. The algorithm assigns the IO135 board to slot 3, which is close to the harness interface, while avoiding the FIU board in slot 9 to avoid high-frequency signal crosstalk.
[0118] After the algorithm completes the solution, it generates a resource binding table, automatically avoiding resources that have been occupied by other projects.
[0119] Furthermore, based on the resource binding list, four sub-tasks—model deployment, I / O configuration, communication configuration, and fault injection configuration—are executed in parallel, specifically as follows: The model is automatically deployed, including: pulling the suspension model_v3.6.fmu and AirSpring_Thermal_v2.1.fmu from the Git repository; automatically configuring it to a fixed step size of 0.5ms and a multi-core parallel mode; automatically parsing the model variable list through the FMU import tool; and configuring the road surface model with test case parameters of "Class C road surface, vehicle speed 60km / h, duration 120s".
[0120] Automatic I / O configuration, comprising: high-frequency AI mapping, that is, binding the model port BodyAcc_FL to channel 0 of IO135, binding WheelAcc_FL to channel 1, and completing the mapping of four channels of wheel acceleration and body acceleration by analogy, automatically generating wiring harness labels and marking "twisted pair shielded cable, single-end grounding"; PWM mapping, that is, binding the model port DampingPWM_FL to FPGA PWM output channel 0, and automatically configuring the frequency to 200Hz, the dead time to 2μs, and the duty cycle resolution to 12bit; DO mapping, that is, binding the model Boolean signal InflateValve_FL to DO channel 0, and configuring interlock logic - the inflation valve and deflation valve on the same bridge arm are prohibited from being opened at the same time to prevent air circuit conflict; power supply configuration for height sensors, that is, configuring the corresponding channels of the AI board as the sensor power supply mode, and connecting a current monitoring loop in series in the FIU.
[0121] Automatic communication configuration, comprising: CAN FD configuration, that is, automatically importing the chassis CAN database, configuring the period of the DampingForceActual message as 10ms, and configuring BodyHeight_Target as an event-based message; comfort CAN configuration for seat / door status signals; LIN configuration, that is, configuring the slave address of the height sensor, synchronizing the break field length to 13 bits, and adopting the enhanced checksum method; diagnostic CAN configuration, that is, configuring UDS session layer parameters to support DTC (Diagnostic Trouble Code) reading and software flashing simulation.
[0122] Automatic fault injection configuration, comprising: FIU channels 0-3: configured to soft-short the body acceleration signal to ground, with the trigger condition being model signal AccFaultTrigger=1; FIU channels 4-7: configured to disconnect the power supply of the height sensor to simulate wiring harness falling off; FIU channels 8-11: configured with open-circuit faults of CDC damping valve driving lines, and enabling current sampling monitoring; FIU channel 12: configured with short-circuit fault between chassis CAN_H and CAN_L to simulate bus physical layer failure.
[0123] After the deployment is completed, the system automatically triggers the debugging process, and sequentially performs the following verifications, comprising: Signal mapping and frequency response verification, comprising: Acceleration channel: injecting white noise excitation into the model, sampling the actual output signal through IO135, calculating the frequency response function, and comparing the theoretical transfer function of the model with the measured transfer function. It is judged as qualified when the amplitude error is <0.5dB and the phase error is <3° at 20Hz.
[0124] Altitude sensor: The model outputs a step signal, jumping from the reference altitude to -30mm off-road altitude, verifying that the AI backsampling value stabilization time is <200ms and the overshoot is <5%.
[0125] PWM output: Automatically measure the actual PWM waveform of each channel, verify the frequency to be 200Hz±0.5%, and the duty cycle linearity is within the range of 10%-90%. The error between the model command and the measured value is <0.2%.
[0126] Automatic calibration of damping force characteristic curve: The control model outputs a full-range PWM duty cycle of 0%-100%, and fits the CDC valve's "duty cycle-damping force" characteristic curve using the sampled damping force sensor signal or internal model observations. It automatically identifies nonlinear regions, typically <10% is the dead zone and >90% is the saturation zone, and generates a LUT (Look-Up Table) calibration file which is then written to the SCM calibration parameters.
[0127] Dynamic response debugging of the gas system: Triggering "Welcome Mode": The model sends a command to lower the vehicle body, monitors the pressure model value of the air tank and the timing of the solenoid valve action, and verifies that the time to descend from the normal height to the welcome height is 3.5s ± 0.5s. It automatically detects pressure oscillations in the air circuit model; if pressure pulsations caused by compressor start-stop are found to be >0.2 bar, it automatically adjusts the damping orifice parameters in the air circuit model.
[0128] Automatic bus handshake: LIN Synchronization: Automatically sends LIN headers to verify that the altitude sensor slave responds within 150μs and that the data field checksum is correct; CAN FD handshake: Monitor the node life signal after the SCM is powered on, verify that the chassis CAN message SCM_Status period is 20ms±2%, and that the BRS bit of CAN FD is set correctly; UDS diagnostic session: Automatically send 10 03 to enter extended diagnostic session, verify that SCM responds with 5003 within P2 time, confirming that the diagnostic link is available.
[0129] Fault injection validity verification: Acceleration drift: Trigger a soft short circuit in FIU channel 0 to simulate a +0.5g drift, and monitor the SCM to report a longitudinal acceleration sensor malfunction within 100ms; Damping valve open circuit: Trigger FIU channel 8 open circuit, monitor PWM drive current sampling value drops to 0A, SCM reports damper solenoid valve open circuit within 20ms; Altitude sensor open circuit: Triggers FIU channel 4 open circuit, monitors LIN bus communication timeout for this node, and SCM reports altitude sensor communication loss; CAN short circuit: Triggers a short circuit in FIU channel 12, monitors the duration of the dominant bit on the bus to be >100μs, and increments the Bus-Off counter of the SCM to confirm that the physical layer fault detection is effective.
[0130] Furthermore, closed-loop verification and delivery are carried out, specifically including: Perform configuration integrity verification, including: verifying that the signal-port mapping is complete, that the 8-channel acceleration sampling clocks are from the same source, and that the synchronization error is <1μs; verifying that the PWM dead time configuration is effective; and verifying the interlock logic of the air circuit solenoid valve, such as the mutually exclusive logic of the DO signals of the inflation valve and deflation valve of the same air spring.
[0131] Conduct a smoke test, including: Static test: Power-on self-test verifies that after SCM initialization, all height sensor readings are within ±2mm tolerance, and the acceleration zero deviation is <0.05g; Dynamic Test 1: Drive at a constant speed of 60km / h for 30 seconds on a Class C road surface to verify that the vehicle body acceleration RMS value is <0.8m / s²; Dynamic Test 2: Sine sweep frequency input, 0.5-30Hz, amplitude 10mm, to verify the effect of the ceiling control algorithm on suppressing the peak resonance of the vehicle body near 10Hz; Functional test: Trigger the welcome mode and verify that the vehicle height drops from the normal height to the welcome height within 5 seconds, and that the attitude control has no asynchronous error of more than 5mm between the front and rear axles.
[0132] After all verifications are successful, an immutable environment image SCM_V1.8_HIL_Env_v2.1 is generated, containing the following complete configuration assets: vehicle dynamics model FMU, including the air circuit sub-model; I / O configuration parameters, including complete parameters such as AI sampling rate 5kHz and PWM 200Hz; communication database, including CAN FD DBC×4 and LIN LDF×2; damping force LUT calibration table; fault injection strategy matrix; and wiring harness definition file.
[0133] The image file of the environment configuration file is digitally signed and locked before being stored in the environment repository, completing the fully automated setup process.
[0134] In some embodiments, combined with Figure 3 As shown, a hardware-in-the-loop testing environment building system 30 is provided, including: The parsing module 310 is configured to obtain test requirements, parse the test requirements, and extract test elements; The template management module 320 is configured to match test elements in a pre-set template library to generate an initial environment configuration scheme. The resource allocation module 330 is configured to orchestrate the resources in the established hardware resource pool based on the initial environment configuration scheme and preset constraints, and generate a resource binding list. The test project generation module 340 is configured to execute model deployment, I / O configuration, communication configuration and fault injection configuration in parallel based on the resource binding list to generate an executable test project; The verification module 350 is configured to deploy on the target machine based on the executable test project, and after debugging, generate an environment configuration file.
[0135] The hardware-in-the-loop test environment building system 30 provided in this embodiment includes: a parsing module 310, a template management module 320, a resource allocation module 330, a test project generation module 340, and a verification module 350.
[0136] Optionally, the parsing module 310 is configured to acquire test requirements and parse them to extract the test elements needed to build the HiL test environment. Test elements include, but are not limited to: the type of controller under test, the type of test scenario, simulation model requirements and version requirements, the number and type of I / O channels, the type and baud rate of the communication bus, and fault injection requirements. This module supports both natural language text format and structured data format as input, and completes the transformation from raw requirements to standardized elements through semantic parsing or structured parsing.
[0137] The template management module 320 is configured to receive test elements output by the parsing module 310, and use these as matching conditions to search and match in a pre-set template library to generate an initial environment configuration scheme. The pre-set template library includes: vehicle platform templates, which encapsulate the overall test environment architecture of the target vehicle platform, such as suspension topology, sensor layout matrix, and bus topology; controller templates, which encapsulate specific configurations for the target controller type, such as signal-port mapping relationships, communication matrices, and fault injection point definitions; and general I / O mapping templates, which encapsulate standardized mapping rules between signal types and physical channels. The template management module 320 calculates the matching degree between the test elements and each template, selecting the template with the highest matching degree as the baseline template. When the matching degree is lower than a preset threshold, a template adaptive adjustment process is triggered, recommending configuration parameters based on historical similar project data, adaptively adjusting the baseline template, and finally generating the initial environment configuration scheme.
[0138] The resource allocation module 330 is configured to receive the initial environment configuration scheme output by the template management module 320, and, in conjunction with preset constraints, orchestrate the resources in the established hardware resource pool to generate a resource binding list. Specifically, the resource allocation module 330 establishes a digital mirror of the hardware resource pool, which includes real-time simulator computing power resources, such as the number of CPU cores, memory capacity, and FPGA resources; I / O board resources, such as board model, number and type of channels, occupied / idle status, and electrical characteristic parameters; bus interface resources, such as the number of CAN / CAN FD channels, the number of LIN channels, the number and speed of Ethernet ports; fault injection unit resources, such as the number of FIU channels, supported fault types, and retrieval capability; and load bank resources, such as resistor simulation channels and power load channels. The resource allocation module 330 models the resource allocation problem as a constraint satisfaction problem. It uses the resource requirements in the initial environment configuration as variables, the available physical resources in the hardware resource pool as the candidate value range for each variable, and preset constraints as the legality constraints for the combinations of variable values. It employs preset orchestration algorithms, such as backtracking search combined with constraint propagation, or heuristic algorithms like genetic algorithms and simulated annealing, to solve the problem. The goal is to maximize resource utilization and optimize constraint satisfaction, generating a resource binding list. These preset constraints include real-time constraints, such as model calculation step size constraints, FPGA resource upper limit constraints, and deterministic latency constraints; physical connection constraints, such as board slot adjacency constraints, harness length constraints, and signal isolation constraints; and resource conflict constraints, such as prohibiting multiple signals from simultaneously occupying the same channel and ensuring the total power of the same board does not exceed its rated value.
[0139] The test project generation module 340 is configured to execute four sub-tasks in parallel—model deployment, I / O configuration, communication configuration, and fault injection configuration—based on the resource binding list generated by the resource allocation module 330, to generate an executable test project. Specifically: The model deployment subtask, based on the simulation model requirements in the test elements, pulls the specified version of the dynamic model file from the model repository, automatically matches and populates the parametric model template according to vehicle parameters, compiles and generates an executable file that can be directly run in the real-time simulation platform, and completes static verification; the I / O configuration subtask automatically processes the interface definition file through the built-in parser, extracts signal information to form a unified signal dictionary, combines it with the hardware channel list in the resource binding list, and uses an intelligent mapping algorithm to automatically allocate model port signals to the corresponding physical channels, generating a complete I / O configuration file and completing compilation; the communication configuration subtask automatically imports the communication database, automatically configures the message transmission and reception cycle, signal initial value, and gateway routing relationship according to the communication matrix of the controller under test; for Ethernet communication, it automatically configures the SOME / IP or DoIP service discovery parameters; the fault injection configuration subtask, based on the fault injection requirements in the test elements, automatically configures the fault type, fault parameters, and safety interlock strategy in the fault injection unit matrix. The above four configuration subtasks synchronize their respective execution status through the message bus. When any subtask fails, a compensation mechanism is triggered, automatically rolling back the completed associated configuration to the previous stable state.
[0140] The verification module 350 is configured to deploy the executable test project output by the test project generation module 340 to the target machine. After completing the model download, multi-core allocation, step size configuration and power-on deployment, it automatically executes the debugging process and generates the final environment configuration file after successful debugging.
[0141] Specifically, the debugging process executed by the verification module 350 includes signal mapping verification, analog quantity calibration, bus handshake verification, and fault injection verification performed sequentially: Signal mapping verification includes: injecting standard excitation signals into the deployed model ports, acquiring actual output signals through I / O retrieval channels, calculating the correlation between the theoretical output and the actual output of the model ports, and determining that the signal mapping is correct when the correlation meets the preset correlation threshold. Analog calibration includes: controlling the deployed model to output known voltage or current values covering the entire range, acquiring measured values through I / O retrieval channels, fitting the transfer function between known values and measured values using the least squares method, generating calibration coefficients based on the fitting results, and writing the calibration coefficients into the configuration file. Bus handshake verification includes: monitoring bus messages, extracting message period, message ID sequence, ACK response status and service discovery status, calculating communication health score based on the deviation between message period and preset period, ACK response status and service discovery status, and determining communication link abnormality when the communication health score is less than the score threshold. Fault injection verification includes: sequentially triggering each fault injection channel, injecting fault types including at least one of hard short circuit, soft short circuit, open circuit, signal crosstalk, and signal drift, monitoring the diagnostic fault codes or model feedback signals reported by the controller under test, and verifying whether the diagnostic fault codes or model feedback signals match the injected fault types.
[0142] During the debugging process, the verification module 350 continuously monitors abnormal states. When a debugging abnormality is detected, it searches the historical problem knowledge base for records that match the current abnormal features. If the match is successful, the root cause and solution are obtained. If no match is found, the current abnormal features are vectorized and compared with historical cases in the historical problem knowledge base. The preset number of records with the highest similarity are returned as suspected causes.
[0143] After debugging, the verification module 350 performs integrity verification and smoke testing. Integrity verification includes verifying whether all model input ports are fully bound, checking for I / O channel conflicts, confirming the effectiveness of the fault injection safety interlock strategy, and verifying the integrity and configuration correctness of communication messages. After successful integrity verification, smoke testing is performed, including executing a pre-defined set of smoke test cases. This set includes power-on self-test cases, static function verification cases, and basic dynamic function verification cases, verifying the basic functional availability of the hardware-in-the-loop test environment. After all smoke tests pass, the verification module 350 generates an environment configuration file, which includes a dynamic model file, I / O configuration parameters, a communication database file, a calibration parameter file, a fault injection strategy matrix, and a harness definition file.
[0144] In some embodiments, a hardware-in-the-loop testing environment setup apparatus 40 is provided, including a processor 400 and a memory 401. Optionally, the apparatus 40 may further include a communication interface 402 and a bus 403. The processor 400, communication interface 402, and memory 401 can communicate with each other via the bus 403. The communication interface 402 can be used for information transmission. The processor 400 can invoke logical instructions in the memory 401 to execute the hardware-in-the-loop testing environment setup method as described in any of the above embodiments.
[0145] Furthermore, the logic instructions in the aforementioned memory 401 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0146] The memory 401, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this disclosure. The processor 400 executes functional applications and data processing by running the program instructions / modules stored in the memory 401, thereby realizing the hardware-in-the-loop test environment construction method in the above embodiments.
[0147] The memory 401 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function. The data storage area may store data created based on the use of the terminal device. Furthermore, the memory 401 may include high-speed random access memory and may also include non-volatile memory.
[0148] In some embodiments, a readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements a method for building a hardware-in-the-loop test environment as described in any of the above embodiments.
[0149] The foregoing description and accompanying drawings fully illustrate embodiments of the present disclosure to enable those skilled in the art to practice them. Other embodiments may include structural and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the order of operation may vary. Parts and features of some embodiments may be included or substituted for parts and features of other embodiments. Embodiments of the present disclosure are not limited to the structures described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from its scope. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for setting up a hardware-in-the-loop test environment, characterized in that, include: Obtain test requirements, parse the test requirements, and extract test elements; Based on the test elements, a matching process is performed in the pre-set template library to generate an initial environment configuration scheme; Based on the initial environment configuration scheme and preset constraints, the resources in the established hardware resource pool are arranged to generate a resource binding list; Based on the resource binding list, the model deployment, I / O configuration, communication configuration, and fault injection configuration are executed in parallel to generate an executable test project; Based on the executable test project, the target machine is deployed and debugged, and then an environment configuration file is generated.
2. The method according to claim 1, characterized in that, The test elements include at least one of the following: type of controller under test, test scenario category, simulation model requirements and version requirements, number and type of I / O channels, communication bus type and baud rate, and fault injection requirements; and / or, The pre-set template library includes at least one of vehicle platform templates, controller templates, and general I / O mapping templates.
3. The method according to claim 1, characterized in that, Based on the initial environment configuration scheme and preset constraints, the resources in the established hardware resource pool are orchestrated to generate a resource binding list, including: Establish a digital mirror of the hardware resource pool, which includes at least one of real-time simulator computing power resources, I / O board resources, bus interface resources, fault injection unit resources, and load cell resources; The resource allocation problem is modeled as a constraint satisfaction problem, with the resource requirements in the initial environment configuration scheme as variables, the available resources in the hardware resource pool as the value range, and the preset constraint conditions as constraints. The resource binding list is generated using a preset orchestration algorithm; The preset constraints include at least one of real-time constraints, physical connection constraints, and resource conflict constraints.
4. The method according to any one of claims 1 to 3, characterized in that, After the target machine is deployed, the debugging steps include: sequentially performing signal mapping verification, analog quantity calibration, bus handshake verification, and fault injection verification. The signal mapping verification includes: injecting a standard excitation signal into the deployed model port, the standard excitation signal including a sine wave signal, a step signal, or a frequency sweep signal; acquiring the actual output signal through the I / O retrieval channel; calculating the correlation between the theoretical output and the actual output of the model port; and determining that the signal mapping is correct when the correlation meets the correlation threshold.
5. The method according to claim 4, characterized in that, The analog calibration includes: Control the deployed model output to cover known voltage or current values across the entire range; Measured values are collected via the I / O sampling channel; The least squares method is used to fit the transfer function between the known value and the measured value; The calibration coefficients are generated based on the fitting results and written into the configuration file.
6. The method according to claim 4, characterized in that, The bus handshake verification includes: Monitor bus messages and extract message period, message ID sequence, ACK response status and service discovery status; A communication health score is calculated based on the deviation between the message period and the preset period, the ACK response status, and the service discovery status. When the communication health score is less than the score threshold, the communication link is determined to be abnormal.
7. The method according to claim 4, characterized in that, The fault injection verification includes: Each fault injection channel is triggered sequentially, and the injected fault types include at least one of hard short circuit, soft short circuit, open circuit, signal crosstalk, and signal drift. Monitor the diagnostic fault codes or model feedback signals reported by the controller under test; Verify whether the diagnostic fault code or model feedback signal matches the injected fault type.
8. The method according to claim 4, characterized in that, The debugging process also includes: When a debugging anomaly is detected, the system retrieves records from the historical problem knowledge base that match the current anomaly characteristics. If a match is found, the root cause and solution are obtained. When no matching result is found, the current abnormal feature is vectorized and compared with the historical cases in the historical problem knowledge base. The preset number of records with the highest similarity are returned as suspected causes.
9. The method according to any one of claims 1 to 3, characterized in that, After debugging is complete, the process also includes performing integrity checks and smoke tests.
10. The method according to any one of claims 1 to 3, characterized in that, The environment configuration file includes: dynamic model file, I / O configuration parameters, communication database file, calibration parameter file, fault injection strategy matrix, and harness definition file.
11. A system for building a hardware-in-the-loop testing environment, characterized in that, include: The parsing module is configured to obtain test requirements, parse the test requirements, and extract test elements; The template management module is configured to match the test elements in a pre-set template library to generate an initial environment configuration scheme. The resource allocation module is configured to arrange the resources in the established hardware resource pool based on the initial environment configuration scheme and preset constraints, and generate a resource binding list. The test project generation module is configured to execute model deployment, I / O configuration, communication configuration and fault injection configuration in parallel based on the resource binding list to generate an executable test project; The verification module is configured to deploy on the target machine based on the executable test project, and after debugging, generate an environment configuration file.
12. A device for building a hardware-in-the-loop test environment, 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 program, it implements the method for building a hardware-in-the-loop test environment according to any one of claims 1 to 10.
