General processing method based on process control

By using XML scripting language and interface specifications to describe the control process of the terminal device in an embedded control system, the problem of large amount of program code changes at the instruction execution unit side caused by changes in the terminal device control process is solved, and software development efficiency and reliability are improved .

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

Patent Information

Application Number
CN202411060207.8
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

Technical Problem

In embedded control systems, changes in control flow or code changes of terminal equipment lead to large changes in program code on the instruction execution unit, reducing software development efficiency and reliability.

Method used

Using an extensible markup language based on XML, defines XML script process language and interface specifications, and describes and controls the control process of the terminal device through XML script files, only changes the script files on the instruction execution unit side to realize process control of the terminal device and reduces the Changes to program code on the instruction execution unit.

Benefits of technology

Without changing the program code on the instruction execution unit side as much as possible, the software development efficiency and reliability are improved, the program code changes are reduced, and flexible process control of the terminal equipment is realized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939374A_ABST
    Figure CN118939374A_ABST
Patent Text Reader

Abstract

The invention relates to a general processing method based on process control, and belongs to the technical field of embedded system communication. When the control flow of the instruction execution unit end is changed or the control code of the terminal equipment end is changed, the method realizes the flow control of the instruction execution unit on the terminal equipment only by changing the script file of the instruction execution unit end under the condition that the program code of the instruction execution unit end is not changed as much as possible or is changed as little as possible. According to the universal processing method based on the process control, the problems that the change amount of program codes at an instruction execution unit end is large and the software development efficiency is low due to the change of the control process of the terminal equipment or the change of codes at the terminal equipment end are perfectly solved. The method 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 general processing method based on process control. Background Art

[0002] In an embedded control system, the instruction execution unit needs to implement control of the terminal device according to the corresponding control process. When the control process on the instruction execution unit side changes or the control code on the terminal device side changes, it is usually necessary to modify the code on the instruction execution unit side to implement process control of the terminal device.

[0003] Although the method of modifying the code on the instruction execution unit side can realize the process control of the instruction execution unit on 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 instruction execution unit side. If the control process of the terminal device is relatively complex, and the program architecture design on the instruction execution unit 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 side and the old terminal device side are large, it will not only lead to an increase in the workload of modifying and maintaining the program on the instruction execution unit 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 program code on the instruction execution unit side or even modifying the software architecture on the instruction execution unit side due to changes in the terminal device control process or the terminal device side code is not conducive to the high-quality reuse of the software code on the instruction execution 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 provides a general processing method based on process control to solve the problem of "large changes in program code on the instruction execution unit side and low software development efficiency caused by changes in terminal device control process or terminal device side code" in embedded control systems. The process control of the terminal device by the instruction execution unit is achieved by only changing the script file on the instruction execution unit side, while the program code on the instruction execution unit side 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 method based on process control, which is implemented based on a console, an instruction execution unit and a terminal device, and includes the following steps:

[0008] S 1 : Define the syntax and commands of the XML scripting process language and generate the XML scripting language interface specification;

[0009] The XML scripting language interface specification is an XML-based extensible markup language designed for the instruction execution unit to execute the terminal device control process, supporting sequential structure, branch judgment and loop structure; the XML scripting language is based on the XML extensible markup language, follows the grammatical rules of the XML language, and is written in sequence according to the control process of the terminal device;

[0010] S 2 : Based on XML extensible markup language, describe the control process of the instruction execution unit on the terminal device according to the XML script language interface specification, and save the control process in the XML script process file;

[0011] The control process of the terminal device by the instruction execution unit is divided into N steps; the console sends different control commands and control parameters to the instruction execution unit through Ethernet, and the instruction execution unit executes different control processes according to different control commands, and each control process is a subset of the complete control process of the terminal device; the instruction execution unit sends control commands and control parameters to the terminal device through different data communication interfaces in the control process of the terminal device; the terminal device sends the execution result of the control command to the instruction execution unit through different data interfaces;

[0012] Among them, the initiation and termination operations of the terminal device control process are completed by the console, and the execution and termination operations of the terminal device control process are completed by the instruction execution unit. When the control process is executed abnormally, the instruction execution unit automatically terminates the process operation, and the control process of the terminal device runs in the instruction execution unit;

