Method and apparatus for automatically adapting matrix topology to generate visualizations of operational matrices

CN122528800BActive Publication Date: 2026-10-09成都华兴汇明科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611034216.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-07-13
Publication Date
2026-10-09
Estimated Expiration
2046-07-13

AI Technical Summary

Technical Problem

传统方式必须依据Visio设计图在另外的控制软件或硬件面板上重建控制逻辑,不仅操作链路长,还容易因图纸与控制程序不一致而引入错误,无法实现所见即所得的实时可视化控制

Benefits of technology

本发明通过直接加载已有矩阵链路拓扑图的Visio源文件,自动解析源文件中所有图形的属性信息, 在此基础上,通过对各形状集合内元素的绝对位置、相对位置、形状样式、数量、方向、连接点及端口分布等特征的深度计算,自动将分散的形状组合匹配为SPST、SPDT、DPDT、衰减器、移相器、环形器等已知控件类型并生成可交互的矩阵开关控件,生成控件后,进一步自动遍历连接线条,同步构建控件端口间的链路配置关联关系表,并依据预设协议码表自动生成各端口切通的控制指令集,将拓扑展示、链路配置与指令生成一体化完成,使矩阵链路具备实时可控能力,使原本仅能静态展示的界面升级为可对每个矩阵元素进行实时操控的控制界面,真正实现了所见即所得的可视化控制。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122528800B_ABST
    Figure CN122528800B_ABST
Patent Text Reader

Abstract

The application discloses a method and device for automatically adapting a matrix topology graph to generate a visual operation matrix, relates to the technical field of computer software processing, and comprises the following steps: analyzing a Visio source file of a matrix link topology graph to obtain each graphical element in the matrix link topology graph and corresponding attributes of the graphical element; traversing each graphical element and the corresponding attributes of the graphical element; storing all graphical elements capable of constituting a closed area in a graphical element combination; re-arranging and combining all graphical elements in each graphical element combination; matching the re-arranged and combined graphical elements with a preset standard control model library; selecting a matrix switch control with the highest matching degree; binding corresponding protocol control instructions according to the association relationship between the ports of the matrix switch control; and generating a control instruction set for controlling each matrix link in the matrix link topology graph. The link topology graph, which is only used for interface display, is converted into a link topology graph that can respond to user operations, link switching instructions are automatically generated, and visual operation on the matrix link is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer software processing technology, and more specifically to a method and apparatus for automatically adapting matrix topology graphs to generate visual operation matrices. Background Technology

[0002] In the design of matrix switching control systems, Visio is typically used to draw the matrix topology schematic, which is then converted into a SAMA diagram to meet standardized display requirements. This conversion essentially merely migrates the topology from one visualization interface to another. The resulting SAMA diagram presents only a static display; all matrix elements on the diagram—including input / output nodes, cross-connections, and signal routing—are not interactively manipulated or can be switched. It is essentially just a display interface, not a control interface. When adjustments to the links or debugging are needed, one must return to Visio, modify the original file, and convert it again, completely separating display from control.

[0003] When performing real-time dynamic switching simulation of the input / output channels of a matrix topology schematic, the traditional approach requires rebuilding the control logic on separate control software or hardware panels based on the Visio design. This not only results in a long operational chain but is also prone to errors due to inconsistencies between the drawings and the control program, failing to achieve WYSIWYG real-time visual control. Furthermore, designers have long used Visio, and a large number of existing projects use Visio format for their matrix drawings, with users often directly providing Visio designs. Redrawing the matrix topology using other software would incur significant duplication of effort and learning costs, and it would be difficult to guarantee that the control interface would be completely consistent with the original design. Summary of the Invention

[0004] The purpose of this invention is to provide a method and apparatus for automatically adapting a matrix topology diagram to generate a visual operation matrix. By generating a control instruction set, an interactive visual matrix link topology diagram is obtained. The method automatically generates link switching instructions in response to user clicks on controls, avoiding repeated drawing in the control software and realizing real-time visual operation matrix links.

[0005] To achieve the above objectives, this application proposes the following solution: On one hand, the present invention provides a method for automatically adapting a matrix topology graph to generate a visual operation matrix, specifically including the following steps: S1. Parse the Visio source file of the matrix link topology diagram to obtain each graphical element in the matrix link topology diagram and its corresponding attributes, and store them in the element set table. S2. Traverse each graphic element and its corresponding attributes in the element set table, identify all graphic elements that can form a closed area and store them in a graphic element combination to obtain several graphic element combinations. S3. Rearrange all graphic elements in each graphic element combination to obtain the corresponding matrix switch shape. Match the matrix switch shape with the preset standard control model library, select the standard control model with the highest matching degree, generate the corresponding matrix switch control and store it in the control collection. S4. Generate a table of link configuration associations between ports of each matrix switch control based on the link connection relationship between each matrix switch control; S5. According to the preset switch control protocol code table, match the switch control protocol code table with the link configuration association table, bind the corresponding protocol control instructions according to the association relationship between the ports of each matrix switch control, and generate a control instruction set for controlling each matrix link in the matrix link topology diagram.

