Method and system for converting logic configuration array into logic execution commandTechnical Field
The present invention relates to the field of industrial control automation, and in particular, to a method for converting a logic configuration array into a logic execution command.
Background
Along with the continuous improvement of the industrial automation degree, the application of PLC/DCS/IPC/ARM and the like is more and more extensive, but the technical requirements on the PLC/DCS/IPC/ARM and the like are also higher and higher. In the process of using the PLC/DCS/IPC/ARM and the like, engineers build the logic relationship by applying the circuit principle thinking, then the logic relationship is compiled into an execution statement of a computer by programming software and is downloaded to the PLC/DCS/IPC/ARM and the like, and the PLC/DCS/IPC/ARM and the like execute the downloaded command so as to achieve the logic relationship effect expected by the engineers.
Because different controller manufacturers use programming software of their own, and because of the factors of software and hardware design architecture, different execution sentences are presented for the same logic relationship, so that users need to realize the same logic relationship by using different execution sentences, and the logic universality is greatly reduced.
Disclosure of Invention
The invention aims to provide a method and a system for converting a logic configuration array into a logic execution command, wherein complex logic relations among functional blocks are represented by the array, data in the array are analyzed by sequentially scanning the array, and the content of the functional blocks is executed, so that logic operation is realized, the working complexity of engineers is greatly reduced, the efficiency is improved, and the method and the system are suitable for any hardware controller.
The method is realized as follows: a method of converting a logical configuration array into a logical execution command, comprising:
step S1, creating an array comprising a function block relation array, a program page calculation sequence array and a task page calculation sequence array, wherein:
the function block relation array stores the input-output relation value of each function block;
the program page calculation sequence array stores the table address of the function block relation array;
the task page calculation sequence array stores the table address of the program page calculation sequence array;
s2, storing the configured logic relationship and the specific input/output value in a corresponding array;
step S3, scanning the array in sequence, and sequentially executing the content of the functional blocks according to a specific algorithm pre-written by each functional block, so that logic operation is realized, and the scanning sequence is as follows: task page calculation order array→program page calculation order array→function block relation array.
Further, when the task page calculation sequence array is scanned, jumping into the corresponding program page calculation sequence array according to the table address of the stored program page calculation sequence array to continue scanning; when the program page calculation sequence array is scanned, jumping into the corresponding function block relation array according to the stored table address of the function block relation array to continue scanning; when the function block relation array is scanned, according to the input-output relation value of each function block, the function block algorithm is called to calculate through the input pin information of the function block, and then the calculation result is processed to the output pin of the function block.
Further, the array may further include a main task computing order array, where the main task computing order array stores a table address of each task page computing order array; the scan order is: a master task calculation sequence array, a task page calculation sequence array, a program page calculation sequence array and a function block relation array; when the main task computing sequence array is scanned, jumping into the corresponding task page computing sequence array according to the stored table address of the task page computing sequence array to continue scanning.
The system of the invention is realized as follows: a system for converting a logical configuration array into a logical execution command, comprising:
the creation array module is used for creating an array, and comprises a function block relation array, a program page calculation sequence array and a task page calculation sequence array, wherein:
the function block relation array stores the input-output relation value of each function block;
the program page calculation sequence array stores the table address of the function block relation array;
the task page calculation sequence array stores the table address of the program page calculation sequence array;
the configuration module is used for configuring the logic relation of each functional block and setting specific input and output values of each functional block, and simultaneously storing the configured logic relation and the set input and output values in corresponding arrays;
the scanning execution module is used for sequentially scanning the array, and sequentially executing the content of the functional blocks according to a specific algorithm pre-written by each functional block, so that the logic operation is realized, and the scanning sequence is as follows: task page calculation order array→program page calculation order array→function block relation array.
Further, when the scanning execution module scans the task page calculation sequence array, the scanning execution module jumps into the corresponding program page calculation sequence array according to the table address of the stored program page calculation sequence array to continue scanning; when the program page calculation sequence array is scanned, jumping into the corresponding function block relation array according to the stored table address of the function block relation array to continue scanning; when the function block relation array is scanned, the input and output relation value of each function block is stored, the function block algorithm is called to calculate through the input pin information of the function block, and then the calculation result is processed to the output pin of the function block.
Further, the array may further include a main task computing order array, where the main task computing order array stores a table address of each task page computing order array; the scan order is: a master task calculation sequence array, a task page calculation sequence array, a program page calculation sequence array and a function block relation array; when the main task computing sequence array is scanned, jumping into the corresponding task page computing sequence array according to the stored table address of the task page computing sequence array to continue scanning.
The invention has the following advantages: the invention expresses the complex logic relation among all the functional blocks through the array, analyzes the data in all the arrays by scanning the arrays in sequence, converts the data into the logic relation, executes the content of the functional blocks, thereby realizing the logic operation, and the numerical information of the arrays is the same as long as the logic relation is the same, and the execution result is the same; greatly reduces the work complexity of engineers, improves the efficiency, and is applicable to any hardware controller (including PLC/DCS/IPC/ARM and the like).
Drawings
The invention will be further described with reference to examples of embodiments with reference to the accompanying drawings.
FIG. 1 is a flow chart of the method of the present invention.
FIG. 2 is a schematic diagram of a functional block relation array according to the present invention.
FIG. 3 is a block diagram illustrating a program page calculation order array according to the present invention.
FIG. 4 is a block diagram illustrating a task page computation order array according to the present invention.
Fig. 5 is a schematic diagram of a structure of main task computing sequence data according to the present invention.
FIG. 6 is a schematic diagram of a scan array according to the present invention.
Detailed Description
Referring to fig. 1, the method for converting a logic configuration array into a logic execution command according to the present invention includes:
step S1, creating an array comprising a function block relation array, a program page calculation sequence array and a task page calculation sequence array, wherein:
as shown in fig. 2, the function block relation array stores the input-output relation value of each function block;
as shown in fig. 3, the program page calculation order array stores a table address of each function block relation array;
as shown in fig. 4, the task page calculation order array stores a table address of each program page calculation order array;
as shown in FIG. 5, in particular embodiments, the array of the present invention may further comprise a master task computing order array that holds the table address of each task page computing order array;
s2, storing the configured logic relationship and the specific input/output value in a corresponding array;
step S3, as shown in FIG. 6, the array is scanned sequentially, and the content of the functional blocks is executed sequentially according to a specific algorithm pre-written by each functional block, so that logic operation is realized, wherein the scanning sequence is as follows: main task calculation sequence array- & gt task page calculation sequence array- & gt program page calculation sequence array- & gt function block relation array.
When the main task computing sequence array is scanned, jumping into the corresponding task page computing sequence array according to the stored table address of the task page computing sequence array to continue scanning;
when the task page calculation sequence array is scanned, jumping into the corresponding program page calculation sequence array according to the stored table address of the program page calculation sequence array to continue scanning;
when the program page calculation sequence array is scanned, jumping into the corresponding function block relation array according to the stored table address of the function block relation array to continue scanning;
when the function block relation array is scanned, according to the input-output relation value of each function block, the function block algorithm is called to calculate through the input pin information of the function block, and then the calculation result is processed to the output pin of the function block.
According to the method of the present invention, as shown in fig. 1 to 6, the present invention further provides a system for converting a logic configuration array into a logic execution command, the system comprising:
the creation array module is used for creating an array, and comprises a function block relation array, a program page calculation sequence array and a task page calculation sequence array, wherein:
the function block relation array stores the input-output relation value of each function block;
the program page calculation sequence array stores the table address of the function block relation array;
the task page calculation sequence array stores the table address of the program page calculation sequence array;
in a specific embodiment, the array of the present invention may further include a main task computing order array, where the main task computing order array stores a table address of each task page computing order array;
the configuration module is used for configuring the logic relation of each functional block and setting specific input and output values of each functional block, and simultaneously storing the configured logic relation and the set input and output values in corresponding arrays;
the scanning execution module is used for sequentially scanning the array, and sequentially executing the content of the functional blocks according to a specific algorithm pre-written by each functional block, so that the logic operation is realized, and the scanning sequence is as follows: main task calculation sequence array- & gt task page calculation sequence array- & gt program page calculation sequence array- & gt function block relation array.
When the main task computing sequence array is scanned, jumping into the corresponding task page computing sequence array according to the stored table address of the task page computing sequence array to continue scanning;
when the scanning execution module scans the task page calculation sequence array, jumping into the corresponding program page calculation sequence array according to the table address of the stored program page calculation sequence array to continue scanning;
when the program page calculation sequence array is scanned, jumping into the corresponding function block relation array according to the stored table address of the function block relation array to continue scanning;
when the function block relation array is scanned, the input and output relation value of each function block is stored, the function block algorithm is called through the input pin information of the function block to calculate, and then the calculation result is processed to the output pin of the function block.
In summary, the invention expresses the complex logic relationship among the functional blocks through the array, analyzes the data in each array by scanning the array in sequence, converts the data into the logic relationship, and executes the content of the functional blocks, thereby realizing the logic operation, and the numerical information of the arrays is the same as long as the same logic relationship is achieved, and the execution result is the same; greatly reduces the work complexity of engineers, improves the efficiency, and is applicable to any hardware controller (including PLC/DCS/IPC/ARM and the like).
While specific embodiments of the invention have been described above, it will be appreciated by those skilled in the art that the specific embodiments described are illustrative only and not intended to limit the scope of the invention, and that equivalent modifications and variations of the invention in light of the spirit of the invention will be covered by the claims of the present invention.