[0013] S 3 : Load the complete XML script process file into the XML script interpreter, and the console sends the control command to the instruction execution unit through Ethernet. The instruction execution unit completes the automatic execution operation of the corresponding control process of the terminal device according to the current control command;

[0014] Among them, the interpreter of the XML script flow file, i.e., the XML script interpreter, runs in the instruction execution unit, and 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, data result checking function and data testing function, and the parameters of the function are the attributes of the above syntax elements; according to the specific function implemented by each syntax element, the assignment statement elements, numerical calculation elements, comparison statement elements, logical calculation elements, branch and loop statement elements, data sending elements, data receiving elements, data result checking elements and data testing elements in the block statement are parsed line by line.

[0015] Preferably, 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 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 no static check is performed before execution; each step of the control flow of the instruction execution unit is implemented by a block statement, and 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, data result checking elements and data testing elements;

[0016] The assignment statement element setvar in the block statement is used to define and initialize a variable of any type, and the return value of the statement is of bool type, indicating whether the assignment is executed successfully; the value acquisition element getvar in the block statement is used to obtain the value of a variable of any type; the getvar element returns the value of a defined variable and is used to reference the defined variable; if the variable to be referenced has not been defined, it returns the invalid type null; the numerical operation element calcula in the block statement is used to perform arithmetic or bitwise operations on the defined variables, and store the results of the operations in the original variables; the return value of the statement is of bool type, indicating whether the operation is executed successfully; the comparison statement element testfield in the block statement is used to compare the values ​​of two variables or the value of a variable and a constant value, and return the comparison result; if the comparison results are consistent, true is returned, and if the comparison results are inconsistent, false is returned.

[0017] Preferably, the logical operation elements in the block statement are used to perform "logical and" or "logical or" operations on sub-statements containing one or more Boolean return values, and return the operation results; the "logical and" statement element and contains one or more sub-statements with Boolean return values; when the and statement is executed, its sub-statements are evaluated in sequence, and if all are true, true is returned, otherwise false is returned; the "logical or" statement element or contains one or more sub-statements with Boolean return values; when the or statement is executed, its sub-statements are evaluated in sequence, and if one is true, true is returned, otherwise false is returned; the branch and loop statement elements in the block statement are used to implement branch statement and loop statement operations.

[0018] Preferably, the data sending element senddata in the block statement is used to implement data sending based on multiple communication interfaces. The element senddata defines the content of the sent data, the name of the data packet, the type of the communication interface, the number of transmissions and the transmission interval. The content of the sent data packet is described by field; senddata contains five attributes: addr represents the destination address of the transmission, name represents the name of the data packet to be sent, type represents the type of the communication interface, times represents the maximum number of transmissions, and gap represents the transmission interval;

[0019] The data receiving element recvdata in the block statement is used to receive the data content, data message name, communication interface type and timeout period sent by the terminal device, and save the received message data content; recvdata contains four attributes: addr represents the received source address, name represents the received data message name, type represents the communication interface type, and timeout represents the timeout period for receiving data.

[0020] Preferably, the data result check element check in the block statement is used to check whether the execution result sent by the terminal device is consistent with the expected result in the control flow; check contains three attributes: addr represents the received source address, name represents the name of the received data message, and type represents the communication interface type; the return value of the check element is 0 or -1, 0 represents consistency with the expected result, and -1 represents non-compliance with the expected result; the data test element testfield in the block statement is used to check whether the content of certain fields in the execution result sent by the terminal device is correct; testfield contains two attributes: field represents the field of the received data, and value represents the comparison data value.

[0021] Preferably, the control process of the terminal device includes:

[0022] (1) The instruction execution unit sends a control command or control parameter to the terminal device. The control command or control parameter may come from the control console or may be generated by the instruction execution unit itself;

[0023] (2) The instruction execution unit receives and saves the execution status / result fed back by the terminal device;

[0024] (3) The instruction execution unit compares the execution status / result fed back by the terminal device to see whether it is consistent with the expected result in the control process; if the execution status / result is consistent with the expected result in the control process, the next control process is executed; otherwise, the instruction execution unit terminates the current control process and gives a prompt indicating that the process execution is abnormal;