[0006] In some specific technical solutions, the attributes include the shape style, starting coordinates, ending coordinates, and shape parameters of the graphic elements. The specific process of obtaining a combination of several graphic elements is as follows: S21. Select the largest graphic element from all graphic elements as the canvas area; S22. Traverse each graphic element within the canvas area. When the shape of the traversed graphic element is rectangular, directly read its starting and ending coordinates as the coordinate range of the closed area. S23. When the shape of the traversed graphic element is a line and the line does not fall within the coordinate range of the rectangle, then perform closed-loop tracing starting from the current line, filter out the line combinations that can form a closed area and mark them as boundary lines, and obtain the coordinate range of the line combinations. S24. Continue traversing and store all graphic elements whose starting and ending coordinates fall within the same coordinate range into a graphic element combination, ultimately obtaining several image element combinations.

[0007] In some specific technical solutions, the process of selecting the combination of lines that can form a closed area is as follows: S231. Using the termination coordinates of the current traversal's initial line as the current connection point, store the current traversal's initial line into the line combination. S232. In each graphic element with the shape style of line, find the next line whose starting or ending coordinates are connected to the current connection point. If it exists, store the next line in the line group, and then continue to search with the endpoint of the next line that is not connected to the connection point as the current connection point. S233. Repeat step S232 until the end coordinate of the found line connects with the start coordinate of the initial line. Then determine that all lines in the line combination can form a closed area and mark all lines in the line combination as boundary lines.

[0008] In some specific technical solutions, the process of generating the corresponding matrix switch control is as follows: S31. For each combination of graphic elements, select the graphic element that encloses its corresponding closed region as the envelope boundary, and calculate the relative positional relationship of other graphic elements with respect to the envelope boundary. S32. Classify and count the graphic elements in each graphic element combination according to their shape and style, and identify the distribution of graphic elements of each shape and style within the closed area based on their relative position. S33. Based on the distribution of each graphic element, construct the topological feature vector of the shape combination within the closed area, traverse the feature vectors of each standard control model in the preset standard control model library, and calculate the matching degree between the topological feature vector and the feature vectors of each feature vector of the standard control model. S34. Select the standard control model with the highest matching degree and generate the corresponding matrix switch control.

[0009] In some specific technical solutions, shape styles include lines and irregular shapes. The specific process for identifying the distribution of graphic elements of each shape style within a closed area is as follows: For graphic elements with a line shape, determine the directional distribution of the lines within the enclosed area and evaluate each line's two endpoints separately. The directional distribution includes vertical, horizontal, or diagonal. The process for evaluating each endpoint is as follows: If the endpoint is located on the envelope boundary, then the endpoint is a port node, and an orientation label is assigned according to the orientation of the port node on the envelope boundary; For port nodes in the same location, sort and number them according to their arrangement order in that location to obtain the port number; If the endpoint is not on the envelope boundary, then continue to determine whether the endpoint is connected to the edge or center of the irregular shape within the envelope boundary. If they are connected, record the connected irregular shape as the internal contact point of the envelope boundary, and mark the connection relationship between the connected line endpoint and the contact point.

[0010] In some specific technical solutions, when the closed area is composed of rectangles, the distribution of graphic elements of various shapes and styles within the closed area is identified by traversing all graphic elements with line shapes in the graphic element combination; when the closed area is composed of boundary lines, it is only necessary to traverse the lines in the graphic element combination except for the boundary lines.

[0011] In some specific technical solutions, the process of generating the link configuration association table between the ports of each matrix switch control is as follows: S41. Store the lines in the element set table that do not fall into any closed area into the connecting line set. Traverse each connecting line in the connecting line set and read the start and end coordinates of the current connecting line. S42. Based on the starting and ending coordinates of the connecting line, find the first port node and the second port node connected to the current connecting line in the generated control set, and determine the two matrix switch controls connected to the first port node and the second port node and their port numbers in the matrix switch controls. S43. Based on the two matrix switch controls connected to each connecting line and the port number in the matrix switch control, generate a link configuration association record and store it in the link configuration association table; The first and second port nodes correspond to two matrix switch controls and port numbers, generating a link configuration association table between the ports of each matrix switch control.

