Method and system for controller to automatically generate graphical control logic

The method automates the generation and visualization of control logic in complex industrial processes, enhancing efficiency and readability by using a configuration database and force-directed algorithms to optimize layout and tag parsing, addressing the labor-intensive nature of existing control logic design.

CN120315324APending Publication Date: 2025-07-15NANJING GUODIAN NANZI WEIMEIDE AUTOMATION CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410270930.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-11
Publication Date
2025-07-15

AI Technical Summary

Technical Problem

In the process control of process industrial processes, a lot of manpower is required to generate control logic, and the existing configuration system cannot effectively combine data tables and graphical displays, resulting in large memory usage and complex debugging.

Method used

By configuring the database to store control logic information, use algorithm model tables, instance tables and reference tables to generate visual control logic diagrams, use force-oriented algorithms to optimize layout, and optimize label locations through label analysis and simulation annealing algorithms to achieve automated generation and graphical display.

Benefits of technology

Improves the efficiency of control logic configuration, enhances readability and maintainability, simplifies user interaction, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120315324A_ABST
    Figure CN120315324A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of power grids, and particularly relates to a method and system for a controller to automatically generate graphical control logic. The invention discloses a method and a system for automatically generating graphical control logic by a controller. The method comprises the following steps of: storing control logic information by utilizing a configuration database; loading a database, reading an algorithm model, an algorithm instance and an algorithm parameter reference table in the database, and automatically generating visual control logic; and generating a corresponding control logic diagram based on label analysis. By automatically generating and managing complex control logic, the working efficiency can be greatly improved. Through graphical representation and layout optimization, readability and maintainability of control logic can be improved. And through label analysis and reference jump, the experience of the user in the use process can be improved. A user can realize the turning among different control logic pages by clicking the reference of one algorithm instance, so that the complicated control logic can be more conveniently understood and managed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of power grids, and particularly relates to a method and system for automatically generating graphical control logic by a controller. Background Art

[0002] In modern process industrial process control, a set of control logic needs to be designed for the controlled object to control it. When a process system contains a large number of devices and the operating states of these devices are strongly correlated, a large amount of manpower is required to design complex control logic for the control of these devices. Therefore, it is particularly important to design an automated and easy-to-use method to generate graphical control.

[0003] Currently, the patents related to configuration systems mainly focus on two aspects. One is like the patent "A Data Modeling Method and System in Controller Configuration", which only constructs a configuration database and establishes a data storage table, without displaying the abstract signals in the data table in a graphical manner, nor creating a configuration database automatically and displaying the configuration logic in a graphical way. The other is like the patent "A Method, System, Device and Medium for Data Point Reference Jumping in a Configuration Tool", which proposes a method for data point reference jumping in control logic. This patent realizes the jumping of data point references by establishing an algorithm hash table in all controllers and performing key value matching of data point references through a hash search algorithm. However, on the one hand, this patent only establishes the jumping of references from the perspective of data sources, without integrating graphics and logic. On the other hand, the method proposed in this patent requires establishing a hash table of data points in all controllers. In an actual DCS project, loading the data points and graphical systems of all controllers occupies a large amount of memory space, and during the debugging process, a large number of data points need to be added and deleted, lacking intuitive control logic references and graphical jumping displays. Summary of the Invention

[0004] In view of the above existing problems, the present invention is proposed.

[0005] Therefore, the technical problem solved by the present invention is: how to automatically generate a configuration database, and load the data in the database to automatically generate a graphical control logic diagram, so as to improve the work efficiency of control logic configuration.

[0006] To solve the above technical problems, the present invention provides the following technical solution: A method for automatically generating graphical control logic by a controller, including: storing control logic information using a configuration database; generating visual control logic; and generating a corresponding control logic diagram based on tag parsing.

[0007] As a preferred solution of the method for automatically generating graphical control logic by the controller described in the present invention, wherein: storing control logic information by using the configuration database includes storing algorithm models by using the algorithm model table ServicesTable, storing algorithm instances by using the instance table SvcInstancesTable, storing algorithm parameters and references of the parameters by using the instance reference table SvcRefsTable;

[0008] The algorithm models stored in the algorithm model table ServicesTable include calculation models and drawer models; the calculation model is a specific mathematical calculation or logical calculation method; the drawer model is a container of algorithm models, including instances of algorithm models or instances of drawer models;

[0009] Use OneService to represent an algorithm model stored in the algorithm model table. The definition of OneService is as follows {svc_type; svc_desc; attr_name}, where svc_type is the type name of the algorithm model; svc_desc is the description of the algorithm model, and attr_name is the parameter name of the algorithm model;

[0010] The algorithm instance table SvcInstancesTable stores all instantiated algorithm models. Each instantiated algorithm model has a unique identifier and an identifier belonging to an instance of the drawer model;

[0011] Use OneInstance to represent the information of an algorithm instance in the SvcInstancesTable table; the definition of OneInstance is as follows {svc_handle; parent_handle; svc_type; pos_x; pos_y;}, where svc_handle is the identifier of the algorithm instance, parent_handle is the identifier of the instance of the drawer model to which it belongs, pos_x is the X-axis coordinate value of the algorithm instance, pos_y is the Y-axis coordinate value of the algorithm instance, and svc_type is the type name of the algorithm model;

[0012] The instance reference table SvcRefsTable stores the parameters of the algorithm instance and the involved references; an algorithm parameter is represented by InsRef, and the definition of InsRef is {svc_handle; attr_name; attr_ref; svcType}; where svc_handle is the algorithm instance identification number, attr_name is the parameter name of the algorithm model, attr_ref is the reference of the algorithm parameter, represented by svc_handle.attr_name, where svc_handle is the identification of the referenced algorithm instance and attr_name is the attribute name of the referencing algorithm instance, and svcType represents the type of the algorithm attribute.

