A method and system for acquiring analysis data during hardware-in-the-loop simulation.

By receiving the record configuration on the simulation computer and collecting and writing data to segmented files according to the sampling period and segmentation conditions, the resource consumption and timeliness issues of data acquisition and analysis in semi-physical simulation are solved, and low-overhead, efficient data management and analysis support are achieved.

CN121901322BActive Publication Date: 2026-07-31北京灵思创奇科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
北京灵思创奇科技有限公司
Filing Date
2025-12-31
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively acquire and segment key signal data during hardware-in-the-loop simulations without significantly increasing the real-time burden on the simulation computer, making it difficult to balance data integrity, online resource consumption, and analysis timeliness.

Method used

The system receives the recording configuration at the beginning of the simulation, establishes the recording description information, and writes the data into a fixed-length structured package according to the sampling recording period during the simulation. It also generates segmented data recording files according to the segmented recording conditions and sets a completion flag, thereby achieving low-overhead and controllable-scale data acquisition and storage.

Benefits of technology

Without increasing the real-time burden on the simulation computer, it achieves timely acquisition and segmented management of key signal data, supports rapid diagnosis and iterative analysis during simulation operation, and balances data integrity and analysis timeliness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121901322B_ABST
    Figure CN121901322B_ABST
Patent Text Reader

Abstract

This application relates to a method and system for acquiring analysis data during a hardware-in-the-loop simulation. The method is applied to a simulation computer and includes: receiving a recording configuration from a data analysis computer at the start of the simulation, the recording configuration including a sampling recording period, segmented recording conditions, a set of signals to be recorded, and a data recording layout; establishing recording description information based on the set of signals to be recorded, recording the correspondence between signal identifiers and field offsets and field lengths; creating an initial segmented data recording file and writing segment header information. During the simulation, the segmented recording conditions are progressively determined. If the conditions are not met, each signal to be recorded is read from the model according to the sampling recording period and packaged into a fixed-length record according to the layout and appended to the record. When the segmentation conditions are met, the current segmentation ends and a completion flag is generated. A new segmented file is created and writing is switched, repeating this process until the simulation ends.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of simulation data acquisition and analysis technology, and in particular to a method and system for acquiring and analyzing data during a hardware-in-the-loop simulation process. Background Technology

[0002] A hardware-in-the-loop (HIL) simulation system typically consists of a simulation computer and a data analysis computer. The simulation computer handles demanding real-time simulation tasks such as model solving, interface driving, and closed-loop control. The data analysis computer monitors, records, replays, and analyzes the signal data generated during the simulation. Since the simulated objects often contain multi-source, multi-rate signals and exhibit characteristics such as high-frequency transients and intermittent events, online monitoring and data acquisition of key signals during the simulation, and timely data acquisition for analysis during simulation operation, are crucial fundamental capabilities of a HIL system.

[0003] In existing technologies, common data acquisition methods mainly fall into two categories: First, to ensure data integrity, a small number of signals of interest are monitored and recorded online at a minimum fixed sampling rate throughout the entire process. While this method can avoid missed sampling, in large-scale simulation systems or high-frequency signal scenarios, it leads to a significant increase in data packaging, caching, and transmission overhead on the simulation computer side, resulting in increased online monitoring and processing latency, excessive CPU and memory usage, and even adversely affecting the stability of real-time simulation calculations. Second, only sampling and recording are performed during the simulation process, and the data is exported centrally and analyzed offline after the simulation ends. This method can reduce the online processing burden during the simulation process, but data availability is delayed. When the simulation cycle is long or it is necessary to locate anomalies, adjust parameters, or trigger subsequent test procedures in a timely manner during the simulation, full data can often only be obtained after the simulation ends, making it difficult to support rapid diagnosis and iteration during the simulation process.

[0004] Therefore, existing technologies struggle to balance data integrity, online resource consumption, and analysis timeliness: on the one hand, full online monitoring and recording can lead to excessive resource consumption and affect real-time performance; on the other hand, purely offline playback cannot meet the real-time analysis needs during simulation. How to achieve effective acquisition and segmented acquisition of key signal data during simulation without significantly increasing the real-time burden on the simulation computer, thereby supporting timely analysis and playback during simulation operation, is a pressing technical problem in this field. Summary of the Invention

[0005] To overcome, to some extent, the problems of high resource consumption, large latency, and untimely analysis caused by the need to wait for the simulation to end before offline playback in the process of hardware-in-the-loop simulation when acquiring and recording full-volume online monitoring data in related technologies, this application provides a method and system for acquiring and analyzing data in the process of hardware-in-the-loop simulation.

