Data message general forwarding processing device based on multiple interfaces

CN118764522APending Publication Date: 2024-10-11TIANJIN JINHANG COMP TECH RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410946884.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

In embedded control systems, workflow changes on the instruction forwarding unit side lead to large changes in program code, low software development efficiency, and an increased risk of errors after code modification, affecting the high-quality reuse and reliability of the code.

Method used

Design a general forwarding processing device for data messages based on multiple interfaces. Use XML script language to describe the workflow of the instruction forwarding unit. Change the workflow through XML script files to reduce changes to program code. Use an XML script interpreter. Parse and execute script files, support sequential structures, branch judgments and loop structures, and dynamically determine the return value type.

Benefits of technology

Without changing as little or as little as possible the program code on the instruction forwarding unit side, a new workflow is implemented, which improves the efficiency and reliability of software development, reduces the risk of program modification, and enhances the reusability of the code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118764522A_ABST
    Figure CN118764522A_ABST
Patent Text Reader

Abstract

The invention relates to a universal data message forwarding processing device based on multiple interfaces, and belongs to the technical field of embedded system communication. When the workflow of the instruction forwarding unit end is changed, the device realizes a new workflow of the instruction forwarding unit end only by changing the script file of the instruction forwarding unit end under the condition that the program code of the instruction forwarding unit end is not changed as much as possible or is changed as little as possible. According to the universal data message forwarding processing device based on the multiple interfaces, the problems that in an embedded control system, due to the fact that the design and workflow of an instruction forwarding unit end are changed, the program code change amount of the instruction forwarding unit end is large, and the software development efficiency is low are perfectly solved. The device provided by the invention has the characteristics of small program code change amount, high software development efficiency and reliability, easiness in implementation and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of embedded system communication, and in particular relates to a data message universal forwarding processing device based on multiple interfaces. Background Art

[0002] In an embedded control system, the console sends control commands and parameters to the instruction forwarding unit via Ethernet, and the instruction forwarding unit sends the received control commands and parameters to the terminal device via different data interfaces (Ethernet, serial port, CAN bus, I / O switch, etc.). When the workflow of the instruction forwarding unit is changed, it is usually necessary to modify the code of the instruction forwarding unit to implement the new workflow of the instruction forwarding unit.

[0003] Although the practice of modifying the code on the instruction forwarding unit side can make the instruction forwarding unit meet the new workflow requirements, this method has certain disadvantages. On the one hand, this method leads to a large amount of changes in the program code on the instruction forwarding unit side. If the program architecture design on the instruction forwarding unit side is not reasonable, when the workflow of the device on the instruction forwarding unit side changes significantly, it will not only lead to an increase in the workload of modifying and maintaining the program on the instruction forwarding unit side, but also increase the risk of errors after the program is modified. On the other hand, a large number of modifications to the code on the instruction forwarding unit side may lead to changes in the software architecture of the code on the instruction forwarding unit side, which is not conducive to the high-quality reuse of the software code on the instruction forwarding unit side, and reduces the software development efficiency and implementation reliability. Summary of the invention

[0004] 1. Technical issues to be resolved

[0005] The present invention aims to solve the technical problems that in an embedded control system, the amount of program code changes on the instruction forwarding unit side is large and the software development efficiency is low due to changes in the design of the instruction forwarding unit side and the workflow.

[0006] (II) Technical solution

[0007] In order to solve the above technical problems, the present invention provides a data message universal forwarding processing device based on multiple interfaces, including a console, an instruction forwarding unit and a terminal device; the console includes:

[0008] A first data sending module, used for sending a control command to an instruction forwarding unit of the embedded control system via Ethernet;

[0009] A first data receiving module, connected to the first data sending module, and configured to receive the instruction execution status / result sent by the instruction forwarding unit via Ethernet;

[0010] A first data processing module, connected to the first data receiving module, is used to determine whether the instruction execution status / result is consistent with the expected execution result, and execute the control process of the terminal device;

[0011] The instruction forwarding unit comprises:

[0012] A second data sending module is used to send control commands and parameters to the terminal device through different data communication interfaces, and send the execution status / result of the terminal device to the console through Ethernet;