[0013] As a preferred solution of the method for automatically generating a graphical control logic by the controller according to the present invention, wherein: generating the visual control logic includes using a force-directed algorithm to optimize the layout of the graphic container. Let the graphic element set be V, the connection line set be E, and each graphic element v i ∈V has a position coordinate (x i , y i ) and a velocity vector

[0014] Each graphic element v i is subject to the repulsive force F j (v r , v i , v j ) from other graphic elements v k and the attractive force F a (v i , v k ) from the graphic elements v

[0015] connected to it; the repulsive force and the attractive force are calculated by the following two formulas respectively: r where k i is the repulsive force constant, q j and q i are the electric charges of the graphic elements v j and v ij , and d i is the distance between the graphic elements v j and v

[0016] F a (v i , v k ) = k a d ik where k a is the attractive force constant, and d ik is the length of the connection line between the graphic elements v i and v k ;

[0017] Each graphic element v i The resultant force is the vector sum of all repulsive and attractive forces, expressed as:

[0018]

[0019] Each graphic element v i Updates its own position and velocity according to the resultant force and velocity, expressed as:

[0020]

[0021]

[0022]

[0023]

[0024] Wherein and are the accelerations of the graphic element v i in the x-axis and y-axis directions, obtained by dividing the resultant force by the mass, and Δt is the time step;

[0025] Repeat the above steps until the forces and displacements of all graphic elements are less than the set threshold.

[0026] As a preferred solution of the method for automatically generating a graphical control logic by a controller according to the present invention, wherein: the generation of the visual control logic includes representing an instance of a drawer model with a graphic container, and a configuration page of a control logic can be displayed in the graphic container; using a graphic element to represent a graphical algorithm model, the graphic element is a graphical object generated by the algorithm model and its parameters, and the graphic element pins represent the parameters of the algorithm model;

[0027] Obtain all drawer model instance linked lists List through a database query statement <oneinstance>GroupList;

[0028] Traverse the GroupList linked list. On the one hand, generate a drawer model instance tree in the system, and the tree nodes are bound to graphic container objects. On the other hand, create an associated container Map<svc_handle, GraphicContainer> GraphicMap of the graphic container. The key of the associated container is the identifier of the drawer model instance, and the value of the associated container is the graphic container object.

[0029] The members of the GraphicContainer object of the graphic container include the appearance parameters of the graphic container, the graphic primitive objects it contains, the connections between the graphic primitives, and the identification graphic information of the graphic primitives.

[0030] Create a visual view according to the appearance size of the graphic container, and query the drawer model instance and all algorithm instances contained in the drawer model instance in the database according to the identifier svc_handle of the graphic container.

[0031] When double-clicking any tree node with the mouse, the system obtains the svc_handle of the drawer model instance of the graphic container object and the graphic container object p_GraphicContainer.

[0032] First, the system jointly queries the SvcInstancesTable table and the SvcRefsTable table and converts the queried data into objects in memory.

[0033] Among them, query the combination of all algorithm instances in the SvcInstancesTable table whose parent_handle is equal to the svc_handle of the drawer model instance, and use the linked list List <oneinstance>represented by Instanceslist;

[0034] Among them, OneInstance represents an algorithm instance object queried from the database table SvcInstancesTable;

[0035] By querying the SvcRefsTable table, all the attributes of the algorithm instances and the references of the attributes are obtained, and an associated container map<instance_handle,List <insref>>Represented by InstanceRefMap,

[0036] where instance_handle represents the identifier of an algorithm instance, List <insref>Represents the set of all attribute parameter objects of an algorithm instance. InsRef represents the object that has a reference relationship with an attribute in the algorithm instance, including {instance_handle; attr_name; attr_ref; svcType};

[0037] According to List <oneinstance>The coordinate values of each algorithm instance, create algorithm graphic elements of the algorithm instance object in the graphic container, and draw the visualized logical relationship according to the reference relationship between algorithm instances obtained from the query database;

[0038] After all graphic elements and the connections between graphic elements are created, the system draws the algorithm container into a visualized view to realize the graphical display of algorithm instances.

[0039] As a preferred solution of a method for automatically generating graphical control logic by a controller according to the present invention, wherein: the generation of the visualized control logic further includes according to the obtained map<svc_handle,List <insref>>Draw the reference relationship between algorithm instances. First, traverse the map;

[0040] When the parent_handle in InsRef is equal to the parent_handle in the OneInstance object, it means that these two algorithm instances belong to the same drawer model instance. In an algorithm container, connect the attrName of the two algorithm instances with a reference relationship using a polyline;

[0041] When the parent_handle in the InsRef object is not equal to the parent_handle in the OneInstance object, it indicates that the algorithm instance references an algorithm instance in another drawer model instance. Add a reference label with the attr_ref string at the attrName position in the calculation primitive to indicate that the algorithm instance references an algorithm instance in another algorithm container;

[0042] If the attributes of the displayed algorithm instance are referenced by algorithm instances in other control diagrams, they should also be displayed through primitive labels in this control diagram. The steps are as follows:

[0043] Traverse the List <oneinstance>Query the SvcInstancesTable table and the SvcRefsTable table in the Instance_list, and query the list of algorithm instances in the SvcRefsTable table where the svc_handle in the algorithm instance reference string attr_ref is included in the linked list Instance_list but the algorithm instance does not belong to the current drawer model instance;

[0044] Draw the applied label at the graphic primitive output attribute in the current control diagram. The attr_ref in the label is identified by svc_handle.attr_name, where svc_handle is the label of the referenced algorithm instance and attr_name identifies the name of the reference attribute.