[0006] The proposed solution is as follows: According to a first aspect of the embodiments of this application, a method for acquiring analysis data during a hardware-in-the-loop simulation is provided, applied to a simulation computer, comprising: S1. At the beginning of the simulation, receive the recording configuration sent by the data analysis computer; the recording configuration includes at least the sampling recording period, segmented recording conditions, the set of signals to be recorded, and the data recording layout. S2. Establish recording description information based on the set of signals to be recorded; the recording description information includes at least: the correspondence between the signal identifier of each signal to be recorded and its field offset and field length in the data recording layout; S3. Create an initial segmented data record file, write segment header information containing the record description information identifier, and set the initial segmented data record file as the currently written segment file; S4. During the simulation process, after each simulation step, determine whether the segmented recording conditions are met. S5. If the segmented recording conditions are not met, check whether the sampling and recording cycle has been reached; S6. If the sampling and recording period is reached, data sampling is performed. The signal values ​​of each signal to be recorded at the current simulation time are read from the simulation model according to the set of signals to be recorded. Based on the field offset and field length in the recording description information, the signal values ​​of each signal to be recorded are packaged into a fixed-length record based on the data recording layout and appended to the current writing segment file. S7. If the segmented record condition is met, the writing of the current segmented file is ended and a completion identifier representing the completion of the segment writing is generated. Then, a new segmented data record file is created, segmented header information containing the record description information identifier is written, and the new segmented data record file is set as the current segmented file. S8. Repeat steps S4-S7 until the simulation ends.

[0007] Preferably, the sampling and recording period is an integer multiple of the minimum simulation step size.

[0008] Preferably, the segmented recording conditions include: Segmentation can be based on a preset simulation duration threshold or a preset file byte length threshold.

[0009] Preferably, determining whether the segmented recording conditions are met includes: When the segmentation recording condition is segmentation according to a preset simulation duration threshold, the starting simulation time of the segment corresponding to the current written segment file is obtained, and the time difference between the current simulation time and the starting simulation time of the segment is calculated; if the time difference reaches the preset simulation duration threshold, it is determined that the segmentation recording condition is met. When the segmentation recording condition is to segment according to a preset file byte length threshold, the current file length of the currently written segmented file is obtained, and the record length of a single fixed-length record is determined; if the sum of the current file length and the record length reaches or exceeds the preset file byte length threshold, it is determined that the segmentation recording condition is met.

[0010] Preferably, the recording configuration further includes: The data length of each signal to be recorded; The method further includes: The field length of each signal to be recorded in the data recording layout is determined based on the data occupancy length of each signal to be recorded, and the field offset and the record length of a single record of each signal to be recorded in the data recording layout are determined based on the field length.

[0011] Preferably, the completion identifier includes: After finishing writing the current segment file, rename the current segment file from the temporary file name to the completed file name; Alternatively, a preset segment end marker can be written to the end of the currently written segment file to indicate that the segment data record file has been written.

[0012] Preferably, when the completion identifier uses a preset segment end marker, the preset segment end marker includes at least: At least one of the following: segment number, segment start simulation time, segment end simulation time, and the number of records currently written to the segment file.

[0013] Preferably, the segment header information further includes record description verification information, which is used to characterize the version or summary of the record description information; The method further includes: When creating a new segmented data record file, the record description verification information is written into the segment header information to verify the parsing consistency of the segmented data record file.

[0014] Preferably, the method further includes: Receive segmented query requests sent by the data analysis computer, wherein the segmented query requests are used to indicate the segment range or segmented filtering conditions to be obtained; Based on the completion identifier, determine the set of segmented data record files that have been written in segments, generate a list of data record sets corresponding to the set of segmented data record files, and return the list of data record sets to the data analysis computer; Based on the file retrieval request initiated by the data analysis computer based on the data record set list, the corresponding segmented data record file in the data record set list is provided to the data analysis computer.

[0015] According to a second aspect of the embodiments of this application, a system for acquiring analysis data during a hardware-in-the-loop simulation is provided, comprising: Simulation computers and data analysis computers; The simulation computer and the data analysis computer are connected via a communication bus: The simulation computer is used to execute a method for acquiring analytical data during a hardware-in-the-loop simulation as described in any of the above.

[0016] The technical solution provided in this application may include the following beneficial effects: This technical solution defines the sampling and recording period, segmented recording conditions, set of signals to be recorded, and data recording layout at the beginning of the simulation. During the simulation, the signals to be recorded are written in fixed-length structured packages according to the sampling and recording period. At the same time, segmented data recording files are generated in a rolling manner according to the segmented recording conditions, and completion markers are set. This allows the simulation computer to achieve low-overhead, controllable-scale data acquisition and storage by sequentially appending data, avoiding the CPU / memory and transmission pressure caused by full-process online monitoring of key signals. Meanwhile, the segmented files can form readable data units during the simulation, which facilitates the acquisition and parsing of data segment by segment without interrupting the simulation. This improves the timeliness of the simulation analysis and ensures the consistency and parsability of the recorded data.

[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0019] Figure 1 This is a flowchart illustrating a method for acquiring analysis data during a hardware-in-the-loop simulation process, provided in one embodiment of this application. Figure 2 This is a schematic diagram of the structure of a system for acquiring analysis data during a hardware-in-the-loop simulation process, provided in one embodiment of this application. Detailed Implementation