[0012] In some specific technical solutions, the preset switch control protocol code table includes the protocol control instruction code corresponding to the switching operation of each port for each type of matrix switch control. The specific process of generating the control instruction set for controlling each matrix link in the matrix link topology diagram is as follows: Traverse each link configuration association record in the link configuration association table and extract the two matrix switch controls and port numbers from the current link configuration association record; In the switch control protocol code table, the corresponding turn-on control command is found according to the type and port number of the two matrix switch controls; The found control commands are combined in sequence to generate a complete control command sequence for each link configuration association record, and then stored in the control command set.

[0013] Some specific technical solutions also include visual display operations, the specific process of which is as follows: Draw the matrix switch control onto the canvas area based on its position. Iterate through each connecting line in the set of connecting lines. If there are duplicate or intersecting connecting lines, optimize the layout by removing duplicates. The specific process is as follows: For horizontally overlapping connecting lines, adjust the horizontal distance between the connecting lines so that they are staggered in the vertical direction. For link lines that overlap vertically, adjust the vertical distance between the connecting lines so that the connecting lines are staggered in the horizontal direction. Based on the link connection relationship between each matrix switch control, the connection lines after deduplication and layout optimization are used to display the connection between each switch control.

[0014] Secondly, this application provides an apparatus for automatically adapting a matrix topology graph to generate a visual operation matrix, comprising: Memory is used to store computer-readable instructions non-transiently; A processor for executing computer-readable instructions, which, when executed by the processor, implement a method for automatically adapting a matrix topology graph to generate a visual operation matrix, according to the first aspect.

[0015] The advantages of this invention over the prior art are as follows: This invention directly loads the Visio source file of an existing matrix link topology diagram, automatically parses the attribute information of all graphics in the source file, and on this basis, through in-depth calculation of the absolute position, relative position, shape style, quantity, direction, connection points and port distribution of elements within each shape set, automatically matches the scattered shape combinations into known control types such as SPST, SPDT, DPDT, attenuator, phase shifter, and circulator, and generates interactive matrix switch controls. After generating the controls, it further automatically traverses the connecting lines, synchronously constructs a link configuration association table between control ports, and automatically generates a control command set for each port to be switched on according to a preset protocol code table. This integrates topology display, link configuration and command generation, enabling the matrix link to have real-time controllability, and upgrading the interface that could only be statically displayed to a control interface that can be manipulated in real time for each matrix element, truly realizing WYSIWYG visual control.

[0016] Meanwhile, the present invention simultaneously classifies and marks lines when identifying closed areas, distinguishing boundary lines, lines within the area, and connecting lines. Subsequently, the classified connecting lines are directly used to generate link configurations, avoiding repeated traversal of all lines and saving computing resources. Furthermore, the automatically generated connecting lines are deduplicated and misaligned, effectively improving the readability and ease of operation of the control interface. Attached Figure Description

[0017] Figure 1 A flowchart of a method for automatically adapting a matrix topology graph to generate a visual operation matrix is ​​provided in an embodiment of the present invention; Figure 2 This is a Visio source file matrix link topology diagram provided in an embodiment of the present invention; Figure 3 This is a partial schematic diagram of a preset standard control model library provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of line coverage provided for an embodiment of the present invention; Figure 5 This is an example diagram of a deduplication and optimization layout provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of the configuration of the visual operation interface provided by the present invention; Figure 7This is a schematic diagram of the final link connection provided in an embodiment of the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the present invention or its application or use. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps described in these embodiments do not limit the scope of the invention.

[0020] At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn according to actual scale.

[0021] Furthermore, for clarity and brevity, descriptions of well-known structures, functions, and configurations may have been omitted. Those skilled in the art will recognize that various changes and modifications can be made to the examples described herein without departing from the spirit and scope of this disclosure.

[0022] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.

[0023] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values.

[0024] Example 1 like Figure 1 As shown, this embodiment provides a method for automatically adapting a matrix topology graph to generate a visual operation matrix, specifically including the following steps: S1. Parse the Visio source file of the matrix link topology diagram to obtain each graphical element in the matrix link topology diagram and its corresponding attributes, and store them in the element set table. S2. Traverse each graphic element and its corresponding attributes in the element set table, identify all graphic elements that can form a closed area and store them in a graphic element combination to obtain several graphic element combinations. The attributes include the shape style, starting coordinates, ending coordinates, and shape parameters of the graphic elements. The specific process of obtaining a combination of several graphic elements is as follows: S21. Select the largest graphic element from all graphic elements as the canvas area; S22. Traverse each graphic element within the canvas area. When the shape of the traversed graphic element is rectangular, directly read its starting and ending coordinates as the coordinate range of the closed area. S23. When the shape of the traversed graphic element is a line and the line does not fall within the coordinate range of the rectangle, then perform closed-loop tracing starting from the current line, filter out the line combinations that can form a closed area and mark them as boundary lines, and obtain the coordinate range of the line combinations. Specifically, the process of selecting the combination of lines that can form a closed area is as follows: S231. Using the termination coordinates of the current traversal's initial line as the current connection point, store the current traversal's initial line into the line combination. S232. In each graphic element with the shape style of line, find the next line whose starting or ending coordinates are connected to the current connection point. If it exists, store the next line in the line group, and then continue to search with the endpoint of the next line that is not connected to the connection point as the current connection point. S233. Repeat step S232 until the end coordinate of the found line connects with the start coordinate of the initial line. Then determine that all lines in the line combination can form a closed area and mark all lines in the line combination as boundary lines.