[0045] As a preferred solution of the method for automatically generating a graphical control logic by a controller according to the present invention, wherein: the generating the corresponding control logic diagram based on label parsing includes that when clicking on the label of a graphic primitive in the view, the system obtains the attr_ref value of the label string on the graphic primitive and parses the string to obtain the svc_handle of the referenced algorithm instance and the attribute name of the referenced algorithm instance;

[0046] First, query the value of the parent_handle, which is the identifier of the drawer model instance where the referenced algorithm instance is identified as svc_handle, in the SvcInstancesTable table;

[0047] According to the obtained value of parent_handle, find the set of all algorithm instances subordinate to the value of parent_handle; through the set List of algorithm instances <oneinstance>;

[0048] According to List <oneinstance>For the coordinate values of each algorithm instance, different types of graphics primitives are created in the graphic container to represent the visualization of the algorithm instance; query the database SvcRefsTable table to obtain the reference relationships between algorithm instances to draw the visualized logical relationships; when all the graphics primitives and the connections between the graphics primitives are created, the system draws the algorithm container into a visualized view to implement the graphical display of the algorithm instance;

[0049] According to the obtained map<svc_handle,List <insref>>Draw the reference relationships between algorithm instances;

[0050] Select the graphic elements in the newly created algorithm container that are equal to the svc_handle included in attr_ref, thereby realizing the switching between different control logic pages by clicking on the reference of an algorithm instance;

[0051] In the newly created algorithm container, find the algorithm instance with the same svc_handle number as the algorithm instance represented by the reference label. In the newly created algorithm container, find the graphic element corresponding to the algorithm instance, thereby realizing the positioning of the referenced algorithm instance.

[0052] As a preferred solution of the method for automatically generating a graphical control logic by the controller according to the present invention, wherein: the generation of the corresponding control logic diagram based on label parsing further includes using the simulated annealing algorithm to iteratively optimize the display position of the label. In each iteration process, update the graphical control logic diagram according to the new label position, including updating the position of the graphic elements and the path of the connection lines; after the simulated annealing algorithm ends, the obtained label position is the optimized label position, and the visualization effect of the graphical control logic diagram has been improved at this time.

[0053] Another object of the present invention is to provide a TCP encrypted communication portrait and risk identification system based on application layer feature recognition, which can solve the technical problems of automatic generation, visual representation and optimized layout of control logic through a configuration database module, a graphical control logic creation module, a label parsing module and a force-directed layout optimization module.

[0054] To solve the above technical problems, the present invention provides the following technical solution: a system for automatically generating a graphical control logic method by a controller, including a configuration database module, a data loading and parsing module, a visualization generation module, a user interaction module, a graphic container management module and a reference relationship processing module;

[0055] The configuration database module is used to store control logic information, including algorithm models, algorithm instances and their input and output parameters and the reference relationships between the parameters;

[0056] The data loading and parsing module is used to read the information of algorithm models, algorithm instances and algorithm parameter reference tables from the configuration database, and perform pre-parsing for subsequent modules to use;

[0057] The visualization generation module is used to automatically generate a graphical representation of the control logic based on the information provided by the data loading and parsing module, and optimize the layout of the graphic container;

[0058] The user interaction module is used to handle the interaction between the user and the graphical control logic interface, including clicking on graphic elements to achieve the jump and positioning of control logic;

[0059] The graphic container management module is used to represent an instance of the drawer model, display the configuration page of the control logic in the graphic container, and manage graphic elements and their connections;

[0060] The reference relationship processing module is used to process the reference relationships between algorithm instances, including drawing the graphical representation of the reference relationships between algorithm instances, and achieving the transfer and positioning between control logic pages by clicking on reference labels.

[0061] A computer device includes a memory and a processor. The memory stores a computer program. The processor, when executing the computer program, implements the steps of a method for automatically generating a graphical control logic by a controller.

[0062] A computer-readable storage medium stores a computer program. The computer program, when executed by a processor, implements the steps of a method for automatically generating a graphical control logic by a controller.

[0063] Advantages of the present invention: By automatically generating and managing complex control logic, the work efficiency is greatly improved. Through graphical representation and optimized layout, the readability and maintainability of the control logic are improved. Through label parsing and reference jump, the user experience during use is improved. The user can achieve the transfer between different control logic pages by clicking on the reference of an algorithm instance, thus more conveniently understanding and managing complex control logic. Description of the Drawings

[0064] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for description in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings. Among them:

[0065] Figure 1 It is a schematic diagram of the overall function of a method for automatically generating a graphical control logic by a controller provided in an embodiment of the present invention.

[0066] Figure 2 It is a schematic diagram of the database representation of a method for automatically generating a graphical control logic by a controller provided in an embodiment of the present invention.

[0067] Figure 3 It is a schematic diagram of the automatic creation control logic process of a method for automatically generating a graphical control logic by a controller provided in an embodiment of the present invention.

[0068] Figure 4 Schematic diagram of a graphically controlled logic diagram automatically created by a method for a controller to automatically generate a graphically controlled logic provided in an embodiment of the present invention.

[0069] Figure 5 Schematic diagram of a jump process for implementing a reference control logic in a method for a controller to automatically generate a graphically controlled logic provided in an embodiment of the present invention.

[0070] Figure 6 Structural diagram of a system for a controller to automatically generate a graphically controlled logic provided in an embodiment of the present invention; Detailed implementation manners

[0071] To make the above objects, features, and advantages of the present invention more apparent and understandable, the following will describe in detail the specific implementation manners of the present invention with reference to the accompanying drawings of the specification. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.