[0020] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0021] Example 1 Figure 1 This is a flowchart illustrating a method for acquiring analysis data during a hardware-in-the-loop simulation, as provided in one embodiment of this application. (Refer to...) Figure 1 A method for acquiring analysis data during a hardware-in-the-loop simulation, applied to a simulation computer, includes: S1. At the beginning of the simulation, receive the recording configuration sent by the data analysis computer; the recording configuration includes at least the sampling recording period, segmented recording conditions, the set of signals to be recorded, and the data recording layout. S2. Establish record description information based on the set of signals to be recorded; the record description information shall include at least: the correspondence between the signal identifier of each signal to be recorded and its field offset and field length in the data record layout; S3. Create an initial segmented data record file, write segment header information containing record description information identifiers, and set the initial segmented data record file as the currently written segment file; S4. During the simulation process, after each simulation step, determine whether the segmented recording conditions are met. S5. If the segmented recording conditions are not met, check whether the sampling and recording cycle has been reached; S6. If the sampling and recording period is reached, perform data sampling, read the signal values ​​of each signal to be recorded from the simulation model at the current simulation time according to the set of signals to be recorded, and according to the corresponding field offset and field length in the recording description information, pack the signal values ​​of each signal to be recorded into a fixed-length record based on the data recording layout, and append it to the current writing segment file. S7. If the segmentation record condition is met, end the current writing to the segment file and generate a completion identifier indicating that the segment writing is complete. Then create a new segment data record file, write segment header information containing record description information identifier, and set the new segment data record file as the current writing segment file. S8. Repeat steps S4-S7 until the simulation ends.

[0022] For ease of understanding, the following explains some key terms in this embodiment: Hardware-in-the-loop (HIL) simulation typically refers to a simulation method that combines actual physical devices with simulation models, enabling real-time data interaction through an interface to verify and test the performance of the physical devices. In this system, the simulation computer is responsible for running the simulation model, driving the interface, and performing real-time control, while the data analysis computer is used to monitor, record, play back, and analyze the signal data generated during the simulation process.

[0023] Recording configuration refers to a set of parameters sent from the data analysis computer to the simulation computer to guide the simulation computer in how to record data. This configuration includes at least the sampling and recording period, segmented recording conditions, the set of signals to be recorded, and the data recording layout, ensuring the flexibility and relevance of data acquisition.

[0024] The sampling and recording period refers to the minimum time interval at which the simulation computer performs one data sampling during the simulation process. This period determines the frequency of data recording and can usually be set according to the simulation requirements.

[0025] In practice, the sampling and recording period is an integer multiple of the simulation's minimum step size. Specifically, the sampling and recording period refers to the fixed time interval at which the system samples and records data during the simulation. For example, if the simulation samples data every 10 milliseconds, then the sampling and recording period is 10 milliseconds. The simulation's minimum step size refers to the smallest, most basic discrete time unit in the time dimension by which the hardware-in-the-loop simulation model progresses. For example, a real-time simulation system might use 1 millisecond as its minimum time step for internal calculations and state updates. When the sampling and recording period is set to an integer multiple of the simulation's minimum step size, it means that each data sample will occur precisely after the simulation model has completed one or more minimum time step calculations. For example, if the simulation's minimum step size is 1 millisecond, the sampling and recording period could be 1 millisecond, 2 milliseconds, 5 milliseconds, etc., all of which are integer multiples of 1 millisecond. This setting ensures that the data sampling points are perfectly aligned with the internal state update points of the simulation model, avoiding situations where sampling points fall in the middle of the simulation step size.

[0026] Segmentation recording conditions refer to the conditions that trigger the end of writing to the current data record file and the creation of a new file. These conditions can be based on time, file size, or other logical judgments to achieve effective segmentation management of long-term or large-volume simulation data.

[0027] The set of signals to be recorded refers to the collection of all signals that need to be acquired and recorded during the simulation process. These signals can be variables within the simulation model or physical quantities that interact with external devices.

[0028] Data record layout refers to the data storage format and arrangement of each signal to be recorded in a data record file. This layout defines the position (field offset) and space (field length) of each signal in the record, ensuring that the data can be correctly packaged and parsed.

[0029] Record description information is metadata built upon the set of signals to be recorded, used to describe in detail the specific position and length of each signal within the data record layout. This information enables data analysis computers to accurately parse the raw data in the record file.

[0030] Segmented data log files are independent data files created and written by a simulated computer when segmented recording conditions are met. By dividing long-term or large-volume record data into multiple segmented files, the efficiency of data management and the timeliness of analysis can be improved.

[0031] Segment header information refers to the metadata contained at the beginning of each segment data record file. This information typically includes record description information and identifiers, indicating the data structure and parsing method used in the file.

[0032] A completion flag is a marker used to indicate that the writing of a file has been completed after the current segment of data records has finished. This flag can be a renaming operation or a specific marker written to the end of the file so that the data analysis computer can identify the usable segment file.

[0033] This application provides a method for obtaining analysis data during hardware-in-the-loop simulation.

[0034] At the start of the simulation, the simulation computer receives a recording configuration from the data analysis computer. This recording configuration can be transmitted as a file or via a network communication protocol. The configuration includes at least parameters such as the sampling recording period, segmented recording conditions, the set of signals to be recorded, and the data recording layout, guiding the simulation computer in data acquisition and storage. For example, the recording configuration can be an XML file or a JSON object, which defines in detail the names of the signals to be recorded, the sampling frequency, the segmented triggering rules, and the order of the data in the storage file.