[0025] (4) The instruction execution unit determines whether the execution status / result fed back by the receiving terminal device has timed out. If the instruction execution unit has timed out receiving the execution status / result fed back by the terminal device, the instruction execution unit terminates the current control process and gives a prompt indicating that the process execution is abnormal;

[0026] (5) The instruction execution unit needs to set the status flag of the terminal device in the process.

[0027] Preferably, the instruction execution unit executes the entire control process of the terminal device in sequence according to the cycle T; the instruction execution unit executes the control process according to the current running step number of the terminal device control process; after receiving the control command sent by the console, the instruction execution unit sets the running step number of the control process; each time the control process is executed, the number of the step Step being executed in the current control process is obtained, and the control process of the step Step is executed is jumped to; when the instruction execution unit executes the control process of the terminal device, it is not necessary to execute the process in sequence according to the step number of the control process; when the instruction execution unit successfully executes the process of the current step, it can jump to the corresponding process step number to execute the control process according to the specific process requirements of the current step;

[0028] Each control process of the terminal device includes a timeout period 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.

[0029] Preferably, the instruction execution unit implements the reception timeout processing of the message data in the control process according to the following strategy: the "timeout" attribute in recvdata represents the reception timeout period. When the reception time is greater than the attribute value of "timeout", the instruction execution unit is prompted that the reception of the terminal device data has timed out and the process is terminated.

[0030] Preferably, the complete XML script flow file is loaded into the XML script interpreter, and the instruction execution unit starts to execute the XML script interpreter after receiving the control command of the console; when the instruction execution unit receives the control command Cmd1 sent by the console and executes the control flow and a failure / abnormality occurs, the console does not have to re-execute the control flow of the terminal device from the beginning. The console re-sends the control command Cmd1, and the instruction execution unit can re-execute the control flow that just failed.

[0031] The invention also provides an application of the method in the field of embedded system communication technology.

[0032] (III) Beneficial effects

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

[0034] 1. This method adapts to and meets the control requirements of the modified instruction execution unit on the terminal device by only changing the script file on the instruction execution unit side without changing or changing the instruction execution unit side program code as much as possible;

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

[0036] Figure 1 It is a schematic diagram of the connection between the control console, the instruction execution unit and the terminal device in the device for implementing the method of the present invention;

[0037] Figure 2 It is an overall flow chart of the method of the present invention. DETAILED DESCRIPTION

[0038] 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.

[0039] The present invention proposes a general processing method based on process control. When the control process on the instruction execution unit side is changed or the control code on the terminal device side is changed, the method realizes the process control of the terminal device by the instruction execution unit only by changing the script file on the instruction execution unit side, while not changing or changing the program code on the instruction execution unit side as much as possible.

[0040] Only by adopting the solution of the present invention can the problem of "large changes in the program code on the instruction execution unit side and low software development efficiency due to changes in the terminal device control process or the terminal device side code" be perfectly solved. The present invention proposes a general processing method based on process control, which only requires changing the script file on the instruction execution unit side, thereby improving the development efficiency and reliability of the software.

[0041] like Figure 1 As shown, the present invention proposes a general processing method based on process control, which is implemented based on a console, an instruction execution unit and a terminal device, and includes the following steps:

[0042] S 1 : Define the syntax and commands of the XML scripting process language and generate the XML scripting language interface specification;

[0043] The XML scripting language interface specification is an XML-based extensible markup language designed for the instruction execution unit to execute the terminal device control process, supporting sequential structure, branch judgment and loop structure;

[0044] The XML scripting language is based on the XML extensible markup language, follows the grammatical rules of the XML language, and is written in sequence according to the control flow of the terminal device.

[0045] The statements in the XML script language interface specification are expressed by an XML element. All statements must have a return value. For statements with meaningless return values, void is returned. Statements in the 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 no static check is performed before execution.

[0046] Among them, each step of the control process of the instruction execution 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, data result checking elements and data testing elements.

[0047] The assignment statement element setvar in the block statement is used to define and initialize a variable of any type. The return value of the statement is of type bool, indicating whether the assignment is successful. For example, the following code assigns the 16-bit unsigned integer variable "int3" to 0x1234:

[0048] <setvartype="uint16" name="int3">

[0049] 0x1234

[0050]