[0025] If no matching line can be found at the starting coordinates of the initial line after traversing all graphic elements, it means that a closed loop cannot be formed. Therefore, the initial line cannot form the boundary of a closed region. Continue to repeat the above operation to process lines that are not marked as boundary lines in the element set table.

[0026] S24. Continue traversing and store all graphic elements whose starting and ending coordinates fall within the same coordinate range into a graphic element combination, ultimately obtaining several image element combinations.

[0027] S3. Rearrange all graphic elements in each graphic element combination to obtain the corresponding matrix switch shape. Match the matrix switch shape with the preset standard control model library, select the standard control model with the highest matching degree, generate the corresponding matrix switch control and store it in the control collection. The specific process for generating the corresponding matrix switch control is as follows: S31. For each combination of graphic elements, select the graphic element that encloses its corresponding closed region as the envelope boundary, and calculate the relative positional relationship of other graphic elements with respect to the envelope boundary. S32. Classify and count the graphic elements in each graphic element combination according to their shape and style, and identify the distribution of graphic elements of each shape and style within the closed area based on their relative position. Shape styles include lines and irregular shapes. The specific process for identifying the distribution of graphic elements of each shape style within a closed area is as follows: For graphic elements with a line shape, determine the directional distribution of the lines within the enclosed area and evaluate each line's two endpoints separately. The directional distribution includes vertical, horizontal, or diagonal. The process for evaluating each endpoint is as follows: If the endpoint is located on the envelope boundary, then the endpoint is a port node, and an orientation label is assigned according to the orientation of the port node on the envelope boundary; For port nodes in the same location, sort and number them according to their arrangement order in that location to obtain the port number; If the endpoint is not on the envelope boundary, then continue to determine whether the endpoint is connected to the edge or center of the irregular shape within the envelope boundary. If they are connected, record the connected irregular shape as the internal contact point of the envelope boundary, and mark the connection relationship between the connected line endpoint and the contact point.

[0028] When the enclosed area is composed of rectangles, the distribution of graphic elements of various shapes and styles within the enclosed area is identified by traversing all graphic elements in the graphic element combination whose shape and style is lines; when the enclosed area is composed of boundary lines, it is only necessary to traverse the lines in the graphic element combination except for the boundary lines.

[0029] S33. Based on the distribution of each graphic element, construct the topological feature vector of the shape combination within the closed area, traverse the feature vectors of each standard control model in the preset standard control model library, and calculate the matching degree between the topological feature vector and the feature vectors of each feature vector of the standard control model. S34. Select the standard control model with the highest matching degree and generate the corresponding matrix switch control.

[0030] S4. Generate a table of link configuration associations between ports of each matrix switch control based on the link connection relationship between each matrix switch control; Specifically, the process of generating the link configuration association table between the ports of each matrix switch control is as follows: S41. Store the lines in the element set table that do not fall into any closed area into the connecting line set. Traverse each connecting line in the connecting line set and read the start and end coordinates of the current connecting line. S42. Based on the starting and ending coordinates of the connecting line, find the first port node and the second port node connected to the current connecting line in the generated control set, and determine the two matrix switch controls connected to the first port node and the second port node and their port numbers in the matrix switch controls. S43. Based on the two matrix switch controls connected to each connecting line and the port number in the matrix switch control, generate a link configuration association record and store it in the link configuration association table; The first and second port nodes correspond to two matrix switch controls and port numbers, generating a link configuration association table between the ports of each matrix switch control.

[0031] S5. According to the preset switch control protocol code table, match the switch control protocol code table with the link configuration association table, bind the corresponding protocol control instructions according to the association relationship between the ports of each matrix switch control, and generate a control instruction set for controlling each matrix link in the matrix link topology diagram.