[0072] In the following description, many specific details are set forth to fully understand the present invention. However, the present invention can also be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the connotation of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed below.

[0073] Secondly, the so-called "one embodiment" or "embodiment" herein refers to a specific feature, structure, or characteristic that can be included in at least one implementation manner of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it an individual or alternative embodiment that excludes other embodiments.

[0074] The present invention will be described in detail in conjunction with the schematic diagrams. When describing the embodiments of the present invention in detail, for the convenience of explanation, the cross-sectional views showing the device structure will be enlarged locally out of the general scale, and the schematic diagrams are only examples and should not limit the scope of protection of the present invention herein. In addition, in actual production, three-dimensional spatial dimensions including length, width, and depth should be included.

[0075] Meanwhile, in the description of the present invention, it should be noted that the orientation or positional relationship indicated by terms such as "upper, lower, inner and outer" is based on the orientation or positional relationship shown in the drawings. It is 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 orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation to 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.

[0076] Unless otherwise clearly defined and limited in the present invention, the terms "installed, connected, connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, and can also be indirectly connected through an intermediate medium, or can be the communication inside two elements. 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 situations.

[0077] Embodiment 1

[0078] Refer to Figures 1-5 , which is an embodiment of the present invention, and provides a method for a controller to automatically generate a graphical control logic, including:

[0079] S1: Use a configuration database to store control logic information;

[0080] Furthermore, the use of the configuration database to store control logic information includes using an algorithm model table ServicesTable to store algorithm models, using an instance table SvcInstancesTable to store algorithm instances, using an instance reference table SvcRefsTable to store algorithm parameters and the references of the parameters;

[0081] The algorithm models stored in the algorithm model table ServicesTable include a calculation model and a drawer model; the calculation model is a specific mathematical calculation or logical calculation method; the drawer model is a container of the algorithm model, containing instances of the algorithm model or instances of the drawer model;

[0082] Use OneService to represent an algorithm model stored in the algorithm model table. The definition of OneService is as follows {svc_type; svc_desc; attr_name}, where svc_type is the type name of the algorithm model; svc_desc is the description of the algorithm model, and attr_name is the parameter name of the algorithm model;

[0083] The algorithm instance table SvcInstancesTable stores all instantiated algorithm models. Each instantiated algorithm model has a unique identifier and an identifier belonging to the drawer model instance;

[0084] Use OneInstance to represent the information of an algorithm instance in the SvcInstancesTable table. OneInstance is defined as {svc_handle; parent_handle; svc_type; pos_x; pos_y;}, where svc_handle is the identifier of the algorithm instance, parent_handle is the identifier of the belonging drawer model instance, pos_x is the X-axis coordinate value of the algorithm instance, pos_y is the Y-axis coordinate value of the algorithm instance, and svc_type is the type name of the algorithm model;

[0085] The instance reference table SvcRefsTable stores the parameters of the algorithm instance and the involved references. Use InsRef to represent a parameter of the algorithm. The definition of InsRef is {svc_handle; attr_name; attr_ref; svcType}; where svc_handle is the algorithm instance identification number, attr_name is the parameter name of the algorithm model, attr_ref is the reference of the algorithm parameter, represented by svc_handle.attr_name, where svc_handle is the identifier of the referenced algorithm instance and attr_name is the attribute name of the referencing algorithm instance, and svcType represents the type of this algorithm attribute.

[0086] S2: Generate visual control logic;

[0087] Furthermore, the generation of visual control logic includes using a force-directed algorithm to optimize the layout of the graphic container. Let the set of graphic elements be V and the set of connections be E. Each graphic element v i ∈V has a position coordinate (x i , y i ) and a velocity vector

[0088] Each graphic element v i is subject to the repulsive force F j from other graphic elements v r (v i , v j ) and the attractive force F k from the graphic element v a (v i , v k ) it is connected to. The repulsive force and the attractive force are calculated by the following two formulas respectively:

[0089] where k r is the repulsive force constant, q i and q j are the electric charges of the graphic elements v i and v j , and d ij is the distance between the graphic elements v i and v j ;

[0090] F a (v i ,v k ) = k a d ik , where k a is the gravitational constant, and d ik is the length of the line connecting the graphic elements v i and v k ;

[0091] The resultant force on each graphic element v i is the vector sum of all repulsive and gravitational forces, expressed as:

[0092]

[0093] Each graphic element v i updates its own position and velocity according to the resultant force and velocity, expressed as:

[0094]

[0095]

[0096]

[0097]

[0098] where and are the accelerations of the graphic element v i in the x-axis and y-axis directions, obtained by dividing the resultant force by the mass, and Δt is the time step;

[0099] Repeat the above steps until the forces and displacements of all graphic elements are less than the set threshold.

[0100] Furthermore, the control logic for generating the visualization includes representing an instance of the drawer model with a graphic container, and a configuration page of the control logic can be displayed in the graphic container; representing the graphical algorithm model with graphic elements, where the graphic elements are graphical objects generated from the algorithm model and its parameters, and the graphic element pins represent the parameters of the algorithm model;

[0101] It should be noted that in the control logic diagram, the combination of graphic elements, the connections between graphic elements, and the label identifications of the pins of graphic elements represents different complex reference relationships between algorithm instances. Among them, if two algorithm instances reference the same drawer model instance, the connection between the pins of the graphic elements represents the logical relationship between the algorithm instances. If the references between two algorithm instances are not to the same drawer model instance, the algorithm instance represented by the graphic element references the parameters of the algorithm instance in other algorithm containers. In an algorithm container, the connections and references between the pins of the graphic elements constitute the graphical control logic;