[0035] Based on the received set of signals to be recorded, the simulation computer establishes record description information. This information clarifies the signal identifier of each signal to be recorded, as well as its field offset and field length in the data record layout. For example, this record description information can be an internal data structure that associates the signal name with its corresponding storage location and size, enabling the simulation computer to accurately locate and process the data of each signal.

[0036] Subsequently, the simulation computer creates an initial segmented data record file. This file is set as the currently written segment file and contains segment header information that identifies the record description information. This identifier can be a unique hash value or version number of the record description information, used to identify and match the correct parsing rules during subsequent data analysis.

[0037] During the simulation, after each simulation calculation, the computer checks whether the preset segmentation conditions are met. This condition can be a simple counter, for example, triggering a segmentation check every certain number of simulation steps.

[0038] If the segmented recording conditions are not currently met, the simulation computer will further check whether the preset sampling and recording period has been reached. This check can be based on the simulation step size or simulation time; for example, it can be performed every fixed number of simulation steps or time intervals.

[0039] When the sampling recording period is reached, the simulation computer performs a data sampling operation. Specifically, it reads the signal values ​​of each signal to be recorded from the simulation model at the current simulation moment, according to the set of signals to be recorded. Then, based on the field offsets and field lengths defined in the record description information, it packages these signal values ​​into a fixed-length record according to the data record layout and appends it to the currently written segment file. For example, if the record configuration specifies that signal A occupies 4 bytes and signal B occupies 8 bytes, the simulation computer will write the values ​​of signal A and signal B sequentially into a 12-byte buffer to form a fixed-length record.

[0040] If the segmentation record conditions are met, the simulation computer will terminate the current write operation to the segment file and generate a completion flag indicating that the segment write is complete. Subsequently, a new segment data record file is created, segment header information containing record description information is written to it, and this new segment data record file is set as the currently written segment file. For example, the completion flag can be implemented by closing the current file handle and marking it as "complete".

[0041] Steps S4 to S7 will be repeated until the entire simulation process ends. Through this cyclical mechanism, simulation data can be continuously collected, packaged, written, and managed in segments according to preset conditions.

[0042] This application achieves effective acquisition and segmented management of key signal data during hardware-in-the-loop simulation by receiving and recording configurations on the simulation computer and performing conditional data sampling and segmented file writing based on these configurations. This method, without significantly increasing the real-time load on the simulation computer, can flexibly acquire the required data according to preset sampling periods and segmentation conditions, and promptly generate segmented files for analysis. This supports rapid diagnosis, parameter adjustment, and iterative analysis during simulation operation, effectively balancing data integrity, online resource consumption, and analysis timeliness.

[0043] Example 2 In practice, the conditions for segmented recording include: Segmentation can be based on a preset simulation duration threshold or a preset file byte length threshold.

[0044] Based on this, determining whether the segmentation record conditions are met includes: When the segmentation recording condition is to segment according to the preset simulation duration threshold, obtain the starting simulation time of the segment corresponding to the current segment file, and calculate the time difference between the current simulation time and the starting simulation time of the segment; if the time difference reaches the preset simulation duration threshold, it is determined that the segmentation recording condition is met. When the segmentation record condition is to segment according to the preset file byte length threshold, the current file length of the file currently being written to the segmented file is obtained, and the record length of a single fixed-length record is determined; if the sum of the current file length and the record length reaches or exceeds the preset file byte length threshold, the segmentation record condition is determined to be met.

[0045] Specifically, when the segmentation recording condition is set to segment according to a preset simulation duration threshold, the system records the simulation time when writing to the newly created segmented data record file begins, serving as the starting simulation time for that segment. During the simulation, after each simulation step, the system obtains the current simulation time and calculates the time difference between the current simulation time and the starting simulation time of the segment. This time difference represents the duration of the current segment's simulation. Subsequently, the calculated time difference is compared with the preset simulation duration threshold. If the time difference reaches or exceeds the preset simulation duration threshold, the system determines that the segmentation recording condition has been met, triggering the segmentation operation, ending the writing of the current file, and creating a new segmented file.

[0046] When the segmentation condition is set to segment according to a preset file byte length threshold, the system first obtains the current file length of the segmented data record file being written each time the segmentation condition is checked. Simultaneously, since data records are packaged as fixed-length records, the system can pre-determine the length of a single fixed-length record. During the check, the system adds the current file length to the length of the next fixed-length record to be written, estimating the total file length after writing the next record. Then, this estimated total length is compared with the preset file byte length threshold. If the estimated total length reaches or exceeds the preset file byte length threshold, the system determines that the segmentation condition has been met, and performs segmentation before writing the next record to ensure that the size of the current segmented data record file does not exceed the preset threshold.

[0047] Through the above technical solutions, this application provides a precise and efficient segmentation record condition judgment mechanism. When segmenting using a preset simulation duration threshold, by calculating the time difference between the current simulation time and the segmentation start simulation time in real time and comparing it with the threshold, it can ensure that the data file is strictly segmented according to the preset simulation duration, avoiding inaccurate segmentation caused by accumulated time errors. When segmenting using a preset file byte length threshold, by pre-calculating the length of the record to be written and comparing it with the sum of the current file length and the threshold, precise control of the file size is achieved, avoiding the situation where the file instantly exceeds the threshold due to the writing of a single record, thus ensuring that the size of each segmented data record file meets expectations. This precise judgment mechanism enables simulation data to be accurately and timely segmented and stored, greatly improving the refinement of data management and the efficiency of subsequent data analysis, while reducing the processing burden caused by excessively large files or inaccurate segmentation.