[0051] Among them, the getvar in the block statement is used to obtain the value of a variable of any type; the getvar element returns the value of a defined variable, mainly used for referencing a defined variable; if the variable to be referenced has not been defined, it returns the invalid type (null). For example, the following code assigns the value of the variable "int1" to the variable "int2":

[0052] <setvartype="uint16" name="int2">

[0053] <getvar variable="int1" type="uint16">

[0054]

[0055] Among them, the calcula in the block statement is used to perform four arithmetic operations or bitwise operations on the defined variable and store the result of the operation in the original variable; the return value of this statement is of bool type, indicating whether the operation is executed successfully. For example, the following code adds 1 to the value of the variable "int2" and saves the result in the variable "int2":

[0056] <calcula op="add" lvalue="int2" rvalue="1">

[0057]

[0058] Among them, the testfield in the block statement is used to compare the values of two variables or the value of a variable with a constant value and return the comparison result; if the comparison results are the same, it returns true, and if the comparison results are different, it returns false. For example, the following code compares whether the value of the status word is equal to 0:

[0059] <testfield field="status word" value="0">

[0060] Among them, the logical operation element in the block statement is used to perform "logical and" or "logical or" operations on sub-statements containing one or more Boolean return values, and return the operation results; the "logical and" statement element and contains one or more sub-statements with Boolean return values; when the and statement is executed, its sub-statements are evaluated in sequence, and if all are true, true is returned, otherwise false is returned; the "logical or" statement element or contains one or more sub-statements with Boolean return values; when the or statement is executed, its sub-statements are evaluated in sequence, and if one is true, true is returned, otherwise false is returned.

[0061] Logical operation elements are often used together. The following are some examples of their use:

[0062] <or>

[0063] <and>

[0064] <testfield field="Type" value="0xAAAA">

[0065] <testfield field="Length" value="10">

[0066] < / and>

[0067] <and>

[0068] <testfield field="Type" value="0x5555">

[0069] <testfield field="Length" value="20">

[0070] < / and>

[0071] < / or>

[0072] The branch and loop statement elements in the block statement are used to implement branch statement and loop statement operations.

[0073] The if element is used to implement branch statements, which select different branches to execute based on the results of conditional judgment.

[0074] <if>

[0075] Conditional statement (statement 1)

[0076] Statement to be executed if the condition is successful (statement 2)

[0077] Statement to be executed if the condition fails (statement 3)

[0078] < / if>

[0079] if executes statement 1 first, if statement 1 returns true, then statement 2 is executed, otherwise statement 3 is executed.

[0080] The while element iteratively evaluates its substatements while its condition is satisfied. The while element has no attributes, but does have requirements on the structure of its contents.

[0081] <while>

[0082] Conditional statement (statement 1)

[0083] Statements that are executed iteratively when the conditions are met (statement 2)

[0084] < / while>

[0085] The while statement first executes statement 1. If statement 1 evaluates to true, it executes statement 2, then executes statement 1 again, and repeats this process until statement 1 returns false.

[0086] Among them, the data sending element senddata in the block statement is used to realize data sending based on multiple communication interfaces (Ethernet, switch quantity, serial port, CAN bus, etc.). This element can define the content of the sent data, the name of the data message, the type of communication interface, the number of transmissions and the transmission interval. The content of the sent data packet can be described by field; senddata contains five attributes: addr represents the destination address of the transmission, name represents the name of the sent data message, type represents the communication interface type, times represents the maximum number of transmissions, and gap represents the transmission interval in ms.

[0087] <senddata addr="192.168.24.5" name="Status data packet" type="Ethernet" times="3" gap="50">

[0088] <field name="XX Status 1" value="0x500a">

[0089] <field name="XX Status 2" value="0x070f">

[0090]

[0091] Among them, the data receiving element recvdata in the block statement is used to receive the data content, data message name, communication interface type, and timeout time sent by the terminal device, and save the received message data content; recvdata contains four attributes: addr represents the received source address, name represents the received data message name, type represents the communication interface type, and timeout represents the data reception timeout time, with the unit of ms. For example, the following code saves the data received from "192.168.24.5" into the array "data". Among them, setarray represents setting the array name.

[0092] <setarray name="data">

[0093] <recvdata addr="192.168.24.5" timeout="50">

[0094]

[0095]