[0102] Obtain the linked list List of all drawer model instances through database query statements <oneinstance>GroupList;

[0103] Traverse the GroupList linked list. On the one hand, generate a drawer model instance tree in the system, where the tree nodes are bound to graphic container objects; on the other hand, create an associated container Map<svc_handle, GraphicContainer> GraphicMap for the graphic containers. The key of the associated container is the identifier of the drawer model instance; the value of the associated container is the graphic container object.

[0104] The members of the GraphicContainer object include the appearance parameters of the graphic container, the graphic primitive objects it contains, the connections between the graphic primitives, and the identification graphic information of the graphic primitives.

[0105] Create a visual view according to the appearance size of the graphic container, and query the drawer model instance and all algorithm instances contained in the drawer model instance in the database according to the svc_handle of the graphic container.

[0106] When double-clicking on any tree node with the mouse, the system obtains the svc_handle of the drawer model instance of the graphic container object and the graphic container object p_GraphicContainer.

[0107] First, the system jointly queries the SvcInstancesTable table and the SvcRefsTable table and converts the queried data into objects in memory.

[0108] Among them, query the combination of all algorithm instances in the SvcInstancesTable table whose parent_handle is equal to the svc_handle of the drawer model instance, and use a linked list List <oneinstance>represented by Instanceslist;

[0109] Among them, OneInstance represents an algorithm instance object queried from the database table SvcInstancesTable;

[0110] By querying the SvcRefsTable table, all the attributes of the algorithm instances and the references to the attributes are obtained, using the associative container map<instance_handle,List <insref>>represented by InstanceRefMap,

[0111] where instance_handle represents the identifier of an algorithm instance, List <insref>Represents the set of all property parameter objects of an algorithm instance. InsRef represents the object that has a reference relationship with a property in the algorithm instance, including {instance_handle; attr_name; attr_ref; svcType};

[0112] According to List <oneinstance>The coordinate values of each algorithm instance, create algorithm graphic elements of the algorithm instance object in the graphic container, and draw the visualized logical relationship according to the reference relationship between algorithm instances obtained from the query database;

[0113] After all graphic elements and the connections between graphic elements are created, the system draws the algorithm container into a visualized view to realize the graphical display of algorithm instances.

[0114] Furthermore, the generated visualized control logic further includes according to the obtained map<svc_handle,List <insref>> Draw the reference relationship between algorithm instances. First, traverse the map;

[0115] When the parent_handle in InsRef is equal to the parent_handle in the OneInstance object, it means that these two algorithm instances belong to the same drawer model instance. In an algorithm container, connect the attrName of the two algorithm instances with a reference relationship using a polyline;

[0116] When the parent_handle in the InsRef object is not equal to the parent_handle in the OneInstance object, it indicates that the algorithm instance references an algorithm instance in another drawer model instance. Add a reference label with the string attr_ref at the attrName position in the calculation primitive to indicate that the algorithm instance references an algorithm instance in another algorithm container;

[0117] It should be noted that in order to automatically create the control logic diagram where the referenced point is located, attr_ref uses svc_handle.attr_name to identify the referenced algorithm instance, where svc_handle identifies the identifier of the referenced algorithm instance and attr_name identifies the attribute name of the referencing algorithm instance;

[0118] If the attributes of the displayed algorithm instance are referenced by algorithm instances in other control diagrams, they should also be displayed through primitive labels in this control diagram. The steps are as follows:

[0119] Traverse the List <oneinstance>Query the SvcInstancesTable table and the SvcRefsTable table in the Instance_list, and query the list of algorithm instances in the SvcRefsTable table where the svc_handle in the algorithm instance reference string attr_ref is included in the linked list Instance_list but the algorithm instance does not belong to the current drawer model instance;

[0120] Draw the applied label at the graphic primitive output attribute in the current control diagram. The attr_ref in the label is identified by svc_handle.attr_name, where svc_handle is the label of the referenced algorithm instance and attr_name identifies the name of the reference attribute.

[0121] S3: Generate the corresponding control logic diagram based on label parsing.

[0122] Furthermore, the generating the corresponding control logic diagram based on label parsing includes that when clicking on the label of the graphic primitive in the view, the system obtains the attr_ref value of the label string on the graphic primitive and parses the string to obtain the svc_handle of the referenced algorithm instance and the attribute name of the referenced algorithm instance;

[0123] First, query the value of the parent_handle, which is the identifier of the drawer model instance where the referenced algorithm instance is identified as svc_handle, in the SvcInstancesTable table;

[0124] According to the obtained value of parent_handle, find the set of all algorithm instances subordinate to this value of parent_handle; through the set List of algorithm instances <oneinstance>;

[0125] According to List <oneinstance>The coordinate values of each algorithm instance are used to create different types of graphic elements in the graphic container to represent the visualization of the algorithm instance; query the database SvcRefsTable table to obtain the reference relationships between algorithm instances to draw the visualized logical relationships; when all the graphic elements and the connections between the graphic elements are created, the system draws the algorithm container into a visualized view to realize the graphic display of the algorithm instance;

[0126] According to the obtained map<svc_handle,List <insref>>Draw the reference relationships between algorithm instances;

[0127] Select the primitive equal to the svc_handle included in attr_ref in the newly created algorithm container, thus realizing the switching between different control logic pages by clicking the reference of an algorithm instance;

[0128] In the newly created algorithm container, find the algorithm instance with the same svc_handle number as the algorithm instance represented by the reference label. In the newly created algorithm container, find the primitive corresponding to the algorithm instance, thus realizing the positioning of the referenced algorithm instance.