[0032] The preset switch control protocol code table includes the protocol control command code corresponding to each port switching operation for each type of matrix switch control. The specific process of generating the control command set for controlling each matrix link in the matrix link topology diagram is as follows: Traverse each link configuration association record in the link configuration association table and extract the two matrix switch controls and port numbers from the current link configuration association record; In the switch control protocol code table, the corresponding turn-on control command is found according to the type and port number of the two matrix switch controls; The found control commands are combined in sequence to generate a complete control command sequence for each link configuration association record, and then stored in the control command set.

[0033] More specifically, it also includes visual display operations, the specific process of which is as follows: Draw the matrix switch control onto the canvas area based on its position. Iterate through each connecting line in the set of connecting lines. If there are duplicate or intersecting connecting lines, optimize the layout by removing duplicates. The specific process is as follows: For horizontally overlapping connecting lines (i.e., two or more lines whose start and end intervals overlap in the X-axis direction and whose Y coordinates are the same or similar), shift their X coordinates to the left or right respectively, adjust the horizontal distance between the connecting lines, and make each connecting line staggered in the vertical direction. For vertically overlapping link lines (i.e., two or more lines with overlapping start and end intervals in the Y-axis direction and the same or similar X coordinates), shift their Y coordinates up or down to adjust the vertical distance between the connecting lines, so that the connecting lines are staggered in the horizontal direction; shift their Y coordinates up or down respectively. Based on the link connection relationship between each matrix switch control, the connection lines after deduplication and layout optimization are used to display the connection between each switch control.

[0034] For ease of understanding of the proposed solution, as follows: Figure 2 The image shows a matrix link topology diagram displayed in a Visio source file. It can be seen that this matrix link topology diagram contains multiple graphic elements, including rectangles, lines, and circular contacts. These graphic elements constitute the canvas area, two two-way switching elements (SPDT), two four-way switches (SP4T), two six-way switches (SP6T), and a programmable attenuator. The task is to automatically convert this matrix link topology diagram from the Visio source file into a visual control interface diagram and generate corresponding link control commands. The specific process is as follows: 1. Use the third-party parsing tool Aspose to parse the generated Visio source file and obtain the shape and attributes of all graphic elements; 2. Perform a comprehensive analysis of the shape style, coordinate position (starting coordinates, ending coordinates), shape parameters (length, thickness, etc.), and all other relevant attributes of each graphic element, and adapt and parse them with the preset model library. For example, for a certain area, determine how many graphic elements are contained in this area, what shape styles are included, the coordinate position of each shape, and how these graphic elements in a certain area can be assembled into a matrix switch style of a certain known type through permutation and combination. Select the one with the highest matching degree to generate the corresponding control.

[0035] To define the display area of ​​the newly generated interface, from all the acquired graphic elements, we select the graphic element with the maximum X-axis coordinate (usually the border) and the graphic element with the maximum Y-axis coordinate. The X and Y coordinates of these two graphic elements are then taken as the maximum X and Y coordinates of the current canvas. For example, if a canvas has 30 graphic elements, and one element has the highest X-axis coordinate (300, 150), where 300 is greater than the X-axis values ​​of the other 29 elements, then the maximum X-axis value of this canvas is 300. Similarly, the maximum Y-axis value can be obtained.

[0036] The process iterates through all graphic elements, sorting them according to their coordinates and storing them in an element set. The scan begins at the top-left corner of the canvas origin (0,0) and ends at the bottom-right corner where the X and Y coordinates are at their maximum values. For example, starting from the origin (0,0), the X-axis coordinates are incremented sequentially: (1,0), (2,0), (3,0), (4,0)... Elements with a Y-axis value of 0 and an X-axis value increasing sequentially (if any) are found and stored in a set. When the Y-axis value is 0 and the X-axis reaches its maximum value, the X-axis remains unchanged while the Y-axis value is incremented by 1, and the X-axis is scanned in descending order. For example, when the maximum X-axis value is 300, the scan would be (300,1), (299,1), (298,1)... and so on. Elements already added to the element set are skipped to avoid duplication.

[0037] Calculations are performed based on the coordinates, shape, and other characteristics of each graphic element. For example, when traversing to a standard rectangular graphic element E, its starting and ending coordinates are (10, 10) and (80, 100). (Note: The starting and ending coordinates of a rectangle are generally the diagonals.) This element is then added to a graphic element combination containing a rectangular element. During traversal scanning, any graphic element whose coordinates are contained within this rectangle is also added to this graphic element combination. This graphic element combination is temporarily called set A. By calculating the coordinates and shapes of each graphic element within the same area (set A), the style that best matches the preset control is selected. For example, a 2-point switch (SPDT) has 2 connected line style sub-areas inside the rectangle, and an N-point switch has n connected line styles inside the rectangle. The control with the highest matching degree is selected for matching.

