General processing device based on flow control
By using a general processing device based on process control in an embedded control system, and sending control instructions and parameters through the console Ethernet, the problem of large amount of program code changes on the console side caused by changes in the terminal equipment control process is solved, and software development is improved Efficiency and reliability.
Patent Information
- Application Number
- CN202411060544.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-05
- Publication Date
- 2024-11-12
AI Technical Summary
In embedded control systems, when the control process or code of the terminal device is changed, the program code on the console side is changed by a large amount, the software development efficiency is low, and it is not conducive to the high-quality reuse of the code.
Using a general processing device based on process control, send control instructions and parameters to the terminal device through the console Ethernet, and receive execution results to realize process control. You only need to change the console script file, no need to significantly modify the console program code, and use XML The script language interface specification and instruction forwarding unit perform process control.
It reduces the amount of changes in the console program code, improves software development efficiency and reliability, and achieves flexible adaptation to terminal equipment process control.
Smart Images

Figure CN118939377A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of embedded system communication, and in particular relates to a general processing device based on process control. Background Art
[0002] In an embedded control system, the console needs to control the terminal device according to the corresponding control process. When the control process on the console side is changed or the control code on the terminal device side is changed, it is usually necessary to modify the code on the console side to realize the process control of the terminal device.
[0003] Although the method of modifying the console-side code can realize the process control of the console over the terminal device, this method has certain disadvantages. On the one hand, this method leads to a large amount of changes in the program code on the console side. If the control process of the terminal device is relatively complex, and the program architecture design of the console side is not reasonable, when the control process of the terminal device is changed a lot, or the code changes between the new terminal device and the old terminal device are large, it will not only lead to an increase in the workload of modifying and maintaining the program on the console side, but also increase the risk of errors after the program is modified. On the other hand, this method of requiring a large amount of modification of the console-side program code or even the modification of the console-side software architecture due to changes in the terminal device control process or the terminal device code is not conducive to the high-quality reuse of the console-side software code, and reduces the software development efficiency and implementation reliability. Summary of the invention
[0004] 1. Technical issues to be resolved
[0005] The present invention provides a general processing device based on process control, which solves the problem of "large amount of changes to console-side program code and low software development efficiency caused by changes to terminal device control process or terminal device-side code" in embedded control systems. The process control of the console over the terminal device is achieved by only changing the console-side script file, while the console-side program code is not changed or changed as little as possible.
[0006] (II) Technical solution
[0007] In order to solve the above technical problems, the present invention provides a general processing device based on process control, including a console, an instruction forwarding unit and a terminal device;
[0008] The control process of the console over the terminal device is divided into N steps; the console sends the requirements and contents of each step to the terminal device via the instruction forwarding unit in the form of control instructions and parameters via Ethernet, and the terminal device sends the execution result of the instruction to the console via the instruction forwarding unit;
[0009] The initiation, execution and termination of the terminal device control process are all completed by the console, and the terminal device control process runs in the console; the console sends the control instructions of each step through Ethernet, and receives the instruction execution result of the current step through Ethernet; if the execution result of the current step does not match the expected result in the control process, the console terminates the current control process and gives a prompt of process execution abnormality; if the execution result of the current step matches the expected result in the control process, the console sends the control instruction of the next step through Ethernet;
[0010] The command forwarding unit receives the control commands and parameters sent by the console through Ethernet, and sends them to the terminal device through different communication interfaces; the command forwarding unit parses and classifies the control commands and parameters sent by the console according to different communication interface types, and generates data packets of different interface types; the command forwarding unit sends the packet data of different interface types to the terminal device according to the data sending cycle and number of times required by the console;
[0011] The instruction forwarding unit receives the instruction execution status / result sent by the terminal device through different communication interfaces, and composes the instruction execution status / result into an Ethernet data packet, and sends it to the console through Ethernet;
[0012] 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 them to the instruction forwarding unit through different data communication interfaces.
[0013] Preferably, the console is based on the XML scripting language interface specification and writes XML script files in sequence according to the control flow of the terminal device; 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 inside it; the return value type of each statement is the interpreter of the XML script file, that is, dynamically determined during the execution of the XML script interpreter, without static checking before execution, and the interpreter of the XML script file is the XML script interpreter.
[0014] Preferably, each step of the control flow of the console 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, Ethernet message data sending elements, Ethernet message data receiving elements, Ethernet message data result checking elements, and Ethernet message data testing elements.
[0015] Preferably, the console executes the entire control process of the terminal device in sequence according to a period T; each time the control process is executed, the number of steps Step being executed in the current control process is obtained, and the control process of the step Step is jumped to the step Step to execute the step; each step of the control process contains a timeout time T for the execution of the step timeout And the delay time T between the previous control process delay ; After executing the control flow of the current step, delay T delay Only then can the next control process be executed.
[0016] Preferably, when the number of times the console sends Ethernet messages exceeds the maximum number set in the XML script file, it prompts that the sending fails and terminates the process; when the time the console receives Ethernet messages exceeds the timeout time set in the XML script file, it prompts that the data reception times out and terminates the process.
[0017] Preferably, an XML script interpreter is run in the console, and the kernel 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, Ethernet message data sending elements, Ethernet message data receiving elements, Ethernet message data result checking elements and Ethernet message data testing 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 console decides under what conditions to start the XML script process.
[0018] Preferably, the console comprises:
[0019] A first data sending module, used for sending a control command to the instruction forwarding unit via Ethernet;
[0020] 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;
[0021] The first data processing module is connected to the first data receiving module 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.
[0022] Preferably, the instruction forwarding unit includes:
[0023] 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;
[0024] 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;
[0025] The second data processing module is connected to the second data receiving module, 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 / results sent by the terminal device into Ethernet message data.
[0026] Preferably, the terminal device includes:
[0027] A third data sending module, used for sending the instruction execution status / result to the instruction forwarding unit through different data communication interfaces;
[0028] A third data receiving module, connected to the third data sending module, and configured to receive control commands and parameters sent by the instruction forwarding unit through different data communication interfaces;
[0029] The third data processing module is connected to the third data receiving module 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.
[0030] The invention also provides an application of the device in the field of embedded system communication technology.
[0031] (III) Beneficial effects
[0032] The advantages of the present invention compared with the prior art are:
[0033] 1. The device adapts to and meets the control requirements of the changed console on the terminal device by only changing the console script file without changing or changing the console program code as little as possible;
[0034] 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
[0035] Figure 1 It is a schematic diagram of the connection between the console and the terminal device in the present invention;
[0036] Figure 2 It is one of the schematic diagrams of the structure of the general processing device based on process control of the present invention;
[0037] Figure 3 This is the second schematic diagram of the structure of the general processing device based on process control of the present invention;
[0038] Figure 4 This is the third schematic diagram of the structure of the general processing device based on process control of the present invention;
[0039] Figure 5 It is the overall working flow chart of the device of the present invention. DETAILED DESCRIPTION
[0040] 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.
[0041] Figure 1 This is a schematic diagram of a general processing device based on process control proposed by the present invention. When the control process on the console side is changed or the control code on the terminal device side is changed, the device realizes the process control of the console over the terminal device only by changing the console-side script file, while changing the console-side program code as little as possible.
[0042] Only by adopting the solution of the present invention can the problem of "large amount of program code changes on the console side and low software development efficiency caused by changes in the terminal device control process or terminal device code changes" be perfectly solved. The present invention proposes a general processing device based on process control, which only requires changing the script file on the console side, thereby improving the development efficiency and reliability of the software.
[0043] like Figure 1 As shown, this embodiment provides a general processing device based on process control, including a console, an instruction forwarding unit, and a terminal device, such as Figure 2 As shown, the console includes:
[0044] A first data sending module 11, used to send a control command to the instruction forwarding unit via Ethernet;
[0045] A first data receiving module 12, connected to the first data sending module 11, for receiving the instruction execution status / result sent by the instruction forwarding unit via Ethernet;
[0046] 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.
[0047] Among them, the control process of the console over the terminal device is divided into N (N>0) steps; the console sends the requirements and content of each step to the terminal device via the instruction forwarding unit in the form of control instructions and parameters via Ethernet, and the terminal device sends the execution result of the instruction to the console via the instruction forwarding unit.
[0048] Among them, the initiation, execution and termination of the terminal device control process are all completed by the console, and the terminal device control process runs in the console; the console sends the control instructions of each step through Ethernet, and receives the instruction execution results fed back by the current step through Ethernet; if the execution result of the current step does not match the expected result in the control process, the console terminates the current control process and gives a prompt of process execution abnormality; if the execution result of the current step matches the expected result in the control process, the console sends the control instructions of the next step through Ethernet.
[0049] The console is based on the XML script language interface specification, and writes XML script files (XML script flow files) in sequence according to the control flow of the terminal device; the statements in the XML script 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 script 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 the interpreter of the XML script file, that is, it is dynamically determined during the execution of the XML script interpreter, and no static check is performed before execution. The interpreter of the XML script file is the XML script interpreter.
[0050] Among them, each step of the control process of the console 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, Ethernet message data sending elements, Ethernet message data receiving elements, Ethernet message data result checking elements, and Ethernet message data testing elements.
[0051] The console executes the entire control process of the terminal device in sequence according to the period T (T>0); each time the control process is executed, the number of steps Step being executed in the current control process is obtained, and the control process of the step Step is jumped to the step Step to execute the step; each step of the control process contains the timeout time T for the execution of the step timeout (T timeout >0) and the delay time T between the previous control process delay (T delay ≥0); after completing the control process of the current step, a delay of T is required delay Only then can the next control process be executed.
[0052] When the number of times the console sends Ethernet messages exceeds the maximum number set in the XML script file, it prompts that the sending fails and terminates the process; when the time the console receives Ethernet messages exceeds the timeout time set in the XML script file, it prompts that the data reception times out and terminates the process.
[0053] Among them, an XML script interpreter is run in the console, and the kernel of the XML script interpreter implements the interpretation and processing of each syntax element in the block statement. According to the specific function implemented by each syntax element, the assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, Ethernet message data sending elements, Ethernet message data receiving elements, Ethernet message data result checking elements and Ethernet message data testing elements in the block statement are parsed line by line; after the complete XML script file is loaded into the XML script interpreter, the console decides under what conditions to start the XML script process.
[0054] like Figure 3 As shown, the instruction forwarding unit includes:
[0055] 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;
[0056] 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;
[0057] 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.
[0058] Among them, the instruction forwarding unit receives the control commands and parameters sent by the console through Ethernet, and sends them to the terminal device through different communication interfaces; the instruction forwarding unit parses and classifies the control commands and parameters sent by the console according to different communication interface types, and generates data packets of different interface types; the instruction forwarding unit sends the packet data of different interface types to the terminal device according to the data sending cycle and number of times required by the console.
[0059] The instruction forwarding unit receives the instruction execution status / result sent by the terminal device through different communication interfaces, and composes the instruction execution status / result into an Ethernet data packet, and sends it to the console through Ethernet.
[0060] like Figure 4 As shown, the terminal device includes:
[0061] A third data sending module 31, used to send the instruction execution status / result to the instruction forwarding unit through different data communication interfaces;
[0062] 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;
[0063] 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.
[0064] 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.
[0065] It can be seen that the general processing device based on process control of the present invention can realize the process control of the terminal device by the console without changing the application code of the console when the control process of the terminal device changes and needs to be modified. Only the corresponding XML script process file needs to be changed to realize the process control of the terminal device by the console.
[0066] 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 general processing device based on process control, It is characterized in that It includes a control console, a command forwarding unit and a terminal device; The control process of the console over the terminal device is divided into N steps; the console sends the requirements and contents of each step to the terminal device via the instruction forwarding unit in the form of control instructions and parameters via Ethernet, and the terminal device sends the execution result of the instruction to the console via the instruction forwarding unit; The initiation, execution and termination of the terminal device control process are all completed by the console, and the terminal device control process runs in the console; the console sends the control instructions of each step through Ethernet, and receives the instruction execution result of the current step through Ethernet; if the execution result of the current step does not match the expected result in the control process, the console terminates the current control process and gives a prompt of process execution abnormality; if the execution result of the current step matches the expected result in the control process, the console sends the control instruction of the next step through Ethernet; The command forwarding unit receives the control commands and parameters sent by the console through Ethernet, and sends them to the terminal device through different communication interfaces; the command forwarding unit parses and classifies the control commands and parameters sent by the console according to different communication interface types, and generates data packets of different interface types; the command forwarding unit sends the packet data of different interface types to the terminal device according to the data sending cycle and number of times required by the console; The instruction forwarding unit receives the instruction execution status / result sent by the terminal device through different communication interfaces, and composes the instruction execution status / result into an Ethernet data packet, and sends it to the console through Ethernet; 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 them to the instruction forwarding unit through different data communication interfaces.
2. The device according to claim 1, It is characterized in that The console is based on the XML script language interface specification and writes XML script files in sequence according to the control flow of the terminal device; the statements in the XML script 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 script 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 the interpreter of the XML script file, that is, it is dynamically determined during the execution of the XML script interpreter, and no static check is performed before execution. The interpreter of the XML script file is the XML script interpreter.
3. The device as claimed in claim 2, It is characterized in that Each step of the control process of the console 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, Ethernet message data sending elements, Ethernet message data receiving elements, Ethernet message data result checking elements, and Ethernet message data testing elements.
4. The device as claimed in claim 3, It is characterized in that The console executes the entire control process of the terminal device in sequence according to the cycle T; each time the control process is executed, the number of steps Step being executed in the current control process is obtained, and the control process of the step Step is jumped to the step Step to execute the step; each step of the control process contains the timeout time T for the execution of the step timeout And the delay time T between the previous control process delay ; After executing the control flow of the current step, delay T delay Only then can the next control process be executed.
5. The device as claimed in claim 4, It is characterized in that When the number of times the console sends Ethernet messages exceeds the maximum number set in the XML script file, it prompts that the sending fails and terminates the process; when the time the console receives Ethernet messages exceeds the timeout time set in the XML script file, it prompts that the data reception times out and terminates the process.
6. The device as claimed in claim 3, It is characterized in that An XML script interpreter is run in the console, and the kernel of the XML script interpreter implements the interpretation and processing of each syntax element in the block statement. According to the specific function implemented by each syntax element, the assignment statement elements, numerical operation elements, comparison statement elements, logical operation elements, branch and loop statement elements, Ethernet message data sending elements, Ethernet message data receiving elements, Ethernet message data result checking elements and Ethernet message data testing elements in the block statement are parsed line by line; after the complete XML script file is loaded into the XML script interpreter, the console decides under what conditions to start the XML script process.
7. The device according to claim 1, It is characterized in that The console comprises: A first data sending module, used for sending a control command to the instruction forwarding unit 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; The first data processing module is connected to the first data receiving module 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.
8. The device according to claim 7, It is characterized in that 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; The second data processing module is connected to the second data receiving module, 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 / results sent by the terminal device into Ethernet message data.
9. The device according to claim 8, It is characterized in that The terminal device comprises: A third data sending module, used for sending the instruction execution status / result to the instruction forwarding unit through different data communication interfaces; A third data receiving module, connected to the third data sending module, and configured to receive control commands and parameters sent by the instruction forwarding unit through different data communication interfaces; The third data processing module is connected to the third data receiving module 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.
10. Application of the device according to any one of claims 1 to 9 in the field of embedded system communication technology.