[0096] Among them, the data result checking element check in the block statement is used to check whether the execution result sent by the terminal device matches the expected result in the control flow; check contains three attributes: addr represents the received source address, name represents the received data message name, and type represents the communication interface type; the return value of the check element is 0 (matching the expected result) or -1 (not matching the expected result). To check whether the message data received from the address 192.168.24.5 is consistent with the expected "Status data packet" content, the following command can be used:

[0097] <check addr="192.168.24.5" name="Status data packet" type="Ethernet">

[0098] Among them, the data test element testfield in the block statement is used to check whether the content of certain fields in the execution result sent by the terminal device is correct; testfield contains two attributes: field represents the field for receiving data, and value represents the comparison data value. To check whether the "instruction identification code" in the message is 0x23, the following command can be used:

[0099] <testfield field="instruction identification code" value="0x23">

[0100] S 2 : Based on the XML (Extensible Markup Language), describe the control process of the instruction execution unit for the terminal device according to the XML script language interface specification, and save this control process in the XML script process file;

[0101] Among them, the control process of the instruction execution unit for the terminal device is divided into N (N>0) steps. The console sends different control commands and control parameters to the instruction execution unit through Ethernet. The instruction execution unit executes different control processes according to different control commands (each control process is a subset of the above-mentioned complete control process of the terminal device); in the control process of the instruction execution unit for the terminal device, control commands and control parameters are sent to the terminal device through different data communication interfaces (Ethernet, digital input / output, serial port, CAN bus, etc.); the terminal device sends the execution result of the control command to the instruction execution unit through different data interfaces.

[0102] Among them, the initiation and termination operations of the control process for the terminal device are completed by the console, and the execution and termination operations of the control process for the terminal device (when the control process execution is abnormal, the instruction execution unit automatically terminates the process operation) are completed by the instruction execution unit. The control process of the terminal device runs in the instruction execution unit. The control process for the terminal device includes:

[0103] (6) The instruction execution unit sends a control command or control parameter to the terminal device, and this control command or control parameter can be either from the console or generated by the instruction execution unit itself;

[0104] (7) The instruction execution unit receives and saves the execution status / result feedback by the terminal device;

[0105] (8) The instruction execution unit compares whether the execution status / result feedback by the terminal device is consistent with the expected result in the control process; if the execution status / result is consistent with the expected result in the control process, then execute the next control process, otherwise, the instruction execution unit terminates the current control process and gives a prompt for abnormal process execution;

[0106] (9) The instruction execution unit determines whether the execution status / result fed back by the receiving terminal device has timed out. If the instruction execution unit has timed out receiving the execution status / result fed back by the terminal device, the instruction execution unit terminates the current control process and gives a prompt indicating that the process execution is abnormal;

[0107] (10) The instruction execution unit needs to set the status flag of the terminal device in the process.

[0108] Among them, the instruction execution unit executes the entire control process of the terminal device in sequence according to the period T (T>0); the instruction execution unit executes the control process according to the current running step number of the terminal device control process; after the instruction execution unit receives the control command sent by the console, it sets the running step number of the control process; 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; when the instruction execution unit executes the control process of the terminal device, it is not necessary to execute the process in sequence according to the step number of the control process; when the instruction execution unit successfully executes the process of the current step, it can jump to the corresponding process step number to execute the control process according to the specific process requirements of the current step.

[0109] Each control process of the terminal device includes a timeout period 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 the control flow of the current step is completed, a delay of T is required. delay Only then can the next control process be executed.

[0110] Among them, the instruction execution unit implements the reception timeout processing of message data in the control process according to the following strategy: the "timeout" attribute in recvdata represents the reception timeout period. When the reception time is greater than the attribute value of "timeout", the instruction execution unit should be prompted that the reception of terminal device data has timed out and the process should be terminated.

[0111] S 3 : Load the complete XML script process file into the XML script interpreter, and the console sends the control command to the instruction execution unit through Ethernet. The instruction execution unit completes the automatic execution operation of the corresponding control process of the terminal device according to the current control command;

[0112] Among them, the interpreter of the XML script flow file is run in the instruction execution unit, that is, the XML script interpreter, and the core of the XML script interpreter implements the interpretation and processing of each syntax element in the block statement. For each syntax element, the 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, data result checking function and data testing function, and the parameters of the function are the attributes of the above syntax elements. According to the specific functions implemented by each syntax element, the assignment statement elements, numerical calculation elements, comparison statement elements, logical calculation elements, branch and loop statement elements, data sending elements, data receiving elements, data result checking elements and data testing elements in the block statement are parsed line by line.