[0013] A second data receiving module, connected to the second data sending module, is used to receive the instruction execution status / result sent by the terminal device through different data communication interfaces, and receive the control commands and parameters sent by the console through Ethernet;

[0014] A second data processing module, connected to the second data receiving module, is used to convert the control commands and parameters of each step of the process sent by the console into message data of corresponding formats according to different message data types and communication interface types; and convert the instruction execution status / result sent by the terminal device into Ethernet message data;

[0015] The terminal device comprises:

[0016] A third data sending module 31, used to send the instruction execution status / result to the instruction forwarding unit through different data communication interfaces;

[0017] A third data receiving module 32, connected to the third data sending module 31, for receiving control commands and parameters sent by the instruction forwarding unit through different data communication interfaces;

[0018] A third data processing module 33, connected to the third data receiving module 32, for saving the instruction execution status / result, and converting the instruction execution status / result into message data in a corresponding communication interface format;

[0019] The console sends control commands and parameters to the instruction forwarding unit via Ethernet, and the instruction forwarding unit sends the received control commands and parameters to the terminal device via different data interfaces; the terminal device sends the execution result of the control command to the instruction forwarding unit via different data interfaces, and the instruction forwarding unit sends the execution result to the console via Ethernet;

[0020] Among them, the terminal device receives control commands and parameters sent by the instruction forwarding unit through different data communication interfaces, converts the instruction execution status / results generated by itself into message data in the corresponding communication interface format, and sends it to the instruction forwarding unit through different data communication interfaces.

[0021] Preferably, the instruction forwarding unit runs an interpreter of the XML script file, i.e., an XML script interpreter; the workflow of the instruction forwarding unit itself is implemented by describing the XML script; the XML script language interface specification is an XML-based extensible markup language designed to implement the workflow of the instruction forwarding unit, and supports sequential structure, branch judgment and loop structure;

[0022] The XML scripting language follows the grammatical rules of the XML language and is written in sequence according to the workflow of the instruction forwarding unit itself; the statements in the XML scripting language interface specification are expressed by an XML element; all statements must have a return value, and for statements with meaningless return values, void is returned; the statements in the XML scripting language interface specification can be nested into combined statements, and the return value of such a statement is the execution result of the last statement within it; the return value type of each statement is dynamically determined during the execution of the XML script interpreter, and is not statically checked before execution.

[0023] Preferably, each step of the workflow of the instruction forwarding unit is implemented by a block statement, each block statement is composed of multiple basic statements, and the XML script interpreter will parse and execute each statement in the block statement in sequence; the language elements of each basic statement in the block include assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, data sending elements, data receiving elements and custom data processing elements.

[0024] Preferably, the workflow of the instruction forwarding unit itself includes: parameter and task initialization, reception and processing of console control commands and parameters, and communication processing with the terminal device;

[0025] Among them, the "parameter initialization" of the instruction forwarding unit is realized by the instruction forwarding unit reading the corresponding XML parameter configuration file; a special function ReadXMLFile is defined in XML as a "file reading" element to realize the function of reading the specified file path, file type and file name; the instruction forwarding unit divides the parameters into different XML parameter configuration files according to the type, and each XML parameter configuration file contains a parameter name, parameter identifier, parameter data type and parameter initial value; a special function InitPara is defined in XML as a "system initialization" element to realize the parameter initialization of the instruction forwarding unit;

[0026] Among them, the "task initialization" of the instruction forwarding unit is realized by the instruction forwarding unit reading the corresponding XML task configuration file; a special function ReadXMLFile is defined in XML as a "file reading" element to realize the function of reading the specified file path, file type and file name; the instruction forwarding unit divides the tasks to be created into different XML task configuration files according to the type, and each XML task configuration file contains the task name, identifier, priority, execution cycle, stack size, semaphore name, semaphore identifier, semaphore type and initialization parameters, message queue name, message queue identifier, message queue type and initialization parameters; a special function CreateTask is defined in XML as a "create task" element to realize the creation and initialization operations of the task, semaphore and message queue of the instruction forwarding unit;

[0027] The "console control command and parameter reception and processing" of the instruction forwarding unit includes receiving control commands and parameters, processing control commands and parameters, and sending control commands and parameters; using Ethernet data receiving elements and Ethernet data sending elements to realize the reception and sending of control commands and parameters, defining a special function DealNetData in XML as a "control command and parameter processing" element, and realizing the processing of control commands and parameters according to the content of the Ethernet protocol;