[0038] If the outer frame of the switch is not a standard rectangle but is made up of lines, then the calculation is performed based on whether the start and end positions of the lines are continuous and form a closed loop. For example, if the start and end coordinates of line p1 are (10,10) to (80,10), the start and end positions of line P2 are (80,10) to (80,220), p3 is (80,200) to (10,200), and p4 is (10,200) to (10,10), then it is still considered that lines p1, p2, p3, and p4 form a closed area of ​​an outer rectangle.

[0039] After obtaining the coordinate range of the closed region using the above method, we can analyze whether other elements within this rectangle can also be constructed as a control, arranging them to form the graphic type assembled from that region. Specifically: For each set A corresponding to a closed region, take the coordinates of the upper left corner of the envelope rectangle of the closed region as the local reference origin. Traverse each graphic element in A and record its absolute position: starting coordinates, ending coordinates, and center point coordinates. Subtract the reference origin from the absolute coordinates to obtain the relative coordinates of all graphic elements in set A. Count the number and type of various shapes in set A, including the number of rectangles (including the outer frame large rectangle and the inner small rectangle, the outer frame large rectangle is the switch boundary, and the inner small rectangle is the switch internal contact identifier), the number of lines, and other irregular shapes (circles / ellipses). Identify the direction of each line in set A. When the difference in the X value of the starting point coordinate of the line is less than the tolerance threshold, the line is a vertical line. When the difference in the Y value is less than the tolerance threshold, it is a horizontal line. Otherwise, it is a diagonal line. Iterate through all lines in set A, and for each line, check its two endpoints: If the distance between the endpoint coordinates and the envelope boundary of the closed region is within the tolerance range, then the endpoint is a port node; record the relative coordinates of the port node, and assign an orientation label according to its orientation (up / down / left / right) on the boundary; for port nodes on the same boundary, sort and number them according to their arrangement order on the edge (from left to right or from top to bottom) to obtain port numbers (such as Y1, Y2, X1, X2).

[0040] For the portion of the line whose endpoints are not on the envelope boundary: Determine whether it coincides with the edge or center of a rectangle (internal contact rectangle) within the shape set (within the tolerance range); if it coincides, record the rectangle as an internal contact and mark the connection relationship between the endpoint of the line and the contact.

[0041] The topological feature vector for constructing the shape combination within the closed region includes: the type of the outer border (a closed region composed of standard rectangles or lines), the number of inner rectangles and their relative positions; the number of inner lines, the direction of each line (horizontal / vertical / diagonal) and their relative positions; the total number of port nodes; the orientation of each port node (up / down / left / right) and its sequence number in that orientation; the number of inner contacts and their relative positions; and whether there is a diagonal line indicating the active blade arm and the connection mode of that diagonal line. The pre-defined standard control model library contains pre-defined standard control models such as... Figure 3The example shown includes a 1-to-2 switch (SPDT), a 1-to-4 switch (SP4T), a 1-to-6 switch (SP6T), attenuators D120, D60, and D20, a phase shifter, and a circulator. All existing graphic elements in the canvas area are matched to generate corresponding controls. The matching method can be as follows: comparing the feature vectors of the standard control model with the topological feature vectors to calculate the matching degree; comparing the number of rectangles for consistency (deducting points if inconsistent); comparing the number and direction distribution of lines for consistency; comparing the total number of port nodes and their distribution in each direction for consistency; comparing the number and arrangement deviation of internal contacts (calculating the Euclidean distance or the mean offset in each direction of the relative coordinates); and combining the results of all comparisons to obtain the comprehensive matching degree score between the current set A and each standard spatial model. If the highest matching degree score is greater than or equal to a preset threshold, then that standard control model is used as the matrix switch control corresponding to set A; if the highest matching degree score is less than the preset threshold, then set A is marked as unrecognized, allowing the user to manually specify the control type.

[0042] 3. After obtaining the matching standard controls, it is necessary to connect them according to the link connection relationship between each matrix switch control. When drawing the connection lines in the canvas area according to the link connection relationship, in order to avoid the connection lines appearing as... Figure 4 The diagram shows a situation where lines overlap and intersect, causing overlap. The connecting lines are optimized to avoid repetition. Automatically generated connecting lines with duplicates are also optimized; for example, overlapping links are shifted left or right by the X-coordinate, and vertically overlapping lines are moved by the Y-coordinate. The final optimized layout after deduplication is shown in the image below. Figure 5 As shown, the connecting lines are now distinct and no longer overlap.