[0048] Example 3 It should be noted that the record configuration also includes: The data length of each signal to be recorded; The method also includes: The field length of each signal to be recorded in the data recording layout is determined based on the data occupancy length of each signal to be recorded, and the field offset of each signal to be recorded in the data recording layout and the record length of a single record are determined based on the field length.

[0049] Specifically, the data occupancy length of each signal to be recorded refers to the actual number of bytes occupied by each signal during storage. For example, a floating-point number (float) might occupy 4 bytes, a double-precision floating-point number (double) might occupy 8 bytes, and a Boolean value might occupy 1 byte. This data occupancy length is determined by the data analysis computer based on its requirements for the data type and precision of the signals and is sent to the simulation computer as part of the recording configuration. After receiving the recording configuration, the simulation computer determines the field length of each signal in the data recording layout based on its data occupancy length. The field length refers to the storage space allocated for that signal in the final fixed-length record. In most cases, the field length is directly equal to the data occupancy length to achieve compact storage. However, in some scenarios where data alignment or reserved expansion space is required, the field length can also be greater than the data occupancy length. For example, a 4-byte signal might be allocated an 8-byte field length to meet the 8-byte alignment requirement. After determining the field lengths of all signals to be recorded, the simulation computer can sequentially calculate the field offset of each signal in the data recording layout. Field offset refers to the byte offset of the signal data relative to the start position of a fixed-length record. The field offset of the first signal is usually 0, and the field offset of subsequent signals is equal to the field offset of the previous signal plus the field length of the previous signal. The sum of the field lengths of all signals constitutes the record length of a single record. This length is fixed to facilitate subsequent data reading, writing, and parsing.

[0050] By introducing the data occupancy length of each signal to be recorded into the recording configuration, the simulation computer can automatically determine the field length, field offset, and single record length of each signal to be recorded in the data recording layout based on this data occupancy length. This application effectively solves the problem of insufficient flexibility in data recording layout configuration in the prior art. Specifically, the data analysis computer can dynamically specify the data type and storage precision of different signals according to actual needs, while the simulation computer does not need to preset a fixed data structure and can automatically generate suitable record description information. This not only greatly simplifies the data recording configuration process, reduces manual intervention and potential configuration errors, but also ensures that the structure of the data record is highly consistent with the data analysis requirements, improving the accuracy of data recording and parsing efficiency. In addition, by automatically calculating the field offset and the single record length, compact storage and efficient access of data in the file can be achieved, optimizing storage space utilization and I / O performance.

[0051] Example 4 It should be noted that the completion indicators include: After finishing writing to the current segment file, rename the current segment file from the temporary file name to the completed file name; Alternatively, a preset segment end marker can be written to the end of the segment currently being written to indicate that the segment data record file has been written.

[0052] A completion flag is a signal or marker used to explicitly indicate that all data writing operations have been completed for a segmented data record file. Its purpose is to ensure data integrity and readability, preventing data analysis computers from reading the file before it is fully written, which could lead to data errors or analytical anomalies.

[0053] Specifically, the currently written segment file is renamed from a temporary filename to a completed filename. This means that during the segment data record file writing process, the file uses a temporary name (e.g., with a specific prefix or suffix, such as ".tmp"). Once all data and necessary metadata (such as segment header information) have been successfully written, and the file handle is closed, the emulated computer performs a file system operation to rename the temporary file to its final, recognizable completed filename. For example, a file being written might be named "segment_001.tmp" and renamed to "segment_001.dat" after writing is complete. This renaming operation is atomic in most file systems, meaning it either succeeds completely or fails completely; there are no intermediate states where the file is in a state of flux, thus providing a clear completion signal to the external system.

[0054] Alternatively, a preset end-of-segment marker can be written to the end of the currently written segment file. This implementation involves appending a specific data segment, i.e., the preset end-of-segment marker, to the physical end of the file after all data records have been written. This marker can be a predefined sequence of bytes, a specific data structure, or metadata such as file checksum, record count, and segment start and end times. When reading the file, the data analysis computer can verify the file's integrity by checking for the presence of the preset end-of-segment marker at the end of the file. If the file is not completely written due to abnormal conditions (such as system crash or program interruption), the end-of-segment marker will be missing or incomplete, indicating that the file may have problems and should not be used for analysis.

[0055] Through the above technical solutions, after the simulation computer finishes writing to the current segmented file, it can generate a completion marker in two explicit ways. Firstly, by renaming the temporary file to the completed filename, the atomicity of file system operations ensures that the data analysis computer finds the completed filename when the file is already complete and usable. This effectively avoids the data analysis computer reading files that are still being written or are incomplete, thus guaranteeing the accuracy and reliability of data analysis. Secondly, by writing a preset segment end marker to the end of the segmented data record file, an internal verification mechanism for file integrity is provided. Even if the filename appears complete, the data analysis computer can still check the segment end marker to further confirm the integrity of the file content. Especially in the event of an unexpected interruption, the missing segment end marker can promptly indicate file abnormalities, thereby improving the robustness of data processing. Both methods provide clear and reliable file completion signals, greatly simplifying the management and processing of simulation data files by the data analysis computer, and improving the efficiency and quality of hardware-in-the-loop (HIL) simulation data acquisition and analysis.