[0028] Among them, the "communication processing with the terminal device" of the instruction forwarding unit includes receiving terminal device data, sending data to the terminal device and terminal device data processing; defining data receiving elements of different interface types in XML, and implementing the data receiving element of each interface type with a dedicated function, and the function parameters are the received data content, data message name, communication interface type and receiving timeout; defining data sending elements of different interface types in XML, and implementing the data sending element of each interface type with a dedicated function, and the function parameters are the content of the sent data, data message name, communication interface type, number of transmissions and transmission interval; defining respective dedicated functions in XML as terminal device data processing elements of different interface types, and processing the message of each interface type according to the message protocol.

[0029] Preferably, the kernel of the XML script interpreter running in the instruction forwarding unit implements the interpretation and processing of each syntax element in the block statement, and parses the assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, data sending elements, data receiving elements and custom data processing elements in the block statement line by line according to the specific function implemented by each syntax element; after the complete XML script file is loaded into the XML script interpreter, the instruction forwarding unit performs parsing and processing according to the cycle specified in the script.

[0030] Preferably, the workflow of the instruction forwarding unit in the XML script file is as follows:

[0031] (1) Using the ReadXMLFile file reading element of the XML scripting language, the execution cycle of the instruction forwarding unit workflow is obtained from the XML configuration file;

[0032] (2) Using the ReadXMLFile file reading element of the XML scripting language, the parameter name, parameter identifier, parameter data type and parameter initial value contained in each XML parameter configuration file are obtained, and the InitPara system initialization element of the XML scripting language is used to complete the initialization of the instruction forwarding unit parameters;

[0033] (3) Using the XML scripting language's ReadXMLFile file reading element, obtain the task name, identifier, priority, execution cycle, stack size, semaphore name, semaphore identifier, semaphore type and initialization parameters, message queue name, message queue identifier, message queue type and initialization parameters contained in each XML task configuration file, and using the XML scripting language's CreateTask to create a task element to complete the initialization and creation of each task, semaphore and message queue in the instruction forwarding unit;

[0034] (4) The instruction forwarding unit executes the workflow periodically according to the cycle read in step (1);

[0035] (5) The instruction forwarding unit creates multiple receiving tasks according to different interface types, and in each receiving task, stores the received message data in a corresponding global data structure according to different interface types, for use by the data receiving element recvdata in the block statement of the XML script;

[0036] (6) Since the instruction forwarding unit mainly realizes the reception, processing and sending of message data, the main XML syntax elements used are the data receiving element recvdata, the data sending element senddata and the custom data processing element. The syntax rules of the assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, data sending elements, data receiving elements and custom data processing elements defined in the XML script block are used, combined with the workflow of the instruction forwarding unit itself, and the XML script is used to describe the execution conditions, parameters, execution timing and execution cycle of the data receiving element recvdata, the data sending element senddata and the custom data processing element.

[0037] Preferably, when the number of times the instruction forwarding unit sends message data is greater than the maximum number set in the XML script file, it indicates that the instruction forwarding unit fails to send data to the terminal device, and the failure result is notified to the console via Ethernet; when the time for the instruction forwarding unit to receive the terminal device data message is greater than the timeout time set in the XML script file, it indicates that the instruction forwarding unit fails to receive the terminal device data, and the failure result is notified to the console via Ethernet.

[0038] Preferably, the kernel of the XML script interpreter implements the interpretation and processing of each syntax element in the block statement; for each syntax element, corresponding functions are defined to respectively implement the assignment statement function, numerical calculation function, comparison statement function, logical calculation function, branch and loop statement function, data sending function, data receiving function and special processing of instruction forwarding unit information data, and the parameters of the function are the attributes of the above syntax elements.

[0039] Preferably, according to the specific functions implemented by each syntax element, the assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, data sending elements, data receiving elements and custom data processing elements in the block statement are parsed line by line.

[0040] The invention also provides an embedded control system implemented based on the device.

[0041] (III) Beneficial effects

[0042] The advantages of the present invention compared with the prior art are:

[0043] 1. The device realizes a new workflow of the instruction forwarding unit by only changing the script file of the instruction forwarding unit without changing or changing the program code of the instruction forwarding unit as little as possible, so as to adapt to and meet the requirements of the new workflow of the instruction forwarding unit after the change;

[0044] 2. The device has the characteristics of small program code changes, high software development efficiency and reliability, and easy implementation. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a schematic diagram of the connection between the console, the instruction forwarding unit and the terminal device of the present invention;

[0046] Figure 2 It is one of the structural schematic diagrams of a universal forwarding processing device for data messages based on multiple interfaces;

[0047] Figure 3 This is the second structural diagram of a universal forwarding processing device for data messages based on multiple interfaces;

[0048] Figure 4 This is a third structural diagram of a universal forwarding processing device for data messages based on multiple interfaces;

[0049] Figure 5 It is the overall working flow chart of the device of the present invention. DETAILED DESCRIPTION

[0050] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the drawings and examples.

[0051] The present invention proposes a data message universal forwarding processing device based on multiple interfaces, when the instruction forwarding unit end (such as Figure 1 When the workflow of the instruction forwarding unit (as shown in the figure) is changed, the device implements the new workflow of the instruction forwarding unit only by changing the script file of the instruction forwarding unit, while not changing or changing the program code of the instruction forwarding unit as little as possible.

[0052] Only by adopting the solution of the present invention can the problem of "large amount of program code changes on the instruction forwarding unit side and low software development efficiency due to changes in the design and workflow of the instruction forwarding unit side" be perfectly solved. The present invention proposes a universal data message forwarding processing device based on multiple interfaces, which only requires changing the script file on the instruction forwarding unit side, thereby improving the development efficiency and reliability of the software.

[0053] like Figure 1 , Figure 2 As shown, this embodiment provides a data message universal forwarding processing device based on multiple interfaces, including a console set in an embedded control system, and the console includes:

[0054] A first data sending module 11, used to send a control command to an instruction forwarding unit of the embedded control system via Ethernet;

[0055] A first data receiving module 12, connected to the first data sending module 11, and configured to receive the instruction execution status / result sent by the instruction forwarding unit via Ethernet;

[0056] The first data processing module 13 is connected to the first data receiving module 12, and is used to determine whether the instruction execution status / result is consistent with the expected execution result, and execute the control process of the terminal device.

[0057] The console sends control commands and parameters to the instruction forwarding unit via Ethernet, and the instruction forwarding unit sends the received control commands and parameters to the terminal device via different data interfaces (Ethernet, serial port, CAN bus, I / O switch, etc.). The terminal device sends the execution result of the control command to the instruction forwarding unit via different data interfaces (Ethernet, serial port, CAN bus, I / O switch, etc.), and the instruction forwarding unit sends the execution result to the console via Ethernet.

[0058] like Figure 1 , Figure 3 As shown, this embodiment provides a data message universal forwarding processing device based on multiple interfaces, and also includes an instruction forwarding unit arranged in an embedded control system, and the instruction forwarding unit includes:

[0059] The second data sending module 21 is used to send control commands and parameters to the terminal device through different data communication interfaces, and send the execution status / result of the terminal device to the console through Ethernet;

[0060] A second data receiving module 22, connected to the second data sending module 21, is used to receive the instruction execution status / result sent by the terminal device through different data communication interfaces, and receive the control commands and parameters sent by the console through Ethernet;

[0061] The second data processing module 23 is connected to the second data receiving module 22, and is used to convert the control commands and parameters of each step of the process sent by the console into message data of corresponding formats according to different message data types and communication interface types; and convert the instruction execution status / result sent by the terminal device into Ethernet message data.

[0062] The interpreter of the XML script file running in the instruction forwarding unit is the XML script interpreter. The workflow of the instruction forwarding unit itself is implemented by XML script description. The XML script language interface specification is an XML-based extensible markup language designed to implement the workflow of the instruction forwarding unit, supporting sequential structure, branch judgment and loop structure.

[0063] Wherein, the XML scripting language is designed based on XML extensible markup language, follows the grammatical rules of XML language, and is written in sequence according to the workflow of the instruction forwarding unit itself. The statements in the XML scripting language interface specification are expressed by an XML element. All statements must have a return value. For statements whose return values ​​are meaningless, void is returned. The statements in the XML scripting language interface specification can be nested into combined statements, and the return value of such a statement is the execution result of the last statement inside it. The return value type of each statement is dynamically determined during the execution of the XML script interpreter, and is not statically checked before execution.

[0064] Each step of the workflow of the instruction forwarding unit is implemented by a block statement, each block statement is composed of multiple basic statements, and the XML script interpreter will parse and execute each statement in the block statement in sequence. The language elements of each basic statement in the block include assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, data sending elements, data receiving elements, and custom data processing elements.

[0065] The workflow of the instruction forwarding unit itself includes: parameter and task initialization, reception and processing of console control commands and parameters, and communication processing with terminal equipment.

[0066] Among them, the "parameter initialization" of the instruction forwarding unit is implemented by the instruction forwarding unit reading the corresponding XML parameter configuration file. Define the special function ReadXMLFile as the "file reading" element in XML to realize the function of reading the specified file path, file type and file name. The instruction forwarding unit divides the parameters into different XML parameter configuration files according to the type. Each XML parameter configuration file contains the parameter name, parameter identifier, parameter data type and parameter initial value. Define the special function InitPara as the "system initialization" element in XML to realize the parameter initialization of the instruction forwarding unit.

[0067] Among them, the "task initialization" of the instruction forwarding unit is realized by the instruction forwarding unit reading the corresponding XML task configuration file. A special function ReadXMLFile is defined in XML as a "file reading" element to realize the function of reading the specified file path, file type and file name. The instruction forwarding unit divides the tasks (threads) to be created into different XML task (thread) configuration files according to the type. Each XML task (thread) configuration file contains the task (thread) name, identifier, priority, execution cycle, stack size, semaphore name, semaphore identifier, semaphore type and initialization parameters, message queue name, message queue identifier, message queue type and initialization parameters. A special function CreateTask is defined in XML as a "create task" element to realize the creation and initialization operations of the task (thread), semaphore and message queue of the instruction forwarding unit.

[0068] The "console control command and parameter reception and processing" of the instruction forwarding unit includes receiving control commands and parameters, processing control commands and parameters, and sending control commands and parameters. The control commands and parameters are received and sent using Ethernet data receiving elements and Ethernet data sending elements. A dedicated function DealNetData is defined in XML as a "control command and parameter processing" element to process the control commands and parameters according to the content of the Ethernet protocol.

[0069] Among them, the "communication processing with the terminal device" of the instruction forwarding unit includes receiving terminal device data, sending data to the terminal device and terminal device data processing. Data receiving elements of different interface types are defined in XML, and the data receiving element of each interface type is implemented with a dedicated function. The function parameters are the received data content, data message name, communication interface type and receiving timeout. Data sending elements of different interface types are defined in XML, and the data sending element of each interface type is implemented with a dedicated function. The function parameters are the content of the sent data, data message name, communication interface type, number of transmissions and transmission interval. Respective dedicated functions are defined in XML as terminal device data processing elements of different interface types, and the messages of each interface type are processed according to the message protocol.

[0070] The instruction forwarding unit runs an interpreter of the XML script file, and the core of the XML script interpreter implements the interpretation and processing of each syntax element in the block statement, and parses the assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, data sending elements, data receiving elements and user-defined data processing elements in the block statement line by line according to the specific functions implemented by each syntax element. After the complete XML script file is loaded into the XML script interpreter, the instruction forwarding unit performs the parsing and processing according to the cycle specified in the script.

[0071] The workflow of the instruction forwarding unit in the XML script file is as follows:

[0072] (1) Using the ReadXMLFile file of the XML scripting language to read the elements, the execution cycle of the instruction forwarding unit workflow is obtained from the XML configuration file (including the XML parameter configuration file and the XML task (thread) configuration file);

[0073] (2) Using the ReadXMLFile file reading element of the XML scripting language, the parameter name, parameter identifier, parameter data type and parameter initial value contained in each XML parameter configuration file are obtained, and the InitPara system initialization element of the XML scripting language is used to complete the initialization of the instruction forwarding unit parameters;

[0074] (3) Using the XML scripting language's ReadXMLFile file reading element, obtain the task (thread) name, identifier, priority, execution cycle, stack size, semaphore name, semaphore identifier, semaphore type and initialization parameters, message queue name, message queue identifier, message queue type and initialization parameters contained in each XML task (thread) configuration file, and using the XML scripting language's CreateTask to create a task element to complete the initialization and creation of each task, semaphore and message queue in the instruction forwarding unit;

[0075] (4) The instruction forwarding unit executes the workflow periodically according to the cycle read in step (1);

[0076] (5) The instruction forwarding unit creates multiple receiving tasks (Ethernet data receiving task, serial port data receiving task, CAN bus data receiving task, etc.) according to different interface types. In each receiving task, the received message data is stored in the corresponding global data structure according to the interface type, for use by the data receiving element recvdata in the block statement of the XML script;

[0077] (6) Since the instruction forwarding unit mainly realizes the reception, processing and sending of message data, the main XML syntax elements used are the data receiving element recvdata, the data sending element senddata and the custom data processing element. The syntax rules of the assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, data sending elements, data receiving elements and custom data processing elements defined in the XML script block are used, combined with the workflow of the instruction forwarding unit itself, and the XML script is used to describe the execution conditions, parameters, execution timing and execution cycle of the data receiving element recvdata, the data sending element senddata and the custom data processing element.

[0078] Wherein, when the number of times the instruction forwarding unit sends message data is greater than the maximum number set in the XML script file, it indicates that the instruction forwarding unit fails to send data to the terminal device, and the failure result is notified to the console via Ethernet. When the time for the instruction forwarding unit to receive the terminal device data message is greater than the timeout time set in the XML script file, it indicates that the instruction forwarding unit fails to receive the terminal device data, and the failure result is notified to the console via Ethernet.

[0079] The kernel of the XML script interpreter implements the interpretation and processing of each syntax element in the block statement. For each syntax element, corresponding functions are defined to respectively implement the assignment statement function, numerical calculation function, comparison statement function, logical calculation function, branch and loop statement function, data transmission function, data reception function and special processing of instruction forwarding unit information data, and the parameters of the function are the attributes of the above syntax elements.

[0080] Among them, according to the specific functions implemented by each syntax element, the assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, data sending elements, data receiving elements and custom data processing elements in the block statement are parsed line by line.

[0081] After the complete XML script file is loaded into the XML script interpreter, the instruction forwarding unit executes the XML script workflow in sequence according to the cycle specified in the script.

[0082] like Figure 1 , Figure 4 As shown, this embodiment provides a general forwarding processing device for data packets based on multiple interfaces, and also includes a terminal device, wherein the terminal device includes:

[0083] A third data sending module 31, used to send the instruction execution status / result to the instruction forwarding unit through different data communication interfaces;

[0084] A third data receiving module 32, connected to the third data sending module 31, for receiving control commands and parameters sent by the instruction forwarding unit through different data communication interfaces;

[0085] The third data processing module 33 is connected to the third data receiving module 32, and is used to save the instruction execution status / result and convert the instruction execution status / result into message data in a corresponding communication interface format.

[0086] Among them, the terminal device receives control commands and parameters sent by the instruction forwarding unit through different data communication interfaces, converts the instruction execution status / results generated by itself into message data in the corresponding communication interface format, and sends it to the instruction forwarding unit through different data communication interfaces.

[0087] It can be seen that by applying the general forwarding processing device for data packets based on multiple interfaces described in the present invention, when the workflow of the instruction forwarding unit changes and needs to be modified, there is no need to modify the application code of the instruction forwarding unit, and only the corresponding XML script file needs to be changed to implement the new workflow of the instruction forwarding unit.

[0088] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A data message universal forwarding processing device based on multiple interfaces, characterized in that: It includes a console, an instruction forwarding unit and a terminal device; the console includes: A first data sending module, used for sending a control command to an instruction forwarding unit of the embedded control system via Ethernet; A first data receiving module, connected to the first data sending module, and configured to receive the instruction execution status / result sent by the instruction forwarding unit via Ethernet; A first data processing module, connected to the first data receiving module, is used to determine whether the instruction execution status / result is consistent with the expected execution result, and execute the control process of the terminal device; The instruction forwarding unit comprises: A second data sending module is used to send control commands and parameters to the terminal device through different data communication interfaces, and send the execution status / result of the terminal device to the console through Ethernet; A second data receiving module, connected to the second data sending module, is used to receive the instruction execution status / result sent by the terminal device through different data communication interfaces, and receive the control commands and parameters sent by the console through Ethernet; A second data processing module, connected to the second data receiving module, is used to convert the control commands and parameters of each step of the process sent by the console into message data of corresponding formats according to different message data types and communication interface types; and convert the instruction execution status / result sent by the terminal device into Ethernet message data; The terminal device comprises: A third data sending module 31, used to send the instruction execution status / result to the instruction forwarding unit through different data communication interfaces; A third data receiving module 32, connected to the third data sending module 31, for receiving control commands and parameters sent by the instruction forwarding unit through different data communication interfaces; A third data processing module 33, connected to the third data receiving module 32, for saving the instruction execution status / result, and converting the instruction execution status / result into message data in a corresponding communication interface format; The console sends control commands and parameters to the instruction forwarding unit via Ethernet, and the instruction forwarding unit sends the received control commands and parameters to the terminal device via different data interfaces; the terminal device sends the execution result of the control command to the instruction forwarding unit via different data interfaces, and the instruction forwarding unit sends the execution result to the console via Ethernet; Among them, the terminal device receives control commands and parameters sent by the instruction forwarding unit through different data communication interfaces, converts the instruction execution status / results generated by itself into message data in the corresponding communication interface format, and sends it to the instruction forwarding unit through different data communication interfaces.

2. The device according to claim 1, characterized in that in, The interpreter of the XML script file running in the instruction forwarding unit is an XML script interpreter; the workflow of the instruction forwarding unit itself is implemented by describing the XML script; the XML script language interface specification is an XML-based extensible markup language designed to implement the workflow of the instruction forwarding unit, supporting sequential structure, branch judgment and loop structure; The XML scripting language follows the grammatical rules of the XML language and is written in sequence according to the workflow of the instruction forwarding unit itself; the statements in the XML scripting language interface specification are expressed by an XML element; all statements must have a return value, and for statements with meaningless return values, void is returned; the statements in the XML scripting language interface specification can be nested into combined statements, and the return value of such a statement is the execution result of the last statement within it; the return value type of each statement is dynamically determined during the execution of the XML script interpreter, and is not statically checked before execution.

3. The device according to claim 2, characterized in that in, Each step of the workflow of the instruction forwarding unit is implemented by a block statement, each block statement is composed of multiple basic statements, and the XML script interpreter will parse and execute each statement in the block statement in sequence; the language elements of each basic statement in the block include assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, data sending elements, data receiving elements and custom data processing elements.

4. The device according to claim 3, characterized in that in, The workflow of the instruction forwarding unit itself includes: parameter and task initialization, reception and processing of console control commands and parameters, and communication processing with terminal devices; The "parameter initialization" of the instruction forwarding unit is realized by the instruction forwarding unit reading the corresponding XML parameter configuration file; a special function ReadXMLFile is defined in XML as a "file reading" element to realize the function of reading the specified file path, file type and file name; the instruction forwarding unit divides the parameters into different XML parameter configuration files according to the type, and each XML parameter configuration file contains a parameter name, parameter identifier, parameter data type and parameter initial value; a special function InitPara is defined in XML as a "system initialization" element to realize the parameter initialization of the instruction forwarding unit; Among them, the "task initialization" of the instruction forwarding unit is realized by the instruction forwarding unit reading the corresponding XML task configuration file; a special function ReadXMLFile is defined in XML as a "file reading" element to realize the function of reading the specified file path, file type and file name; the instruction forwarding unit divides the tasks to be created into different XML task configuration files according to the type, and each XML task configuration file contains a task name, identifier, priority, execution cycle, stack size, semaphore name, semaphore identifier, semaphore type and initialization parameters, message queue name, message queue identifier, message queue type and initialization parameters; a special function CreateTask is defined in XML as a "create task" element to realize the creation and initialization operations of tasks, semaphores and message queues of the instruction forwarding unit; The "console control command and parameter reception and processing" of the instruction forwarding unit includes receiving control commands and parameters, processing control commands and parameters, and sending control commands and parameters; using Ethernet data receiving elements and Ethernet data sending elements to realize the reception and sending of control commands and parameters, defining a special function DealNetData in XML as a "control command and parameter processing" element, and realizing the processing of control commands and parameters according to the content of the Ethernet protocol; Among them, the "communication processing with the terminal device" of the instruction forwarding unit includes receiving terminal device data, sending data to the terminal device and terminal device data processing; defining data receiving elements of different interface types in XML, and implementing the data receiving element of each interface type with a dedicated function, and the function parameters are the received data content, data message name, communication interface type and receiving timeout; defining data sending elements of different interface types in XML, and implementing the data sending element of each interface type with a dedicated function, and the function parameters are the content of the sent data, data message name, communication interface type, number of transmissions and transmission interval; defining respective dedicated functions in XML as terminal device data processing elements of different interface types, and the message of each interface type is processed according to the message protocol.

5. The device according to claim 4, characterized in that The kernel of the XML script interpreter running in the instruction forwarding unit implements the interpretation and processing of each syntax element in the block statement, and parses the assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, data sending elements, data receiving elements and custom data processing elements in the block statement line by line according to the specific functions implemented by each syntax element; after the complete XML script file is loaded into the XML script interpreter, the instruction forwarding unit performs parsing and processing according to the cycle specified in the script.

6. The device according to claim 5, characterized in that in, The workflow of the instruction forwarding unit in the XML script file is as follows: (1) Using the ReadXMLFile file reading element of the XML scripting language, the execution cycle of the instruction forwarding unit workflow is obtained from the XML configuration file; (2) Using the ReadXMLFile file reading element of the XML scripting language, the parameter name, parameter identifier, parameter data type and parameter initial value contained in each XML parameter configuration file are obtained, and the InitPara system initialization element of the XML scripting language is used to complete the initialization of the instruction forwarding unit parameters; (3) Using the XML scripting language's ReadXMLFile file reading element, obtain the task name, identifier, priority, execution cycle, stack size, semaphore name, semaphore identifier, semaphore type and initialization parameters, message queue name, message queue identifier, message queue type and initialization parameters contained in each XML task configuration file, and using the XML scripting language's CreateTask to create a task element to complete the initialization and creation of each task, semaphore and message queue in the instruction forwarding unit; (4) The instruction forwarding unit executes the workflow periodically according to the cycle read in step (1); (5) The instruction forwarding unit creates multiple receiving tasks according to different interface types, and in each receiving task, stores the received message data in a corresponding global data structure according to different interface types, for use by the data receiving element recvdata in the block statement of the XML script; (6) Using the grammatical rules of assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, data sending elements, data receiving elements, and custom data processing elements defined in the XML script block, combined with the workflow of the instruction forwarding unit itself, use XML script to describe the execution conditions, parameters, execution timing, and execution cycle of the data receiving element recvdata, the data sending element senddata, and the custom data processing element.

7. The device according to claim 6, characterized in that in, When the number of times the instruction forwarding unit sends message data is greater than the maximum number set in the XML script file, it indicates that the instruction forwarding unit has failed to send data to the terminal device, and the failure result will be notified to the console via Ethernet; when the time for the instruction forwarding unit to receive the terminal device data message is greater than the timeout time set in the XML script file, it indicates that the instruction forwarding unit has failed to receive the terminal device data, and the failure result will be notified to the console via Ethernet.

8. The device according to claim 7, characterized in that in, The kernel of the XML script interpreter implements the interpretation and processing of each syntax element in the block statement; for each syntax element, corresponding functions are defined to respectively implement the assignment statement function, numerical calculation function, comparison statement function, logical calculation function, branch and loop statement function, data sending function, data receiving function and special processing of instruction forwarding unit information data, and the parameters of the function are the attributes of the corresponding syntax element.

9. The device according to claim 8, characterized in that in, According to the specific functions implemented by each syntax element, the assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, data sending elements, data receiving elements and custom data processing elements in the block statement are parsed line by line.

10. An embedded control system implemented based on the device according to any one of claims 1 to 9.