[0129] Furthermore, the generation of the corresponding control logic diagram based on label parsing further includes using the simulated annealing algorithm to optimize the display position of the labels, and the steps are as follows:

[0130] Let the label set be L, and each label l i ∈L has a position coordinate (x i , y i ) and a size (w i , h i ); the primitive set is V, and the connection set is E;

[0131] Define the energy function E(L) as the negative value of the quality of the label position, expressed as:

[0132]

[0133] where Q(l i ) is the quality of a single label l i , and Q(l i , l j ) is the quality between two labels l i and l j , including the distance and overlap factors between the labels;

[0134] Initialize a high temperature T0 and an initial state L0, set the current state to L0, and set the current temperature to T0;

[0135] Randomly select a new state L c in the neighborhood of the current state L n , calculate the energy E(L n ) of the new state and the energy difference ΔE = E(L n ) - E(L c );

[0136] If ΔE < 0, accept the new state L n as the current state L c ; otherwise accept the new state L with a probability ​ n As the current state L c ;

[0137] Reduce the current temperature T according to the set rules c , and repeat the above steps until the current temperature is less than the set threshold.

[0138] It should be noted that the reason for choosing this algorithm is that it can find a globally optimal set of label positions through random search and probabilistic acceptance, and at the same time avoid being trapped in local optima. The basic idea of this algorithm is to regard the optimization problem of label positions as an energy minimization problem, that is, to define an energy function to measure the quality of label positions, and then by simulating the annealing process of a physical system, starting from a high-temperature initial state, gradually reducing the temperature, and randomly selecting a new state in the neighborhood of the current state each time. If the energy of the new state is lower than the energy of the current state, the new state is accepted; otherwise, the new state is accepted with a certain probability until a low-temperature stable state, that is, the state with the minimum energy, is reached.

[0139] Embodiment 2

[0140] The second embodiment of the present invention is different from the previous embodiment in that:

[0141] If the described function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or part of this technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.

[0142] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a definite list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or used in combination with these instruction execution systems, apparatus, or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.

