Fast-configuration real-time Ethernet communication method and communication board card
Through the fast-configured real-time Ethernet communication method, the automated configuration of data flow and TRDP network communication in the vehicle network control system is realized through the fast-configuration of real-time Ethernet communication method, solving the problem of excessive manual participation in the prior art, and improving development efficiency and accuracy.
Patent Information
- Application Number
- CN202411407047.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-02-28
AI Technical Summary
In the prior art In the vehicle network control system, a large amount of manual participation is required in the development of network communication protocols, which leads to large workload, time-consuming, labor-consuming, and error-prone.
Provide a fast configuration of real-time Ethernet communication method, which realizes automated data flow and TRDP network communication configuration through the steps of initializing and establishing basic attributes of XML file framework, creating child nodes, TRDP communication equipment, data flow file acquisition, multicast communication, database establishment and connection.
The programming work of importing a large number of data flows is reduced, and the automation of communication from data flows to TRDP network is realized, the development process of network communication protocols is simplified, and efficiency and accuracy are improved.
Smart Images

Figure CN119544770A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of Ethernet communication, in particular to a fast-configured real-time Ethernet communication method and a communication board. Background Art
[0002] The vehicle network control system is a set of on-board computer systems specially designed for vehicle control and communication. Its main functions are to monitor and display the operating status of important components of the vehicle, perform fault diagnosis, and remotely control various components as needed. The process data and status data collected by the control units of various subsystems of the vehicle are all transmitted to the network system. After logical operations and analysis, the operation control, status evaluation and fault diagnosis of the vehicle are realized. At the same time, for systems or equipment related to driving safety, in addition to using the on-board communication network for transmission, vehicle hard lines are generally set up redundantly to ensure that the vehicle can maintain operation under special circumstances. As the most important in the vehicle network control system, the premise of ensuring network communication is the network communication protocol. The implementation of the network communication protocol is the purpose of information exchange between various subcomponents (or network nodes) in the network system.
[0003] The network communication protocol is manifested in the form of a data stream file, which is common to the entire project team or can be divided into data stream files for sub-components according to confidentiality requirements to only allow some components to communicate with each other. However, all file formats should adopt the format recognized and agreed upon by the project team. The problem with the existing technology is that the project team has spent a lot of time communicating and agreeing on the file format and file content, and then the designers or programmers have to input or write code for the development methods of the data network communication one by one. This is a large workload, time-consuming, and labor-intensive. Too much manual participation is also prone to errors. Therefore, it is necessary to propose a fast-configured real-time Ethernet communication method. Summary of the invention
[0004] In view of the problems in the prior art, the present invention provides a fast-configured real-time Ethernet communication method.
[0005] The technical solution adopted by the present invention to solve its technical problem is: a fast-configured real-time Ethernet communication method, including initialization and establishment of basic attributes of an XML file framework, creation of child nodes, TRDP communication equipment, data stream file acquisition, multicast communication, database establishment and connection, and TRDP communication;
[0006] The basic attributes of the xml file framework are initialized and established according to the data stream data protocol file and the xml file, the data class of the xml file is established, and the attribute variable list is designed using the Qstringlist type;
[0007] First, create the file name of the xml file, establish the root node and attributes, and assign values.
[0008] The creation of child nodes requires establishing each parent node and child node step by step under the XML file name and the root node created above, and progressively completing the child node as the parent node, and then adding the child node, and so on, until the leaf node ends;
[0009] For the convenience of design, the node adding function method is adopted, and repeated calls are made to complete the node adding: including the XML file name, parent node name, child node name, node attributes and node values;
[0010] The basic XML framework has been established here, which contains the prototype XML file tree structure of the TRDP protocol and the TRDP communication protocol model content.
[0011] The TRDP communication device generally has three functions: a data transmitter can send data to multiple devices, a data receiver can receive data sent by multiple devices, and a network monitor is not a node device of a network function, but is used as a monitor to monitor all data flows of network devices for network analysis and other functions;
[0012] When the TRDP board is used as the sender, all destination address IPs corresponding to the board as the source IP are obtained from the data stream file.
[0013] When the TRDP board is used as a receiving device, all rows in the data stream Qsringlist chain list with the destination address listed in the board IP are obtained, and the source address IP chain list is obtained after deduplication, and each comid after each source address IP is added to the receiving frame node of the xml;
[0014] When the TRDP board is used as a monitoring device, the IP list of the destination address of each device should include the IP address of the board as the monitoring device, otherwise other devices will not send data to the IP address of the monitoring device.
[0015] The data stream file is obtained by calling the file path through the window function, reading and selecting the data stream file ".csv format", recording the file path through the folder opening method, and storing it in the path variable filepath of Qstring type;
[0016] Determine whether the file is empty. If it is empty, output a prompt "File is empty" through the QmessageBox box and record it in the journal.
[0017] If it is not empty, open the file through the Qfile file management class and determine whether the file exists. If it does not exist, output a prompt "file does not exist" through the QmessageBox box and record it in the journal;
[0018] If the file exists, open the file through the open function of the file class and convert the file into a text stream.
[0019] The multicast communication is TRDP as a real-time communication protocol for Ethernet communication. During multicast communication, the device IP addresses of the sender and the receiver in the multicast address correspond to multiple destination addresses;
[0020] Especially when the network architecture is complex and there are many device nodes, communication will cause a huge burden on the network bus; when multicasting is used, this method can also quickly implement the multicast communication function according to the XML configuration of the data stream file.
[0021] The database establishment and connection adopts the network communication and database combination method to make the network communication intuitive and easy to manage data. The data flow, the XML file of the data flow, and the database can intuitively reflect the data communication relationship table. During the communication, the data variables are updated in real time in the database, which is more conducive to the docking of the input and output of the project logic, as well as a series of other applications such as subsequent data visualization, log recording, reporting, data mining, data analysis, etc.
[0022] A lightweight SQlite database is used. It is easy to know from the relationship of the data flow that a relational database needs to be established. The design adopts a two-layer relationship: the first layer is the data flow table, that is, the data flow file content. The database create table instruction is used to create a variable name number as the primary key, and the source address IP, destination address IP, port number, comid, data length, byte offset, bit offset and data size as the remaining columns. The database insert instruction is used again to loop and insert all the contents in the data flow table.
[0023] The second layer is a data table for each comid under the first layer table. The data table is named after comid, the primary key is a long integer data type (with the timestamp of TRDP as the primary key unique identifier), and all variables (variable names are in the form of var+variable name number) are the remaining columns. When performing TRDP communication, insert data operations before communication is sent at each moment and insert data operations after communication receives data, then all data variables under each comid will be refreshed corresponding to the variables in the database. The input and output reading of the control logic (the variable value of the latest timestamp row of the variable name number in the comid table can be obtained) The database value will also be refreshed synchronously.
[0024] The TRDP communication is connected with the communication routine in the TRDP international standard, and the TRDP LIB library and DLL dynamic link library or .A static library file are directly loaded; in the development environment such as VisualStudio or QT under the required operating system, a routine C / C++ language .C or .CPP file is selected according to the project needs, and the necessary .h file needs to be added, such as TRDP-xmlpd-test.c content is copied to the project project;
[0025] The data flow quick configuration xml is in the same project as above, and the function interface is connected. TRDP communication uses the publish and subscribe frame method to implement the specific communication process; read the xml file with the same relative naming rules as the IP address of this device in the XML folder of the TRDP communication generated above;
[0026] TRDP publishes data frames corresponding to the data variable group in the sending comid contained in all destination address IPs in the xml file;
[0027] The TRDP subscription data frame corresponds to the data variable group in the receiving comid contained in all source address IPs in the xml file.
[0028] A fast-configured real-time Ethernet communication board, characterized in that: it includes a hardware module and a software module, wherein the TRDP board in the hardware module is mainly used for the TRDP protocol stack to carry and automatically realize fast-configured real-time Ethernet communication;
[0029] The TRDP board in the software module mainly realizes fast data configuration based on data stream and TRDP communication function. In addition, there are other commonly used industrial bus communication interfaces in vehicle communication. It is necessary to convert the multiple protocols of the lower layer to have the transmission communication function of TRDP. In addition to realizing the data stream file fast configuration method of the above-mentioned TRDP standard, it is also designed with common network communication protocol conversion functions, such as CAN communication and serial port communication;
[0030] Driver layer embedded hardware abstraction layer and hardware support package, TRDP driver and IP routing configuration, the operating system will carry Linux and TRDP virtual operating system synchronous interaction, complete the basic file system and user interface, and provide TRDP process communication, message communication and TCP message communication mechanism, realize the interface for the application layer and docking with the driver, complete the hardware management and final interface;
[0031] The application layer will use TRDP, system and other industrial network conversion interface functions and applications to achieve other industrial bus network protocol conversion, based on the rapid configuration of TRDP communication and network monitoring functions.
[0032] Beneficial effects of the present invention:
[0033] A kind of real-time Ethernet communication method and communication board of fast configuration of the present invention, by the program software of design, utilize the data stream file and TRDP board of a certain car model, persuasiveness is strong, data stream can be directly input into the XML source code of TRDP and run, it is suitable for the IP address of each subsystem in network system, and the XML file and data stream Unicom of IP.xml named by each IP voluntarily, application method reduces the programming work imported by a large amount of data stream, builds the bridge of data stream and TRDP communication, realizes the automation from data stream to TRDP network communication.It is particularly suitable for industrial unit in network platform product application and promotion, it is not necessary to understand the internal implementation process of network communication protocol, it is only necessary to focus on the data file of maintenance data stream, and the corresponding data TRDP network communication can be automatically completed later, and application process is simple, convenient and practical. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0035] Figure 1 A flowchart of the implementation process of TRDP in a real-time Ethernet communication method for rapid configuration provided by the present invention;
[0036] Figure 2 An example flow chart of a method process in a fast-configured real-time Ethernet communication method provided by the present invention;
[0037] Figure 3 A TRDP communication process flow chart in a real-time Ethernet communication method for rapid configuration provided by the present invention;
[0038] Figure 4 A data protocol interface flow chart in a fast-configured real-time Ethernet communication method provided by the present invention;
[0039] Figure 5 A flowchart of establishing an XML framework file in a fast-configured real-time Ethernet communication method provided by the present invention;
[0040] Figure 6 A node adding flow chart of a fast-configured real-time Ethernet communication method provided by the present invention;
[0041] Figure 7 A TRDP board software system architecture diagram of a fast-configured real-time Ethernet communication method provided by the present invention;
[0042] Figure 8 A physical object and external dimension diagram of a board in a fast-configured real-time Ethernet communication method provided by the present invention;
[0043] Fig. 9 A board principle block diagram of a fast-configured real-time Ethernet communication method provided by the present invention. DETAILED DESCRIPTION
[0044] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the present invention is further explained below in conjunction with specific implementation methods.
[0045] like Figure 1-Figure 9 As shown, a fast-configured real-time Ethernet communication method described in the present invention includes initializing and establishing basic attributes of an xml file framework, creating child nodes, processing data stream macro definitions, acquiring data stream files, multicast communication, establishing and connecting a database, and TRDP communication;
[0046] The basic attributes of the xml file framework are initialized and established according to the data stream data protocol file and the xml file, and the data class of the xml file is established, and the attribute variable list is designed using the Qstringlist type.
[0047] Includes: storage blocks, bus interfaces, communication parameters, process communication parameters, message communication parameters, communication frames, network communication parameters, source addresses, target addresses, source target communication parameters, network service parameters, data group settings, array data element information, and debugging information;
[0048] During the communication process, the biggest changes in the data stream are the number of communication frames and the changes in the data group variable list of each frame. The information binding format corresponding to the other data stream information and the XML file is fixed;
[0049] Therefore, you can first establish the content of fixed attributes in the XML file by designing the xml_base function;
[0050] First, create the file name of the xml file, establish the root node and attributes and assign values, create the xml file, and open it in write-only mode. According to the function parameters, obtain the root node name, xml version information and file encoding format, convert them into the processing content of the add instruction through string concatenation, and create a processing instruction insertion string as the first line of the xml file;
[0051] Then you can create a child node command for xml, declare the creation of a root node, and create the following attributes for the root node, such as the naming prefix, namespace, host name, and type attributes and attribute assignments of the xml file, add them to the node of the root element, and output all output streams in file format. Because xml is a tree structure, add the appropriate number of indent values according to design habits, save the file and close it.
[0052] The creation of child nodes requires establishing each parent node and child node step by step under the XML file name and the root node created above, and progressively completing the child node as the parent node, and then adding the child node, and so on, until the leaf node ends;
[0053] For the convenience of design, the node adding function method is adopted, and repeated calls are made to complete the node adding: including the XML file name, the parent node name, each child node must be placed under the appropriate parent node level; child node name, node attributes and node value;
[0054] The basic XML framework has been established here, which contains the prototype XML file tree structure of the TRDP protocol and the TRDP communication protocol model content.
[0055] The TRDP communication device usually has three functions: a data sending end: data can be sent to multiple devices; a data receiving end: data can be received from multiple devices; a network monitoring end: a node device that does not function as a network function, but is used as a monitoring device to monitor all data streams of network devices for network analysis and other functions; to connect the header information of the data stream file, only different column numbers need to be corresponding through macro definitions, and multiple file conversions do not need to be performed, saving time;
[0056] When the TRDP board is used as the sender, all destination address IPs corresponding to the board as the source IP are obtained from the data stream file;
[0057] From the data stream linked list, obtain all row data whose source device address IP is consistent with the TRDP board device IP;
[0058] Through the deduplication method, since each destination address has a lot of data to be sent, it is necessary to obtain different destination address IPs and obtain the destination IP address list;
[0059] The multiple communication port comids corresponding to each destination IP address are cyclically added to the comid list linked list corresponding to each destination address IP linked list;
[0060] Add each comid of each destination address IP list to the sending frame node of xml, add a telegram child node under the parent node, attribute data-set-id, the attribute value of com-id is the comid value, and name is the unique identifier composed of tlg+comid;
[0061] Similarly, add the parameter node of TRDP process communication and the destination address subnode under telegram, and assign its uri attribute to the IP address of the TRDP destination address;
[0062] Create a data-set child node under the parent node data-set-list, with the attribute name testDS+comid unique identifier, and repeat the operation until all comids are created;
[0063] Take the data-set of each comid as the parent node, and add the communication member variable element child node to it. The number and data type of the data flow variables under each comid are different. Add the type attribute of the child node according to the data type and length sequence after the same comid column of the read data flow protocol file. The assignment convention of the name attribute is the row number of the data flow.
[0064] Repeat the above steps until all the devices with destination IP addresses are added to the XML file;
[0065] When the TRDP board is used as a receiving device, the process of using the TRDP board as a receiving device is similar to that of the sending device. After obtaining all the rows in the data flow linked list where the destination address is listed as the board IP, the source address IP linked list is obtained after deduplication, and then each comid after each source address IP is added to the receiving frame node of the xml; under telegram, add the parameter node of the TRDP process communication and the source address subnode, and assign its uri attribute to the IP address of the TRDP source address, until the data stream of the source and destination IP is added to the xml file;
[0066] When the TRDP board is used as a monitoring device, the destination address IP list of each device should include the IP address of the board as the monitoring device, otherwise other devices will not send data to the IP address of the monitoring device;
[0067] At the same time, the monitoring device can only monitor and cannot send any data to other devices, so the IP address of the monitoring device must not appear in the source IP list;
[0068] Based on this requirement, this device needs to be used as the IP address of the monitoring device. By adding the parameter node of the TRDP process communication and the destination address child node under the telegram parent node in the xml file of each device, the address of the monitoring device is added to the destination address IP corresponding to each comid that needs to communicate in the xml file of each device in the network;
[0069] The monitoring device is used as an xml file of the network node, that is, the IP of the device in all data streams is used as the source address, the parameter node of the TRDP process communication and the source address subnode are added under telegram, and then the comid data and data flow variables of each source IP are added to the xml, and finally the monitoring function of the device is realized.
[0070] The data stream file calls the file path through the window function to read and select the data stream file ".csv format";
[0071] The path is recorded by opening the folder and stored in the Qstring type path variable filepath;
[0072] Determine whether the file is empty. If it is empty, output a prompt "File is empty" through the QmessageBox box and record it in the diary. If it is not empty, open the file through the Qfile file management class and determine whether the file exists. If it does not exist, output a prompt "File does not exist" through the QmessageBox box and record it in the diary. If the file exists, open the file through the open function of the file class and convert the file into a text stream. Each line ends with "\n" to distinguish it. Loop through each line of data and put it into the Qsringlist linked list;
[0073] Loop through each column of data in each row and put them into a linked list. Use "," to distinguish each column. Compare the correctness of the data stream based on the known number of columns in the data stream to prevent subsequent data processing errors. After closing the file, return to the Qsringlist linked list and perform file error processing on the first and last row of the Qsringlist linked list to prevent program overflow and other protection processing.
[0074] The multicast communication is TRDP as a real-time communication protocol for Ethernet communication. During multicast communication, the device IP addresses of the sender and the receiver in the multicast address correspond to multiple destination addresses;
[0075] Especially when the network architecture is complex, there are many device nodes, and communication will cause a huge burden on the network bus, in multicast mode, this method can also quickly realize the multicast communication function according to the XML configuration of the data stream file;
[0076] Generally, the project data stream will provide a multicast communication table, which can be understood as a .csv format data table with two columns, one is the multicast address column marked as column A, and the other is the actual device address column marked as column B. Many multicast address columns can be set according to network communication needs, and each actual device that plays the role of sending and / or receiving data will join multiple multicast groups;
[0077] The design reads the contents of the multicast communication data table through a file, uses linked list A to manage the multicast addresses in column A, and uses linked list B to manage the device addresses in column B:
[0078] ① When this device is a sending device, that is, all the multicast addresses that it needs to send are obtained in column A, and the actual device address in each multicast address is obtained from the multicast address, and is placed in the destination IP address list. Then, the operation process of using the TRDP board as the sending device can realize the generation of the XML file of the multicast function;
[0079] ② When this device is a receiving device and is also suitable for monitoring devices, first obtain in column A which multicast groups it exists in, which may be one or more multicast addresses, and then obtain the source address IP linked list of all its receiving devices from column B based on these multicast addresses, and add the TRDP board as the source address child node in the receiving device.
[0080] The database establishment and connection adopts the network communication and database combination method to make the network communication intuitive and easy to manage data. The data flow, the XML file of the data flow, and the database can intuitively reflect the data communication relationship table. During the communication, the data variables are updated in real time in the database, which is more conducive to the docking of the project logic input and output, as well as a series of other applications such as subsequent data visualization, log recording, reporting, data mining, data analysis, etc.
[0081] This method uses a lightweight SQlite database, which has a corresponding SQlite database browser, which is very convenient for users to debug the process and apply it in practice;
[0082] From the relationship of data flow, it is easy to know that a relational database needs to be established. The design adopts two layers of relationship:
[0083] The first layer is the data stream table, that is, the data stream file content. Use the database create table instruction to create a variable name number as the primary key, source address IP, destination address IP, port number, comid, data length, byte offset, bit offset and data size as the remaining columns. Use the database insert instruction again to loop and insert all the contents in the data stream table.
[0084] The second layer is a data table for each comid under the first layer table. The data table is named after comid, the primary key is a long integer data type, and the timestamp of TRDP is used as the primary key to uniquely identify all variables. The variable names are in the form of var+variable name number for the remaining columns.
[0085] When performing TRDP communication, data is inserted before each communication is sent and after each communication is received. Then, all data variables under each comid will be refreshed corresponding to the variables in the database, and the input and output of the control logic will be read. By looking up the variable value of the latest timestamp row of the variable name number in the comid table, the latest data of the variable can be obtained, and the database value will also be refreshed synchronously.
[0086] The TRDP communication is connected with the communication routine in the TRDP international standard, and the LIB library and DLL dynamic link library or .A static library file of TRDP are directly loaded; under the development environment such as VisualStudio or QT under the required operating system, a routine C / C++ language .C or .CPP file is selected according to the project needs, such as TRDP-xmlpd-test.c content is copied to the project project, and the aforementioned data flow fast configuration xml is in the same project, and the function interface is connected;
[0087] TRDP communication uses publish and subscribe frames to implement the specific communication process. In the XML folder of TRDP communication generated above, read the XML file with the same relative naming rules as the IP address of this device;
[0088] Because the actual variable assignment in the data flow of each project is related to the logic of the specific project implementation, the variable content in the sending data area and the variable content in the receiving data area need to be refreshed during the communication cycle. The communication task of TRDP should be a periodic dead loop task;
[0089] TRDP publishes data frames corresponding to the data variable group in the sending comid contained in all destination address IPs in the xml file, loops through all the published data frames, updates the variable data group of each comid that needs to be sent in the database, calls the TRDP function to add the tlp_put sending comid variable data group, calls the TRDP function to add the tlc_process processing communication session process, and logs the results of the communication session;
[0090] The TRDP subscription data frame corresponds to the data variable group in the receiving comid contained in all source address IPs in the xml file. All subscription data frames are executed in a loop, and the TRDP function tlp_get is called to match the variable data group of comid. Each variable data group that needs comid in the database is updated. Regardless of the process of sending and receiving communication, the database needs to be updated with the communication timestamp as the key, and this is used as a sign to read the latest data.
[0091] When the communication dead loop ends, the conditions are met, TRDP function freeParameters is called to release the memory space, TRDP function tau_freeXmlDoc is called to close the XML file, TRDP function tlp_unpublish is called to stop publishing and TRDP function tlp_unsubscribe is called to stop subscribing to all data frames, all TRDP sessions are closed, and the device is shut down.
[0092] A fast-configured real-time Ethernet communication board, comprising a hardware module and a software module, wherein the TRDP module in the hardware module is mainly used for the TRDP protocol stack to carry and automatically realize fast-configured real-time Ethernet communication;
[0093] The main chip uses the low-power, high-performance and low-cost application processor IMX6ULL based on the ARM Cortex-A7 core;
[0094] CPU core: Equipped with a single-core ARM Cortex-A7 core, the main frequency can reach 900MHz, providing high-performance computing capabilities;
[0095] Memory and storage: Support LPDDR2, DDR3 / DDR3L memory, as well as storage solutions such as eMMC and SD card;
[0096] Connectivity: It has two USB 2.0OTG ports, supporting high-speed / full-speed device or host mode, and two 10 / 100Mbps Ethernet ports to meet network communication needs;
[0097] Other interfaces: including multiple UART interfaces, I2C, SPI and other communication interfaces, as well as 2 12-bit ADCs, supporting resistive touch screen function;
[0098] Power management: It has an advanced power management part PMU to optimize energy efficiency. The on-chip memory chip uses 1GB DDR, the storage uses 4G EMMC, and the non-volatile memory card format SD card is used for data storage;
[0099] The TRDP board in the software module can realize fast data configuration based on data stream and TRDP communication function. In addition, there are other commonly used industrial bus communication interfaces in vehicle communication, and it is necessary to convert the multiple protocols of the lower layer to have the transmission communication function of TRDP.
[0100] In addition to implementing the above-mentioned TRDP standard data stream file fast configuration method, it is also designed with common network communication protocol conversion functions, such as CAN communication and serial port communication;
[0101] The hardware layer uses the embedded processor as the central processing unit, and the peripheral devices are connected to the memory devices, storage devices, IO interfaces, and commonly used industrial serial ports, CAN communication interfaces, and Ethernet interfaces (the physical interfaces of ordinary Ethernet interfaces and TRDP interfaces are the same) through direct pin connections and commonly recommended circuits;
[0102] Driver layer embedded hardware abstraction layer and hardware support package, TRDP driver and IP routing configuration;
[0103] The operating system will carry Linux and TRDP's virtual operating system to interact synchronously, complete the basic file system and user interface, and provide TRDP's process communication, message communication and TCP message communication mechanism, realize the interface for the application layer and dock with the driver, complete the hardware management and final interface;
[0104] The application layer will use TRDP, system and other industrial network conversion interface functions and applications to achieve other industrial bus network protocol conversion, based on the rapid configuration of TRDP communication and network monitoring functions.
[0105] The board designed by the present invention has the following characteristics:
[0106] ① Compact design. The board adopts a multi-layer circuit board design solution, taking into account the network signal interference, reflection and electromagnetic compatibility issues of high-speed communication. The board size is 32X45X2mm and light weight, meeting the development needs of lightweight design in industrial sites;
[0107] ② Rich interfaces. The board is equipped with Ethernet, TRDP, CAN, and serial port (232, 484, TTL) interfaces, which are suitable for interconnection and interoperability of diversified products, multi-interface forms, and multi-protocol conversion in industrial sites;
[0108] ③ The board encapsulates TRDP protocol communication and data flow into a universal interface, so that users can quickly implement configuration-based TRDP communication without knowing the TRDP principle in detail, saving a lot of bottom-level transplantation and middle-level programming processes, saving manpower and material resources, and speeding up the development and design process;
[0109] ④ The board can be used as a monitoring device for TRDP. Debugging equipment and monitoring equipment are often needed on site to debug network interconnection and monitor whether network equipment is working normally, as well as extract and analyze on-site data after a fault. Monitoring equipment is indispensable. By using the board as the destination address and the remaining devices as the source address of the board, the network monitoring device function can be realized, and the configuration method is consistent;
[0110] ⑤ The main chip adopts a low-power, high-performance and low-cost processor with an ARM core. It has strong computing power, high scalability, strong versatility, standard interfaces, and is practical and simple. It is very suitable for the product development needs of the industrial field and network communication industry.
[0111] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The description in the above embodiments is only to illustrate the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of the present invention is defined by the attached claims and their equivalents.
Claims
1. A fast-configured real-time Ethernet communication method, characterized in that: Including the initialization and establishment of basic attributes of the XML file framework, creation of child nodes, TRDP communication equipment, data stream file acquisition, multicast communication, database establishment and connection and TRDP communication; The basic attributes of the xml file framework are initialized and established according to the data stream data protocol file and the xml file, the data class of the xml file is established, and the attribute variable list is designed using the Qstringlist type; Create the file name of the xml file, establish the root node and attributes, and assign values.
2. A fast-configured real-time Ethernet communication method according to claim 1, characterized in that: The creation of child nodes requires the establishment of each parent node and child node step by step under the XML file name and the root node created above; Use the node adding function method and call it repeatedly to complete the node adding: including the XML file name, the parent node name, each child node must be placed under the appropriate parent node level, the child node name, node attributes and node value; The basic XML framework has been established, which includes the prototype XML file tree structure of the TRDP protocol and the TRDP communication protocol model content.
3. A fast-configured real-time Ethernet communication method according to claim 1, characterized in that: The TRDP communication device generally has three functions: a data transmitter can send data to multiple devices, a data receiver can receive data sent by multiple devices, and a network monitor is not a node device of a network function, but is used as a monitor to monitor all data flows of network devices for network analysis and other functions; When the TRDP board is used as the sender, all destination IP addresses corresponding to the source IP of this board are obtained from the data stream file; When the TRDP board is used as a receiving device, all rows in the data stream Qsringlist chain list with the destination address listed as the board IP are obtained, and after deduplication, the source address IP chain list is obtained. Each comid after each source address IP is added to the receiving frame node of the xml; When the TRDP board is used as a monitoring device, the IP list of the destination address of each device should include the IP address of the board as the monitoring device, otherwise other devices will not send data to the IP address of the monitoring device.
4. A fast-configured real-time Ethernet communication method according to claim 1, characterized in that: The data stream file is obtained by calling the file path through the window function, reading and selecting the data stream file ".csv format", recording the file path through the folder opening method, and storing it in the path variable filepath of Qstring type; Determine whether the file is empty. If it is empty, a QmessageBox prompt is displayed, and the prompt "file is empty" is output and recorded in the journal. If it is not empty, open the file through the Qfile file management class and determine whether the file exists. If it does not exist, output a prompt "file does not exist" through the QmessageBox box and record it in the journal; If the file exists, open the file through the open function of the file class and convert the file into a text stream.
5. A fast-configured real-time Ethernet communication method according to claim 1, characterized in that: The multicast communication is TRDP as a real-time communication protocol for Ethernet communication. During multicast communication, the device IP addresses of the sender and the receiver in the multicast address correspond to multiple destination addresses; Especially when the network architecture is complex and there are many device nodes, communication will cause a huge burden on the network bus; when multicasting is used, this method can also quickly implement the multicast communication function according to the XML configuration of the data stream file.
6. A fast-configured real-time Ethernet communication method according to claim 1, characterized in that: The database establishment and connection adopts the network communication and database combination method to make the network communication intuitive and easy to manage data. The data flow, the XML file of the data flow, and the database can intuitively reflect the data communication relationship table. During the communication, the data variables are updated in real time in the database, which is more conducive to the docking of the input and output of the project logic, as well as a series of other applications such as subsequent data visualization, log recording, reporting, data mining, data analysis, etc. A lightweight SQlite database is used. It is easy to know from the relationship of the data flow that a relational database needs to be established. The design adopts a two-layer relationship: the first layer is the data flow table, that is, the content of the data flow file. The database create table instruction is used to create a variable name number as the primary key, and the source address IP, destination address IP, port number, comid, data length, byte offset, bit offset and data size as the remaining columns. The database insert instruction is used again to loop and insert all the contents in the data flow table; The second layer is a data table for each comid under the first layer table. The data table is named after comid, the primary key is a long integer data type (with the timestamp of TRDP as the primary key unique identifier), and all variables (variable names are in the form of var+variable name number) are the remaining columns. When performing TRDP communication, insert data operations before communication is sent at each moment and insert data operations after communication receives data, then all data variables under each comid will be refreshed corresponding to the variables in the database. The input and output reading of the control logic (the variable value of the latest timestamp row of the variable name number in the comid table can be obtained) The database value will also be refreshed synchronously.
7. A fast-configured real-time Ethernet communication method according to claim 1, characterized in that: The TRDP communication is connected with the communication routine in the TRDP international standard, and the TRDP LIB library and DLL dynamic link library or .A static library file are directly loaded; in the development environment such as VisualStudio or QT under the required operating system, a routine C / C++ language .C or .CPP file is selected according to the project needs, and the necessary .h file needs to be added, such as TRDP-xmlpd-test.c content is copied to the project project; The data flow quick configuration xml is in the same project as above, and the function interface is connected. TRDP communication uses the publish and subscribe frame method to implement the specific communication process; read the xml file with the same relative naming rules as the IP address of this device in the XML folder of the TRDP communication generated above; TRDP publishes data frames corresponding to the data variable group in the sending comid contained in all destination address IPs in the xml file; The TRDP subscription data frame corresponds to the data variable group in the receiving comid contained in all source address IPs in the xml file.
8. A fast-configuration real-time Ethernet communication board, characterized in that: It includes hardware modules and software modules. The TRDP module in the hardware module is mainly used for the TRDP protocol stack and automatic implementation of fast-configured real-time Ethernet communication. The TRDP board in the software module mainly realizes fast data configuration based on data stream and TRDP communication function. In addition, there are other commonly used industrial bus communication interfaces in vehicle communication. It is necessary to convert the multiple protocols of the lower layer to have the transmission communication function of TRDP. In addition to realizing the data stream file fast configuration method of the above-mentioned TRDP standard, it is also designed with common network communication protocol conversion functions, such as CAN communication and serial port communication; Driver layer embedded hardware abstraction layer and hardware support package, TRDP driver and IP routing configuration, the operating system will carry Linux and TRDP virtual operating system synchronous interaction, complete the basic file system and user interface, and provide TRDP process communication, message communication and TCP message communication mechanism, realize the interface for the application layer and docking with the driver, complete the hardware management and final interface; The application layer will use TRDP, system and other industrial network conversion interface functions and applications to achieve other industrial bus network protocol conversion, based on the rapid configuration of TRDP communication and network monitoring functions.