Upper computer software design method and device, upper computer and storage medium
By parsing the DBC file of the CAN communication protocol, generating a DBC object tree, and binding display control objects, the problem of time-consuming and labor-intensive protocol parsing in host computer development is solved, and efficient and low-error host computer software generation is achieved.
Patent Information
- Application Number
- CN202510781021.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-11-07
AI Technical Summary
In existing technologies, the development of host computers for power supply products requires a significant amount of time to parse the CAN communication protocol provided by the customer, resulting in low development efficiency and a high risk of errors.
By parsing the DBC file of the CAN communication protocol, a DBC object tree is generated, and signal objects are bound to display control objects, which are then populated into the display control object mapping table to finally generate the host computer display interface.
It improves the convenience and efficiency of host computer software development, reduces the workload of developers, and lowers the error rate.
Smart Images

Figure CN120909576A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of software design, and in particular to a host computer software design method and device, a host computer and a storage medium. BACKGROUND
[0002] Power supply products generally interact with external information through a controller area network (CAN), and the CAN communication protocol is generally specified by a customer, and the CAN communication protocol ID and data packet of each customer are very different, which causes about 10% of the energy of a developer to be used for developing a host computer during a product development stage. In addition, the main work of the host computer development is to convert the ID and data packet definition in the communication protocol into a form that can be understood by a user and displayed on the host computer. Since the CAN communication protocol provided by the customer is based on a word version or an excel version, the readability is poor, and the developer writes the host computer by parsing the protocol constraint by piece, which takes a long time and is prone to errors. SUMMARY
[0003] Embodiments of the present application provide a host computer software design method and device, a host computer and a storage medium to improve the convenience of designing the host computer software of a product.
[0004] In a first aspect, embodiments of the present application provide a host computer software design method, comprising:
[0005] obtaining a DBC file of a CAN communication protocol;
[0006] generating a DBC object tree according to the DBC file;
[0007] binding each signal object in the DBC object tree with a display control object to obtain a DBC display control object tree;
[0008] filling the display control object into a display control object mapping table;
[0009] generating a host computer display interface according to the display control object mapping table.
[0010] In a possible implementation, the binding each signal object in the DBC object tree with a display control object comprises:
[0011] creating an array of display control objects for each signal object, the array of display control objects including a plurality of display areas;
[0012] binding the array of display control objects to the corresponding signal object.
[0013] In a possible implementation, the generating, according to the display control object mapping table, of the host computer display interface comprises:
[0014] receiving a CAN interaction message of the device;
[0015] matching the CAN interaction message with a signal object and analyzing an actual value of the signal object;
[0016] generating, according to the display control object mapping table and the actual value, of the host computer display interface.
[0017] In a possible implementation, the method further comprises:
[0018] refreshing the display interface every preset real-time period.
[0019] In a possible implementation, the plurality of display regions comprises:
[0020] a signal object name, a signal object value, a signal object unit and a signal object setting.
[0021] In a possible implementation, the generating, according to the DBC file, of the DBC object tree comprises:
[0022] traversing the DBC file to generate a DBC object tree with a message array as a branch point and a signal object as a leaf, and initializing attributes and signal values of the signal objects in the DBC object tree.
[0023] In a second aspect, an embodiment of the present application provides a host computer software design device, comprising:
[0024] an acquisition module configured to acquire a DBC file of a CAN communication protocol;
[0025] a generation module configured to generate a DBC object tree according to the DBC file;
[0026] a processing module configured to bind each signal object in the DBC object tree with a display control object respectively to obtain a DBC display control object tree;
[0027] a mapping module configured to fill the display control objects into a display control object mapping table;
[0028] a display module configured to generate a host computer display interface according to the display control object mapping table.
[0029] In a third aspect, an embodiment of the present application provides a host computer, comprising a memory and a processor, the memory stores a computer program, and the processor implements the method in the first aspect or any possible implementation manner of the first aspect when executing the computer program.
[0030] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program, when executed by a processor, implements the method in the first aspect or any possible implementation manner of the first aspect.
[0031] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program, and the computer program, when executed by a processor, implements the method in the first aspect or any possible implementation manner of the first aspect.
[0032] In the embodiment of the present application, the DBC object tree is generated by parsing the DBC file of the CAN communication protocol, each signal object in the DBC object tree is bound with a display control object respectively to obtain the DBC display control object tree, the display control object is filled into the display control object mapping table, and the host computer display interface is generated according to the display control object mapping table. In this way, the developer no longer needs to parse the CAN communication protocol line by line to write the code, only needs to simply drag and drop the DBC file to the host computer interface, the host computer will automatically generate the display interface according to the DBC file content, and the CAN interaction is implemented according to the DBC file agreement, the development efficiency is high and the quality is good, and the convenience of designing the host computer software is improved. BRIEF DESCRIPTION OF DRAWINGS
[0033] Figure 1 is the implementation flowchart of the host computer software design method provided by the embodiment of the present application;
[0034] Figure 2 is a schematic diagram of the DBC object tree provided by the embodiment of the present application;
[0035] Figure 3 is a schematic diagram of the DBC display control object tree provided by the embodiment of the present application;
[0036] Figure 4 is a structural schematic diagram of the host computer software design device provided by the embodiment of the present application;
[0037] Figure 5 is a schematic diagram of the host computer provided by the embodiment of the present application. DETAILED DESCRIPTION
[0038] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0039] In the host computer software, data display, data analysis and data interaction are three core function modules, which need to be implemented one by one by the host computer. In the prior art, the developer needs to code and implement the three core function modules according to the communication protocol file, and finally integrate them to realize the device debugging.
[0040] Exemplary, with the communication protocol BCP data between the non-vehicle-mounted conductive charger of the electric vehicle and the battery management system as an example, the message classification in the charging parameter configuration stage is shown in Table 1, and the PGN message format is shown in Table 2.
[0041] Table 1 message classification table in the charging parameter configuration stage
[0042]
[0043] Table 2 PGN message format table
[0044]
[0045] The upper computer simulation charger end developed by the developer needs to calculate the data packet ID according to the BCP row PGN column of Table 1 when developing the upper computer, and add the reception of the ID in the code; then, the information body of the data packet is parsed according to Table 2 and its description, and finally each SPN is converted into information that can be understood by the user and displayed to the upper computer interface. Since the developer needs to spend a lot of time in interpreting the protocol text, and then implement the parsing and display code. The protocol text is a static text description, which is obscure and difficult to understand, requires the interpreter to master the related basic knowledge and strong understanding ability, and requires high personnel. The information body of the data packet generally includes the start bit of the data, the data length, the resolution, the offset and other key parameters, and the developer needs to parse byte by byte according to the protocol requirements, and then restore the original value combined with the resolution and offset, which has great development difficulty and high error probability.
[0046] In order to solve the above problems, the embodiment of the present application provides a scheme for automatically generating an upper computer through a DBC file. Referring to Figure 1 which shows the implementation flowchart of the upper computer software design method provided by the embodiment of the present application, and is described in detail as follows:
[0047] Step S101, obtaining the DBC file of the CAN communication protocol.
[0048] CAN is a widely used field bus standard, which is used to realize the communication between different electronic control units (ECU). The DBC file is a database file used to describe the information of signals, messages, nodes and the like on the CAN bus. It defines the message format, data type, signal meaning, signal position in the message, byte sequence and the like of each node sending and receiving in the CAN network, and is an important basis for developing and debugging the CAN network related applications. Through the DBC file, the developer can understand the transmission rules and meanings of the data in the CAN network, so as to carry out corresponding software development and system integration.
[0049] Step S102, generating a DBC object tree according to the DBC file.
[0050] The DBC object tree is a tree structure for representing various objects in the DBC file and their relationships, which helps to clearly show the logical organization and hierarchical relationship of the DBC file, and facilitates developers to understand and process data in the CAN network.
[0051] In the embodiment, by reading the DBC file, the DBC data types BO_, SG_, BA_, VAL_ and BA_DEF_ can be designed as corresponding classes, as follows:
[0052] BO class: message, used for managing data frames, and their attributes and signals transmitted on the frames.
[0053] SG class: signal, used for managing frame content, listing all signals placed on the message, their positions in the data field of the message and their attributes.
[0054] BA class: attribute value, defining values for attributes.
[0055] VAL class: signal value, used for defining original values of specific signals.
[0056] BA_DEF class: custom attribute, used for extending object attributes of the DBC file.
[0057] The corresponding object arrays bo_obj, sg_obj, object ba_obj, val_obj and ba_def_obj are declared, and by traversing the DBC file, a DBC object tree is formed with the DBC object dbc_obj as the root, bo_obj as the branching point and sg_obj as the leaves, and BA and VAL are used to initialize related attributes and signal values.
[0058] The finally formed DBC object tree is shown in Figure 2 .
[0059] In step S103, each signal object in the DBC object tree is bound with a display control object, and a DBC display control object tree is obtained.
[0060] In the embodiment, the host computer needs to display the value of each SG_ object, and therefore an InfoShow class of display control object can be designed here for managing dynamic display controls. The InfoShow class can include but is not limited to the following display areas: title, value, unit, set, representing the SG_ object name, SG_ object value, SG_ object unit and SG_ object setting (for passing downlink messages) respectively. The host computer can define an array info of InfoShow objects, and then traverse the DBC object tree to bind each SG_ object to an InfoShow object, and finally form a DBC display control object tree as shown in Figure 3a DBC display control object tree.
[0061] In step S104, the display control object is filled into the display control object mapping table.
[0062] In the embodiment, the host computer can define a display control object container window, i.e., a display control object mapping table, for managing the dynamically created InfoShow objects. The host computer reads the DBC file, establishes a DBC display control object tree according to the content of the DBC file, and fills the InfoShow objects into the InfoShow object container, thereby realizing the display of each SG_ object.
[0063] In step S105, the host computer display interface is generated according to the display control object mapping table.
[0064] In the embodiment, the host computer program and the device interact through CAN messages. The host computer matches the specific SG_ object according to the ID of the received message, then parses the actual value according to the SG_ object description, and displays the value on the corresponding InfoShow control object. In addition, the host computer program can set a timer to refresh the interface data at a period of 100 ms, thereby ensuring that the latest data is displayed on the interface.
[0065] In the embodiment, the DBC file of the CAN communication protocol is parsed to generate a DBC object tree. Each signal object in the DBC object tree is bound with a display control object to obtain a DBC display control object tree. The display control object is filled into a display control object mapping table. The host computer display interface is generated according to the display control object mapping table. In this way, the developer no longer needs to parse the CAN communication protocol line by line to write code. The developer only needs to simply drag and drop the DBC file to the host computer interface. The host computer will automatically generate a display interface according to the content of the DBC file, and implement CAN interaction according to the DBC file agreement, thereby achieving high development efficiency and good quality. The DBC file is a formatted embodiment of the protocol text. The embodiment automatically generates the host computer software by parsing the DBC file. The host computer automatically parses the DBC content line by line, generates the corresponding SG_ object for each information body, and establishes an association relationship between the SG_ object and the InfoShow object, thereby greatly liberating the developer's energy.
[0066] It should be understood that the size of the serial number of each step in the above embodiment does not mean the order of execution. The execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0067] The following is a device embodiment of the present application. For details not described in detail, reference can be made to the corresponding method embodiments described above.
[0068] Figure 4 A structure diagram of the host computer software design device provided by the embodiment of the application is shown. For the convenience of description, only the parts related to the embodiment of the application are shown, and the details are as follows.
[0069] As shown in Figure 4 The host computer software design device 40 comprises:
[0070] The acquisition module 41 is configured to acquire a DBC file of a CAN communication protocol.
[0071] The generation module 42 is configured to generate a DBC object tree according to the DBC file.
[0072] The processing module 43 is configured to bind each signal object in the DBC object tree with a display control object respectively, so as to obtain a DBC display control object tree.
[0073] The mapping module 44 is configured to fill the display control object into a display control object mapping table.
[0074] The display module 45 is configured to generate a host computer display interface according to the display control object mapping table.
[0075] In a possible implementation, the processing module 43 is specifically configured to:
[0076] create an array of display control objects for each signal object, and the array of display control objects comprises a plurality of display areas;
[0077] bind the array of display control objects to the corresponding signal object.
[0078] In a possible implementation, the display module 45 is specifically configured to:
[0079] receive a CAN interaction message of the device;
[0080] match the signal object according to the CAN interaction message, and parse an actual value of the signal object;
[0081] generate the host computer display interface according to the display control object mapping table and the actual value.
[0082] In a possible implementation, the display module 45 is further configured to:
[0083] refresh the display interface every preset real-time period.
[0084] In a possible implementation, the plurality of display areas comprises:
[0085] a signal object name, a signal object value, a signal object unit and a signal object setting.
[0086] In a possible implementation, the generating module 42 is specifically configured to:
[0087] The DBC file is traversed to generate a DBC object tree with the message array as a branch point and the signal object as a leaf, and the attributes and signal values of the signal objects in the DBC object tree are initialized.
[0088] In the embodiment of the application, the DBC object tree is generated by parsing the DBC file of the CAN communication protocol, each signal object in the DBC object tree is bound with a display control object respectively to obtain a DBC display control object tree, the display control objects are filled into a display control object mapping table, and the host computer display interface is generated according to the display control object mapping table. In this way, the developer no longer needs to parse the CAN communication protocol line by line to write code, but only needs to simply drag and drop the DBC file to the host computer interface, and the host computer will automatically generate a display interface according to the DBC file content and implement CAN interaction according to the DBC file agreement, which is high in development efficiency and quality and improves the convenience of designing the host computer software.
[0089] Figure 5 is a schematic diagram of the host computer provided by the embodiment of the application. As shown in Figure 5 The host computer 5 of this embodiment includes a processor 50 and a memory 51. The memory 51 stores a computer program 52. The processor 50 implements the steps in each of the method embodiments described above when executing the computer program 52. Alternatively, the processor 50 implements the functions of each module / unit in each of the device embodiments described above when executing the computer program 52.
[0090] For example, the computer program 52 can be divided into one or more modules / units, which are stored in the memory 51 and executed by the processor 50 to complete the application. The one or more modules / units can be a series of computer program instruction segments capable of completing a specific function, which are used to describe the execution process of the computer program 52 in the host computer 5.
[0091] The host computer 5 can include, but is not limited to, the processor 50 and the memory 51. Those skilled in the art can understand that Figure 5 The host computer 5 is only an example and does not constitute a limitation on the host computer 5, and can include more or fewer components than those shown, or combine certain components, or different components, for example, the host computer 5 can also include an input / output device, a network access device, a bus, etc.
[0092] The processor 50 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.
[0093] The memory 51 can be an internal storage unit of the host computer 5, such as a hard disk or a memory of the host computer 5. The memory 51 can also be an external storage device of the host computer 5, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory 51 can include both the internal storage unit and the external storage device of the host computer 5. The memory 51 is used to store the computer program 52 and other programs and data required by the host computer 5. The memory 51 can also be used to temporarily store data that has been output or will be output.
[0094] For the convenience and brevity of description, only the above-mentioned division of the functional modules / units is exemplified, and in actual applications, the above-mentioned functions can be completed by different functional modules / units according to needs. The above-mentioned modules / units can be realized in the form of hardware, software or a combination of hardware and software.
[0095] The embodiments of the present application also provide a computer readable storage medium storing a computer program. When the computer program is executed by a processor, the method in the above-mentioned method embodiments is implemented.
[0096] The embodiments of the present application also provide a computer program product comprising a computer program. When the computer program is executed by a processor, the method in the above-mentioned method embodiments is implemented.
[0097] The computer program includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms, etc. The computer readable medium can include any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc.
[0098] In the above embodiments, the description of each embodiment has its own focus, and the parts not described or recorded in a certain embodiment can be referred to the relevant description of other embodiments. If there is no special description and logical conflict, the terms and / or descriptions of different embodiments are consistent and can be mutually referred to, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationship.
[0099] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can still be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A method for designing host computer software, characterized in that, include: Obtain the DBC file for the CAN communication protocol; Generate a DBC object tree based on the DBC file; Each signal object in the DBC object tree is bound to a display control object to obtain the DBC display control object tree; Populate the display control object into the display control object mapping table; The host computer display interface is generated based on the display control object mapping table.
2. The host computer software design method according to claim 1, characterized in that, The step of binding each signal object in the DBC object tree to a display control object includes: Create an array of display control objects for each signal object, wherein the array of display control objects contains multiple display areas; Bind the array of display control objects to the corresponding signal objects.
3. The host computer software design method according to claim 1, characterized in that, The step of generating the host computer display interface based on the display control object mapping table includes: CAN communication messages received from the receiving device; Match the signal object to the CAN interaction message and parse out the actual value of the signal object; The host computer display interface is generated based on the display control object mapping table and the actual value.
4. The host computer software design method according to claim 1, characterized in that, The method further includes: The display interface is refreshed at preset time intervals.
5. The host computer software design method according to claim 2, characterized in that, The plurality of display areas include: Signal object name, signal object value, signal object unit, and signal object settings.
6. The host computer software design method according to any one of claims 1 to 5, characterized in that, The step of generating a DBC object tree based on the DBC file includes: Traverse the DBC file, using the message array as the branch point and the signal object as the leaf, to generate a DBC object tree, and initialize the attributes and signal values of the signal objects in the DBC object tree.
7. A host computer software design device, characterized in that, include: The acquisition module is used to acquire the DBC file of the CAN communication protocol; The generation module is used to generate a DBC object tree based on the DBC file; The processing module is used to bind each signal object in the DBC object tree to a display control object to obtain the DBC display control object tree; The mapping module is used to populate the display control object into the display control object mapping table; The display module is used to generate the host computer display interface based on the display control object mapping table.
8. A host computer, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 6.