[0143] More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer disk cartridge (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation, or other suitable processing as necessary, and then stored in a computer memory.

[0144] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits with logic gate circuits for implementing logical functions on data signals, application-specific integrated circuits with suitable combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.

[0145] Embodiment 3

[0146] Refer to Figure 6 , which is the third embodiment of the present invention. This embodiment provides a system for automatically generating graphical control logic by a controller, including a configuration database module, a data loading and parsing module, a visualization generation module, a user interaction module, a graphic container management module, and a reference relationship processing module;

[0147] The configuration database module is used to store control logic information, including algorithm models, algorithm instances, their input and output parameters, and the reference relationships between the parameters;

[0148] The data loading and parsing module is used to read information of algorithm models, algorithm instances and algorithm parameter reference tables from the configuration database, and perform parsing preprocessing for use by subsequent modules;

[0149] The visualization generation module is used to automatically generate a graphical representation of the control logic based on the information provided by the data loading and parsing module, and optimize the layout of the graphical container;

[0150] The user interaction module is used to process the interaction between the user and the graphical control logic interface, including clicking on the graphic element to realize the jump and positioning of the control logic;

[0151] The graphic container management module is used to represent an instance of the drawer model, display the configuration page of the control logic in the graphic container, and manage the graphic primitive objects and their connections;

[0152] The reference relationship processing module is used to process the reference relationship between algorithm instances, including drawing a graphical representation of the reference relationship between algorithm instances, and realizing the switching and positioning between control logic pages by clicking on the reference tag.

[0153] Example 4

[0154] The fourth embodiment of the present invention provides a method for automatically generating graphical control logic by a controller. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and experiments.

[0155] Experimental measurement criteria:

[0156] Control Logic Creation Time: Measures the time required from initiation to completion of the graphical display of the control logic.

[0157] User interface response time: the time required for the interface to jump after clicking a reference or label.

[0158] Accuracy: The percentage to which the control logic graph matches expectations.

[0159] User satisfaction: User satisfaction with the graphical interface.

[0160] Experimental parameters:

[0161] Dataset size: The number of algorithm instances used to create the graph logic.

[0162] Reference complexity: the average number of references per algorithm instance.

[0163] Table 1 Comparison of the method of the present invention with the prior art method for different data sets

[0164]

[0165] As can be seen from Table 1, for the control logic creation time, under a dataset of size 1000 and low-complexity references, this method only takes 1.2 seconds. Compared with 2.5 seconds of the existing technology, this method is more than 50% faster.

[0166] Under medium-complexity references and a dataset of size 5000, the time required for this method is 2.5 seconds, while the existing technology is 4.8 seconds. Even under the conditions of increasing dataset size and complexity, this method still has an advantage of nearly 50%.

[0167] Under high-complexity references and a dataset of size 10000, this method requires 4.1 seconds, while the existing technology requires 7.3 seconds, showing that this method reduces the time consumption by nearly 45%.

[0168] For the user interface response time, under a dataset of size 1000 and low-complexity references, the response time of this method is 0.8 seconds. Compared with 1.4 seconds of the existing technology, it has a time advantage of 43%. When the dataset size is 5000 and medium-complexity references are used, the response time of this method is 1.0 second. Compared with 2.2 seconds of the existing technology, it saves 55% of the time. Under high-complexity references and a dataset of size 10000, this method is 1.6 seconds, compared with 3.3 seconds of the existing technology, it has an advantage of 50%.

[0169] For accuracy, under all dataset sizes and complexity conditions, the accuracy of this method always exceeds that of the existing technology.

[0170] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered by the scope of the claims of the present invention.< / insref> < / oneinstance> < / oneinstance> < / oneinstance> < / insref> < / oneinstance> < / insref> < / insref> < / oneinstance> < / oneinstance> < / insref> < / oneinstance> < / oneinstance> < / oneinstance> < / insref> < / oneinstance> < / insref> < / insref> < / oneinstance> < / oneinstance>

Claims

1. A method for a controller to automatically generate graphical control logic, characterized in that, include: Using the configuration database to store control logic information including algorithm models, algorithm instances and their input and output parameters, as well as references between algorithm parameters; Load the database to read the algorithm model, algorithm instance and algorithm parameter reference table in the database, and automatically generate visual control logic; Generate the corresponding control logic diagram based on label analysis. By clicking on the control logic diagram, the jump of the control logic corresponding to the algorithm referenced and applied in the control logic and the location of the referenced point in the graphical system are output.

2. The method for automatically generating a graphical control logic by a controller according to claim 1, wherein: The use of the configuration database to store control logic information includes using the algorithm model table ServicesTable to store algorithm models, using the instance table SvcInstancesTable to store algorithm instances, and using the instance reference table SvcRefsTable to store algorithm parameters and parameter references; The algorithm model stored in the algorithm model table ServicesTable includes a calculation model and a drawer model; the calculation model is a specific mathematical calculation or logic calculation method; the drawer model is a container of the algorithm model, including an instance of the algorithm model or an instance of the drawer model; OneService is used to represent an algorithm model stored in the algorithm model table. The definition of OneService is as follows {svc_type; svc_desc; attr_name}, where svc_type is the type name of the algorithm model; svc_desc is the description of the algorithm model, and attr_name is the parameter name of the algorithm model; The algorithm instance table SvcInstancesTable stores all instantiated algorithm models, each instantiated algorithm model has a unique identifier and an identifier of the drawer model instance; OneInstance is used to represent the information of an algorithm instance in the SvcInstancesTable table; OneInstance is defined as follows {svc_handle; parent_handle; svc_type; pos_x; pos_y;}, where svc_handle is the identifier of the algorithm instance, parent_handle is the identifier of the drawer model instance to which it belongs, pos_x is the X-axis coordinate value of the algorithm instance, pos_y is the Y-axis coordinate value of the algorithm instance, and svc_type is the type name of the algorithm model; The above-mentioned instance reference table SvcRefsTable stores the parameters of the algorithm instance and the involved references; InsRef is used to represent a parameter of the algorithm, and the definition of InsRef is {svc_handle; attr_name; attr_ref; svcType}; among them, svc_handle is the algorithm instance identification number, attr_name is the parameter name of the algorithm model, attr_ref is the reference of the algorithm parameter, which is represented by svc_handle.attr_name, where svc_handle is the identification of the referenced algorithm instance, attr_name is the attribute name of the referencing algorithm instance, and svcType represents the type of the algorithm attribute.

3. The method for automatically generating a graphical control logic by a controller according to claim 2, characterized in that: The control logic for generating visualization includes using a force-directed algorithm to optimize the layout of the graphic container. Let the set of graphic elements be V and the set of connections be E. Each graphic element v i ∈V has a position coordinate (x i , y i ) and a velocity vector Each primitive v i is repelled by other primitive v j with a repulsive force F r (v i , v j ) and the gravitational force F k of the connected primitive v a (v i , v k ). The repulsive force and the gravitational force are calculated by the following two formulas respectively: where k r is the repulsive constant, q i and q j are the electric charges of the primitive elements v i and v j , and d ij is the distance between the primitive elements v i and v j ; F a (v i ,v k ) = k a d ik where k a is the gravitational constant and d ik is the length of the line connecting the primitive elements v i and v k . The resultant force of each graphic element v i is the vector sum of all repulsive and attractive forces, expressed as: Each graphic element v i Update its own position and velocity according to the resultant force and velocity, expressed as: where and are the accelerations of the graphic primitive v i in the x-axis and y-axis directions, obtained by dividing the resultant force by the mass, and Δt is the time step.

4. The method for automatically generating a graphical control logic by a controller according to claim 3, characterized in that: The above-mentioned control logic for generating visualization includes representing the instance of the drawer model with a graphic container, and a configuration page of the control logic can be displayed in the graphic container; using graphic elements to represent the graphical algorithm model, and the graphic elements are graphical objects generated by the algorithm model and its parameters, and the graphic element pins represent the parameters of the algorithm model; Obtain all the drawer model instance linked lists List<OneInstance> GroupList through the database query statement; Traverse the GroupList linked list. On the one hand, generate a drawer model instance tree in the system, and the tree nodes are bound to the graphic container objects; on the other hand, create an associated container Map<svc_handle, GraphicContainer> GraphicMap of the graphic container, and the key of the associated container is the identification of the drawer model instance; the value of the associated container is the graphic container object; The members of the graphic container GraphicContainer object include the appearance parameters of the graphic container, the included graphic element objects, the connections between the graphic elements, and the identification graphic information of the graphic elements; Create a visual view according to the appearance size of the graphic container, and query the drawer model instance and all the algorithm instances included in the drawer model instance in the database according to the identification svc_handle of the graphic container; When double-clicking any tree node with the mouse, the system obtains the svc_handle of the drawer model instance of the graphic container object and the graphic container object p_GraphicContainer; First of all, the system jointly queries the SvcInstancesTable table and the SvcRefsTable table to convert the queried data into objects in memory; Among them, the combination of algorithm instances that query all algorithm instances in the SvcInstancesTable table where the parent_handle is equal to the svc_handle of the drawer model instance is represented by the linked list List <oneinstance>It is represented by Instanceslist; < / oneinstance> Among them, OneInstance represents an algorithm instance object queried from the database table SvcInstancesTable; By querying the SvcRefsTable, obtain the attributes of all algorithm instances and the references of the attributes, and use the associative container map<instance_handle, List <insref>It is represented by >InstanceRefMap, < / insref> where instance_handle represents the identifier of an algorithm instance, List <insref>Represents a set of all attribute parameter objects of an algorithm instance, and InsRef represents an object with a reference relationship for an attribute in the algorithm instance, including {instance_handle; attr_name; attr_ref; svcType};< / insref> According to List <oneinstance>The coordinate values of each algorithm instance, create algorithmic graphic elements for algorithm instance objects in the graphic container, and draw the visualized logical relationships based on the reference relationships between algorithm instances obtained from the query database; < / oneinstance> When all graphic elements and the connections between them are created, the system draws the algorithm container into a visualized view to achieve the graphical display of algorithm instances.

5. The method for automatically generating a graphical control logic by a controller according to claim 4, characterized in that: The control logic for generating visualization further includes, according to the obtained map<svc_handle, List <insref>> To draw the reference relationships between algorithm instances, first traverse the map; < / insref> When the parent_handle in InsRef is equal to the parent_handle in the OneInstance object, it means that these two algorithm instances belong to the same drawer model instance. In an algorithm container, connect the attrNames of the two algorithm instances with a reference relationship using a polyline; When the parent_handle in the InsRef object is not equal to the parent_handle in the OneInstance object, it indicates that the algorithm instance references an algorithm instance in another drawer model instance. Add a reference label with the string attr_ref at the attrName position in the algorithmic graphic element, indicating that the algorithm instance references an algorithm instance in another algorithm container; If the attributes of the displayed algorithm instances are referenced by algorithm instances in other control graphs, they are displayed through graphic element labels in this control graph. The steps are as follows: Traverse the List <oneinstance>Query the Instance_list and the query database tables SvcInstancesTable and SvcRefsTable to query the list of algorithm instances whose svc_handle in the algorithm instance reference string attr_ref in the SvcRefsTable is included in the linked list Instance_list but the algorithm instances do not belong to the current drawer model instance; < / oneinstance> Draw the applied label at the output attribute of the graphic element in the current control graph. The attr_ref in the label is identified by svc_handle.attr_name, where svc_handle is the label of the referenced algorithm instance and attr_name identifies the name of the referenced attribute.

6. The method for automatically generating a graphical control logic by a controller according to claim 5, wherein The generation of the corresponding control logic graph based on label parsing includes that when clicking on the label of a graphic element in the view, the system obtains the attr_ref value of the label string on the graphic element and parses the string to obtain the svc_handle of the referenced algorithm instance and the attribute name of the referenced algorithm instance; First, query the value of the parent_handle, which is the identifier of the drawer model instance where the referenced algorithm instance is identified as svc_handle, in the SvcInstancesTable; According to the obtained parent_handle value, find all sets of algorithm instances subordinate to the parent_handle value; through the set List of algorithm instances <oneinstance> ;< / oneinstance> According to List <oneinstance>The coordinate values of each algorithm instance, create different types of graphic elements in the graphic container to represent the graphicalization of algorithm instances;< / oneinstance> Query the SvcRefsTable table in the database to obtain the reference relationships between algorithm instances for drawing the visual logical relationships. When all the graphic elements and the connections between them are created, the system draws the algorithm containers into a visual view to achieve the graphical display of algorithm instances. According to the obtained map<svc_handle, List <insref>> Draw the reference relationships between algorithm instances. < / insref> Select the graphic elements in the newly created algorithm container that are equal to the svc_handle included in attr_ref, thereby realizing the switching between different control logic pages by clicking on the reference of an algorithm instance. In the newly created algorithm container, find the algorithm instance with the same svc_handle number as the algorithm instance represented by the reference label. In the newly created algorithm container, find the graphic element corresponding to the algorithm instance, thereby realizing the positioning of the referenced algorithm instance.

7. The method for automatically generating graphical control logic by a controller according to claim 6, wherein: The generation of the corresponding control logic diagram based on label parsing further includes using the simulated annealing algorithm to iteratively optimize the display position of the labels. During each iteration, update the graphical control logic diagram according to the new label positions, including updating the positions of the graphic elements and the paths of the connections. After the simulated annealing algorithm ends, the obtained label positions are the optimized label positions.

8. A system for automatically generating a graphical control logic method using a controller as described in any one of claims 1 to 7, characterized in that: It includes a configuration database module, a data loading and parsing module, a visualization generation module, a user interaction module, a graphic container management module, and a reference relationship processing module. The configuration database module is used to store control logic information, including algorithm models, algorithm instances, their input and output parameters, and the reference relationships between the parameters. The data loading and parsing module is used to read the information of algorithm models, algorithm instances, and algorithm parameter reference tables from the configuration database and perform pre-parsing for use by subsequent modules. The visualization generation module is used to automatically generate a graphical representation of the control logic based on the information provided by the data loading and parsing module and optimize the layout of the graphic container. The user interaction module is used to handle the interaction between the user and the graphical control logic interface, including clicking on graphic elements to achieve the jump and positioning of control logic. The graphic container management module is used to represent an instance of the drawer model, display the configuration pages of the control logic in the graphic container, and manage the graphic element objects and their connections. The reference relationship processing module is used to handle the reference relationships between algorithm instances, including drawing a graphical representation of the reference relationships between algorithm instances, and realizing the switching and positioning between control logic pages by clicking on the reference labels.

9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the method described in any one of claims 1 to 7.

Citation Information

Cited By

  • Method for quickly and automatically positioning DCS (Distributed Control System) control logic

    CN120802883A