[0056] Furthermore, when the completion identifier uses a preset segment end marker, the preset segment end marker includes at least: At least one of the following: segment number, segment start simulation time, segment end simulation time, and the number of records currently written to the segment file.

[0057] Specifically, the segment number indicates the sequential number of the current segment data record file throughout the simulation process or among all segment files. For example, it can be an integer starting from 1 and incrementing to uniquely identify each segment. By including the segment number, the data analysis computer can quickly identify the order of the segment files, facilitating sequential processing or data reorganization, and effectively detecting whether there are missing or duplicate segment files.

[0058] The segment start simulation time indicates the simulation time corresponding to the start of data recording in the current segment data file. This time is usually a precise point in time on the simulation timeline, such as in seconds, milliseconds, or simulation steps. By recording the segment start simulation time, the data analysis computer can directly understand the time starting point of the segment data, and can filter or locate the time range without parsing the file content.

[0059] The segment end simulation time indicates the simulation time corresponding to the end of data recording in the current segment data file. Similar to the segment start simulation time, this time is also a precise point in time on the simulation timeline. By recording the segment end simulation time, the data analysis computer can clearly determine the time end point of the segment data. Combined with the start time, it can quickly determine the simulation time range covered by the segment data, thereby improving the efficiency of data retrieval and analysis.

[0060] The number of records currently written to the segment file indicates the actual number of fixed-length records contained in the current segment data record file. This number is an integer representing the total number of fixed-length data records collected and written according to the sampling record period from the start to the end of the segment. By recording the number of records, the data analysis computer can quickly verify the integrity of the segment file, for example, by comparing whether the expected number of records matches the actual number of records, or by checking whether the file size matches the number of records during file transfer, thereby ensuring the reliability of data transmission.

[0061] Example 5 It should be noted that the segment header information also includes record description verification information, which is used to characterize the version or summary of the record description information; The method also includes: When creating a new segmented data record file, record description verification information is written into the segment header information to verify the parsing consistency of the segmented data record file.

[0062] Specifically, the record description verification information can be supplementary data used to verify or identify the integrity, version, or content of the record description information. It does not directly contain the record description information itself, but rather a simplified representation or checksum. For example, the record description verification information can be a unique version number representing a specific version of the record description information. This version number is updated when the record description information changes. Alternatively, the record description verification information can be a fixed-length digest value obtained by hashing (e.g., MD5, SHA-256) the record description information (e.g., its XML or JSON representation). Any minor modification to the record description information will cause a significant change in the hash value. Furthermore, the record description verification information can be a checksum calculated from the binary data of the record description information, used to quickly detect errors during data transmission or storage. Its function is to provide a fast and reliable reference during data parsing to determine whether the record description information used by the parser is consistent with the information used when the data file was generated.

[0063] When creating a new segmented data record file, such as in steps S3 and S7, when writing the segment header information, in addition to the record description information identifier, the calculated or obtained record description verification information is also written into the segment header information. This is usually done in a specific field reserved in the file header. In this way, it is ensured that each segmented data record file carries verification information related to its internal data structure definition.

[0064] By introducing record description verification information into the segment header information and writing it when creating a new segmented data record file, this application can effectively solve the data parsing consistency problem. When the data analysis computer attempts to parse the segmented data record file, it can first read the record description verification information in the segment header information and compare it with the record description information currently used for parsing. This comparison mechanism can quickly and accurately determine whether the record description information used by the parser is consistent with the information version or content on which the file was based. Once an inconsistency is found, the system can issue a warning or block parsing in a timely manner, thereby avoiding data parsing errors, data misreading, or inaccurate analysis results caused by mismatched record description information, greatly improving the reliability and accuracy of hardware-in-the-loop data analysis.

[0065] Example 6 It should be noted that the method also includes: Receive segmented query requests sent by the data analysis computer. The segmented query requests are used to indicate the segment range or segment filtering conditions to be obtained. Based on the completion identifier, determine the set of segmented data record files that have been written in segments, generate a list of data record sets corresponding to the set of segmented data record files, and return the list of data record sets to the data analysis computer. Based on the file retrieval request initiated by the data analysis computer based on the data record set list, the corresponding segmented data record files in the data record set list are provided to the data analysis computer.

[0066] Specifically, the simulation computer first receives a segmented query request from the data analysis computer. This segmented query request aims to enable the data analysis computer to proactively and selectively acquire the required segmented data, rather than passively receiving or blindly requesting it. The segmented query request can include various parameters; for example, it can specify a time range, such as data from simulation time T1 to T2; or it can specify a segment sequence range, such as the Nth to Mth segment files. Furthermore, segment filtering conditions can be based on specific simulation events, signal states, or preset metadata tags; for example, querying only segmented data recorded during a specific fault occurrence. After receiving this request, the simulation computer will perform subsequent data preparation and provision based on the request content.

