A real-time optimization method and system for DCS logic configuration screen connection
By using the OCR algorithm to generate orthogonal networks and D* algorithm calculation paths, the problem of poor connection processing of functional blocks in the DCS control system is solved, multi-objective optimization and automatic obstacle avoidance of connections are realized, and work efficiency and system are improved. Security.
Patent Information
- Application Number
- CN202311478928.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-08
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2043-11-08
AI Technical Summary
In the existing DCS control system, the connection processing method between functional blocks is relatively simple, and the connection cannot be effectively optimized, resulting in messy connections, long time occupancy, and excessive CPU memory, affecting the safe operation of other processes.
Use the OCR algorithm to generate the orthodox network between the graphic connection point. By establishing a rule to determine the changing scene of the screen, call the main function of the D*algorithm proces_State and Modify_Cost. After the calculation path is completed, the coordinates are changed to the original coordinate system.
It achieves multi-objective optimization of the connections while ensuring the orthogonality of the connections, reducing manual operations, improving work efficiency, reducing CPU memory usage, and avoiding affecting other processes.
Smart Images

Figure CN117631618B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power control systems, and in particular to a real-time optimization method and system for DCS logic configuration screen connections. Background Art
[0002] With the increase in the capacity of power plant units and the advancement of power generation technology in my country, the control logic of the distributed control system of power plants has become increasingly complex, and the requirements for the distributed control system algorithm configuration software have become increasingly higher. Complex control systems usually require hundreds of pages of function block diagrams to be implemented. In order to improve the efficiency of making function block diagrams, higher requirements are put forward for the automatic routing method of the connection between function blocks. For example, the connection adopts a right-angle layout, and it is necessary to intelligently avoid obstacles and bypass the function blocks, ensure that the intersection of the connection is minimal, and the screen layout is beautiful and the algorithm should have a short calculation time to make the connection work fast, minimize the workload of manual intervention and adjustment, improve work efficiency, and optimize the display effect. However, in the current DCS control systems of various manufacturers at home and abroad, the graphic editing software used for the configuration of each process control subsystem has a simple processing method for element layout and connection, and does not optimize the connection in the above aspects. In addition, some system connections do not have obstacle avoidance functions. After the function block layout is moved, the connection will not change accordingly, and manual adjustment is required to achieve a neat effect. When the connection is very complex, the manual adjustment function provided by the software has little effect. The clutter of wiring lines will cause great difficulties for on-site staff to check complex logical configurations, posing hidden dangers to the safe operation of the process control station and even the entire power plant. It will also take up the configuration personnel's graphic editing time and reduce the readability of the configuration.
[0003] There are roughly the following types of routing algorithms for connecting graphics: inflection point routing, shortest path routing, and Manhattan routing. Manhattan routing is a common orthogonal connection algorithm. Manhattan routing can minimize line length and intersections, but how to optimize the layout according to the standards of uniform distribution, center of gravity balance, and beautiful layout still requires the assistance of some rules and intelligent algorithms. When other graphics are inserted into the connection line, the Manhattan algorithm needs to recalculate the path, which increases the calculation time. Commonly used path planning methods can be roughly divided into three categories: traditional algorithms (Dijkstra algorithm, A* algorithm, etc.), intelligent algorithms (PSO algorithm, genetic algorithm, reinforcement learning, etc.), and algorithms that combine traditional and intelligent algorithms. Intelligent algorithms have long calculation time and high calculation complexity, and are not suitable for fast connection of graphics. In the traditional algorithm, D* searches for the path nodes in the scene by maintaining a priority queue (openlist). D* does not start the search from the starting point, but starts from the target point. It starts the search by placing the target point in the openlist until the current position node is removed from the queue. If the state of a node in the middle changes dynamically, it only needs to re-find the path after the changed node. Compared with the Dijkstra algorithm and the A* algorithm, this method improves the pathfinding efficiency, so it is a dynamic pathfinding algorithm. In the current popular flowchart editing application software, the code volume of the wiring routing function is large and the logic is complex. When operating the configuration software offline, the long wiring path calculation time will affect the software experience and extend the project time. When the configuration software is debugged online, the computer CPU performance requirements are high. It is a dangerous operation to modify the control system configuration logic with huge computing volume and hundreds of thousands of semaphores online. Since the wiring needs to change dynamically with the position of the function block during the operation, the time and CPU memory occupied by the wiring process will affect other processes. Summary of the invention
[0004] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0005] In view of the above existing problems, the present invention is proposed. Therefore, the present invention provides a real-time optimization method for DCS logic configuration screen connection, which is used to solve the problems in practical problems that the connection cannot take into account the position of adaptive function blocks, the process takes a long time, and the process occupies too much CPU memory and affects other processes.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] In a first aspect, the present invention provides a real-time optimization method for DCS logic configuration screen connection, comprising:
[0008] Use OCR algorithm to generate orthogonal network between graphic connection points, and determine the scene of picture change by establishing rules;
[0009] According to the changing scenario, the main functions PROCESS_STATE and MODIFY_COST of the D* algorithm are called to calculate the path in the original graphic coordinates and the orthogonal pathfinding network coordinates respectively;
[0010] After the calculation path is completed, the coordinates are transformed into the original coordinate system.
[0011] As a preferred solution of the real-time optimization method of the DCS logic configuration screen connection of the present invention, the method of determining the screen change scene by establishing rules includes:
[0012] Determine whether the path needs to be replanned based on the type of screen changes;
[0013] Get screen information from the front end. If the coordinates of the connection endpoints in the screen change or the page size changes, the path needs to be replanned. If function blocks and other graphics are placed on the connection lines in the screen, there is no need to replan the path.
[0014] As a preferred solution of the real-time optimization method of the DCS logic configuration screen connection of the present invention, it also includes:
[0015] If the path needs to be replanned, the graphic information is called and the OCR algorithm is used to generate an orthogonal path-finding network between the graphic connection points; the coordinates of the target point are obtained, and the D* algorithm is used in the original coordinates to perform the first calculation of the path; during the calculation process, the original coordinates of the path are saved and transformed into VectorPoint coordinates; the cost function values h(x) and k(x) generated at each point during the calculation process are saved and stored as the path cost matrix H; the rules for generating the orthogonal network and calculating the number of inflection points are specified in the process of calculating the cost function;
[0016] If there is no need to re-plan the path, the cost function value saved in the path cost matrix is called, the cost modification function of the D* algorithm is called, the cost function of the breakpoint and the surrounding adjacent points is modified in the orthogonal path-finding network coordinates, the path is recalculated with the breakpoint as the starting point, and the calculated path is re-saved; the path coordinates are transformed into the original coordinates.
[0017] As a preferred solution of the real-time optimization method of the DCS logic configuration screen connection of the present invention, wherein: using the OCR algorithm to generate an orthogonal path-finding network between graphic connection points includes:
[0018] Graphic settings: Set the size of the drawing paper to length L × width W. Then, the coordinates of each point in the figure are (x, y), where (0 < x < L, 0 < y < W). The coordinates of all points in the screen form a two-dimensional array, which is named barrier, and a graphic object is established through the said array;
[0019] After obtaining the valid graphic object, add the connection point coordinates to the connection point set. The set of x values of the connection points is XI = {x1, x2,..., xlenx}, and the set of y values of the connection points is YI = {y1, y2,..., yleny};
[0020] Process XI and YI respectively, delete the duplicate values among them, and sort the values in the set in ascending order;
[0021] According to the above processing results, calculate the Cartesian product of XI and YI to generate the original orthogonal network. The formula is:
[0022] XI × YI = {(x i , y j ) | x i ∈ XI, y j ∈ YI}
[0023] = {(x1, y1), (x1, y2),..., (x1, y leny ), (x2, y1), (x2, y2),..., (x2, y leny ),..., (x lenx , y leny )}
[0024] Among them, lenx is the length of XI, and leny is the length of YI;
[0025] Transform the coordinates of the original orthogonal network into the coordinates of the orthogonal pathfinding network matrix. The set of X values of the orthogonal pathfinding network matrix is The set of Y values is
[0026] Calculate the Cartesian product of the two as:
[0027] Initialize the connection points. When generating the original orthogonal network, simultaneously judge whether all the original coordinates (x i , y j ) of the coordinate points in the network fall within the valid area. If they fall within the valid area (non-obstacle area), then convert the coordinates of this point into the coordinate points (i, j) in the orthogonal pathfinding network and add them to the pathfinding matrix VectorPoint.
[0028] As a preferred solution of the real-time optimization method for the connection lines of the DCS logic configuration screen described in the present invention, wherein: in the original coordinates, the D* algorithm is used to perform the first calculation of this path, including:
[0029] Initialize the target point G and the starting point S. Starting from the target point G, add the target point G to an open list composed of valid connection points, and h(X)=k(X)=0 for G;
[0030] Expand the surrounding nodes of the target point G, search for adjacent connection points X, and if any, calculate h(X) and k(X) of this point and save them in the path cost matrix H;
[0031] Among them, the path cost matrix is in the format of a one-dimensional array: H(X)={(Xi, Xj, h(X), k(X))}, where Xi is the abscissa of this point, Xj is the ordinate of this point, and h(X), k(X) are the cost functions of this point;
[0032] Execute the logic of the function PROCESS_STATE(). If t(X)=new, then k(X)=h(X); if t(X)≠new, it means that the K of the node already has a cost and needs to continue to judge;
[0033] Put the end point G into the close list, that is, no longer traverse; find the node with the smallest cost as the new node, repeat the search until the starting point S pops out of the open list and enters the close list; find the parent node from the starting point and search until the end point, and save each node in the path in the path array;
[0034] Transform the coordinates in the path array into the coordinates in the orthogonal pathfinding matrix.
[0035] As a preferred solution of the real-time optimization method for the connection lines of the DCS logic configuration screen described in the present invention, wherein: it means that the K of the node already has a cost and needs to continue to judge, including:
[0036] When K_old<h(X), then the node x is in the raise state, indicating that the original path is not the optimal path; if a point y can be found around x such that h(Y)+C(X, Y) is smaller, then modify the parent node of X to Y, reset the value of h(X), and update the path cost matrix H;
[0037] When K_old = h(X), then the node X is in the lower state, indicating that it is not affected by obstacles or is still in the initial traversal stage.
[0038] In the original coordinate network, the coordinate attribute Value of the obstacle is 0. Find the path point X at the obstacle, and the h value of X becomes infinite. By calculating b(X), find its parent node Y. At this time, the path finding direction is from (S—Y—X—G).
[0039] As a preferred solution of the real-time optimization method for the DCS logic configuration screen connection of the present invention, wherein: after the calculation path is completed, the coordinates are transformed into the original coordinate system, including:
[0040] Call the OCR algorithm to regenerate the orthogonal pathfinding network coordinates, but retain the properties of the original coordinates;
[0041] Transform the (S-Y) path to the new orthogonal pathfinding network coordinates, and call cost modification: MODIFY_COST() at this coordinate to put node Y back into the openlist;
[0042] The logic of MODIFY_COST() is that if the parent node Value = 0, the h value of point Y will become infinite, and it will be put into the openlist; at this time, the k of the node is still the original h value, and the cost of Y walking through the neighborhood points to the end point G needs to be recalculated, h(Y) = C(Y, Z) + h(Z), and the minimum value Z is found to become its parent node; at the same time, the h values of the surrounding child nodes of Y are updated, h(U) = updated h(Y)-C;
[0043] Until K_min (the minimum k value of all nodes in the openlist) >= hx (the h value of the current point X), the h value updated by the calculation process is saved in the path cost matrix H;
[0044] Re-execute the logical calculation path of PROCESS_STATE() to obtain the modified path. The modified path coordinates are orthogonal path finding network coordinates. By looking up the reverse coordinate attribute value of each point, the coordinates are converted and saved in the path.
[0045] In a second aspect, the present invention provides a real-time optimization system for DCS logic configuration screen connections, comprising:
[0046] The rule building module uses the OCR algorithm to generate an orthogonal network between graphic connection points and determines the scene of screen changes by establishing rules;
[0047] Call the processing and calculation module, and call the main functions PROCESS_STATE and MODIFY_COST of the D* algorithm to calculate the path in the original graphic coordinates and the orthogonal pathfinding network coordinates according to the changing scene;
[0048] The replacement module transforms the coordinates into the original coordinate system after the calculation path is completed.
[0049] In a third aspect, the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, wherein: the processor implements any step of the above method when executing the computer program.
[0050] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: the computer program implements any step of the above method when executed by a processor.
[0051] Compared with the prior art, the invention has the following beneficial effects: the invention utilizes an OCR algorithm to generate an orthogonal network between graphic connection points, and determines the scene of picture changes by establishing rules; according to the change scene, the main functions PROCESS_STATE and MODIFY_COST of the D* algorithm are respectively called to calculate the path in the original graphic coordinates and the orthogonal path-finding network coordinates; and after the calculation of the path is completed, the coordinates are transformed into the original coordinate system; the method of the invention can perform multi-objective optimization on the connection while ensuring the orthogonality of the connection, and by comprehensively selecting the best among the fewer intersections and fewer turning points of the connection, and the connection path has the characteristics of automatically and dynamically avoiding inaccessible areas, which greatly reduces manual operations; and compared with other orthogonal path planning algorithms, it has the advantages of comprehensive functions, small algorithm size, and low time complexity. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0053] Figure 1 The overall flow chart of the real-time optimization method of the DCS logic configuration screen connection according to one embodiment of the present invention;
[0054] Figure 2 A specific implementation flow chart of a real-time optimization method for connecting DCS logic configuration screens according to an embodiment of the present invention;
[0055] Figure 3 An orthogonal routing network diagram generated by a real-time optimization method for connecting a DCS logic configuration screen according to an embodiment of the present invention;
[0056] Figure 4 A two-point connection line diagram (in the original coordinate system) of the first path calculation of the screen of the real-time optimization method of the DCS logic configuration screen connection according to an embodiment of the present invention;
[0057] Figure 5A two-point connection line diagram (under an orthogonal network coordinate system) of a real-time optimization method for connecting a DCS logic configuration screen according to an embodiment of the present invention after adding a function block to the screen;
[0058] Figure 6 This is a functional effect diagram of a real-time optimization method for DCS logic configuration screen connections according to an embodiment of the present invention. DETAILED DESCRIPTION
[0059] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0060] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0061] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0062] The present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.
[0063] At the same time, in the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "upper, lower, inner and outer" are based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as limiting the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0064] Unless otherwise clearly defined and limited in the present invention, the terms "installation, connection, and coupling" shall be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or an integral connection; it may also be a mechanical connection, an electrical connection, or a direct connection, or it may be indirectly connected through an intermediate medium, or it may be the communication inside two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0065] Embodiment 1
[0066] Referring to Figure 1 , which is the first embodiment of the present invention. This embodiment provides a real-time optimization method for the connection lines of the DCS logic configuration screen, including:
[0067] S1. Use the OCR algorithm to generate an orthogonal network between graphic connection points, and judge the screen change scenario by establishing rules;
[0068] Furthermore, establish rules to judge the screen change scenario, and judge whether it is necessary to re-plan the path according to the type of screen change;
[0069] Furthermore, obtain the screen information from the front end. If the coordinates of the connection endpoints in the screen change, or the page size changes, or new connection lines are added, the path needs to be re-planned; if function blocks and other graphics are moved into the connection lines in the screen, there is no need to re-plan the path;
[0070] Furthermore, if it is necessary to re-plan the path, then call the graphic information, use the OCR algorithm to generate an orthogonal path-finding network between graphic connection points; obtain the target point coordinates, and use the D* algorithm in the original coordinates to perform the first calculation of this path; save the coordinates of the path passed during the calculation and transform them into VectorPoint coordinates; save the cost function values h(x) and k(x) generated at each point during the calculation as the path cost matrix H of this path; rules for the generation of the orthogonal network and the calculation of the turning point number are specified during the calculation of the cost function;
[0071] Furthermore, if there is no need to re-plan the path, then call the cost function value saved in the path cost matrix, call the cost modification function of the D* algorithm, modify the cost function of the break point and its surrounding adjacent points in the orthogonal path-finding network coordinates, re-calculate the path with the break point as the starting point, and re-save the calculated path; transform the path coordinates into the original coordinates;
[0072] Furthermore, for graphic settings, set the size of the drawing paper to length L × width W, then the coordinates of each point in the figure are (x, y), where (0 < x < L, 0 < y < W). The coordinates of all points in the screen form a two-dimensional array, which is named barrier;
[0073] It should be noted that each point in the array has the following properties as an object: the actual coordinate position in the graph; the coordinate position in the orthogonal pathfinding network; if the point does not exist in the orthogonal network, the attribute value is NULL; the connectivity attribute, set value Value, expressed as:
[0074]
[0075] The cost h(X) from this point to the end point G (distance + number of inflection points + number of intersections of connecting lines + boundary value) is initially infinite; the initial value of k(X) is: k(X) = h(X);
[0076] Furthermore, a graphics object is created through an array;
[0077] It should be noted that the graphic object includes the following attributes: the coordinates of the upper left corner are (x0, y0); the width of the rectangle is w, the height of the rectangle is h; the Value of the area occupied (the graphic is specified as an obstacle, Value = 0); the unconnected area of the graphic is set as: the graphic area and the peripheral area of the graphic after the graphic is expanded outward by 10 pixels to prevent the connection line from moving against the graphic; the Value of the unconnected area is first all 0, and then the graphic connection points in the area take a special value, Value = 1; the coordinates of the graphic connection points are set according to the distribution of the function block pins in the function block graphic template file; for example, in the graphic template file, the relative coordinates of the upper left corner of the graphic are selected as the origin (0, 0), and the coordinates of pin 1 are (0, -yc), then the actual connection point coordinates are calculated as follows: the actual coordinates of the upper left corner + the relative coordinates of the pin = (x0, y0-yc);
[0078] Further, after obtaining a valid graphic object, the connection point coordinates are added to the connection point set, the connection point x value set is XI = {x1, x2, ..., xlenx}, and the connection point y value set is YI = {y1, y2, ..., yleny};
[0079] Furthermore, XI and YI are processed separately, duplicate values are deleted, and the values in the set are sorted from small to large;
[0080] Further, according to the above processing results, the Cartesian product of XI and YI is calculated to generate an orthogonal network, the formula is:
[0081] XI×YI={(x i ,y j )|x i ∈XI,y j ∈YI}
[0082] ={(x1,y1),(x1,y2),…,(x1,y leny),(x2,y1),(x2,y2),…,(x2,y leny ),…,(x lenx ,y leny )}
[0083] Among them, lenx is the array length of XI, and leny is the array length of YI;
[0084] Furthermore, the original orthogonal network coordinates are transformed into orthogonal pathfinding network matrix coordinates, and the orthogonal pathfinding network matrix coordinate X value set is The set of Y values is
[0085] Furthermore, the Cartesian product of the two is calculated as:
[0086] Furthermore, the connection points are initialized, and when the original orthogonal network is generated, all the original coordinates (x i ,y j ) falls within the valid area. If it falls within the valid area (non-obstacle area), the coordinates of the point are converted to the coordinate point (i, j) in the orthogonal pathfinding network and added to the pathfinding matrix VectorPoint;
[0087] It should be noted that the coordinate point in VectorPoint has the following properties: the actual coordinate position of the point (mapped to the coordinates in the barrier array); the entry direction of the point OR; the parent node parent in the path; the cost h(X) from the point to the end point G (distance + number of inflection points + number of intersections of connecting lines + boundary value), which is initially infinite; the initial value of k(X) is: k(X) = h(X);
[0088] S2, according to the changing scene, the main functions PROCESS_STATE and MODIFY_COST of the D* algorithm are called to calculate the path in the original graphic coordinates and the orthogonal pathfinding network coordinates respectively;
[0089] Furthermore, the D* routing algorithm is used to calculate the first orthogonal path between the two end points of the connection and store it in the connection set. The steps are as follows:
[0090] Specify the parameters and symbols in the algorithm:
[0091] The D* algorithm is based on a directed graph, that is, between nodes A and B, "A to B" and "B to A" represent two arcs, so the corresponding weights are not necessarily the same;
[0092] X, Y, Z, S, G: called nodes, specifically expressed as coordinates, also called state, where S represents the start point, and G represents the goal point; since D* takes the goal point as the starting point, the goal point of D*, DG = S, DS = G;
[0093] {S, ..., G}: represents a path, which starts from S and ends at G, abbreviated as {S};
[0094] b(X)=Y: used to record the backpointer, that is, X->Y. When at position X, the next node Y to be reached can be obtained according to b(X) to make the path optimal.
[0095] t(X): access tag of the node, supporting three types: NEW, OPEN, CLOSED
[0096] NEW: The node has never been visited. This is the initial setting. Some nodes may be permanently in a changed state.
[0097] OPEN: The node is being accessed and stored in the openlist, waiting for access expansion;
[0098] CLOSED: The node has been visited, removed from the priority queue, and the expansion of adjacent nodes has been completed. Generally, the optimal path to the end point G has been found;
[0099] h(X): used to estimate the cost of the path ({G, …X}) from node X to the end point G;
[0100] Among them, the cost value h(X) = Manhattan distance H of two points + number of inflection points gd + number of intersection points of connecting lines jd + boundary value nc + direction d;
[0101] Manhattan distance: If there are two points (x1, y1), (x2, y2), Manhattan distance is expressed as:
[0102] H=|x2-x1|+|y2-y1|
[0103] Calculation of inflection point number: If there are two points A(x1,y1), B(x2,y2) from A to B;
[0104] It should be noted that the conditions for judging the number of inflection points are as follows: when the direction from A to B is the same as the direction of entry of A, and y2=y1, the number of inflection points is 0; when the direction from A to B is the same as the direction of entry of A, and the direction of entry of B is the same as that of A, the number of inflection points is 2; when the direction from A to B is opposite to the direction of entry of A, but the direction of entry of B is the same as that of A, the number of inflection points is 4;
[0105] Boundary value nc: The larger the nc, the closer to the obstacle; when the actual coordinates of the point are within the range of 10 pixels extending outward from the unconnected area (rectangular boundary), nc = 500; when they are within 10 pixels and the obstacle range, nc = 1 / Value;
[0106] Direction d: When the direction is up, down, left, or right, the cost is 0, and when it is diagonal, the cost is 500;
[0107] k(X): used to record the minimum h(X) value since the X node was added to the openlist; k is calculated after updating the h of this node. If the current point t(X) = new, k(X) = h(X); if the current point t(X) = open, then take the minimum value of the current k and new_h (h after selecting other parent nodes); if the current point is t(X) = closed, take the minimum value of the current h and new_h; through the above process, k will be kept to the minimum, which represents the minimum cost of this point to point G in the whole graph environment;
[0108] It should be noted that the cost of c(X, Y) from X to Y is calculated in the same way as h(X);
[0109] Priority: According to the position and direction of the point, get the adjacent connection points around it, with the priority of forward direction > right > left;
[0110] Furthermore, the first path calculation is performed, and all the coordinates calculated are in the original coordinate system. The algorithm calculation logic is as follows:
[0111] Initialize the target point G and the starting point S. Start from the target point G and add it to an openlist consisting of valid connection points. Now there is only one item in the openlist, that is, the target point G, and G's h(X) = k(X) = 0;
[0112] Expand the nodes around the point and find the adjacent connection point X. If there is one, calculate h(X) and k(X) of the point. Save it in the path cost matrix H, which is a one-dimensional array.
[0113] It should be noted that the data format in the array is as follows: H(X)={(Xi, Xj, h(X), k(X))}, Xi is the horizontal coordinate of the point, Xj is the vertical coordinate of the point, h(X), k(X) are the cost functions of the point;
[0114] Furthermore, the logic of the function PROCESS_STATE() is executed: if t(X) = new, then k(X) = h(X); if t(X) ≠ new, the node K already has a cost, and the following judgment is made:
[0115] Furthermore, when K_old < h(X): It indicates that the node x is in the raise state. The current increase in h(X) means that the original path is no longer optimal. If a point y can be found around x such that h(Y) + C(X, Y) is smaller, then modify the parent node of X to Y, reset the value of h(X), and update the path cost matrix H;
[0116] Furthermore, if K_old = h(X): The node X is in the lower state, not affected by obstacles, or still in the first traversal stage;
[0117] Further, put the end point G into the close list (no longer traverse); then find the node with the minimum cost as the new node, and continue to repeat the search until the start point S pops out of the open list and enters the close list; then start from the start point to find the parent node, and search all the way to the end point to save each node in the path in the path array;
[0118] Transform the coordinates in the path array into the coordinates in the orthogonal pathfinding matrix;
[0119] S3. After calculating the path, transform the coordinates back to the original coordinate system;
[0120] Further, search for the path break point position: In the original coordinate network, the coordinate attribute Value of the obstacle is 0. Find the path point X at the obstacle, and change the h value of X to infinity; by calculating b(X), find its parent node Y; the current pathfinding direction is from (S - Y - X - G);
[0121] Call the OCR algorithm to regenerate the orthogonal pathfinding network coordinates, but retain the attributes of the original coordinates;
[0122] Transform the (S - Y) path into the new orthogonal pathfinding network coordinates, and call the cost modification: MODIFY_COST() under this coordinate, and put the node Y back into the open list;
[0123] It should be noted that the required h() during the call is called from the path cost matrix H, and the required parameters during the calculation are called from the original coordinate system;
[0124] The logic of MODIFY_COST() is that if the value of the parent node is 0 and the h value of point Y becomes infinite, then put it into the open list; at this time, the k of this node is still the original h value, and it is necessary to recalculate the cost from the neighboring points of Y to the end point G, h(Y) = C(Y, Z) + h(Z), find the minimum value Z and make it its parent node; at the same time, update the h values of the child nodes around Y, h(U) = the updated h(Y) - C;
[0125] Until K_min (the minimum k value of all nodes in the openlist) >= hx (the h value of the current point X), the h value updated in the calculation process is saved in the path cost matrix H;
[0126] Re-execute the logical calculation path of PROCESS_STATE() to obtain the modified path. The modified path coordinates are orthogonal path finding network coordinates. By looking up the reverse lookup of the coordinate attribute value of each point, the coordinates are converted and saved in the path.
[0127] It should be noted that since the h and k values from the subsequent points to the target point in the re-execution of the logic calculation path of PROCESS_STATE() have been calculated before, they do not need to be calculated; this can ensure the efficiency of re-planning of dynamic obstacles.
[0128] Furthermore, this embodiment also provides a real-time optimization system for DCS logic configuration screen connection, including:
[0129] The rule building module uses the OCR algorithm to generate an orthogonal network between graphic connection points and determines the scene of screen changes by establishing rules;
[0130] Call the processing and calculation module, and call the main functions PROCESS_STATE and MODIFY_COST of the D* algorithm to calculate the path in the original graphic coordinates and the orthogonal pathfinding network coordinates according to the changing scene;
[0131] The replacement module transforms the coordinates into the original coordinate system after the calculation path is completed.
[0132] This embodiment also provides a computer device, which is applicable to the case of a real-time optimization method for connecting a DCS logic configuration screen, and includes:
[0133] Memory and processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the real-time optimization method of DCS logic configuration screen connection proposed in the above embodiment.
[0134] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0135] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the real-time optimization method for the DCS logic configuration screen connection proposed in the above embodiment is implemented.
[0136] The storage medium proposed in this embodiment and the data storage method proposed in the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be found in the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0137] Example 2
[0138] Reference Figures 2 to 6 , which is the second embodiment of the present invention, and which provides a real-time optimization method for connecting a DCS logic configuration screen, comprising:
[0139] Judgment condition 1: The coordinates of the endpoints of the connection line change;
[0140] Judgment condition 2: The page size changes;
[0141] Judgment condition 3: Add a new connection;
[0142] Judgment condition 4: Move function blocks and other graphics into the connection line;
[0143] First, determine the graphics change scene. If the determination conditions 1 to 3 are met, proceed as follows:
[0144] Initialize Barrier and XI, YI arrays according to the graphics information;
[0145] Calculate the Cartesian product of XI and YI to generate VectorPoint, that is, the orthogonal pathfinding network (such as Figure 3As shown, black represents the disconnected area where the functional block is located, gray represents the disconnected area outside the functional block, black grid lines represent the orthogonal pathfinding network coordinate system, and gray grid lines represent the original coordinate system). Each coordinate point in the network has the attributes of the original coordinate point;
[0146] Obtain the coordinate information of the starting point and the end point by clicking the mouse to obtain the target point G and the starting point S, store the target node in the Open table, initialize the node, and after the target node is initialized, h(X) = k(x);
[0147] In the original coordinates (such as Figure 4 As shown in the figure, the black orthogonal lines represent the original network coordinate system, and the lines with arrows represent the connection paths). Based on this, the D* algorithm is called to perform the first calculation of the path in the same way as Dijkstra. The cost of up, down, left, and right is set to 0, and the cost of the diagonal direction is set to 500. Each coordinate contains three quantities (node name, cost, and parent node). Starting from the end point G, the surrounding neighboring nodes are searched, and their surrounding coordinates are labeled as B, C, D, E, and F. The cost is calculated according to the regulations and saved in the H matrix. The PROCESS_STATE() function is called, and then the node with the smallest cost is found as the new node, and the end point G is put into the closelist (no longer traversed). The search continues, and the end condition of the search is that the end point pops out of the openlist and enters the closelist. Then, starting from the starting point, the parent node is found according to the smallest h value, and the search is carried out all the way to the end point, and the path is saved to path.
[0148] If judgment condition 4 is met, proceed as follows:
[0149] Searching for the affected path, that is, searching for the coordinate point where Value=0 in the path matrix path; for example, path1, extracting the path from path as an array path1;
[0150] Find the breakpoint X at the obstacle in path1, calculate b(X), and find its parent node Y; call the OCR algorithm to regenerate the orthogonal pathfinding network coordinates (such as Figure 5 As shown in the figure, the black intersection area represents the orthogonal network coordinate system, the lines with arrows represent the connection paths, and the gray area represents the unconnectable area), but the properties of the original coordinates are retained;
[0151] Transform the S-Y path into a new orthogonal pathfinding network coordinate, call the cost modification under this coordinate: MODIFY_COST(), put node Y back into the openlist, the h() required in the calling process is called from the path cost matrix H, and the parameters required in the calculation process are called from the original coordinate system;
[0152] Re-execute the logical calculation path of PROCESS_STATE() to obtain the modified path, and save it to path after coordinate conversion (such as Figure 6 shown).
[0153] Those skilled in the art will appreciate that the embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the application can adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program codes. The scheme in the embodiments of the present application can be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.
[0154] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0155] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0156] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0157] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0158] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A real-time optimization method for DCS logic configuration screen connection, characterized in that: Including: Using the OCR algorithm to generate an orthogonal network between graphic connection points and judging the scene of picture change by establishing rules; The judging the scene of picture change by establishing rules includes: judging whether it is necessary to re-plan the path according to the type of picture change; obtaining picture information from the front end. If the coordinates of the connection endpoints in the picture change, or the page size changes, or new connections are added, then the path needs to be re-planned; if function blocks and other graphics are placed on the connection line in the picture, then there is no need to re-plan the path; If it is necessary to re-plan the path, then call the graphic information, use the OCR algorithm to generate an orthogonal pathfinding network between graphic connection points; obtain the target point coordinates, and use the D* algorithm in the original coordinates to perform the first calculation of this path; save the coordinates of the path passing points during the calculation process and transform them into VectorPoint coordinates; save the cost function values h(x) and k(x) generated at each point during the calculation process as the path cost matrix H of this path; rules for generating the orthogonal network and calculating the number of turning points are specified during the calculation of the cost function; If there is no need to re-plan the path, then call the cost function value saved in the path cost matrix, call the cost modification function of the D* algorithm, modify the cost function of the breakpoint and its surrounding adjacent points in the orthogonal pathfinding network coordinates, re-calculate the path starting from the breakpoint, and re-save the calculated path; transform the path coordinates into the original coordinates; Call the main functions PROCESS_STATE and MODIFY_COST of the D* algorithm to calculate the path in the original graphic coordinates and the orthogonal pathfinding network coordinates respectively according to the change scene; After the path calculation is completed, transform the coordinates into the original coordinate system.
2. The real-time optimization method for DCS logic configuration screen connection according to claim 1, characterized in that: Using the OCR algorithm to generate an orthogonal pathfinding network between graphic connection points, including: Graphic setting, set the size of the drawing paper to length L × width W, then the coordinates of each point in the figure are (x, y), where (0 < x < L, 0 < y < W), the coordinates of all points in the picture form a two-dimensional array, which is named barrier, and a graphic object is established through the array; After obtaining the valid graphic object, add the connection point coordinates to the connection point set. The set of x values of the connection points is XI = {x1, x2,..., xlenx}, and the set of y values of the connection points is YI = {y1, y2,..., yleny}; Process XI and YI respectively, delete the duplicate values in them, and sort the values in the set from small to large; According to the above processing results, calculate the Cartesian product of XI and YI to generate an orthogonal network, and the formula is: where lenx is the array length of XI, and leny is the array length of YI; Transform the original orthogonal network coordinates into orthogonal pathfinding network matrix coordinates. The set of X values of the orthogonal pathfinding network matrix coordinates is The set of Y values is Calculate the Cartesian product of the two: Initialize the connection points, and when generating the original orthogonal network, determine all the original coordinates (x i ,y j ) falls within the valid area. If it does, the coordinates of the point are converted to the coordinate point (i, j) in the orthogonal pathfinding network and added to the pathfinding matrix VectorPoint.
3. The real-time optimization method for DCS logic configuration screen connection according to claim 2, characterized in that: Using the D* algorithm in the original coordinates to perform the first calculation of this path, including: Initialize the target point G and the starting point S. Starting from the target point G, add the target point G to an openlist composed of valid connection points, and h(X) = k(X) = 0 for G; Expand the surrounding nodes of the target point G, search for the adjacent connection points X, if any, calculate the h(X) and k(X) of this point, and save them in the path cost matrix H; Among them, the path cost matrix is in the format of a one-dimensional array: H(X) = {(Xi, Xj, h(X), k(X))}, where Xi is the abscissa of this point, Xj is the ordinate of this point, and h(X) and k(X) are the cost functions of this point; Execute the logic of the function PROCESS_STATE(). If t(X) = new, then k(X) = h(X); if t(X) ≠ new, it means that the K of the node already has a cost and needs to continue the judgment; Put the end point G into the closelist, that is, no longer traverse; find the node with the smallest cost as the new node, and repeat the search until the starting point S is popped out of the openlist and enters the closelist; find the parent node from the starting point and search until the end point. Save each node in the path in the path array; Transform the coordinates in the path array into the coordinates in the orthogonal pathfinding matrix.
4. The real-time optimization method for DCS logic configuration screen connection according to claim 3, characterized in that: It means that the K of the node already has a cost and needs to continue the judgment, including: When K_old < h(X), then the node x is in the raise state, indicating that the original path is not the optimal path; if a point y can be found around x such that h(Y) + C(X, Y) is smaller, then modify the parent node of X to Y, reset the value of its h(X), and update the path cost matrix H; When K_old = h(X), then the node X is in the lower state, indicating that it has not been affected by obstacles or is still in the initial traversal stage; In the original coordinate network, the coordinate attribute Value of the obstacle is 0. Find the path point X at the obstacle, and the h value of X becomes infinite; by calculating b(X), find its parent node Y; the pathfinding direction at this time is from (S - Y - X - G).
5. The real-time optimization method for DCS logic configuration screen connection according to claim 4, characterized in that: After calculating the path, transform the coordinates into the original coordinate system, including: Call the OCR algorithm to regenerate the orthogonal pathfinding network coordinates, but retain the attributes of the original coordinates; Transform the (S - Y) path into the new orthogonal pathfinding network coordinates, and call the cost modification: MODIFY_COST() at this coordinate, and put the node Y back into the openlist; The logic of MODIFY_COST() is that if the value of the parent node is 0 and the h value of point Y becomes infinite, then put it into the openlist; at this time, the k of this node is still the original h value, and it is necessary to recalculate the cost from the neighboring points of Y to the end point G, h(Y) = C(Y, Z) + h(Z), and find the minimum value Z to become its parent node; at the same time, update the h values of the child nodes around Y, h(U) = the updated h(Y) - C; Until K_min (the smallest k value among all nodes in the openlist) >= hx (the h value of the current point X), the updated h value during the calculation process is saved to the path cost matrix H; Re - execute the logic of PROCESS_STATE() to calculate the path, obtain the modified path, the coordinates of the modified path are the orthogonal pathfinding network coordinates, and convert and save the coordinates to path by reverse - looking up the coordinate attribute values of each point.
6. A real-time optimization system for DCS logic configuration screen connections, based on the real-time optimization method for DCS logic configuration screen connections according to any one of claims 1 to 5, characterized in that: Including: The rule building module uses the OCR algorithm to generate an orthogonal network between graphic connection points and determines the scene of screen changes by establishing rules; Call the processing and calculation module, and call the main functions PROCESS_STATE and MODIFY_COST of the D* algorithm to calculate the path in the original graphic coordinates and the orthogonal pathfinding network coordinates according to the changing scene; The replacement module transforms the coordinates into the original coordinate system after the calculation path is completed.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of any one of the methods of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of any one of the methods of claims 1 to 5 are implemented.