[0113] The complete XML script flow file is loaded into the XML script interpreter, and the instruction execution unit starts to execute the XML script interpreter after receiving the control command of the console. When the instruction execution unit receives the control command Cmd1 sent by the console and executes the control flow and a fault / abnormality occurs, the console does not need to re-execute the control flow of the terminal device from the beginning. The console only needs to re-send the control command Cmd1, and the instruction execution unit can re-execute the control flow that just failed.

[0114] It can be seen that the general processing method based on process control of the present invention can realize that when the control process of the terminal device changes and needs to be modified, there is no need to change the application code of the instruction execution unit. Only the corresponding XML script process file needs to be changed to realize the process control of the terminal device by the instruction execution unit.

[0115] 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 method based on process control, It is characterized in that The method is implemented based on a console, an instruction execution unit and a terminal device, and includes the following steps: S 1 : Define the syntax and commands of the XML scripting process language and generate the XML scripting language interface specification; The XML scripting language interface specification is an XML-based extensible markup language designed for the instruction execution unit to execute the terminal device control process, supporting sequential structure, branch judgment and loop structure; the XML scripting language is based on the XML extensible markup language, follows the grammatical rules of the XML language, and is written in sequence according to the control process of the terminal device; S 2 : Based on XML extensible markup language, describe the control process of the instruction execution unit on the terminal device according to the XML script language interface specification, and save the control process in the XML script process file; The control process of the terminal device by the instruction execution unit is divided into N steps; the console sends different control commands and control parameters to the instruction execution unit through Ethernet, and the instruction execution unit executes different control processes according to different control commands, and each control process is a subset of the complete control process of the terminal device; the instruction execution unit sends control commands and control parameters to the terminal device through different data communication interfaces in the control process of the terminal device; the terminal device sends the execution result of the control command to the instruction execution unit through different data interfaces; Among them, the initiation and termination operations of the terminal device control process are completed by the console, and the execution and termination operations of the terminal device control process are completed by the instruction execution unit. When the control process is executed abnormally, the instruction execution unit automatically terminates the process operation, and the control process of the terminal device runs in the instruction execution unit; S 3 : Load the complete XML script process file into the XML script interpreter, and the console sends the control command to the instruction execution unit through Ethernet. The instruction execution unit completes the automatic execution operation of the corresponding control process of the terminal device according to the current control command; Among them, the interpreter of the XML script flow file, i.e., the XML script interpreter, runs in the instruction execution unit, and 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, data result checking function and data testing function, and the parameters of the function are the attributes of the above syntax elements; according to the specific function implemented by each syntax element, the assignment statement elements, numerical calculation elements, comparison statement elements, logical calculation elements, branch and loop statement elements, data sending elements, data receiving elements, data result checking elements and data testing elements in the block statement are parsed line by line.

2. The method according to claim 1, It is characterized in that 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 whose return values ​​are meaningless, void is returned; the statements in the 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; Each control flow of the instruction execution 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, data result checking elements and data testing elements; The assignment statement element setvar in the block statement is used to define and initialize a variable of any type, and the return value of the statement is of bool type, indicating whether the assignment is executed successfully; the value acquisition element getvar in the block statement is used to obtain the value of a variable of any type; the getvar element returns the value of a defined variable and is used to reference the defined variable; if the variable to be referenced has not been defined, it returns the invalid type null; the numerical operation element calcula in the block statement is used to perform arithmetic or bitwise operations on the defined variables, and store the results of the operations in the original variables; the return value of the statement is of bool type, indicating whether the operation is executed successfully; the comparison statement element testfield in the block statement is used to compare the values ​​of two variables or the value of a variable and a constant value, and return the comparison result; if the comparison results are consistent, true is returned, and if the comparison results are inconsistent, false is returned.