[0067] Based on this, the simulation computer determines the set of segmented data record files that have completed segmented writing, using the generated completion identifiers. This step ensures that the data analysis computer can only access complete and stable data files, avoiding data inconsistencies or errors that might occur from accessing files that are being written or have not yet completed. The completion identifier can be a file renaming mechanism; for example, when a segmented file is completed, it is renamed from a temporary filename to a formal filename. Alternatively, the completion identifier can be a preset segment end marker written to the end of the segmented file, which can contain information such as the segment sequence number, the start simulation time of the segment, the end simulation time of the segment, and the number of records in the segmented file. The simulation computer identifies all segmented files with valid completion identifiers by scanning the storage directory or querying the internal file status management system, thereby constructing a set of files that have completed segmented writing. Subsequently, the simulation computer generates a data record set list for these files, which can contain metadata such as the name, size, simulation time range, and record description information identifier for each file, and sends this list to the data analysis computer.

[0068] Furthermore, after receiving the list of data record sets, the data analysis computer can selectively initiate file retrieval requests based on the information in the list. For example, the data analysis computer can request only the specific segment files it is interested in, based on the segmented simulation time range shown in the list. Upon receiving the file retrieval request, the simulation computer will retrieve the corresponding files from its storage and transmit these segmented data record files to the data analysis computer via a network transmission protocol (such as TCP / IP). This on-demand delivery method avoids unnecessary data transmission and improves the efficiency of data acquisition.

[0069] The above technical solution effectively solves the problem of data analysis computers struggling to efficiently and accurately acquire dynamically generated segmented data record files during hardware-in-the-loop simulation. Specifically, by sending segmented query requests, the data analysis computer can clearly express its need for specific segments of data (such as data within a specific time range or data meeting specific conditions), avoiding the blind acquisition or processing of irrelevant data. The simulation computer, based on completion markers, intelligently identifies and filters all fully written segmented data record files, generating a list of data record sets containing key metadata, thus providing the data analysis computer with a clear and reliable data view. The data analysis computer then initiates precise file acquisition requests based on this list, and the simulation computer provides the corresponding files as needed. This interactive mechanism ensures that the data analysis computer acquires only the required and complete data, significantly reducing network transmission load and data processing complexity, improving the efficiency and accuracy of data analysis, and thus optimizing the reliability and availability of the entire hardware-in-the-loop simulation data analysis process.

[0070] Example 7 Figure 2 This is a schematic diagram of the structure of a system for acquiring analysis data during a hardware-in-the-loop simulation process, provided in one embodiment of this application. (Refer to...) Figure 2 A system for acquiring and analyzing data during a hardware-in-the-loop simulation includes: Simulation computers and data analysis computers; The simulation computer and the data analysis computer are connected via a communication bus: The simulation computer is used to execute a method for acquiring analysis data during a hardware-in-the-loop simulation process as described in the above embodiments.

[0071] In some embodiments of this application, the system is applied to a hardware-in-the-loop simulation scenario, where the simulation computer undertakes real-time simulation computation tasks such as model solving, interface driving, and closed-loop control, while the data analysis computer is used to monitor, record, replay, and analyze the signal data generated during the simulation process. Given the difficulty in balancing data integrity, online resource consumption, and analysis timeliness in existing technologies, this application achieves effective management of critical signal data by implementing a conditional data sampling and segmented file writing mechanism through the simulation computer. Specifically, at the start of the simulation, the simulation computer receives a recording configuration sent by the data analysis computer; this recording configuration includes at least the sampling recording period, segmented recording conditions, the set of signals to be recorded, and the data recording layout. Based on the set of signals to be recorded, the simulation computer establishes recording description information; this recording description information includes at least the correspondence between the signal identifier of each signal to be recorded and its field offset and field length in the data recording layout. Subsequently, the simulation computer creates an initial segmented data recording file, writes segment header information containing the recording description information identifier, and sets the initial segmented data recording file as the currently written segmented file.

[0072] During the simulation, after each simulation step, the simulation computer determines whether the segmented recording condition is met. If the condition is not met, it checks whether the sampling recording period has been reached. If the period has been reached, data sampling is performed. The signal values ​​of each signal to be recorded at the current simulation moment are read from the simulation model according to the set of signals to be recorded. Based on the field offset and field length in the record description information, the signal values ​​of each signal to be recorded are packaged into a fixed-length record based on the data record layout and appended to the currently written segment file. If the segmented recording condition is met, the writing of the currently written segment file ends, and a completion flag indicating the completion of the segment writing is generated. Then, a new segmented data record file is created, a segment header information containing the record description information flag is written, and the new segmented data record file is set as the currently written segment file. The simulation computer repeats the above operations until the simulation ends.