[0043] 4. After processing according to the above steps, the combined layout of the entire canvas area is obtained in the new software display interface, and the resulting matrix topology link diagram is as follows. Figure 6 As shown, based on the generated matrix topology link diagram and the preset switch control protocol code table, the binding relationship between the protocol control command and the link for each type of switch control is generated.

[0044] like Figure 6 As shown, while matching the standard controls, it is also necessary to perform the operation of generating a binding relationship table. When starting to traverse the connecting line a, the start and end coordinates of line a are obtained, the start position and the port Y1 of the standard control A connected to it are obtained, the end coordinate of the connecting line a and the Y1 of the standard control B connected to it are obtained, and the configuration association relationship A:Y1-----B:Y1 is automatically generated. And so on, to obtain the configuration relationship table of all the connecting lines (Table 1).

[0045] Table 1 Link Configuration Association Table Then, based on the switch control protocol code table (which has a unified correspondence rule with each port of the development board), the on / off control commands for each port of each switch in the current software are generated. The switch control protocol code table is shown in Table 2: Table 2 Switch Control Protocol Code Table For example, according to the protocol code table, the command to turn on port Y1 of SP6T switch 1 is: OF 06 01 00 00……, and the command to turn on port Y1 of SPDT switch 2 is: OF 01 02 00 00……; like Figure 7 As shown, when the user needs to go from input 1 to output 1, the command OF 06 01 00 00……, OF 01 02 00 00 …… is automatically sent.

[0046] Example 2 This embodiment provides an apparatus for automatically adapting a matrix topology graph to generate a visual operation matrix, comprising: Memory is used to store computer-readable instructions non-transiently; A processor for executing computer-readable instructions, which, when executed by the processor, implement a method for automatically adapting a matrix topology graph to generate a visual operation matrix according to Embodiment 1.

[0047] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Based on the technical essence of the present invention, any simple modifications, equivalent substitutions, and improvements made to the above embodiments within the spirit and principles of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A method for automatically adapting a matrix topology graph to generate a visual operation matrix, characterized in that, Specifically, the following steps are included: S1. Parse the Visio source file of the matrix link topology diagram to obtain each graphical element in the matrix link topology diagram and its corresponding attributes, and store them in the element set table. S2. Traverse each graphic element and its corresponding attributes in the element set table, identify all graphic elements that can form a closed area and store them in a graphic element combination to obtain several graphic element combinations. S3. Rearrange all graphic elements in each graphic element combination to obtain the corresponding matrix switch shape. Match the matrix switch shape with the preset standard control model library, select the standard control model with the highest matching degree, generate the corresponding matrix switch control and store it in the control collection. S4. Generate a table of link configuration associations between ports of each matrix switch control based on the link connection relationship between each matrix switch control; The specific process for generating the link configuration association table between the ports of each matrix switch control is as follows: S41. Store the lines in the element set table that do not fall into any closed area into the connecting line set. Traverse each connecting line in the connecting line set and read the start and end coordinates of the current connecting line. S42. Based on the starting and ending coordinates of the connecting line, find the first port node and the second port node connected to the current connecting line in the generated control set, and determine the two matrix switch controls connected to the first port node and the second port node and their port numbers in the matrix switch controls. S43. Based on the two matrix switch controls connected to each connecting line and the port number in the matrix switch control, generate a link configuration association record and store it in the link configuration association table; The first and second port nodes correspond to two matrix switch controls and port numbers, generating a link configuration association table between the ports of each matrix switch control; S5. According to the preset switch control protocol code table, match the switch control protocol code table with the link configuration association table, bind the corresponding protocol control instructions according to the association relationship between the ports of each matrix switch control, and generate a control instruction set for controlling each matrix link in the matrix link topology diagram.

2. The method for automatically adapting a matrix topology graph to generate a visual operation matrix according to claim 1, characterized in that, The attributes include the shape style, starting coordinates, ending coordinates, and shape parameters of the graphic elements. The specific process of obtaining a combination of several graphic elements is as follows: S21. Select the largest graphic element from all graphic elements as the canvas area; S22. Traverse each graphic element within the canvas area. When the shape of the traversed graphic element is rectangular, directly read its starting and ending coordinates as the coordinate range of the closed area. S23. When the shape of the traversed graphic element is a line and the line does not fall within the coordinate range of the rectangle, then perform closed-loop tracing starting from the current line, filter out the line combinations that can form a closed area and mark them as boundary lines, and obtain the coordinate range of the line combinations. S24. Continue traversing and store all graphic elements whose starting and ending coordinates fall within the same coordinate range into a graphic element combination, ultimately obtaining several graphic element combinations.

