Method for generating power electrical system diagram
Through user interaction and data acquisition, the electrical system topology is constructed, and the clustering algorithm and genetic-ant colony hybrid algorithm are used to optimize the layout, which solves the problems of traditional low drawing efficiency and local optimal solutions, and generates high-quality electrical system diagrams to adapt to different system structures and meet user needs.
Patent Information
- Application Number
- CN202510275209.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-10
- Publication Date
- 2025-06-13
AI Technical Summary
Traditional manual drawing of electrical system diagrams is inefficient and prone to errors. Automation software has shortcomings in graphic layout optimization, making it difficult to adapt to various system structures, especially in complex systems, which are prone to fall into local optimal solutions.
Through user interaction and data collection, data cleaning and verification are carried out, the system topology is built, and the clustering algorithm and genetic-ant colony hybrid algorithm are used to optimize the graph layout, and personalized customization is carried out in combination with user preferences.
Generate high-quality electrical system diagrams to avoid local optimal solutions, adapt to different system structures, meet users' personalized needs, and improve work efficiency.
Smart Images

Figure CN120147469A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electric power and electrical engineering, and particularly to a method for generating an electric power and electrical system diagram. Background Art
[0002] In the field of industrial and civil electrical power supply and distribution design, an electrical system diagram is a drawing used to display electrical equipment, electrical circuits, and connection methods, providing important guidance for electrical engineering design. An accurate and clear electrical system diagram helps reduce errors and misunderstandings during construction and ensure the safe operation of the electrical system. When drawing an electric power and electrical system diagram, most are still manually drawn.
[0003] Traditional manual drawing of system diagrams is inefficient and error-prone. Although automated software can improve efficiency, there are obvious shortcomings in graphic layout optimization. Intelligent algorithms are difficult to adapt to various system structures and are prone to falling into local optimal solutions in complex systems. Summary of the Invention
[0004] The purpose of the present invention is to overcome the defects of the prior art and provide a method for generating an electric power and electrical system diagram to solve the problems raised in the above background art.
[0005] A method for generating an electric power and electrical system diagram includes the following steps: User interaction and data collection, data cleaning and verification, system modeling and topological analysis; Based on graph theory, construct device nodes and connection edges with the cleaned and verified data to form an electric power and electrical system topological structure; Clarify the electrical connection sequence, signal flow direction, and logical relationship between devices to generate a topological analysis report; Conduct system structure feature analysis, establish a system structure feature analysis model, and perform in-depth feature extraction on the system from multiple dimensions; Adopt a clustering algorithm to classify different electric power and electrical systems according to the extracted features, and summarize the typical structural characteristics of each type of system; Establish a layout strategy library, and pre-develop multiple layout strategies for different types of system structural characteristics; According to the results of system structure feature analysis, screen out an appropriate initial layout strategy from the layout strategy library, and at the same time set a user preference input interface; Optimize the layout through a hybrid algorithm: Introduce a genetic-ant colony hybrid algorithm; Define a layout rationality index, and calculate the fitness value of each chromosome according to the index; Dynamically adjust the algorithm parameters according to the system structure characteristics and user preferences; Graphic template matching customization, graphic drawing and rendering, graphic editing and optimization, and graphic output and storage.
[0006] Preferably, user interaction and data collection include the following steps: S11: Present the input area in the form of a form, including device name, model, rated parameters, and connection method, and input data using either a drop-down menu or a text box; S12: Batch import device information from either Excel or CSV.
[0007] Preferably, data cleaning and verification include the following steps: S21: Use data cleaning algorithms to identify and eliminate duplicate records in the collected data, and correct incorrect data according to preset verification rules; S22: Build a complete data verification rule library to verify the legality of voltage levels and device parameters.
[0008] Preferably, the multiple dimensions in the deep feature extraction of the system from multiple dimensions include topological structure, device type and quantity, and connection relationship complexity, where the degree distribution of computing nodes is calculated to measure the concentration of the system, and the length and curvature of connection lines are statistically analyzed to evaluate the connection complexity; In the clustering algorithm, either K-Means clustering or hierarchical clustering is selected as the clustering algorithm.
[0009] Preferably, the multiple layout strategies include a decentralized layout strategy for node-intensive systems and a path optimization layout strategy for long-distance connection systems; The user preference input interface in the setting of the user preference input interface is used for the user to adjust the layout tendency according to their own aesthetics and usage habits, and the system customizes the initial layout strategy according to the user preferences.
[0010] Preferably, in the introduction of the genetic-ant colony hybrid algorithm, the positions of graphic elements are encoded as chromosomes, and through operations such as selection, crossover, and mutation, the chromosomes are continuously evolved to find a better layout; In the introduction of the genetic-ant colony hybrid algorithm, ants select paths in the graphic space according to the pheromone concentration and heuristic information, and the update of pheromone is used to guide the ants to find a better layout plan; The rationality index in the definition of the layout rationality index includes element overlap rate, connection line crossing rate, and layout compactness. The genetic algorithm selects excellent chromosomes for the next generation of evolution according to the fitness value, and the ant colony algorithm updates the pheromone concentration according to the fitness value to guide the ants to search for a better path; The algorithm parameters in the dynamic adjustment of algorithm parameters according to system structure characteristics and user preferences include the crossover probability and mutation probability of the genetic algorithm, the pheromone evaporation coefficient and heuristic factor of the ant colony algorithm.
[0011] Preferably, the graphic template matching and customization includes the following steps: S71: Construct a graphic template library, which includes single-line diagrams, three-line diagrams, and floor plans. According to the system type and requirements input by the user, match a suitable graphic template; S72: The user performs personalized customization on the template. The user adjusts the size, color, and style of graphic symbols through the operation interface, and modifies the position and content of the annotations.
[0012] Preferably, the graphic drawing and rendering includes the following steps: S81: Use a drawing library to draw the devices and connection relationships into visual graphics according to the optimized layout strategy and the selected graphic template. The drawing library is a two-dimensional drawing library, and the two-dimensional drawing library is one of Matplotlib or Graphviz; S82: Perform rendering processing on the drawn graphics, and use image processing algorithms to optimize the line quality.
[0013] Preferably, the graphic editing and optimization includes the following steps: S91: Manually adjust the generated system diagram. After the user's manual adjustment, the system records the adjustment operation in real time and inputs it into the layout optimization algorithm as user feedback information to further optimize the layout algorithm.
[0014] S92: After the user completes the manual adjustment, the system automatically starts a local optimization process, and combines the previous layout strategy and the results of the optimization algorithm to re-optimize the graphic layout to ensure the rationality and compactness of the graphic layout.
[0015] Preferably, the graphic output and storage includes the following steps: S101: Output the generated power and electrical system diagram in one of the formats of PDF, JPEG, PNG, SVG. When outputting, provide options for setting the resolution and file size parameters; S102: Store the source data of the system diagram and the generated graphic file in a database. The database adopts a data storage structure, and is one of a relational database or a non-relational database. The relational database is one of MySQL and Oracle, and the non-relational database is MongoDB.
[0016] Advantages of the present invention: The method for generating an electrical power system diagram is data-driven, which converts the electrical power system parameters input by the user into a visual graph. By constructing an accurate system structure feature analysis model, exclusive layout strategies are matched for different systems, and the improved genetic-ant colony hybrid algorithm is used to optimize the graph layout, breaking the bondage of local optimal solutions. A deep learning and real-time feedback mechanism for user preferences is established. According to the user's operation habits and aesthetic needs, the layout effect is continuously optimized, so as to generate a high-quality system diagram. Description of the Drawings
[0017] Figure 1 It is a flowchart of the method for generating an electrical power system diagram of the present invention.
[0018] Figure 2 It is a schematic structural diagram of the electronic device provided by this application. Detailed Embodiments
[0019] As Figure 1 shown, a method for generating an electrical power system diagram includes the following steps: S1: User interaction and data collection. S11: Create a simple and intuitive user interface, present the input area in a clear form, covering comprehensive parameters of the electrical power system such as device name, model, rated parameters, and connection method, and use accurate input controls such as drop-down menus and text boxes to facilitate users to quickly and accurately input data; S12: Develop a data import function to support batch import of device information from common data files such as Excel and CSV. Before import, the system automatically performs strict format checks, clearly prompts the data that does not meet the format requirements, and provides a detailed data preview for the user to confirm the data accuracy. S2: Data cleaning and verification. S21: Use advanced data cleaning algorithms to accurately identify and eliminate duplicate records in the collected data, correct incorrect data according to preset verification rules, and prominently mark and promptly inform the user of the invalid data that cannot be corrected; Data cleaning is a key step to ensure data quality in the process of generating an electrical power system diagram. This process will use a series of advanced data cleaning algorithms to comprehensively process the collected device information data, mainly including identifying and eliminating duplicate records, correcting incorrect data according to preset rules, and marking and feedbacking the invalid data that cannot be corrected.
[0020] To accurately identify duplicate records, multiple key attributes of device information are comprehensively considered. For the data of power and electrical systems, the device name, model, and rated parameters are important bases for judging whether records are duplicates. For example, if the device names in two records are exactly the same, the models are consistent, and the rated parameters (such as voltage, current, power, etc.) are also the same, then these two records can be determined as duplicate records.
[0021] At the same time, to avoid misjudging duplicate records due to format differences during data entry, the data will be standardized before comparison. For example, unify the case in the device name, remove redundant spaces and special characters; for the rated parameters, convert them to a unified unit and precision.
[0022] After identifying duplicate records, one of the records will be retained, and the remaining duplicate records will be removed from the dataset. To ensure the traceability of data processing, relevant information of the removed duplicate records will be detailedly recorded, including the original content of the record, the data source file where it is located, and the removal time, etc.
[0023] The preset verification rules are formulated according to the standards of the power and electrical industry and actual business requirements. These rules cover aspects such as the reasonable range of device parameters and the standardization of data formats. For example, for the voltage level, a reasonable value range (such as 220V, 380V, 10kV, etc.) will be set according to common power system voltage standards; for the device model, it will be stipulated that it must conform to specific coding rules.
[0024] At the same time, the association relationships between the rules are also established. For example, there is a certain mathematical relationship between the rated current and power of some devices. When one of the parameters does not conform to this relationship, it can be judged that the parameter may be incorrect.
[0025] When it is found that the data does not conform to the preset verification rules, corresponding correction methods will be adopted according to different situations. For some simple format errors, such as spelling mistakes and decimal point position errors during data entry, they can be automatically corrected through preset replacement rules. For example, replace the common spelling mistake "Vlotage" with "Voltage".
[0026] For errors caused by incomplete data entry, an attempt will be made to obtain the missing information from other relevant records for supplementation. For example, if the rated power of a device is missing in a certain record, but the corresponding rated power value can be found from other complete records through the device model, it can be supplemented to this record.
[0027] For some complex errors, such as when the parameter value exceeds the reasonable range and the correct value cannot be determined by other means, manual intervention will be used for correction. The system will mark these error data and provide detailed error information and relevant reference data for professionals to judge and correct.
[0028] When the data does not conform to the preset verification rules and cannot be processed by the above correction methods, it will be determined as invalid data. For example, if the rated parameters of the equipment show obviously unreasonable values (such as negative voltage) and no relevant reference information can be found in the dataset to determine the correct value, then the data is considered invalid.
[0029] For invalid data, it will be prominently marked in the dataset, such as using a specific color or symbol for identification, so that users can quickly identify it. At the same time, a notification will be sent to the user in a timely manner to inform them of the existence of invalid data. The notification content will detail the specific location of the invalid data (such as the data source file, record number, etc.), error information, and possible impacts, facilitating further processing by the user. The user can choose to ignore these invalid data according to the actual situation or re-collect relevant data for supplementation and correction.
[0030] S22: According to the standards and specifications of the power and electrical industry, construct a complete data verification rule library to strictly verify the legality of data such as voltage levels and equipment parameters, ensure that the data conforms to the standard series and reasonable range, and guarantee the accuracy and integrity of the data. S3: System modeling and topology analysis. S31: Based on graph theory, construct device nodes and connection edges with the cleaned and verified data to form an accurate topological structure of the power and electrical system; S32: Use topological analysis algorithms such as depth-first search algorithm and breadth-first search algorithm to clarify the electrical connection sequence, signal flow direction, and logical relationship between devices, and generate a detailed topological analysis report, providing a solid basis for subsequent graphic layout. The depth-first search algorithm is an algorithm used to traverse or search a tree or graph. In the topological structure of the power and electrical system, starting from a starting device node, visit the nodes as deep as possible along a path until unable to continue, then backtrack to the previous node and continue to explore other paths.
[0031] Specific steps: Initialization: Mark all device nodes as unvisited.
[0032] Select a starting device node and mark it as visited.
[0033] Depth-first search process: For the currently accessed device node, check all the edges connected to it.
[0034] For each connecting edge, find the other device node connected to it.
[0035] If the node has not been visited, mark it as visited and recursively perform a depth - first search on this node.
[0036] Determine the electrical connection order: During the depth - first search process, record the order of node access, which can reflect the electrical connection order between devices. For example, the nodes visited first may be in a more upstream position in the electrical connection.
[0037] Determine the signal flow direction: Combined with the characteristics of the power electrical system, determine the signal flow direction according to the type and connection method of the devices. For example, for power supply devices, the signal usually flows from the power supply node to the load node.
[0038] In the depth - first search, clarify the propagation path of the signal in the system by recording the direction of the edges and the type of the nodes.
[0039] Determine the logical relationship: Analyze the connection and functional relationships between devices to determine the logical relationship. For example, some devices may be in series relationship, and some devices may be in parallel relationship.
[0040] Identify these logical relationships through the access situation of nodes and edges during the depth - first search process.
[0041] Generate a topology analysis report: Record the key information during the depth - first search process, including the order of node access, signal flow direction, logical relationship, etc.
[0042] Organize this information into a detailed topology analysis report, which can include charts and text descriptions to visually display the electrical connection order, signal flow direction, and logical relationship between devices.
[0043] The breadth - first search algorithm is an algorithm used to traverse or search a tree or graph. It starts from the starting node and visits the nodes layer by layer, first visiting all the nodes closest to the starting node, and then visiting the nodes farther away in turn.
[0044] Specific steps: Initialization: Mark all device nodes as unvisited.
[0045] Create a queue, add the starting device node to the queue, and mark it as visited at the same time.
[0046] Breadth - First Search Process: When the queue is not empty, take out a node from the queue.
[0047] For this node, check all the edges connected to it.
[0048] For each connected edge, find the other device node connected to it.
[0049] If the node has not been visited, mark it as visited and add it to the queue.
[0050] Determine the electrical connection order: During the breadth - first search process, according to the order in which nodes enter the queue, the electrical connection order between devices can be determined. Nodes that enter the queue first may be closer to the starting node in terms of electrical connection.
[0051] Determine the signal flow direction: Similarly, combined with the characteristics of the power and electrical system, determine the signal flow direction according to the types and connection methods of devices. In the breadth - first search, by analyzing the hierarchical relationship of nodes and the direction of edges, clarify the propagation path of signals in the system.
[0052] Determine the logical relationship: Analyze the connection and functional relationships between devices to determine the logical relationship. For example, nodes on the same layer may have a parallel relationship, and nodes on different layers may have a series relationship.
[0053] Identify these logical relationships through the access situation of nodes and edges during the breadth - first search process.
[0054] Generate a topology analysis report: Record the key information during the breadth - first search process, including the access order of nodes, signal flow direction, logical relationship, etc.
[0055] Organize this information into a detailed topology analysis report. The report can include charts and text descriptions to visually display the electrical connection order, signal flow direction, and logical relationship between devices.
[0056] To more comprehensively and accurately clarify the electrical connection order, signal flow direction, and logical relationship between devices, the depth - first search algorithm and the breadth - first search algorithm can be used in combination. S4: Conduct system structure feature analysis. S41: Establish a comprehensive system structure feature analysis model, and perform in - depth feature extraction on the system from multiple dimensions such as topological structure, device types and quantities, and connection relationship complexity. For example, accurately calculate the node degree distribution to measure the concentration of the system, and detailedly count the connection line length and curvature to evaluate the connection complexity; S42: Adopt efficient clustering algorithms such as K-Means clustering and hierarchical clustering to classify different power and electrical systems according to the extracted features, and summarize the typical structural characteristics of each type of system. When using the K-Means clustering algorithm to classify power and electrical systems, the number of clusters K needs to be determined first. This requires combining the actual situation and experience of power and electrical systems to judge. For example, through the preliminary analysis of a large amount of historical power and electrical system data, it is found that the common system structures can be roughly divided into 3 - 5 types, then the K value can be set within this range for trial. For features such as the topological structure, equipment type and quantity, and connection relationship complexity extracted from the system, their numerical values are used as the input data for the K-Means clustering algorithm. Taking the topological structure feature as an example, after calculating the node degree distribution, statistical quantities such as the mean and variance of the node degrees of each system are used as the quantization values of this feature; for the equipment type and quantity, the proportion of the quantity of different types of equipment is counted as the feature value; the connection relationship complexity is reflected by the statistical values of the connection line length and curvature. After the algorithm starts, K initial clustering centers are randomly selected. These centers represent the "templates" of the initial various power and electrical system structures. Each data point of the power and electrical system will be assigned to the cluster to which the nearest clustering center belongs according to the distance (usually the Euclidean distance) from these K clustering centers. After the assignment is completed, the mean of the data points within each cluster is recalculated, and this mean is used as the new clustering center. This process of data point assignment and clustering center update is continuously repeated until the clustering centers no longer change significantly, that is, the algorithm converges. After multiple iterations of convergence, the power and electrical systems within different clusters have similar structural characteristics. For example, the systems within a certain cluster may all have a relatively high mean node degree, which means that the equipment connections in these systems are relatively concentrated, showing a node-intensive structural characteristic; the systems within another cluster may have a relatively long mean connection line length and a relatively large statistical value of curvature, indicating that these systems belong to a long-distance connection type of system structure. The hierarchical clustering algorithm is divided into two types: agglomerative and divisive. Here, the application of the agglomerative hierarchical clustering in the classification of power and electrical systems is illustrated. Similarly, first numericalize the various features extracted from the power and electrical systems. Initially, each data point of the power and electrical system is regarded as a separate class. Then, calculate the distance between every two classes (different distance measurement methods such as single-link, complete-link, and average-link can be used. In the classification of power and electrical systems, if more attention is paid to the overall similarity of the system structure, the average-link method is more appropriate). According to the distance measurement, the two classes with the closest distance are merged into a new class. As the merging process progresses, the number of classes gradually decreases, and a clustering hierarchy is formed. This structure can be represented by a dendrogram. In the dendrogram, the lower-level nodes represent the original individual system data points, and the higher-level nodes represent the merged classes. By observing the dendrogram, the similarity and classification among different power and electrical systems can be intuitively seen. For example, on a certain branch of the dendrogram, several power and electrical systems are merged together at a lower level, indicating that these systems have relatively similar structural characteristics. Further analyzing the characteristic data of these systems, it may be found that they have similar proportions of equipment types in terms of equipment type and quantity characteristics. For example, they are mainly composed of a certain type of transformer and switchgear. The typical structural characteristics of these systems in terms of equipment composition can be summarized. At the same time, by analyzing the topological structure and the complexity characteristics of the connection relationship of these systems, the commonalities in their overall layout and line connection can be summarized. For example, they may all adopt a ring topology structure and the connection lines are relatively simple and other typical structural characteristics. S5: Formulate personalized layout strategies. S51: Establish a rich layout strategy library. For the structural characteristics of different types of systems, formulate multiple layout strategies in advance. For example, for node-intensive systems, adopt a decentralized layout strategy, and for long-distance connection systems, adopt a path optimization layout strategy; S52: According to the analysis results of the system structure characteristics, screen out the appropriate initial layout strategy from the layout strategy library. At the same time, set up a user preference input interface. Users can select or adjust the layout tendency according to their own aesthetics and usage habits, such as preferring horizontal layout or vertical layout, the size of the equipment spacing. The system combines the user preferences to customize the initial layout strategy. S6: Optimize the layout through a hybrid algorithm. S61: Introduce a genetic-ant colony hybrid algorithm. Regard the graphic layout process as a complex optimization process. In the genetic algorithm part, encode the positions of the graphic elements as chromosomes, and through operations such as selection, crossover, and mutation, continuously evolve the chromosomes to find a better layout. In the ant colony algorithm part, ants select paths in the graphic space according to the pheromone concentration and heuristic information, and update the pheromone to guide the ants to find a better layout plan. The two cooperate with each other to improve the layout optimization effect; S62: Define accurate layout rationality indicators, such as element overlap rate, connection line crossing rate, layout compactness. Calculate the fitness value of each chromosome (layout plan) according to these indicators. The genetic algorithm selects excellent chromosomes for the next generation of evolution according to the fitness value, and the ant colony algorithm updates the pheromone concentration according to the fitness value to guide the ants to search for better paths; S63: During the operation of the algorithm, the algorithm parameters are dynamically adjusted according to the system structure characteristics and user preferences, such as the crossover probability and mutation probability of the genetic algorithm, and the pheromone evaporation coefficient and heuristic factor of the ant colony algorithm, to improve the adaptability of the algorithm to different systems and user requirements. In this implementation, the element overlap rate: In the electrical power system diagram, elements such as devices and graphic symbols should not overlap with each other, otherwise it will affect the clarity and readability of the drawing. When calculating the element overlap rate, it is necessary to traverse all graphic elements and check whether there is an overlapping area between every two elements. Taking the device graphic represented by a rectangle as an example, if the coordinate ranges of two rectangles have an intersection, it is considered that these two device elements overlap. Dividing the number of all overlapping element pairs by the total number of element pairs, the element overlap rate can be obtained. For example, there are 100 device elements in the system diagram, and after inspection, it is found that there are 5 pairs of overlapping elements, then the element overlap rate is 5÷(100×(100 - 1)÷2)×100%, approximately 0.1%. A lower element overlap rate means that the layout scheme is more reasonable in terms of element placement. In this implementation, the connection line crossing rate: The crossing of connection lines will make the logical relationship of the system diagram more complex and increase the difficulty of understanding. To calculate the connection line crossing rate, it is necessary to count the number of crossing points between all connection lines. For every two connection lines, judge whether their line segments in the drawing space intersect. For example, use a line segment intersection detection algorithm to judge whether there is an intersection according to the endpoint coordinates of the line segments. Divide the total number of crossing points by the maximum number of possible crossing points that the connection lines can generate, and the connection line crossing rate is obtained. Suppose there are 20 connection lines in the system diagram, and after calculation, there are 3 crossing points, while theoretically 20 lines can generate at most (20×(20 - 1)÷2) = 190 crossing points, then the connection line crossing rate is 3÷190×100%, approximately 1.6%. The lower the connection line crossing rate, the more conducive the layout scheme is to clearly showing the connection relationship of the system. In this implementation, the layout compactness: The layout compactness is used to measure the distribution compactness of all elements in the system diagram within the drawing space. One calculation method is to first calculate the area of the minimum bounding rectangle of all elements, and then compare it with the available area of the entire drawing. Suppose the area of the minimum bounding rectangle formed by all devices and connection lines is S1, and the actual available area of the drawing is S2, then the layout compactness = S1÷S2×100%. If the layout compactness is close to 100%, it means that the elements are densely distributed within the drawing and the space utilization rate is high; if the layout compactness is too low, it may result in a large amount of blank space in the drawing and the layout is not reasonable. For example, the available area of the drawing is 10000 square units, and the area of the minimum bounding rectangle of the elements is 6000 square units, then the layout compactness is 60%.
[0057] In this implementation, the fitness value is calculated according to the indicators and the algorithm optimization process: Genetic algorithm: After encoding each layout plan into a chromosome, according to the element overlap rate, connection line crossing rate, and layout compactness indicators defined above, calculate the fitness value for each chromosome. The calculation of the fitness value can adopt the method of weighted summation, and corresponding weights are assigned according to the importance of different indicators. For example, assume the weight of the element overlap rate is 0.4, the weight of the connection line crossing rate is 0.3, and the weight of the layout compactness is 0.3. The element overlap rate corresponding to a certain chromosome is 0.2%, the connection line crossing rate is 2%, and the layout compactness is 70%. Then its fitness value = 0.4×(1 - 0.002) + 0.3×(1 - 0.02) + 0.3×0.7 = 0.4×0.998 + 0.3×0.98 + 0.3×0.7 = 0.3992 + 0.294 + 0.21 = 0.9032. The higher the fitness value, the closer the layout plan is to the ideal state. In the selection operation of the genetic algorithm, according to the high and low fitness values, excellent chromosomes will be selected with a higher probability for the next generation of evolution, so that the excellent genes in the population can be retained and transmitted, and the layout plan can be gradually optimized. In this implementation, ant colony algorithm: Ants choose paths in the graphic space according to the pheromone concentration and heuristic information, and the heuristic information can be related to the layout rationality index. For example, when ants choose the direction of the connection line, they will tend to choose the direction that makes the connection line crossing rate lower and the layout more compact. When an ant completes a path search and forms a layout plan, update the pheromone concentration according to the fitness value of this plan. If the fitness value of the layout plan is high, it means that this path performs well, then increase the pheromone concentration on the path passed by the ant; on the contrary, if the fitness value is low, reduce the pheromone concentration. In this way, as the iteration progresses, the pheromone concentration will guide ants to search more for paths with high fitness values, that is, better layout plans. Genetic algorithm parameter adjustment: Crossover probability: In a node-intensive power and electrical system, due to the complex system structure, more new layout combinations need to be explored. At this time, the crossover probability can be appropriately increased, such as from the default 0.7 to 0.85, so that more different combinations can be generated during the crossover operation of chromosomes, increasing the possibility of finding a better layout. For a system with a relatively simple structure and clear connection relationships, the crossover probability can be appropriately reduced to around 0.6 to prevent the destruction of excellent genes due to excessive crossover. Mutation probability: If there are some special devices or connection relationships in the system with strict requirements for layout, when it is found that the genetic algorithm falls into a local optimal solution, the mutation probability can be appropriately increased, for example, from 0.01 to 0.03, to prompt more mutations in chromosomes and jump out of the local optimum. For a conventional system, the mutation probability is kept at a low level to ensure the stability of the algorithm. Ant colony algorithm parameter adjustment: Pheromone evaporation coefficient: In a long-distance connection type system, due to the long connection lines, the propagation and accumulation of pheromones are relatively slow. To enable ants to adapt to new layout information faster, the pheromone evaporation coefficient can be appropriately increased, such as from 0.5 to 0.7, to accelerate the pheromone update speed and prevent ants from relying too much on the old pheromone paths. For a short-distance and compact system, the pheromone evaporation coefficient can be maintained between 0.3 and 0.4, enabling ants to make better use of the accumulated pheromones. Heuristic factor: If the user prefers a simple and clear layout, that is, pays more attention to the connection line crossing rate and layout compactness, the weights related to these two indicators in the heuristic factor can be increased. For example, the weight of the heuristic factor related to the connection line crossing rate is increased from 0.4 to 0.6, so that ants are more inclined to reduce the connection line crossing and improve the layout compactness when choosing paths, thereby generating a layout plan that meets the user's preferences. If the user has special requirements for the layout of certain specific elements of the system diagram, the heuristic factor can be adjusted accordingly to guide ants to give priority to meeting these requirements.
[0058] S7: Graphic template matching and customization. S71: Build a comprehensive graphic template library, including common power and electrical system diagram templates such as single-line diagrams, three-line diagrams, and floor plans, and automatically match the most suitable graphic template according to the system type and requirements input by the user; S72: The user can customize the template. The user can adjust the size, color, and style of graphic symbols through the operation interface, and modify the position and content of annotations to meet the special requirements of different projects.
[0059] S8: Graphic drawing and rendering. S81: Using professional drawing libraries (such as Matplotlib, Graphviz), draw the devices and connection relationships into visual graphs according to the optimized layout strategy and selected graph templates. The drawing process strictly follows the graph symbol standards of the electric power and electrical industry (such as GB / T 4728) to ensure the standardization and readability of the graphs. S82: Perform rendering processing on the drawn graphs. Use image processing algorithms to optimize the line quality, such as using anti-aliasing algorithms to make the lines smoother, adjusting the filling colors to make the graph colors coordinated, and optimizing the text layout to ensure clear and easy-to-read annotations, thus enhancing the aesthetics of the graphs. S9: Graph editing and optimization. S91: Provide graph editing functions, allowing users to manually adjust the generated system diagrams, such as moving the device positions, modifying the connection lines, and adding annotations. After the user's manual adjustment, the system records the adjustment operations in real time and inputs them into the layout optimization algorithm as user feedback information to further optimize the layout algorithm. S92: Implement the automatic optimization function. When the user finishes the manual adjustment, the system automatically starts the local optimization process. Combining the previous layout strategy and the results of the optimization algorithm, it re-optimizes the graph layout to ensure the rationality and compactness of the graph layout. S10: Graph output and storage. S101: Output the generated electric power and electrical system diagrams in multiple common formats such as PDF, JPEG, PNG, and SVG to meet the needs of users for printing, sharing, and archiving. When outputting, provide options for setting parameters such as resolution and file size to facilitate users to select appropriate output configurations according to actual uses. S102: Store the source data of the system diagrams and the generated graph files in a database. The database adopts a reliable data storage structure, such as a relational database (MySQL, Oracle) or a non-relational database (MongoDB), for easy subsequent querying, modification, and version management. At the same time, establish a data backup mechanism to regularly back up the database to ensure data security.
[0060] In summary: The method for generating electric power and electrical system diagrams adapts to different system structures: Through the system structure feature analysis model and clustering algorithm, accurately identify the structural characteristics of different electric power and electrical systems, and match targeted layout strategies from the layout strategy library, enabling the layout algorithm to better adapt to various system structures and avoiding layout irrationality caused by system uniqueness. The method for generating electric power and electrical system diagrams avoids local optimal solutions: Introduce a genetic-ant colony hybrid algorithm, utilize the global search ability of the genetic algorithm and the positive feedback mechanism of the ant colony algorithm to break the limitation of local optimal solutions, continuously optimize the graph layout, and improve the rationality of the graph layout of complex systems. The method for generating electrical power system diagrams meets personalized requirements: by setting up a user preference input interface, collecting information on the user's aesthetics and usage habits regarding the graphic layout, customizing the layout strategy according to the user's preferences, and at the same time, taking the user's manual adjustment operations as feedback information to further optimize the layout algorithm, so that the generated system diagrams can better meet the user's personalized needs, reduce the time for manual adjustment by the user, and improve work efficiency.
[0061] Therefore, through data-driven means, the electrical power system parameters input by the user are transformed into visual graphics. By constructing an accurate system structure feature analysis model, exclusive layout strategies are matched for different systems, and the improved genetic-ant colony hybrid algorithm is used to optimize the graphic layout, breaking the bondage of local optimal solutions. A deep learning and real-time feedback mechanism for user preferences is established, and the layout effect is continuously optimized according to the user's operation habits and aesthetic needs, so as to generate high-quality system diagrams.
[0062] Figure 2 The structural schematic diagram of an electronic device 40 that can be used to implement the embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0063] As Figure 2 shown, the electronic device 40 includes at least one processor 41, and a memory communicatively connected to the at least one processor 41, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc. Among them, the memory stores a computer program executable by the at least one processor. The processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 into the random access memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the electronic device 40 can also be stored. The processor 41, the ROM 42, and the RAM 43 are connected to each other through a bus 44. The input / output (I / O) interface 45 is also connected to the bus 44.
[0064] Multiple components in the electronic device 40 are connected to the I / O interface 45, including: an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a disk, an optical disc, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0065] The processor 41 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The processor 41 executes the various methods and processes described above, such as the method for generating an electrical power system diagram.
[0066] In some embodiments, the method for generating an electrical power system diagram can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as the storage unit 48. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the method for generating an electrical power system diagram described above can be executed.
[0067] It should be noted that the various embodiments in this specification are described in a progressive manner. The same or similar parts among the various embodiments can be referred to each other, and the differences between each embodiment and other embodiments are emphasized. A person of ordinary skill in the art can understand and implement it without creative work.
Claims
1. A method for generating a power electrical system diagram, characterized in that: Includes steps: User interaction and data collection, data cleaning and verification, system modeling and topology analysis; The cleaned and verified data is constructed based on graph theory to construct device nodes and connection edges to form the topology of the power electrical system; Clarify the electrical connection sequence, signal flow and logical relationship between devices, and generate a topology analysis report; Conduct system structure feature analysis, establish a system structure feature analysis model, and perform in-depth feature extraction of the system from multiple dimensions; Clustering algorithms are used to classify different power and electrical systems based on the extracted features, and the typical structural characteristics of each type of system are summarized; Establish a layout strategy library and formulate multiple layout strategies in advance according to the structural characteristics of different types of systems; According to the results of the system structure feature analysis, an appropriate initial layout strategy is selected from the layout strategy library, and a user preference input interface is set; Optimizing layout through hybrid algorithms: Introducing genetic-ant colony hybrid algorithm; Define the layout rationality index and calculate the fitness value of each chromosome based on the index; Dynamically adjust algorithm parameters based on system structure characteristics and user preferences; Graphic template matching customization, graphics drawing and rendering, graphics editing and optimization, and graphics output and storage.
2. A method for generating a power electrical system diagram according to claim 1, characterized in that: User interaction and data collection include the following steps: S11: The input area is presented in a form, including the device name, model, rated parameters, and connection method, and data is input using a drop-down menu or a text box; S12: Import device information in batches from either Excel or CSV.
3. A method for generating a power electrical system diagram according to claim 1, characterized in that: Data cleaning and verification includes the following steps: S21: Use data cleaning algorithms to identify and remove duplicate records in the collected data, and correct erroneous data according to preset verification rules; S22: Build a complete data validation rule base to verify the legality of voltage levels and equipment parameters.
4. A method for generating a power electrical system diagram according to claim 1, characterized in that: The multiple dimensions in which the system is deeply characterized from multiple dimensions include topological structure, device type and quantity, and connection relationship complexity, wherein the node degree distribution is calculated to measure the concentration of the system, and the length and curvature of the connection line are counted to evaluate the connection complexity; The clustering algorithm used in the clustering algorithm is selected from either K-Means clustering or hierarchical clustering.
5. The method for generating a power electrical system diagram according to claim 1, characterized in that: The multiple layout strategies include a decentralized layout strategy for a node-intensive system and a path optimization layout strategy for a long-distance connection system; The user preference input interface in the setting user preference input interface is used for users to adjust the layout tendency according to their own aesthetics and usage habits.
6. A method for generating a power electrical system diagram according to claim 1, characterized in that: The genetic-ant colony hybrid algorithm is introduced to encode the positions of graphic elements into chromosomes, and the chromosomes are continuously evolved through selection, crossover and mutation operations to find a better layout; The ants in the introduced genetic-ant colony hybrid algorithm select paths in the graph space according to pheromone concentration and heuristic information, and guide the ants to find a better layout solution through the update of pheromones; The rationality indicators in the definition of layout rationality indicators include element overlap rate, connection line crossing rate, and layout compactness. The genetic algorithm selects excellent chromosomes for next generation evolution according to the fitness value, and the ant colony algorithm updates the pheromone concentration according to the fitness value to guide ants to search for a better path. The algorithm parameters dynamically adjusted according to system structure characteristics and user preferences include the crossover probability and mutation probability of the genetic algorithm, the pheromone volatility coefficient and the heuristic factor of the ant colony algorithm.
7. A method for generating a power electrical system diagram according to claim 1, characterized in that: Graphic template matching and customization includes the following steps: S71: Build a graphic template library, which includes single-line diagrams, three-line diagrams, and floor plan diagrams. According to the system type and requirements input by the user, a suitable graphic template is matched; S72: The user customizes the template. The user adjusts the size, color, and style of the graphic symbol and modifies the position and content of the annotation through the operation interface.
8. A method for generating a power electrical system diagram according to claim 1, characterized in that: Graphics drawing and rendering includes the following steps: S81: using a drawing library according to the optimized layout strategy and the selected graphic template, wherein the drawing library is a two-dimensional drawing library, and the two-dimensional drawing library is one of Matplotlib or Graphviz, to draw the device and the connection relationship into a visual graphic; S82: Rendering the drawn graphics, and optimizing line quality using image processing algorithms.
9. The method for generating a power electrical system diagram according to claim 1, characterized in that: Graphics editing and optimization includes the following steps: S91: Manually adjust the generated system diagram. After the user manually adjusts the diagram, the system records the adjustment operation in real time and inputs the adjustment operation into the layout optimization algorithm as user feedback information to further optimize the layout algorithm. S92: After the user completes the manual adjustment, the system automatically starts the local optimization process, combines the previous layout strategy and optimization algorithm results, and optimizes the graphic layout again to ensure the rationality and compactness of the graphic layout.
10. The method for generating a power electrical system diagram according to claim 1, characterized in that: Graphics output and storage includes the following steps: S101: output the generated power and electrical system diagram in one of the formats of PDF, JPEG, PNG, and SVG, and provide resolution and file size parameter setting options when outputting; S102: The source data of the system diagram and the generated graphic file are stored in a database. The database adopts a data storage structure and adopts one of a relational database and a non-relational database. The relational database is one of MySQL and Oracle, and the non-relational database is MongoDB.
Citation Information
Cited By
Method and system for intelligently generating GIS circuit diagram based on electric power tube bank engineering drawing
CN120832736A