[0073] The core innovation of this embodiment lies in combining the segmented recording conditions with the sampling recording period through dynamic triggering, and using the simulation computer to perform conditional data sampling and segmented file writing. This achieves effective acquisition and segmented acquisition of key signal data without significantly increasing the real-time burden on the simulation computer, thus balancing data integrity, reducing online resource consumption, and improving analysis timeliness. Specifically, this system avoids the excessive resource consumption caused by full-process recording and overcomes the data availability lag defect of pure offline playback. It enables timely acquisition of segmented data for analysis during simulation, supporting rapid diagnosis and iteration. Through the above technical solution, the system significantly reduces the CPU and memory usage of the simulation computer while ensuring data integrity, avoiding adverse effects on the stability of strong real-time simulation calculations. It also ensures that when the simulation cycle is long or when timely anomaly location is required, segmented data can be acquired for immediate analysis, effectively supporting parameter adjustment and test process optimization during simulation.

[0074] It is understood that the same or similar parts in the above embodiments can be referred to each other, and the contents not described in detail in some embodiments can be referred to the same or similar contents in other embodiments.

[0075] It should be noted that in the description of this application, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means at least two.

[0076] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the function involved, as will be understood by those skilled in the art to which embodiments of this application pertain.

[0077] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0078] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0079] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0080] The storage media mentioned above can be read-only memory, disk, or optical disk, etc.

[0081] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0082] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.

Claims

1. A method for obtaining analysis data in a semi-physical simulation process, applied to a simulation computer end, and characterized in that, include: S1. At the beginning of the simulation, receive the recording configuration sent by the data analysis computer; the recording configuration includes at least the sampling recording period, segmented recording conditions, the set of signals to be recorded, and the data recording layout. S2. Establish recording description information based on the set of signals to be recorded; The record description information includes at least: the correspondence between the signal identifier of each signal to be recorded and its field offset and field length in the data record layout; S3. Create an initial segmented data record file, write segment header information, and set the initial segmented data record file as the currently written segment file; the segment header information contains the identifier of the record description information; S4. During the simulation process, after each simulation step, determine whether the segmented recording conditions are met. S5. If the segmented recording conditions are not met, check whether the sampling and recording cycle has been reached; S6. If the sampling and recording period is reached, data sampling is performed. The signal values ​​of each signal to be recorded at the current simulation time are read from the simulation model according to the set of signals to be recorded. Based on the field offset and field length in the recording description information, the signal values ​​of each signal to be recorded are packaged into a fixed-length record based on the data recording layout and appended to the current writing segment file. S7. If the segmented record condition is met, the writing of the current segmented file is ended and a completion identifier representing the completion of the segment writing is generated. Then, a new segmented data record file is created, segmented header information containing the record description information identifier is written, and the new segmented data record file is set as the current segmented file. S8. Repeat steps S4-S7 until the simulation ends; Receive segmented query requests sent by the data analysis computer, wherein the segmented query requests are used to indicate the segment range or segmented filtering conditions to be obtained; Based on the completion identifier, determine the set of segmented data record files that have been written in segments, generate a list of data record sets corresponding to the set of segmented data record files, and return the list of data record sets to the data analysis computer; Based on the file retrieval request initiated by the data analysis computer based on the data record set list, provide the data analysis computer with the corresponding segmented data record file in the data record set list; The segmented recording conditions include: Segmented according to a preset simulation duration threshold, or segmented according to a preset file byte length threshold; Determine whether the conditions for segmented recording are met, including: When the segmentation recording condition is segmentation according to a preset simulation duration threshold, the starting simulation time of the segment corresponding to the current written segment file is obtained, and the time difference between the current simulation time and the starting simulation time of the segment is calculated; if the time difference reaches the preset simulation duration threshold, it is determined that the segmentation recording condition is met. When the segmentation recording condition is to segment according to a preset file byte length threshold, the current file length of the currently written segmented file is obtained, and the record length of a single fixed-length record is determined; if the sum of the current file length and the record length reaches or exceeds the preset file byte length threshold, it is determined that the segmentation recording condition is met.

2. The method of claim 1, wherein, The sampling and recording period is an integer multiple of the minimum simulation step size.

3. The method of claim 1, wherein, The record configuration also includes: The data length of each signal to be recorded; The method further includes: The field length of each signal to be recorded in the data recording layout is determined based on the data occupancy length of each signal to be recorded, and the field offset and the record length of a single record of each signal to be recorded in the data recording layout are determined based on the field length.

4. The method according to claim 1, characterized in that, The completion identifier includes: After finishing writing the current segment file, rename the current segment file from the temporary file name to the completed file name; Alternatively, a preset segment end marker can be written to the end of the currently written segment file to indicate that the segment data record file has been written.

5. The method according to claim 4, characterized in that, When the completion identifier uses a preset segment end marker, the preset segment end marker includes at least: At least one of the following: segment number, segment start simulation time, segment end simulation time, and the number of records currently written to the segment file.

6. The method according to claim 1, characterized in that, The segment header information also includes record description verification information, which is used to characterize the version or summary of the record description information. The method further includes: When creating a new segmented data record file, the record description verification information is written into the segment header information to verify the parsing consistency of the segmented data record file.

7. A system for acquiring analytical data during a hardware-in-the-loop simulation, characterized in that, include: Simulation computers and data analysis computers; The simulation computer and the data analysis computer are connected via a communication bus: The simulation computer is used to execute a method for acquiring analysis data during a hardware-in-the-loop simulation process as described in any one of claims 1-6.