3. The method for automatically adapting a matrix topology graph to generate a visual operation matrix according to claim 2, characterized in that, The specific process for selecting the combination of lines that can form a closed area is as follows: S231. Using the termination coordinates of the current traversal's initial line as the current connection point, store the current traversal's initial line into the line combination. S232. In each graphic element with the shape style of line, find the next line whose starting or ending coordinates are connected to the current connection point. If it exists, store the next line in the line group, and then continue to search with the endpoint of the next line that is not connected to the connection point as the current connection point. S233. Repeat step S232 until the end coordinate of the found line connects with the start coordinate of the initial line. Then determine that all lines in the line combination can form a closed area and mark all lines in the line combination as boundary lines.

4. The method for automatically adapting a matrix topology graph to generate a visual operation matrix according to claim 2, characterized in that, The specific process for generating the corresponding matrix switch control is as follows: S31. For each combination of graphic elements, select the graphic element that encloses its corresponding closed region as the envelope boundary, and calculate the relative positional relationship of other graphic elements with respect to the envelope boundary. S32. Classify and count the graphic elements in each graphic element combination according to their shape and style, and identify the distribution of graphic elements of each shape and style within the closed area based on their relative position. S33. Based on the distribution of each graphic element, construct the topological feature vector of the shape combination within the closed area, traverse the feature vectors of each standard control model in the preset standard control model library, and calculate the matching degree between the topological feature vector and each feature vector of the standard control model. S34. Select the standard control model with the highest matching degree and generate the corresponding matrix switch control.

5. The method for automatically adapting a matrix topology graph to generate a visual operation matrix according to claim 4, characterized in that, Shape styles include lines and irregular shapes. The specific process for identifying the distribution of graphic elements of each shape style within a closed area is as follows: For graphic elements with a line shape, determine the directional distribution of the lines within the enclosed area and evaluate each line's two endpoints separately. The directional distribution includes vertical, horizontal, or diagonal. The process for evaluating each endpoint is as follows: If the endpoint is located on the envelope boundary, then the endpoint is a port node, and an orientation label is assigned according to the orientation of the port node on the envelope boundary; For port nodes in the same location, sort and number them according to their arrangement order in that location to obtain the port number; If the endpoint is not on the envelope boundary, then continue to determine whether the endpoint is connected to the edge or center of the irregular shape within the envelope boundary. If they are connected, record the connected irregular shape as the internal contact point of the envelope boundary, and mark the connection relationship between the connected line endpoint and the contact point.

6. The method for automatically adapting a matrix topology graph to generate a visual operation matrix according to claim 5, characterized in that, When the enclosed area is composed of rectangles, the distribution of graphic elements of various shapes and styles within the enclosed area is identified by traversing all graphic elements with line shapes in the combination of graphic elements. When a closed region consists of boundary lines, it is only necessary to traverse the lines in the combination of graphic elements other than the boundary lines.

7. The method for automatically adapting a matrix topology graph to generate a visual operation matrix according to claim 5, characterized in that, The preset switch control protocol code table includes the protocol control command code corresponding to the on / off operation of each port for each type of matrix switch control. The specific process of generating the control command set for controlling each matrix link in the matrix link topology diagram is as follows: Traverse each link configuration association record in the link configuration association table and extract the two matrix switch controls and port numbers from the current link configuration association record; In the switch control protocol code table, the corresponding turn-on control command is found according to the type and port number of the two matrix switch controls; The found control commands are combined in sequence to generate a complete control command sequence for each link configuration association record, and then stored in the control command set.

8. The method for automatically adapting a matrix topology graph to generate a visual operation matrix according to claim 5, characterized in that, It also includes visualization display operations, the specific process of which is as follows: Draw the matrix switch control onto the canvas area based on its position in the canvas area; Iterate through each connecting line in the set of connecting lines. If there are duplicate or intersecting connecting lines, optimize the layout by removing duplicates. The specific process is as follows: For horizontally overlapping connecting lines, adjust the horizontal distance between the connecting lines so that they are staggered in the vertical direction. For link lines that overlap vertically, adjust the vertical distance between the connecting lines so that the connecting lines are staggered in the horizontal direction. Based on the link connection relationship between each matrix switch control, the connection lines after deduplication and layout optimization are used to display the connection between each switch control.

9. An apparatus for automatically adapting a matrix topology graph to generate a visual operation matrix, characterized in that, include: Memory is used to store computer-readable instructions non-transiently; A processor for executing the computer-readable instructions, which, when executed by the processor, implement the method for automatically adapting a matrix topology graph to generate a visual operation matrix as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Methods, systems, and computer program product for binding and back annotating an electronic design with a schematic driven extracted view

    US10678978B1

  • Switching matrix representation for an incremental algorithm computing connected components

    US20180060038A1