3. The method according to claim 2, It is characterized in that The logical operation element in the block statement is used to perform "logical AND" or "logical OR" operations on sub-statements containing one or more Boolean return values, and return the operation results; the "logical AND" statement element and contains one or more sub-statements with Boolean return values; when the and statement is executed, its sub-statements are evaluated in sequence, and if all are true, true is returned, otherwise false is returned; the "logical OR" statement element or contains one or more sub-statements with Boolean return values; when the or statement is executed, its sub-statements are evaluated in sequence, and if one is true, true is returned, otherwise false is returned; the branch and loop statement elements in the block statement are used to implement branch statement and loop statement operations.

4. The method according to claim 2, It is characterized in that The data transmission element senddata in the block statement is used to implement data transmission based on multiple communication interfaces. The element senddata defines the content of the data to be sent, the name of the data packet, the type of the communication interface, the number of transmissions and the transmission interval. The content of the data packet to be sent is described by field; senddata contains five attributes: addr represents the destination address of the transmission, name represents the name of the data packet to be sent, type represents the type of the communication interface, times represents the maximum number of transmissions, and gap represents the transmission interval; The data receiving element recvdata in the block statement is used to receive the data content, data message name, communication interface type and timeout period sent by the terminal device, and save the received message data content; recvdata contains four attributes: addr represents the received source address, name represents the received data message name, type represents the communication interface type, and timeout represents the timeout period for receiving data.

5. The method according to claim 2, It is characterized in that The data result check element check in the block statement is used to check whether the execution result sent by the terminal device is consistent with the expected result in the control flow; check contains three attributes: addr represents the received source address, name represents the name of the received data message, and type represents the communication interface type; the return value of the check element is 0 or -1, 0 represents consistency with the expected result, and -1 represents non-compliance with the expected result; the data test element testfield in the block statement is used to check whether the content of certain fields in the execution result sent by the terminal device is correct; testfield contains two attributes: field represents the field of the received data, and value represents the comparison data value.

6. The method according to claim 1, It is characterized in that The control process of the terminal device includes: (1) The instruction execution unit sends a control command or control parameter to the terminal device. The control command or control parameter may come from the control console or may be generated by the instruction execution unit itself; (2) The instruction execution unit receives and saves the execution status / result fed back by the terminal device; (3) The instruction execution unit compares the execution status / result fed back by the terminal device to see whether it is consistent with the expected result in the control process; if the execution status / result is consistent with the expected result in the control process, the next control process is executed; otherwise, the instruction execution unit terminates the current control process and gives a prompt indicating that the process execution is abnormal; (4) The instruction execution unit determines whether the execution status / result fed back by the receiving terminal device has timed out. If the instruction execution unit has timed out receiving the execution status / result fed back by the terminal device, the instruction execution unit terminates the current control process and gives a prompt indicating that the process execution is abnormal; (5) The instruction execution unit needs to set the status flag of the terminal device in the process.

7. The method according to claim 1, It is characterized in that The instruction execution unit executes the entire control process of the terminal device in sequence according to the period T; the instruction execution unit executes the control process according to the current running step number of the control process of the terminal device; After receiving the control command sent by the console, the instruction execution unit sets the running step number of the control process; Each time the control flow is executed, the number of the step Step being executed in the current control flow is obtained, and the control flow of step Step is jumped to execute the step; when the instruction execution unit executes the control flow of the terminal device, it is not necessary to execute the flow in sequence according to the step number of the control flow; When the instruction execution unit successfully completes the process of the current step, it can jump to the corresponding process step number to execute the control process according to the specific process requirements of the current step; Each control process of the terminal device includes a timeout period 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.

8. The method according to claim 4, It is characterized in that The instruction execution unit implements the reception timeout processing of the message data in the control process according to the following strategy: the "timeout" attribute in recvdata indicates the reception timeout period. When the reception time is greater than the attribute value of "timeout", the instruction execution unit is prompted that the reception of the terminal device data has timed out and the process is terminated.

9. The method according to claim 4, It is characterized in that The complete XML script flow file is loaded into the XML script interpreter, and the instruction execution unit starts to execute the XML script interpreter after receiving the control command of the console; when the instruction execution unit receives the control command Cmd1 sent by the console and executes the control flow and a failure / abnormality occurs, the console does not have to re-execute the control flow of the terminal device from the beginning. The console re-sends the control command Cmd1, and the instruction execution unit can re-execute the control flow that just failed.

10. Application of the method according to any one of claims 1 to 9 in the field of embedded system communication technology.