A file generation method and apparatus, a terminal device, and a storage medium
By importing and editing the DBC/LDF files in the hardware-in-the-loop simulation test system and generating JSON files, the problem of strong model coupling in the hardware-in-the-loop simulation test system is solved, and modularity and hardware compatibility are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- KUNYI ELECTRONICS TECHNOLOGY (SHANGHAI) CO LTD
- Filing Date
- 2023-02-23
- Publication Date
- 2026-05-01
AI Technical Summary
In existing hardware-in-the-loop simulation testing systems, the simulation model and I/O hardware are highly coupled, making it difficult to achieve modularity and unable to be compatible with various hardware.
By importing the DBC/LDF file of the target model, the system reads the data frames of CAN/LIN signals according to the preset protocol, edits the target data frames, and generates a JSON file corresponding to the target protocol and target model, thus realizing the connection between the models.
No need to manually write glue code, reducing coupling, easy to achieve modularity, and compatible with various hardware.
Smart Images

Figure CN116029008B_ABST
Abstract
Description
A method, apparatus, terminal device, and storage medium for generating files. Technical Field
[0001] This application relates to the field of hardware-in-the-loop simulation technology, and in particular to a file generation method, apparatus, terminal device and storage medium. Background Technology
[0002] Hardware-in-the-Loop (HIL) is a hardware-in-the-loop simulation and testing system. It uses a real-time processor to run a simulation model to simulate the operating state of a controlled object. It connects to the ECU under test via I / O interfaces to perform comprehensive and systematic testing of the ECU.
[0003] Hardware-in-the-loop (HIL) test systems typically consist of simulation models, bench I / O hardware, and the device under test (DUT) (e.g., an ECU). The simulation model, usually generated by modeling software, is a mathematical model whose inputs and outputs are independent of the bench I / O hardware boards themselves. However, for HIL testing to be performed, the signals from the DUT must be fed to the simulation model through the bench I / O hardware boards. Therefore, direct connections need to be established between simulation models and between the simulation models and the bench I / O hardware.
[0004] In existing technologies, establishing direct connections between simulation models is achieved by writing glue code. While glue code can connect incompatible models and enable them to function correctly, this approach suffers from strong coupling, difficulty in modularization, and incompatibility with various hardware. Summary of the Invention
[0005] This application provides a HIL-based file generation method, apparatus, terminal device, and storage medium to solve the problems mentioned in the background art.
[0006] In a first aspect, embodiments of this application provide a document generation method, the method comprising:
[0007] Import the target model's DBC / LDF file;
[0008] The DBC / LDF file is read according to the preset target protocol to determine the data frame contained in the corresponding CAN / LIN signal;
[0009] The target data frame in the data frame is edited so that the target data frame can be used as a medium for transmitting and / or receiving target signals;
[0010] Generate a JSON file corresponding to the target protocol and the target model based on the editing results.
[0011] Secondly, embodiments of this application also provide a document generation apparatus, the apparatus comprising:
[0012] The import module is used to import the target model's DBC / LDF files;
[0013] The determination module is used to read the DBC file / LDF file according to a preset target protocol and determine the data frame contained in the corresponding CAN signal / LIN signal;
[0014] An editing module is used to edit the target data frame in the data frame so that the target data frame can be used as a medium for transmitting and / or receiving target signals;
[0015] The generation module is used to generate a JSON file corresponding to the target protocol and the target model based on the editing results.
[0016] Fourthly, embodiments of this application also provide a storage medium storing a plurality of instructions adapted for loading by a processor to execute the file generation method described above.
[0017] The file generation method in this embodiment reads the imported DBC / LDF file according to a preset target protocol, determines the data frames contained in the corresponding CAN / LIN signals, and edits the target data frames within the data frames so that the target data frames can be used as a medium for sending and / or receiving target signals. Based on the editing results, a JSON file corresponding to the target protocol and target model is generated. This method eliminates the need for manually writing glue code to establish connections between models, resulting in low coupling, easy modularization, and compatibility with various hardware. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 is a flowchart of a file generation method provided in an embodiment of this application.
[0020] Figure 2 is a user interface diagram for importing DBC files provided in an embodiment of this application.
[0021] Figure 3 is a user interface diagram for importing LDF files according to an embodiment of this application.
[0022] Figure 4 is a user interface diagram of a list display provided in an embodiment of this application.
[0023] Figure 5a is a user interface diagram of a model editing method provided in an embodiment of this application.
[0024] Figure 5b is another user interface diagram of a model editing provided in an embodiment of this application.
[0025] Figure 6 is a user interface diagram of a group configuration provided in an embodiment of this application.
[0026] Figure 7 is a user interface diagram of a model configuration provided in an embodiment of this application.
[0027] Figure 8 is a user interface diagram of a completed model configuration provided in an embodiment of this application.
[0028] Figure 9 is another user interface diagram of a completed model configuration provided in an embodiment of this application.
[0029] Figure 10 is a structural schematic diagram of a document generation device provided in an embodiment of this application.
[0030] Figure 11 is another structural schematic diagram of a document generation device provided in an embodiment of this application.
[0031] Figure 12 is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. Detailed Implementation
[0032] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0033] In the description of the embodiments of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, features defined with "first" and "second" may explicitly or implicitly include one or more of the stated features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0034] To enable any person skilled in the art to implement and use this application, the following description is provided. In this description, details are set forth for purposes of explanation. It should be understood that those skilled in the art will recognize that this application can be implemented without using these specific details. In other instances, well-known processes will not be described in detail to avoid obscuring the description of the embodiments of this application with unnecessary detail. Therefore, this application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in the embodiments of this application.
[0035] This application provides a file generation method, apparatus, terminal device, and storage medium, which will be described in detail below.
[0036] Please refer to Figure 1, which is a flowchart of a file generation method provided in an embodiment of this application, including the following:
[0037] 101. Import the target model's DBC / LDF file.
[0038] 102. Read the DBC file / LDF file according to the preset target protocol to determine the data frame contained in the corresponding CAN signal / LIN signal.
[0039] 103. Edit the target data frame in the data frame so that the target data frame can be used as a medium for transmitting and / or receiving target signals.
[0040] Set up scenario testing requirements, determine the target model for which model instances need to be generated, retrieve the DBC / LDF files of the target model from the database, import the DBC / LDF files into the hardware-in-the-loop simulation testing system, generate a JSON file of the DBC / LDF files using the hardware-in-the-loop simulation testing system, compile the JSON file, and then generate the final target model, i.e., a model instance of the target model. Hardware-in-the-loop simulation testing is then performed using this model instance. Optionally, the database storing the files can include a DBC database and an LDF database; the DBC database stores the DBC files, and the LDF database stores the LDF files.
[0041] When the imported file is a DBC file, the corresponding target model is a DBC model. When the imported file is an LDF file, the corresponding target model is an LDF model.
[0042] To import a target model's DBC / LDF file, enter its name in the "Button Name" field of the hardware-in-the-loop simulation test system's user interface, and then click the "Import" button. Alternatively, you can select the target model's DBC / LDF file from the database using the selection function on the hardware-in-the-loop simulation test system's user interface, and then click the "Import" button to import the file.
[0043] After the files are imported, the corresponding interface is displayed on the user interface of the hardware-in-the-loop simulation test system. Figure 2 shows the user interface when the target model's DBC file is selected but not imported; clicking the "Import DBC" button on the user interface imports the DBC file. Figure 3 shows the user interface when the target model's LDF file is selected but not imported; clicking the "Import LDF" button on the user interface imports the LDF file.
[0044] After importing the DBC / LDF file, the hardware-in-the-loop simulation test system reads the imported DBC / LDF file to determine the data frames contained in the corresponding CAN / LIN signals. The CAN signals correspond to the DBC file, and the LIN signals correspond to the LDF file.
[0045] For example, the DBC file of the target model is imported into the hardware-in-the-loop simulation test system. The hardware-in-the-loop simulation test system reads the DBC file and determines the data frame contained in the CAN signal through the information of the corresponding CAN bus.
[0046] As shown in Figure 4, the user interface displaying data frames contained in CAN or LIN signals shows the ID, name, and type of each data frame in a list format. After setting the output and / or input of a target data frame, clicking or selecting a target data frame will display the signal name and frame type of the target data frame. The frame type can include transmit and receive frames. If a target data frame is set to output a signal, clicking or selecting it will display a transmit frame. If a target data frame is set to input a signal, clicking or selecting it will display a receive frame. If a target data frame is set to both output and input a signal, clicking or selecting it will display both transmit and receive frames. Editing data frames, i.e. setting up model test nodes, is done as follows: First, select the model DBC file. After selecting the DBC file, all CAN network nodes described in the DBC file will be listed in the node selection box. Then, select a CAN network node as the test node. After selecting the test node, the node's receive and transmit frames will be automatically listed in the node receive frame and node transmit frame list. After confirmation, the data frames of the selected test node will be used for subsequent model editing. After selecting the test node, the system will automatically configure the corresponding transmit packets for the transmit frames of the selected node.
[0047] The input and output settings for the target data frame within the data frame are shown in Figures 5a-5b. Editing settings can include setting it as a send frame, a receive frame, a transmit / receive frame, adding it to a group, and deleting it from a group. An example of adding it to a group is adding multiple send frames to a single send group. Additionally, editing settings can also include removal; removed data frames are not included in subsequent model editing. Settings can be configured according to the scenario testing requirements and the characteristics of the data frame.
[0048] If the editing setting for a target data frame is set to send, then that target data frame is an output frame. Conversely, if the editing setting for a target data frame is set to receive, then that target data frame is an input frame. Alternatively, if the editing setting for a target data frame is set to transmit and receive, then that target data frame is both an input and output frame.
[0049] Optionally, in some embodiments, the target data frame in the data frame is edited to make the target data frame a medium for sending and / or receiving the target signal, including: creating a task group according to the scenario test requirements and setting the transmission function of the task group; editing the target data frame in the data frame according to the transmission function; adding the edited target data frame to the task group; and sending and / or receiving the target signal through the task group.
[0050] For imported DBC files, creating a task group essentially creates a group of CAN signals. Correspondingly, setting the transmission function of the task group involves setting the target signal for the data frame group transmission and configuring the group for input / output / input / output of the target signal. After removing discarded CAN signal data frames and editing the target data frames, it's determined whether the retained CAN signal data frames are input frames, output frames, or input / output frames. Based on the configured transmission function, a matching target data frame is identified from the retained and edited data frames, and this target data frame is added to the task group, i.e., added to the group, thus achieving input / output / input / output of the target signal.
[0051] Optionally, each data frame can have multiple signals after being expanded. The characteristic information of the corresponding data frame can be obtained through the information of these signals. Therefore, based on the characteristic information and the requirements of the scenario test, the matching target data frame can be determined from the retained and edited data frames and added to the task group.
[0052] As shown in Figure 6, the user interface displays the editing of group configurations, corresponding to the creation of task groups described above. After creating a task group, matching target data frames can be added to the task group, and unmatched target data frames can be deleted from the task group. Alternatively, task groups with added or unadded target data frames can be deleted. After creating a task group, the system sets a group name according to preset naming rules, or the group name can be manually set. In addition to setting the group name, a group identifier, i.e., the group ID, can also be set. After adding matching target data frames to the task group, the group identifier associates the task group with each target data frame it contains, facilitating the querying and management of the task group.
[0053] For imported LDF files, the process involves creating task groups and configuring their transmission functions. Essentially, this involves creating tasks that meet preset goals, setting the target signal for transmission, configuring the task for input / output / input / output of the target signal, and defining the task type. Task types include main task, initialization task, and conflict resolution task.
[0054] Optionally, in some embodiments, if the imported file is an LDF file, a task group is created according to the scenario testing requirements, and the transmission function of the task group is set, including: obtaining the configurable model generation mode and simulation node corresponding to the LDF file, obtaining the LIN network node described in the LDF file, determining the target generation mode of the target model from the model generation modes according to the scenario testing requirements, determining the simulation node of the target model from the LIN network node according to the target generation mode, creating a task group of the target model according to the target generation mode and simulation node, and setting the transmission function of the task group.
[0055] After determining the target generation mode, the simulation nodes are identified from the LIN network nodes described in the LDF file. The LIN network nodes are divided into master nodes and slave nodes.
[0056] As shown in Figure 7, after importing the LDF file, a creation mode selection can be made. The user interface corresponding to the creation mode selection displays configurable model generation modes and simulation nodes. Model generation modes include master mode, slave mode, and master-slave mode. Simulation nodes are set according to actual needs and are defined by the LDF file. A simulation node is a communication node defined in the LDF file, which can be a master or slave node in a LIN network. The simulation node is determined based on the target generation mode, including: master mode selecting the master node in the LIN network described in the LDF file as the simulation node, and the master node's scheduling task can be edited; slave mode selecting a slave node in the LIN network described in the LDF file as the simulation node, and the node's transmit and receive frames can be edited; master-slave mode selecting a slave node in the LIN network described in the LDF file as the simulation node, and the master node's scheduling task can be edited. On the user interface, one of the model generation modes is selected as the target generation mode, and a master or slave node in the LIN network is selected as the simulation node based on the target generation mode. After selecting the target generation mode and simulation node, clicking the confirmation button sets the target generation mode and simulation node for the target model corresponding to the LDF file.
[0057] As shown in Figure 8, the user interface includes a message sending bar and a message receiving bar, which are used to configure sending / receiving messages. The message sending bar can be considered as creating a task with the function of sending signals; this task can correspond to one or multiple target data frames for output signals. The message receiving bar is used to create a task with the function of receiving signals; this task can correspond to one or multiple target data frames for input signals.
[0058] During setup, the target data frames contained in the LIN signals of the LDF file can be edited. Editing settings can include sending, receiving, and transmitting / receiving. Editing the target data frames in the LIN signals determines the input and output of the target data frames, thus forming the corresponding ports of the target model. After editing the target data frames, task groups can be created in the message sending or receiving bar according to the scenario testing requirements. One or more edited target data frames can be added to the task group, enabling each task group to send and / or receive the target signals.
[0059] After creating a task group in the message sending or receiving field, you can modify and delete it. You can also set the task group's name, task identifier, and the sender / receiver of the target signal. Specifically, when a task group is created in the message sending field, the target data frame contained within the task group acts as the sender, used to transmit the target signal, while the receiver of the target signal acts as the receiver. Conversely, when a task group is created in the message receiving field, the target data frame contained within the task group acts as the receiver, used to receive the target signal, while the sender of the target signal acts as the sender.
[0060] Optionally, in some embodiments, after adding the edited target data frame to the task group and sending and / or receiving the target signal through the task group, the method further includes: determining the task type of the task group based on the transmission function. The task types include main tasks, initialization tasks, and conflict resolution tasks. The task group is then added to a scheduling table matching the task type. The main task is the primary scheduling task of the master node, consisting of multiple master scheduling tables used to schedule the transmission of data frames on the bus during model runtime. These master scheduling tables are executed sequentially. The initialization task contains an initialization scheduling table and executes the initialization task. The conflict resolution task contains multiple conflict resolution scheduling tables, bound to event-triggered data frames. When a conflict occurs in an event-triggered data frame, the corresponding conflict resolution scheduling table is executed.
[0061] As shown in Figure 9, the user interface corresponding to the schedule table displays three task bars: the main task bar, the initial task bar, and the conflict resolution task bar. After creating a task group and setting its transfer function, the task group can be added to the task bar in the schedule table that matches its task type, according to the scenario's creation requirements.
[0062] After the task group is added to the corresponding task bar in the matching schedule table, the task group in the main task bar, initial task bar, and conflict resolution task bar is processed in the subsequent processing according to the pre-set task processing rules.
[0063] 104. Generate a JSON file corresponding to the target protocol and the target model based on the editing results.
[0064] Since the DBC / LDF file is read according to a preset target protocol, after reading the DBC / LDF file, the data frames contained in the corresponding signal are determined, and the target data frames in the data frames are edited so that the edited target data frames can send and / or receive the target signal, thereby generating the corresponding JSON file. The file protocol of the generated JSON file is the target protocol, and the generated JSON file corresponds to the target model. Optionally, the target protocol can be a schema protocol.
[0065] This target protocol can be understood as a protocol that can define at least the following:
[0066] The method for reading data frames in CAN signals in a DBC file; for example, from which position to read which data frame;
[0067] The method for reading data frames in LIN signals within an LDF file; for example, from which position to read which data frame;
[0068] The relationship between the various editable information in the data frames of CAN and LIN signals and the corresponding code in the JSON file; for example, where the edited information (i.e. the information in the editing result) should be written in the JSON file, and how the information should be described, etc., at least one of these is required.
[0069] Furthermore, this target protocol can also define the configurable information, non-configurable information, and format conditions of configurable information required for different model categories, in addition to LDF models and DBC models.
[0070] Furthermore, the method may also include:
[0071] A first JSON file is determined for the simulation model that is not the target model (i.e., not an LDF model, not a DBC model). The first JSON file is used to define at least one configurable and non-configurable information required to generate the model file package of the simulation model. For example, the model category of the target model is determined. The first JSON file is generated according to the target protocol and the model category of the simulation model. The protocol is used to define the configurable and non-configurable information required to be configured for different model categories, as well as the format conditions of the configurable information.
[0072] Configure the configurable information defined in the first JSON file to generate a second JSON file of the target model, wherein the second JSON file is used to describe all configurable and non-configurable information of the target model;
[0073] The simulation model's model file package is generated based on the second JSON file.
[0074] The simulation model can be any one of the following: analog output processing model, analog input model, digital output model, digital input model, PWM signal input model, PWM signal output model, Ethernet model, timer model, socket model, custom model, or third-party model.
[0075] Furthermore, the target protocol can be used to predefine in a standardized manner how to use DBC files, LDF files (and other files and information corresponding to simulation models) and ultimately form a JSON file that can be compiled. This effectively improves the generation efficiency of DBC models, LDF models (and other models) and reduces the workload of developers. The generation requirements can be met simply by calling the protocol, without the need to manually write a large amount of code to meet the generation requirements of the models. At the same time, it can help ensure the validity of the generated DBC models and LDF models in a standardized way.
[0076] Optionally, in some embodiments, if the imported file is a DBC file, after generating a JSON file corresponding to the target protocol and target model based on the editing results, the method further includes: compiling the JSON file to generate the final target model of the target model, generating a schedulable object of the final target model corresponding to the task group, and registering the schedulable object to the target system so that the schedulable object can be invoked. Here, the schedulable object is an object that can be scheduled by the target system, and in the target system, it is represented as an executable function. Scheduling means executing this executable function, and the schedulable object can be activated and executed by target system events.
[0077] The generated JSON file is initially without configured parameters. It needs to be configured and compiled to generate a model file package that can be parsed and run on the test bench. This model file package is then used to generate the final target model, i.e., a model instance of the target model, and a schedulable object corresponding to the created task group. This schedulable object is then registered with the MRTD (Model Runtime Driver) system, allowing it to be activated and executed by target system events corresponding to the final target model or other models.
[0078] Optionally, in some embodiments, after registering the schedulable object with the target system so that the schedulable object can be invoked, the method further includes: when a system event corresponding to the schedulable object is received, invoking the schedulable object from the target system, and sending and / or receiving the target signal corresponding to the system event through the schedulable object.
[0079] System events can be events that occur in the final target model, or events that occur in other models connected to the MRTD system.
[0080] The file generation method of this application embodiment includes: importing the DBC file / LDF file of the target model; reading the DBC file / LDF file according to a preset target protocol to determine the data frames contained in the corresponding CAN signal / LIN signal; editing the target data frames in the data frames so that the target data frames serve as the medium for sending and / or receiving the target signal; and generating a JSON file corresponding to the target protocol and the target model based on the editing result. The method of this application embodiment eliminates the need for manually writing glue code to establish connections between models, resulting in low coupling, easy modularization, and compatibility with various hardware.
[0081] In one embodiment, the connection relationship of the data ports between models can also be determined in the host computer through the following process:
[0082] Identify the available data ports in the target simulation model to be connected (any one or two of the target models and simulation models mentioned above);
[0083] Determine the port description information of the target data port;
[0084] Based on the port description information and preset port connection rules, the connection relationships between the target data ports are determined so that signal transmission can be performed based on these connections when the target simulation model is working. The process of determining the connection relationships can be initiated in response to user operations on the corresponding interface. During this process, the results of user operations can be restricted, adjusted, or verified based on the port description information and port connection rules.
[0085] In the above process, besides ensuring that the data types in the port description information of the connected data ports are the same and the data transmission directions are corresponding, in one example, it can be determined whether the target data port has a queue attribute based on the port description information; then, based on the port connection rules, it can be determined that the target data port that does not have a queue attribute and serves as an input port is connected to only one target data port in the connection relationship. Furthermore, if the connection relationship achieved by the user operation does not conform to the requirements, the determination of the connection relationship can be prohibited or canceled, or an abnormality in the connection relationship can be indicated.
[0086] Queue attributes can also be understood as queue identifiers, used to identify whether a corresponding port is allowed to connect to multiple target data ports. Furthermore, it can also be understood as whether the corresponding simulation model has designed a mechanism that, based on a queue, processes the data input (or output) to the different connected data ports sequentially.
[0087] In one implementation, after determining the two target simulation models that need to be connected, if we assume that the two target simulation models are a first target simulation model and a second target simulation model, the target data ports and their connection relationships can also be determined through the following steps:
[0088] Obtain one or more pieces of empirical information from simulation models of the first target simulation model type and simulation models of the second target simulation model type; the empirical information represents a connection method that has occurred in the past between the data ports of the two types of models;
[0089] If there are multiple pieces of experience information, the frequency of each piece of experience information can be counted. Based on the frequency, candidate connection relationships can be suggested on the interface. For example, the connection relationships can be described and then displayed in descending order of frequency. Furthermore, the final connection relationship can be determined in response to the user's operation on the suggested connection relationship. That is, the connection operation mentioned above can be the user's operation on the recommended connection.
[0090] By using the above methods, we can draw on past experience in connection relationships to improve connection efficiency, and at the same time avoid or reduce errors when engineers with less experience make connections.
[0091] In a further example, each piece of experience information can also be configured with a mapped scenario identifier to identify the characteristics of the test scenario, such as a scenario for testing the chassis domain controller, a scenario for testing the intelligent driving domain controller, etc. The characteristics of the scenario are not limited to domain-based distinctions, but may also include the manufacturer and purpose of the controller under test, etc.
[0092] Furthermore, in the process of obtaining one or more pieces of experience information from the two types of models, it is possible to obtain only the experience information whose scene identifier is exactly the same or partially the same as the scene being tested.
[0093] Furthermore, highly relevant connection records can be applied to this test to ensure that the recommended connections are helpful. This is especially beneficial for adapting to the changing test tasks and requirements in HIL clustered testing, improving efficiency.
[0094] Please refer to Figure 10, which is a schematic diagram of a document generation apparatus provided in an embodiment of this application. The document generation apparatus 200 includes the following modules:
[0095] Import module 201 is used to import the DBC / LDF file of the target model.
[0096] The determination module 202 is used to read the DBC file / LDF file according to the preset target protocol and determine the data frame contained in the corresponding CAN signal / LIN signal.
[0097] The editing module 203 is used to edit the target data frame in the data frame according to the scenario test requirements, so that the target data frame can be used as a medium for sending and / or receiving target signals.
[0098] The generation module 204 is used to generate a JSON file corresponding to the target protocol and target model based on the editing results.
[0099] Optionally, the document generation device 200 may also include the following modules:
[0100] The list generation module is used to generate corresponding display lists based on data frames.
[0101] The removal module is used to identify data frames to be discarded and remove them from the display list.
[0102] The list generation module is executed after the determination module 202 mentioned above.
[0103] Optionally, the editing module 203 may include the following sub-modules:
[0104] The first creation submodule is used to create task groups according to scenario testing requirements and set the transmission function of the task groups.
[0105] The frame editing submodule is used to edit the target data frame in the data frame according to the transmission function.
[0106] The frame addition submodule is used to add the edited target data frame to the task group, and to send and / or receive the target signal through the task group.
[0107] Optionally, corresponding to the settings of the first creation submodule, frame editing submodule, and frame adding submodule described above, the file generation device 200 may further include the following modules:
[0108] The model generation module is used to compile JSON files, generate the final target model of the target model, and generate a schedulable object of the final target model corresponding to the task group.
[0109] The registration module is used to register schedulable objects with the target system, so that the schedulable objects can be invoked.
[0110] The calling module is used to call the schedulable object from the target system when a system event corresponding to the schedulable object is received, and to send and / or receive the target signal corresponding to the system event through the schedulable object.
[0111] Optionally, if the file imported by import module 201 is an LDF file, the first creation submodule mentioned above may include the following submodules:
[0112] The acquisition submodule is used to obtain the configurable model generation mode corresponding to the LDF file and to obtain the LIN network nodes described in the LDF file.
[0113] The first determination submodule is used to determine the target generation mode of the target model from the model generation modes according to the scenario testing requirements.
[0114] The second determination submodule is used to determine the simulation nodes of the target model from the LIN network nodes according to the target generation mode.
[0115] The second creation submodule is used to create task groups for the target model based on the target generation mode and simulation nodes, and to set the transmission function of the task groups.
[0116] Optionally, corresponding to the above-described acquisition submodule, first determination submodule, second determination submodule, and second creation submodule, the file generation device 200 may further include the following modules:
[0117] The task determination module is used to determine the task type of the task group based on the transmission function. The task types include main task, initialization task and conflict resolution task.
[0118] The task addition module is used to add task groups to a schedule table that matches the task type.
[0119] The task determination module is executed after the sub-module is added to the above frame.
[0120] Optionally, the document generation apparatus 200 in this application embodiment may also include other modules and sub-modules, which will not be described in detail here.
[0121] The file generation apparatus 200 of this application embodiment includes: an import module 201 for importing a DBC file / LDF file of a target model; a determination module 202 for reading the DBC file / LDF file according to a preset target protocol and determining the data frames contained in the corresponding CAN signal / LIN signal; an editing module 203 for editing the target data frames in the data frames so that the target data frames can be used as a medium for sending and / or receiving target signals; and a generation module 204 for generating a JSON file corresponding to the target protocol and the target model based on the editing results. With the apparatus of this application embodiment, there is no need to manually write glue code to achieve the connection between models, resulting in low coupling, easy modularization, and compatibility with various hardware.
[0122] Please refer to Figure 11, which is another structural schematic diagram of the file generation apparatus provided in this application embodiment. The file generation apparatus 200 includes a memory 120, one or more processors 180, and one or more application programs, wherein the one or more application programs are stored in the memory 120 and configured to be executed by the processors 180; the processors 180 may include an import module 201, a determination module 202, an editing module 203, and a generation module 204. For example, the structure and connection relationship of the above components can be as follows:
[0123] Memory 120 can be used to store applications and data. The applications stored in memory 120 contain executable code. Applications can be composed of various functional modules. Processor 180 executes various functional applications and steps of file generation methods by running the applications stored in memory 120. Furthermore, memory 120 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, memory 120 may also include a memory controller to provide processor 180 with access to memory 120.
[0124] The processor 180 is the control center of the device, connecting various parts of the terminal through various interfaces and lines. It performs various functions and processes data by running or executing applications stored in the memory 120 and calling data stored in the memory 120, thereby providing overall monitoring of the device. Optionally, the processor 180 may include one or more processing cores; preferably, the processor 180 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications.
[0125] Specifically, in this embodiment, the processor 180 loads the executable code corresponding to the processes of one or more applications into the memory 120 according to the following instructions, and the processor 180 runs the applications stored in the memory 120 to achieve various functions:
[0126] Import the target model's DBC / LDF file;
[0127] The DBC / LDF file is read according to the preset target protocol to determine the data frame contained in the corresponding CAN / LIN signal;
[0128] The target data frame in the data frame is edited so that the target data frame can be used as a medium for transmitting and / or receiving target signals;
[0129] Generate a JSON file corresponding to the target protocol and the target model based on the editing results.
[0130] In some embodiments, after determining the data frame contained in the corresponding CAN signal / LIN signal, the method further includes:
[0131] A corresponding display list is generated based on the data frame;
[0132] Identify the data frames to be discarded from the data frames and remove the data frames to be discarded from the display list.
[0133] In some embodiments, editing a target data frame within the data frame to make the target data frame serve as a medium for transmitting and / or receiving a target signal includes:
[0134] Create task groups according to the scenario testing requirements, and configure the transmission function of the task groups;
[0135] Edit the target data frame in the data frame according to the transmission function;
[0136] The edited target data frame is added to the task group, through which the target signal is sent and / or received.
[0137] In some embodiments, if the imported file is a DBC file, after generating a JSON file corresponding to the target protocol and the target model based on the editing results, the method further includes:
[0138] The JSON file is compiled to generate the final target model of the target model, and a schedulable object of the final target model corresponding to the task group is generated.
[0139] Register the schedulable object with the target system so that the schedulable object can be invoked.
[0140] In some embodiments, after registering the schedulable object to the target system, making the schedulable object invokable, the method further includes:
[0141] When a system event corresponding to the schedulable object is received, the schedulable object is invoked from the target system, and the target signal corresponding to the system event is sent and / or received through the schedulable object.
[0142] In some embodiments, if the imported file is an LDF file, the step of creating a task group according to the scenario testing requirements and setting the transmission function of the task group includes:
[0143] Obtain the configurable model generation mode corresponding to the LDF file, and obtain the LIN network nodes described in the LDF file;
[0144] Based on the scenario testing requirements, determine the target generation mode of the target model from the model generation modes;
[0145] Based on the target generation pattern, the simulation nodes of the target model are determined from the LIN network nodes;
[0146] Based on the target generation mode and the simulation node, create a task group for the target model and set the transmission function of the task group.
[0147] In some embodiments, after adding the edited target data frame to the task group and transmitting and / or receiving the target signal through the task group, the method further includes:
[0148] Based on the transmission function, the task type of the task group is determined, and the task type includes main task, initialization task and conflict resolution task;
[0149] Add the task group to the scheduling table that matches the task type.
[0150] This application also provides a terminal device. The terminal device may be a server, smartphone, computer, tablet computer, or other similar device.
[0151] Please refer to Figure 12, which is a schematic diagram of a terminal device provided in an embodiment of this application. This terminal device 1200 can be used to implement the file generation method provided in the above embodiments. The terminal device 1200 can be a smartphone or a tablet computer.
[0152] As shown in Figure 12, the terminal device 1200 may include an RF (Radio Frequency) circuit 110, a memory 120 including one or more (only one is shown in the figure) computer-readable storage media, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a transmission module 170, a processor 180 including one or more (only one is shown in the figure) processing cores, and a power supply 190, etc. Those skilled in the art will understand that the structure of the terminal device 1200 shown in Figure 12 does not constitute a limitation on the terminal device 1200, and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0153] RF circuit 110 is used to receive and transmit electromagnetic waves, realizing the mutual conversion between electromagnetic waves and electrical signals, thereby enabling communication with communication networks or other devices. RF circuit 110 may include various existing circuit elements used to perform these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, Subscriber Identity Module (SIM) cards, memory, etc. RF circuit 110 can communicate with various networks such as the Internet, corporate intranets, and wireless networks, or communicate with other devices via wireless networks.
[0154] The memory 120 can be used to store software programs and modules, such as the program instructions / modules corresponding to the file generation method in the above embodiments. The processor 180 executes various functional applications and the various steps of the file generation method by running the software programs and modules stored in the memory 120. The memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 120 may further include memory remotely located relative to the processor 180, and these remote memories can be connected to the terminal device 1200 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0155] Input unit 130 can be used to receive input numerical or character information, and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control. Specifically, input unit 130 may include touch-sensitive surface 131 and other input devices 132. Touch-sensitive surface 131, also known as a touch display screen or touchpad, can collect user touch operations on or near it (such as user operations using fingers, styluses, or any suitable object or accessory on or near touch-sensitive surface 131), and drive corresponding connection devices according to a pre-set program. Optionally, touch-sensitive surface 131 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to processor 180, and can receive and execute commands from processor 180. In addition, the touch-sensitive surface 131 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. Besides the touch-sensitive surface 131, the input unit 130 may also include other input devices 132. Specifically, other input devices 132 may include, but are not limited to, one or more of the following: a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick.
[0156] Display unit 140 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of terminal device 1200. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Display unit 140 may include display panel 141, which may optionally be configured as an LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), or similar form. Further, touch-sensitive surface 131 may cover display panel 141. When touch-sensitive surface 131 detects a touch operation on or near it, it transmits the information to processor 180 to determine the type of touch event. Subsequently, processor 180 provides corresponding visual output on display panel 141 according to the type of touch event. Although in FIG. 12, touch-sensitive surface 131 and display panel 141 are implemented as two separate components to realize input and output functions, in some embodiments, touch-sensitive surface 131 and display panel 141 can be integrated to realize input and output functions.
[0157] The terminal device 1200 may also include at least one sensor 150, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 141 according to the ambient light level, and the proximity sensor can turn off the display panel 141 and / or backlight when the terminal device 1200 is moved to the ear. As a type of motion sensor, a gravity acceleration sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, tapping), etc. Other sensors that the terminal device 1200 may also be configured with, such as a gyroscope, barometer, hygrometer, thermometer, and infrared sensor, will not be described in detail here.
[0158] Audio circuitry 160, speaker 161, and microphone 162 provide an audio interface between the user and terminal device 1200. Audio circuitry 160 converts received audio data into electrical signals, which are then transmitted to speaker 161, where they are converted into sound signals for output. Conversely, microphone 162 converts collected sound signals into electrical signals, which are received by audio circuitry 160, converted back into audio data, and then processed by processor 180 before being transmitted via RF circuitry 110 to, for example, another terminal, or output to memory 120 for further processing. Audio circuitry 160 may also include an earphone jack to facilitate communication between peripheral headphones and terminal device 1200.
[0159] Terminal device 1200, through transmission module 170 (e.g., Wi-Fi module), can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 12 shows transmission module 170, it is understood that it is not an essential component of terminal device 1200 and can be omitted as needed without changing the essence of the invention.
[0160] The processor 180 is the control center of the terminal device 1200. It connects to various parts of the mobile phone via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 120, and by calling data stored in the memory 120, it performs various functions of the terminal device 1200 and processes data, thereby providing overall monitoring of the mobile phone. Optionally, the processor 180 may include one or more processing cores; in some embodiments, the processor 180 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 180.
[0161] The terminal device 1200 also includes a power supply 190 that supplies power to the various components. In some embodiments, the power supply can be logically connected to the processor 180 through a power management system, thereby enabling functions such as discharge management and power consumption management through the power management system. The power supply 190 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0162] Although not shown, the terminal device 1200 may also include a camera (such as a front-facing camera and a rear-facing camera), a Bluetooth module, etc., which will not be described in detail here. Specifically, in this embodiment, the display unit 140 of the terminal device 1200 is a touch screen display, and the terminal device 1200 also includes a memory 120 and one or more programs, wherein one or more programs are stored in the memory 120 and configured to be executed by one or more processors 180, and the one or more programs include steps for performing the following operations:
[0163] Import the target model's DBC / LDF file;
[0164] The DBC / LDF file is read according to the preset target protocol to determine the data frame contained in the corresponding CAN / LIN signal;
[0165] The target data frame in the data frame is edited so that the target data frame can be used as a medium for transmitting and / or receiving target signals;
[0166] Generate a JSON file corresponding to the target protocol and the target model based on the editing results.
[0167] In some embodiments, after determining the data frame contained in the corresponding CAN signal / LIN signal, the method further includes:
[0168] A corresponding display list is generated based on the data frame;
[0169] Identify the data frames to be discarded from the data frames and remove the data frames to be discarded from the display list.
[0170] In some embodiments, editing a target data frame within the data frame to make the target data frame serve as a medium for transmitting and / or receiving a target signal includes:
[0171] Create task groups according to the scenario testing requirements, and configure the transmission function of the task groups;
[0172] Edit the target data frame in the data frame according to the transmission function;
[0173] The edited target data frame is added to the task group, through which the target signal is sent and / or received.
[0174] In some embodiments, if the imported file is a DBC file, after generating a JSON file corresponding to the target protocol and the target model based on the editing results, the method further includes:
[0175] The JSON file is compiled to generate the final target model of the target model, and a schedulable object of the final target model corresponding to the task group is generated.
[0176] Register the schedulable object with the target system so that the schedulable object can be invoked.
[0177] In some embodiments, after registering the schedulable object to the target system, making the schedulable object invokable, the method further includes:
[0178] When a system event corresponding to the schedulable object is received, the schedulable object is invoked from the target system, and the target signal corresponding to the system event is sent and / or received through the schedulable object.
[0179] In some embodiments, if the imported file is an LDF file, the step of creating a task group according to the scenario testing requirements and setting the transmission function of the task group includes:
[0180] Obtain the configurable model generation mode corresponding to the LDF file, and obtain the LIN network nodes described in the LDF file;
[0181] Based on the scenario testing requirements, determine the target generation mode of the target model from the model generation modes;
[0182] Based on the target generation pattern, the simulation nodes of the target model are determined from the LIN network nodes;
[0183] Based on the target generation mode and the simulation node, create a task group for the target model and set the transmission function of the task group.
[0184] In some embodiments, after adding the edited target data frame to the task group and transmitting and / or receiving the target signal through the task group, the method further includes:
[0185] Based on the transmission function, the task type of the task group is determined, and the task type includes main task, initialization task and conflict resolution task;
[0186] Add the task group to the scheduling table that matches the task type.
[0187] This application also provides a storage medium storing a computer program. When the computer program is run on a computer, the computer executes the file generation method described in any of the above embodiments.
[0188] It should be noted that, for the file generation method described in this application, those skilled in the art will understand that all or part of the process of the file generation method described in the embodiments of this application can be implemented by a computer program controlling related hardware. The computer program can be stored in a computer-readable storage medium, such as in the memory of a terminal device, and executed by at least one processor within the terminal device. During execution, it can include the process of the embodiments of the file generation method described. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), etc.
[0189] For the document generation apparatus described in this application embodiment, its functional modules can be integrated into a single processing chip, or each module can exist physically separately, or two or more modules can be integrated into one 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, such as a read-only memory, a disk, or an optical disk.
[0190] The document generation method, apparatus, terminal device, and storage medium provided in the embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application; at the same time, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for generating a file, characterized in that, The method includes: importing the DBC / LDF file of the target model; reading the DBC / LDF file according to a preset target protocol to determine the data frames contained in the corresponding CAN / LIN signals; editing the target data frames in the data frames to make the target data frames serve as the medium for sending and / or receiving target signals; and generating a JSON file corresponding to the target protocol and the target model based on the editing results; wherein, editing the target data frames in the data frames to make the target data frames serve as the medium for sending and / or receiving target signals includes: creating a task group according to scenario testing requirements and setting the task group... The method includes: 1) The transmission function of the task group; 2) Editing the target data frame in the data frame according to the transmission function; 3) Adding the edited target data frame to the task group, and sending and / or receiving the target signal through the task group; 4) If the imported file is a DBC file, after generating a JSON file corresponding to the target protocol and the target model based on the editing results, the method further includes: 1) Compiling the JSON file to generate the final target model of the target model, and generating a schedulable object of the final target model corresponding to the task group; 2) Registering the schedulable object to the target system so that the schedulable object can be invoked.
2. The file generation method according to claim 1, characterized in that, After determining the data frame contained in the corresponding CAN signal / LIN signal, the method further includes: generating a corresponding display list based on the data frame; determining the data frames to be discarded in the data frame, and removing the data frames to be discarded from the display list.
3. The file generation method according to claim 1, characterized in that, After registering the schedulable object to the target system so that the schedulable object can be invoked, the method further includes: when a system event corresponding to the schedulable object is received, invoking the schedulable object from the target system, and sending and / or receiving a target signal corresponding to the system event through the schedulable object.
4. The file generation method according to claim 1, characterized in that, If the imported file is an LDF file, the step of creating a task group according to the scenario testing requirements and setting the transmission function of the task group includes: obtaining the configurable model generation mode corresponding to the LDF file and obtaining the LIN network nodes described in the LDF file; determining the target generation mode of the target model from the model generation modes according to the scenario testing requirements; determining the simulation node of the target model from the LIN network nodes according to the target generation mode; creating a task group for the target model according to the target generation mode and the simulation node, and setting the transmission function of the task group.
5. The file generation method according to claim 4, characterized in that, After adding the edited target data frame to the task group and transmitting and / or receiving the target signal through the task group, the method further includes: determining the task type of the task group according to the transmission function, the task type including main task, initialization task and conflict resolution task; and adding the task group to a scheduling table that matches the task type.
6. A document generation device, characterized in that, The device includes: an import module for importing a DBC / LDF file of a target model; a determination module for reading the DBC / LDF file according to a preset target protocol and determining the data frames contained in the corresponding CAN / LIN signals; an editing module for editing target data frames in the data frames according to scenario testing requirements, so that the target data frames can be used as a medium for sending and / or receiving target signals; and a generation module for generating a JSON file corresponding to the target protocol and the target model based on the editing results. The editing module includes the following sub-modules: a first creation sub-module, a frame editing sub-module, and a frame adding sub-module; the first creation sub-module is used to create a frame according to scenario testing requirements. The system comprises a task group and sets up the transmission function of the task group; the frame editing submodule is used to edit the target data frame in the data frame according to the transmission function; the frame adding submodule is used to add the edited target data frame to the task group, and send and / or receive the target signal through the task group; corresponding to the settings of the first creation submodule, the frame editing submodule and the frame adding submodule, the generation device includes the following modules: a model generation module and a registration module; the model generation module is used to compile the JSON file to generate the final target model of the target model, and generate a schedulable object of the final target model corresponding to the task group; the registration module is used to register the schedulable object to the target system, so that the schedulable object can be called.
7. A terminal device, characterized in that, It includes a memory and a processor, the memory being used to store instructions and data, and the processor being used to execute the file generation method according to any one of claims 1-5.
8. A storage medium, characterized in that, The storage medium stores a plurality of instructions, which are adapted to be loaded by a processor to execute the file generation method according to any one of claims 1-5.
Citation Information
Patent Citations
Communication method based on multiprotocol, multiprotocol gateway equipment and storable medium
CN107124421A
File format conversion method and device, storage medium and electronic equipment
CN112559470A
Simulation model generation method, simulation method, storage medium and terminal equipment
CN115664980A