System configuration graph automatic generation method and device, equipment, medium and product
By parsing the object model file and combining layout algorithms with interactive rendering technology, configuration diagrams are automatically generated, solving the problems of high labor costs, high error risks and poor scalability in existing technologies, and achieving efficient industrial visualization.
Patent Information
- Application Number
- CN202510665446.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-22
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-05-22
AI Technical Summary
Existing system configuration diagram generation solutions have problems such as high labor costs, high error risks, poor scalability, and low industrial visualization efficiency.
By parsing the physical model file in the target system, obtaining the object set and edge set, the layout algorithm is used to calculate the node coordinates of the device on the canvas, and combined with interactive rendering technology, the configuration diagram is automatically generated.
It realizes the automatic and efficient generation and flexible and convenient editing of configuration diagrams, reduces labor costs and error risks, and improves scalability and industrial visualization efficiency.
Smart Images

Figure CN120597997A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of industrial automation and visualization, and in particular relates to a method, device, equipment, medium and product for automatically generating a system configuration diagram. Background Art
[0002] A system configuration diagram is a graphical representation used to depict the relationships and interactions between various elements in a system. It typically consists of nodes (also called vertices) and edges (also called connecting lines). Nodes represent various elements in the system, while edges represent the relationships or connections between them. Configuration diagrams can intuitively demonstrate the dependencies between various elements in the system, the sequence of processes, and data transfer, helping users fully understand the system's structure and operation.
[0003] Currently, in traditional industrial automation scenarios, the design and maintenance of system configuration diagrams mainly rely on engineers to manually complete operations such as device node layout, pipeline connection, and layout adjustment in a visual editor. As a result, this generation process has the following obvious defects: (1) High labor costs, that is, the nodes and connection relationships of complex systems such as heating, ventilation and air conditioning (HVAC) systems, industrial control systems, and microgrid systems are intricate, making manual drawing not only time-consuming and labor-intensive, but also inefficient in configuration; (2) High risk of error, that is, a slight careless manual operation may lead to node omissions, connection errors, or layout imbalances, which will seriously affect the stability and reliability of the system display; (3) Poor scalability, that is, when equipment is updated or the topology structure changes, manual readjustment is required, which makes it difficult to adapt to the rapid iteration requirements of the Industrial Internet of Things (IoT) and digital twin technology.
[0004] Furthermore, with the development of physical modeling technology, device attributes (such as name, icon, and location parameters), topological relationships (such as pipe connections and signal flow), and visualization features have been standardized. Leveraging this structured information in physical models to automatically generate system configuration diagrams, thereby improving industrial visualization efficiency and reducing manual intervention and labor costs, has become a pressing research topic for those skilled in the art. Summary of the Invention
[0005] The purpose of the present invention is to provide a method, apparatus, computer device, computer-readable storage medium and computer program product for automatically generating a system configuration diagram, so as to solve the problems of high labor cost, high error risk, poor scalability and low efficiency of industrial visualization in existing system configuration diagram generation solutions.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] In a first aspect, a method for automatically generating a system configuration diagram is provided, comprising:
[0008] Obtain physical model files for each device in the target system;
[0009] For each device, parse the corresponding object model file to obtain a corresponding object set and edge set, wherein the object set includes a unique identifier, a type, and a visualization attribute, and the edge set includes all outgoing edges with the corresponding device node as a source node and / or all incoming edges with the corresponding device node as a target node;
[0010] Calculating node coordinates of each device on the canvas using a layout algorithm according to the edge set of each device and the visualization attributes in the object set;
[0011] For each of the devices, rendering the corresponding object set as a corresponding visual node element on the canvas and at a position of the corresponding node coordinate;
[0012] According to the edge sets of the respective devices, connection rendering is further performed on the canvas to obtain visual line elements for connecting the visual node elements;
[0013] All the visual node elements and all the visual line elements on the canvas are taken as the configuration diagram of the target system and outputted.
[0014] Based on the above invention content, a new solution for automatically generating complex system configuration diagrams based on physical model files is provided, namely, first, for each device in the target system, the corresponding physical model file is parsed to obtain the corresponding object set and edge set, and then, based on the edge set and the visualization attributes in the object set, the layout algorithm is used to calculate the node coordinates of each device on the canvas, and then, for each device, the corresponding object set is rendered as a corresponding node element at the position on the canvas and at the corresponding node coordinate, and based on the edge set, connection rendering is also performed on the canvas to obtain the line elements used to connect the node elements, and finally all elements on the canvas are output as the target system configuration diagram, thereby realizing automatic and efficient generation and flexible and convenient editing of the configuration diagram through in-depth analysis of the nodes and their connection relationships of the physical model, and clever integration of layout algorithms and interactive rendering technology, thereby effectively solving the shortcomings of traditional manual drawing methods in efficiency and accuracy, reducing labor costs and error risks, and improving scalability and industrial visualization efficiency, which is convenient for practical application and promotion.
[0015] In one possible design, the layout algorithm adopts a force-directed algorithm, a grid layout algorithm, or a regular arrangement algorithm.
[0016] In one possible design, a layout algorithm is used to calculate the node coordinates of each device on the canvas based on the edge set of each device and the visual attributes in the object set, including:
[0017] According to the edge sets of the respective devices, the respective devices are layered and sorted within the layers to determine the layer number and the sequence number within the layer of the respective devices, wherein the sorting within the layer refers to adjusting the left-to-right order of all devices within the layer by adopting a strategy of minimizing the number of edge crossings;
[0018] For each device, extract the corresponding height and width from the corresponding visual attributes, and calculate the node coordinates of the corresponding device on the canvas according to the following formula:
[0019]
[0020] In the formula, m represents a positive integer, x coord,m Indicates the node horizontal coordinate of the mth device in the target system on the canvas, y coord,m Indicates the node vertical coordinate of the mth device on the canvas, x m Indicates the layer number of the mth device, y m Indicates the layer number of the mth device, N width,m Indicates the width of the mth device, N height,m Indicates the height of the mth device, G horizontal Indicates the preset horizontal spacing between devices on the canvas, G vertical Indicates the preset vertical spacing between devices on the canvas.
[0021] In one possible design, the devices are layered according to the edge sets of the devices to determine the layer number of the devices, including the following steps S311 to S316:
[0022] S311. For each device, count the total number of incoming edges in the corresponding edge set, and use the total number as the corresponding current in-degree, and then execute step S312;
[0023] S312. Initialize integer variable i = 1, and then execute step S313;
[0024] S313. Add all devices with a current in-degree of zero to the device set of the i-th layer, and then execute step S314;
[0025] S314. For each device in the device set of the i-th layer, traverse each out-edge in the corresponding edge set in sequence as follows: first determine a device corresponding to the target node of the currently traversed out-edge, then decrement the current in-degree of the device by 1, then determine whether the current in-degree of the device is zero; if so, add the device to the device set of the i+1-th layer and traverse the next out-edge; otherwise, directly traverse the next out-edge, and finally execute step S315;
[0026] S315. Determine whether the device set of the i+1th layer is an empty set. If so, execute step S316. Otherwise, increment i by 1 and then return to step S314.
[0027] S316. End the layering, and for each device, use the serial number of the corresponding layer as the corresponding layer number.
[0028] In one possible design, the edge crossing number minimization strategy includes:
[0029] Adjust the left-to-right order of all devices in two adjacent layers to minimize the total number of device groups that meet the following edge intersection condition: the device group includes a first device, a second device, a third device, and a fourth device, the first device and the second device are respectively located in one of the two adjacent layers, the third device and the fourth device are respectively located in the other of the two adjacent layers, the first device and the third device are each other's source node and target node of one edge, the second device and the fourth device are each other's source node and target node of another edge, and the left-to-right sequence number of the first device is smaller than the left-to-right sequence number of the second device and the left-to-right sequence number of the third device is greater than the left-to-right sequence number of the fourth device, or the left-to-right sequence number of the first device is greater than the left-to-right sequence number of the second device and the left-to-right sequence number of the third device is smaller than the left-to-right sequence number of the fourth device.
[0030] In one possible design, before outputting the configuration diagram of the target system, the method further includes:
[0031] In response to an element-based operation performed by a user from a human-computer interaction interface, adjusting the posture of the visual node element or the visual link element, wherein the element-based operation includes an element dragging operation, an element scaling operation, or an element rotating operation;
[0032] and / or, in response to a property editing operation performed by a user from a human-computer interaction interface, rendering and updating the visual node element, wherein the property editing operation includes a node icon modification operation, a node label modification operation, or a node color modification operation;
[0033] And / or, in response to a layout optimization operation performed by a user from a human-computer interaction interface, for a plurality of said visual node elements selected by the operation and located in the local area of the canvas, the new node coordinates of the corresponding device on the canvas are calculated using the layout algorithm based on the edge set of the corresponding device and the visual attributes in the object set, and rendering is updated according to the calculation results.
[0034] In a second aspect, a system configuration diagram automatic generation device is provided, comprising a model file acquisition unit, a model file parsing unit, a node coordinate calculation unit, a node element rendering unit, a line element rendering unit, and a configuration diagram output unit;
[0035] The model file acquisition unit is used to acquire the physical model file of each device in the target system;
[0036] The model file parsing unit is communicatively connected to the model file acquiring unit and is configured to parse the corresponding object model file for each device to obtain a corresponding object set and edge set, wherein the object set includes a unique identifier, a type, and a visualization attribute, and the edge set includes all outgoing edges with the corresponding device node as a source node and / or all incoming edges with the corresponding device node as a target node;
[0037] The node coordinate calculation unit is communicatively connected to the model file parsing unit and is configured to calculate the node coordinates of each device on the canvas using a layout algorithm based on the edge set of each device and the visualization attributes in the object set;
[0038] The node element rendering unit is communicatively connected to the model file parsing unit and the node coordinate calculation unit, and is used to render the corresponding object set as a corresponding visual node element at a position of the corresponding node coordinate on the canvas for each device;
[0039] The line element rendering unit is communicatively connected to the model file parsing unit and the node element rendering unit, and is used to perform connection rendering on the canvas according to the edge sets of each device to obtain visual line elements for connecting the visual node elements;
[0040] The configuration diagram output unit is communicatively connected to the node element rendering unit and the line element rendering unit, respectively, and is used to output all the visual node elements and all the visual line elements on the canvas as the configuration diagram of the target system.
[0041] In a third aspect, the present invention provides a computer device comprising a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the method for automatically generating a system configuration diagram as described in the first aspect or any possible design of the first aspect.
[0042] In a fourth aspect, the present invention provides a computer-readable storage medium having instructions stored thereon. When the instructions are run on a computer, the method for automatically generating a system configuration diagram as described in the first aspect or any possible design of the first aspect is executed.
[0043] In a fifth aspect, the present invention provides a computer program product, comprising a computer program or instructions, which, when executed by a computer, implements the method for automatically generating a system configuration diagram as described in the first aspect or any possible design of the first aspect.
[0044] Beneficial effects of the above scheme:
[0045] (1) The present invention creatively provides a new solution for automatically generating complex system configuration diagrams based on physical model files, namely, first, for each device in the target system, the corresponding physical model file is parsed to obtain the corresponding object set and edge set, and then, based on the edge set and the visual attributes in the object set, the layout algorithm is used to calculate the node coordinates of each device on the canvas, and then, for each device, the corresponding object set is rendered as a corresponding node element at the position of the corresponding node coordinate on the canvas, and based on the edge set, connection rendering is also performed on the canvas to obtain the line elements used to connect the node elements, and finally all the elements on the canvas are output as the target system configuration diagram, thereby deeply parsing the nodes and their connection relationships of the physical model and cleverly integrating the layout algorithm with the interactive rendering technology, realizing the automatic and efficient generation and flexible and convenient editing of the configuration diagram, thereby effectively solving the shortcomings of the traditional manual drawing method in efficiency and accuracy, reducing labor costs and error risks, and improving scalability and industrial visualization efficiency, which is convenient for practical application and promotion. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. 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 paying any creative work.
[0047] Figure 1A flow chart of a method for automatically generating a system configuration diagram provided in an embodiment of the present application.
[0048] Figure 2 This is a schematic diagram of the structure of the automatic generation device of the system configuration diagram provided in an embodiment of the present application.
[0049] Figure 3 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be briefly introduced below in conjunction with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structures of the drawings is only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these embodiments without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.
[0051] It should be understood that although the terms first, second, etc. may be used herein to describe various objects, these objects should not be limited by these terms. These terms are merely used to distinguish one object from another. For example, a first object can be referred to as a second object, and similarly, a second object can be referred to as a first object without departing from the scope of the exemplary embodiments of the present invention.
[0052] It should be understood that the term "and / or" that may appear in this document is merely a description of the association relationship between associated objects, indicating that there may be three relationships. For example, A and / or B can indicate three situations: A exists alone, B exists alone, or A and B exist at the same time. For another example, A, B and / or C can indicate the existence of any one of A, B and C or any combination of them. The term " / and" that may appear in this document describes another type of association object relationship, indicating that there may be two relationships. For example, A / and B can indicate two situations: A exists alone or A and B exist at the same time. In addition, the character " / " that may appear in this document generally indicates that the previous and next associated objects are in an "or" relationship.
[0053] Example
[0054] like Figure 1As shown, the method for automatically generating a system configuration diagram provided in the first aspect of this embodiment can be executed by, but is not limited to, a computer device with certain computing resources, such as a cloud server, a personal computer (PC, a multi-purpose computer with a size, price and performance suitable for personal use; desktops, laptops, small laptops, tablets and ultrabooks are all personal computers), a smart phone, a personal digital assistant (PDA) or a wearable device. Figure 1 As shown, the method for automatically generating a system configuration diagram may include, but is not limited to, the following steps S1 to S6.
[0055] S1. Obtain the physical model files of each device in the target system.
[0056] In step S1, the target system is the object for which the configuration diagram is to be drawn, and may be, but is not limited to, a heating, ventilation, and air conditioning system, an industrial control system, a microgrid system, or other complex systems with a multi-level node structure. The physical model file is a standardized file based on existing physical model technology, and may specifically include, but is not limited to, the following content: device node information and topology information, wherein the device node information includes, but is not limited to, the device type (e.g., fan, valve, or sensor), unique identification code, and / or visualization attributes (e.g., icon path, size, and color); and the topology information includes, but is not limited to, the connection relationship between nodes (e.g., pipeline connection, control signal, or transmission path), and physical / logical location parameters. The object model file can be, but is not limited to, a JSON (JavaScript Object Notation, a lightweight data exchange format) format file and pre-stored in an existing file system or a NoSQL (generally referring to a non-relational database) database such as MongoDB (which is a database based on distributed file storage and written in C++) for unified management (e.g., supporting storage, version control, retrieval and loading, etc.). The object model file of each device can then be routinely obtained from these file systems or databases, for example, by calling the data read and write interface provided by them, such as the loadmode() function. For example, when the target system is a HVAC system, the object model files of devices such as fans (FAN_COIL_UNIT) and control valves (CONTROL_VALVE) can be read. These model files will specifically include id, type attributes, properties attributes (e.g., location parameters and icon paths, etc.), and connections attributes (e.g., indicating the connection relationship from "fan to control valve").
[0057] S2. For each of the devices, parse the corresponding physical model file to obtain the corresponding object set and edge set, wherein the object set includes but is not limited to a unique identifier, type, and visualization attributes, and the edge set includes but is not limited to all outgoing edges with the corresponding device node as the source node and / or all incoming edges with the corresponding device node as the target node.
[0058] In step S2, specifically, but not limited to, existing syntax parsing tools (such as the ThingModelUtils tool) can be used to extract the core elements in the thing model file: the object set used to reflect the node content and the edge set used to reflect the connection relationship between nodes; for example, by calling the parseThingMode() function (which supports compatibility parsing of thing models from different manufacturers), the thing model file is converted into a {nodes, edges} data structure, where nodes is the object set and edges is the edge set.
[0059] S3. Based on the edge set of each device and the visualization attributes in the object set, a layout algorithm is used to calculate the node coordinates of each device on the canvas.
[0060] In step S3, the calculation and application of the above-mentioned node coordinates are similar to the application of multi-agent systems in the automatic layout generation of industrial park buildings and the application of image recognition technology in DCS (Distributed Control System, distributed control system, DCS configuration configures hardware and software parameters to build the core process of the system to realize the automatic control of industrial processes; its main goal is to connect equipment signals and define control logic, and ensure the precise operation of the system; in DCS configuration, through physical model technology, the system can automatically generate and optimize configuration diagrams, help achieve effective layout of equipment nodes and accurate expression of control logic, and improve the efficiency and accuracy of system design and operation and maintenance) configuration screen generation. Specifically, the layout algorithm can be, but is not limited to, a force-directed algorithm, a grid layout algorithm, or a regular arrangement algorithm, among which the force-directed algorithm is an algorithm commonly used in network visualization and social network analysis. It simulates the interaction of nodes through the attraction and repulsion between nodes, thereby laying out the nodes in the network into a beautiful and readable graph; the grid layout algorithm refers to dividing the web page into grids, and determining the position and size of each grid element through an algorithm to create a complex page layout; the regular arrangement algorithm is a method that can rearrange a string of disorganized data in a specific order (such as from small to large, from large to small, or in alphabetical or character order). In detail, the force-directed algorithm can be implemented through the existing D3.js force module or other self-developed engines to complete the force-directed layout. In addition, the strategy of the layout algorithm can be dynamically switched by configuring parameters.
[0061] In step S3, in order to reduce the computing resource requirements and quickly calculate the node coordinates of each device on the canvas, preferably, a layout algorithm is used to calculate the node coordinates of each device on the canvas based on the edge set of each device and the visualization attributes in the object set, including but not limited to the following steps S31 to S32.
[0062] S31. According to the edge sets of the devices, the devices are layered and sorted within the layers to determine the layer number and the sequence number within the layer of the devices, wherein the sorting within the layer refers to adjusting the left-to-right order of all devices in the layer by adopting the strategy of minimizing the number of edge crossings.
[0063] In step S31, the devices are first layered and then sorted within the layers. Specifically, the devices are layered according to the edge sets of the devices to determine the layer number of the devices, including but not limited to the following steps S311 to S316.
[0064] S311. For each device, count the total number of incoming edges in the corresponding edge set, and use the total number as the corresponding current in-degree, and then execute step S312.
[0065] In step S311, the in-degree is used to measure the number of edges pointing to the corresponding device node; for example, if there are 2 in-edges in the edge set of device A, the current in-degree of device A is 2.
[0066] S312. Initialize integer variable i=1, and then execute step S313.
[0067] S313. Add all devices whose current in-degree is zero to the device set of the i-th layer, and then execute step S314.
[0068] In step S313, for example, if the current in-degree of device A is 2, the current in-degree of device B is 0, the current in-degree of device C is 1, and the current in-degree of device D is 0, then devices B and D can be added to the device set of the first layer.
[0069] S314. For each device in the device set of the i-th layer, traverse each outgoing edge in the corresponding edge set in turn in the following manner: first determine a device corresponding to the target node of the currently traversed outgoing edge, then decrement the current in-degree of the device by 1, and then determine whether the current in-degree of the device is zero. If so, add the device to the device set of the i+1-th layer and traverse the next outgoing edge. Otherwise, directly traverse the next outgoing edge, and finally execute step S315.
[0070] In the step S314, for example, when i=1, for device B in the device set of the first layer, if there is an out-edge BC and an out-edge BA in the corresponding edge set, then when traversing the out-edge BC, the current in-degree of device C can be set to 1-1=0, and then device C is added to the device set of the second layer, and then when traversing the out-edge BA, the current in-degree of device A can be set to 2-1=1, but device A is not added to the device set of the second layer; and then for device D in the device set of the first layer, if there is an out-edge DA in the corresponding edge set, then when traversing the out-edge DA, the current in-degree of device A can be set to 1-1=0, and then device A is added to the device set of the second layer.
[0071] S315. Determine whether the device set of the i+1th layer is an empty set. If so, execute step S316; otherwise, increment i by 1, and then return to execute step S314.
[0072] In step S315 , for example, since the device set of the second layer includes at least device C and device A, that is, it is a non-empty set, i needs to be incremented by 1, and then the process returns to step S314 .
[0073] S316. End the layering, and for each device, use the serial number of the corresponding layer as the corresponding layer number.
[0074] In step S316, for example, since device B and device D are added to the device set of the first layer, and device C and device A are added to the device set of the second layer, it can be determined that: the layer number of device A is 2, the layer number of device B is 1, the layer number of device C is 2, and the layer number of device D is 1.
[0075] In step S31, the edge crossing number minimization strategy is used to ensure that the number of edge element crossings in the subsequent system configuration diagram is minimized so as to clearly present the structural relationship of the configuration diagram. Specifically, the edge crossing number minimization strategy includes but is not limited to: adjusting the left-to-right order of all devices in two adjacent layers to minimize the total number of device groups that meet the following edge crossing conditions: the device group includes a first device, a second device, a third device, and a fourth device, the first device and the second device are respectively located in one of the two adjacent layers, the third device and the fourth device are respectively located in the other of the two adjacent layers, the first device and the third device are each other's source node and target node of an edge, the second device and the fourth device are each other's source node and target node of another edge, and the left-to-right sequence number of the first device is smaller than the left-to-right sequence number of the second device and the left-to-right sequence number of the third device is larger than the left-to-right sequence number of the fourth device, or the left-to-right sequence number of the first device is larger than the left-to-right sequence number of the second device and the left-to-right sequence number of the third device is smaller than the left-to-right sequence number of the fourth device. For example, if devices B and D are on the first layer, and devices C and A are on the second layer, and there are outgoing edges BC and DA, the device order on the first layer needs to be adjusted to: device B, device D, and the device order on the second layer needs to be adjusted to: device C, device A, to ensure that outgoing edges BC and DA do not intersect. Furthermore, the aforementioned device order adjustment method can be performed enumeratively or through an optimization method based on an optimization algorithm such as a particle swarm optimization algorithm or a genetic algorithm.
[0076] S32. For each device, extract the corresponding height and width from the corresponding visualization attributes, and calculate the node coordinates of the corresponding device on the canvas according to the following formula:
[0077]
[0078] In the formula, m represents a positive integer, x coord,m Indicates the node horizontal coordinate of the mth device in the target system on the canvas, y coord,m Indicates the node vertical coordinate of the mth device on the canvas, x m Indicates the layer number of the mth device, y m Indicates the layer number of the mth device, N width,m Indicates the width of the mth device, N height,m Indicates the height of the mth device, G horizontal Indicates the preset horizontal spacing between devices on the canvas, G vertical Indicates the preset vertical spacing between devices on the canvas.
[0079] In step S32, since there is size information in the visual attributes, the height and width can be conventionally extracted based on the size information. Considering that the size information is static data, in order to make the rendering of node elements more accurate and flexible, the height and width can also be dynamically adjusted according to specific conditions (such as scaling factor or node type, etc.) or actual needs. The horizontal spacing between devices and the vertical spacing between devices are used to ensure that node elements do not overlap, and can be specifically determined by the user according to actual sparse requirements. In addition, the units of the height, the width, the horizontal spacing between devices and the vertical spacing between devices are specifically but not limited to pixels in the canvas. For example, the horizontal spacing between devices and the vertical spacing between devices are 10 pixels respectively.
[0080] S4. For each of the devices, render the corresponding object set as a corresponding visual node element on the canvas and at the position of the corresponding node coordinate.
[0081] In step S4, the React framework (a JavaScript library for building user interfaces originating from an internal Facebook project) and an interactive library (such as Moveable or Selecto) can be used to render nodes on the canvas. Device nodes are drawn based on visual properties and placed at locations specified by node coordinates. Specifically, an interactive canvas can be built based on React, and then efficient node rendering can be achieved using Canvas or SVG, two existing graphics rendering methods.
[0082] S5. Based on the edge sets of the respective devices, connection rendering is further performed on the canvas to obtain visual line elements for connecting the visual node elements.
[0083] In step S5, React and the interactive library can also be specifically used to implement connection rendering on the canvas: Bezier curves or straight lines are used to draw connections between nodes, and dynamic updates of connection paths are supported to adapt to layout adjustments.
[0084] S6. All the visual node elements and all the visual line elements on the canvas are taken as a configuration diagram of the target system and outputted.
[0085] In step S6, the configuration diagram can be output and saved in multiple formats, for example, using JSON (for storing node coordinates, connection relationships and style attributes) format and SVG (as a vector graphics format, supporting high-definition printing and free scaling) format to export the configuration diagram, and store it locally or synchronize it to a cloud database to support fast rendering and version management during subsequent loading; for example, using the canvasStore.save() function to serialize the current canvas element set (i.e., including nodes, lines and styles, etc.) into JSON format or SVG format. In addition, in order to provide a multi-level interactive function to allow the user to fine-tune the automatically generated configuration diagram, preferably, before outputting the configuration diagram of the target system, the method also includes but is not limited to: responding to element-based operations performed by the user from the human-computer interaction interface, adjusting the posture of the visual node element or the visual connection element (i.e., position adjustment and / or posture adjustment), wherein the element-based operations include but are not limited to element dragging operations (specific implementation example: listening for mouse events in the CanvasContent.tsx file, and triggering the onDragEnd event when the dragging ends), element scaling operations or element rotation operations, etc.; and / or responding to element-based operations performed by the user from the human-computer interaction interface. The attribute editing operation performed by the user renders and updates the visual node elements, wherein the attribute editing operation includes but is not limited to a node icon modification operation, a node label modification operation or a node color modification operation, etc.; and / or, in response to a layout optimization operation performed by the user from the human-computer interaction interface, for a plurality of the visual node elements selected for the operation and located in the local area of the layout, the layout algorithm is used to calculate the new node coordinates of the corresponding device on the canvas based on the edge set of the corresponding device and the visual attributes in the object set (which is used to ensure that the adjusted nodes and lines can remain coordinated), and the rendering is updated according to the calculation results (i.e., steps S4 to S5 are re-executed for the corresponding device). The aforementioned interactive function can specifically utilize the Vue3 framework through the CanvasContent component, and combine the Moveable library and the Selecto library to realize the dragging, scaling and selection state processing of the node, thereby rendering interactive elements. In addition, the aforementioned basic element operations can also support batch grouping operations and alignment tools (such as horizontal / vertical alignment).
[0086] Therefore, based on the automatic generation method of the system configuration diagram described in the aforementioned steps S1 to S6, a new solution for automatically generating a complex system configuration diagram based on a physical model file is provided, namely, first, for each device in the target system, the corresponding physical model file is parsed to obtain the corresponding object set and edge set, and then, based on the edge set and the visualization attributes in the object set, the layout algorithm is used to calculate the node coordinates of each device on the canvas, and then, for each device, the corresponding object set is rendered as a corresponding node element at the position on the canvas and located at the corresponding node coordinate, and based on the edge set, connection rendering is also performed on the canvas to obtain the line elements used to connect the node elements, and finally all elements on the canvas are output as the target system configuration diagram. Therefore, by deeply analyzing the nodes and their connection relationships of the physical model and cleverly integrating the layout algorithm with the interactive rendering technology, the automatic and efficient generation and flexible and convenient editing of the configuration diagram are realized, which can effectively solve the shortcomings of the traditional manual drawing method in efficiency and accuracy, reduce labor costs and error risks, and improve scalability and industrial visualization efficiency, facilitating practical application and promotion.
[0087] like Figure 2 As shown, the second aspect of this embodiment provides a virtual device for implementing the method for automatically generating a system configuration diagram according to the first aspect, comprising a model file acquisition unit, a model file parsing unit, a node coordinate calculation unit, a node element rendering unit, a line element rendering unit, and a configuration diagram output unit;
[0088] The model file acquisition unit is used to acquire the physical model file of each device in the target system;
[0089] The model file parsing unit is communicatively connected to the model file acquiring unit and is configured to parse the corresponding object model file for each device to obtain a corresponding object set and edge set, wherein the object set includes a unique identifier, a type, and a visualization attribute, and the edge set includes all outgoing edges with the corresponding device node as a source node and / or all incoming edges with the corresponding device node as a target node;
[0090] The node coordinate calculation unit is communicatively connected to the model file parsing unit and is configured to calculate the node coordinates of each device on the canvas using a layout algorithm based on the edge set of each device and the visualization attributes in the object set;
[0091] The node element rendering unit is communicatively connected to the model file parsing unit and the node coordinate calculation unit, and is used to render the corresponding object set as a corresponding visual node element at a position of the corresponding node coordinate on the canvas for each device;
[0092] The line element rendering unit is communicatively connected to the model file parsing unit and the node element rendering unit, and is used to perform connection rendering on the canvas according to the edge sets of each device to obtain visual line elements for connecting the visual node elements;
[0093] The configuration diagram output unit is communicatively connected to the node element rendering unit and the line element rendering unit, respectively, and is used to output all the visual node elements and all the visual line elements on the canvas as the configuration diagram of the target system.
[0094] The working process, working details and technical effects of the aforementioned device provided in the second aspect of this embodiment can be found in the method for automatically generating a system configuration diagram described in the first aspect, and will not be described in detail here.
[0095] like Figure 3 As shown, the third aspect of the present embodiment provides a computer device for executing the system configuration diagram automatic generation method as described in the first aspect, including a memory, a processor and a transceiver that are sequentially connected in communication, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the system configuration diagram automatic generation method as described in the first aspect. For example, the memory may include, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a flash memory (Flash Memory), a first-in-first-out memory (FIFO) and / or a first-in-last-out memory (FILO), etc.; the processor may include, but is not limited to, a microprocessor of the STM32F105 series. In addition, the computer device may also include, but is not limited to, a power module, a display screen and other necessary components.
[0096] The working process, working details and technical effects of the aforementioned computer device provided in the third aspect of this embodiment can be found in the method for automatically generating a system configuration diagram described in the first aspect, and will not be described in detail here.
[0097] A fourth aspect of this embodiment provides a computer-readable storage medium storing instructions including the method for automatically generating a system configuration diagram as described in the first aspect. Specifically, the computer-readable storage medium stores instructions that, when executed on a computer, execute the method for automatically generating a system configuration diagram as described in the first aspect. The computer-readable storage medium refers to a data storage medium and may include, but is not limited to, a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash drive, and / or a memory stick. The computer may be a general-purpose computer, a dedicated computer, a computer network, or other programmable device.
[0098] The working process, working details and technical effects of the aforementioned computer-readable storage medium provided in the fourth aspect of this embodiment can be found in the method for automatically generating a system configuration diagram as described in the first aspect, and will not be described in detail here.
[0099] A fifth aspect of this embodiment provides a computer program product, including a computer program or instructions, which, when executed by a computer, implements the method for automatically generating a system configuration diagram as described in the first aspect. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0100] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.
Claims
1. A method for automatically generating a system configuration diagram, characterized in that: include: Obtain physical model files for each device in the target system; For each device, parse the corresponding object model file to obtain a corresponding object set and edge set, wherein the object set includes a unique identifier, a type, and a visualization attribute, and the edge set includes all outgoing edges with the corresponding device node as a source node and / or all incoming edges with the corresponding device node as a target node; Calculating node coordinates of each device on the canvas using a layout algorithm according to the edge set of each device and the visualization attributes in the object set; For each of the devices, rendering the corresponding object set as a corresponding visual node element on the canvas and at a position of the corresponding node coordinate; According to the edge sets of the respective devices, connection rendering is further performed on the canvas to obtain visual line elements for connecting the visual node elements; All the visual node elements and all the visual line elements on the canvas are taken as the configuration diagram of the target system and outputted.
2. The method for automatically generating a system configuration diagram according to claim 1, wherein: The layout algorithm adopts a force-directed algorithm, a grid layout algorithm or a regular arrangement algorithm.
3. The method for automatically generating a system configuration diagram according to claim 1, wherein: Calculating node coordinates of each device on the canvas using a layout algorithm according to the edge set of each device and the visualization attributes in the object set includes: According to the edge sets of the respective devices, the respective devices are layered and sorted within the layers to determine the layer number and the sequence number within the layer of the respective devices, wherein the sorting within the layer refers to adjusting the left-to-right order of all devices within the layer by adopting a strategy of minimizing the number of edge crossings; For each device, extract the corresponding height and width from the corresponding visual attributes, and calculate the node coordinates of the corresponding device on the canvas according to the following formula: In the formula, m represents a positive integer, x coord,m Indicates the node horizontal coordinate of the mth device in the target system on the canvas, y coord,m Indicates the node vertical coordinate of the mth device on the canvas, x m Indicates the layer number of the mth device, y m Indicates the layer number of the mth device, N width,m Indicates the width of the mth device, N height,m Indicates the height of the mth device, G horizontal Indicates the preset horizontal spacing between devices on the canvas, G vertical Indicates the preset vertical spacing between devices on the canvas.
4. The method for automatically generating a system configuration diagram according to claim 3, wherein: Layering the devices according to the edge sets of the devices to determine the layer number of the devices includes the following steps S311 to S316: S311. For each device, count the total number of incoming edges in the corresponding edge set, and use the total number as the corresponding current in-degree, and then execute step S312; S312. Initialize integer variable i = 1, and then execute step S313; S313. Add all devices with a current in-degree of zero to the device set of the i-th layer, and then execute step S314; S314. For each device in the device set of the i-th layer, traverse each out-edge in the corresponding edge set in sequence as follows: first determine a device corresponding to the target node of the currently traversed out-edge, then decrement the current in-degree of the device by 1, then determine whether the current in-degree of the device is zero; if so, add the device to the device set of the i+1-th layer and traverse the next out-edge; otherwise, directly traverse the next out-edge, and finally execute step S315; S315. Determine whether the device set of the i+1th layer is an empty set. If so, execute step S316. Otherwise, increment i by 1 and then return to step S314. S316. End the layering, and for each device, use the serial number of the corresponding layer as the corresponding layer number.
5. The method for automatically generating a system configuration diagram according to claim 3, wherein: The edge crossing number minimization strategy includes: Adjust the left-to-right order of all devices in two adjacent layers to minimize the total number of device groups that meet the following edge intersection condition: the device group includes a first device, a second device, a third device, and a fourth device, the first device and the second device are respectively located in one of the two adjacent layers, the third device and the fourth device are respectively located in the other of the two adjacent layers, the first device and the third device are each other's source node and target node of one edge, the second device and the fourth device are each other's source node and target node of another edge, and the left-to-right sequence number of the first device is smaller than the left-to-right sequence number of the second device and the left-to-right sequence number of the third device is greater than the left-to-right sequence number of the fourth device, or the left-to-right sequence number of the first device is greater than the left-to-right sequence number of the second device and the left-to-right sequence number of the third device is smaller than the left-to-right sequence number of the fourth device.
6. The method for automatically generating a system configuration diagram according to claim 1, wherein: Before outputting the configuration diagram of the target system, the method further includes: In response to an element-based operation performed by a user from a human-computer interaction interface, adjusting the posture of the visual node element or the visual link element, wherein the element-based operation includes an element dragging operation, an element scaling operation, or an element rotating operation; and / or, in response to a property editing operation performed by a user from a human-computer interaction interface, rendering and updating the visual node element, wherein the property editing operation includes a node icon modification operation, a node label modification operation, or a node color modification operation; And / or, in response to a layout optimization operation performed by a user from a human-computer interaction interface, for a plurality of said visual node elements selected by the operation and located in the local area of the canvas, the new node coordinates of the corresponding device on the canvas are calculated using the layout algorithm based on the edge set of the corresponding device and the visual attributes in the object set, and rendering is updated according to the calculation results.
7. A system configuration diagram automatic generation device, characterized in that: It includes a model file acquisition unit, a model file parsing unit, a node coordinate calculation unit, a node element rendering unit, a line element rendering unit and a configuration diagram output unit; The model file acquisition unit is used to acquire the physical model file of each device in the target system; The model file parsing unit is communicatively connected to the model file acquiring unit and is configured to parse the corresponding object model file for each device to obtain a corresponding object set and edge set, wherein the object set includes a unique identifier, a type, and a visualization attribute, and the edge set includes all outgoing edges with the corresponding device node as a source node and / or all incoming edges with the corresponding device node as a target node; The node coordinate calculation unit is communicatively connected to the model file parsing unit and is configured to calculate the node coordinates of each device on the canvas using a layout algorithm based on the edge set of each device and the visualization attributes in the object set; The node element rendering unit is communicatively connected to the model file parsing unit and the node coordinate calculation unit, and is used to render the corresponding object set as a corresponding visual node element at a position of the corresponding node coordinate on the canvas for each device; The line element rendering unit is communicatively connected to the model file parsing unit and the node element rendering unit, and is used to perform connection rendering on the canvas according to the edge sets of each device to obtain visual line elements for connecting the visual node elements; The configuration diagram output unit is communicatively connected to the node element rendering unit and the line element rendering unit, respectively, and is used to output all the visual node elements and all the visual line elements on the canvas as the configuration diagram of the target system.
8. A computer device, characterized in that: The invention comprises a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the method for automatically generating a system configuration diagram according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on the computer, the method for automatically generating a system configuration diagram as described in any one of claims 1 to 6 is executed.
10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or the instruction is executed by a computer, the method for automatically generating a system configuration diagram according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Object guidance-based automatic generation method of thematic map of fault site
CN107844620A
Combination primitive development and use method for configuration tool
CN115599365A
System and method of rendering multi-variant graphs
US20170337293A1