Plc wiring diagram automatic identification and physical information extraction method, device and equipment
Patent Information
- Application Number
- CN202311852068.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2043-12-29
AI Technical Summary
[0005]现阶段,已有相关的自动识别技术应用于电网接线图纸和通信工程图纸[1-4],但应用于PLC接线图纸时依旧存在不足:现有的图纸自动识别技术主要关注图元(图像符号的类别和位置)的识别[1-2,4]以及图纸拓扑关系的提取和存储[3],主要涉及图像处理技术,缺少对图纸文本的处理
[0050]本发明的有益效果是:本发明首先从PLC接线图中提取文本信息并分类,解析文本内容提取输入输出地址,连接的物理设备的信息等系统信息;利用文本引导的多尺度窗口机制结合目标检测模型来检测定位图纸图像中的元件,并通过聚类和投票机制匹配元件的文字符号和图像符号;利用图像处理技术提取连接线。其次通过拓扑分析进行图元之间的匹配关联,整合输出PLC接线图的物理信息,并通过数据表的形式存储。本发明实现PLC接线图自动识别与物理信息提取,将图纸转为可数字化存储和处理的结构化数据,有效提升运维调试、维护、更新工业控制系统的效率,有助于实现工业系统信息的整合、共享及再利用。
Smart Images

Figure CN117671718B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of industrial control system drawing recognition and information extraction, and relates to a method, device and equipment for automatic recognition of PLC wiring diagrams and extraction of physical information. Background Technology
[0002] Programmable Logic Controllers (PLCs) are widely used automation control devices in the industrial control field. They mainly consist of a power supply unit, input / output modules (I / O), and a processor. By periodically 1) scanning and monitoring input module signals, 2) executing user-written logic operation programs, and 3) controlling physical devices through output modules, PLCs can perform various industrial automation tasks, such as discrete manufacturing production line control, warehousing and logistics, and chemical process control.
[0003] PLCs directly control physical devices through input / output modules, and their program control logic is directly affected by the characteristics of the corresponding physical devices. Therefore, the wiring method of a PLC intuitively reflects the control logic of the entire industrial control system. PLC wiring diagrams are common electrical diagrams used to describe in detail the physical and electrical connections between various components in a PLC system (such as sensors, actuators, and the PLC itself). In all stages of industrial control system design, deployment, maintenance, and upgrades, PLC wiring diagrams help engineers and developers efficiently and accurately familiarize themselves with the system and complete various production and maintenance plans, playing a crucial role.
[0004] However, reading PLC wiring diagrams requires a certain level of electrical knowledge, as they typically contain specific symbols, markings, and details of various electrical systems. Furthermore, unlike text or tables which are easily processed by machines, PLC wiring diagrams are semi-structured data, making direct use as input for various tools inconvenient. Automated drawing recognition technology can utilize computer vision and text processing techniques to convert drawings into digital formats, making the content easier to integrate with PLC programming tools and other engineering management systems. This facilitates data processing and improves the engineering efficiency, accuracy, maintainability, and scalability of industrial systems.
[0005] At present, relevant automatic identification technologies have been applied to power grid wiring diagrams and communication engineering diagrams [1-4], but there are still shortcomings when applied to PLC wiring diagrams: existing automatic identification technologies for diagrams mainly focus on the identification of graphic elements (the category and position of image symbols) [1-2,4] and the extraction and storage of diagram topology relationships [3], which mainly involve image processing technology and lacks processing of diagram text. In addition to geometric shapes (such as connecting lines, component symbols, etc.), graphic elements in PLC wiring diagrams also include text (such as I / O addresses, I / O descriptions, etc.). Only by integrating the image and text information of the diagram can the physical information of the industrial control system (I / O and device mapping, controlled device status, etc.) in the PLC wiring diagram be fully extracted.
[0006] [1] Hunan Yingchao Intelligent Computing Research Institute Co., Ltd. A system and method for identifying power grid wiring diagram components and lines based on artificial intelligence: CN202111661655.X[P]. 2022-04-08.
[0007] [2] South China University of Technology. A method for identifying elements in power grid wiring diagrams based on overlapping sliding window mechanism and YOLOv4: CN202111587313.8[P]. 2022-04-15.
[0008] [3] Laiwu Power Supply Company of State Grid Shandong Electric Power Company, State Grid Corporation of China. An automatic identification, conversion and storage method for power grid substation wiring diagrams: CN202210633919.9[P]. 2022-09-20.
[0009] [4] China Mobile Communications Group Guangdong Co., Ltd., China Mobile Communications Group Co., Ltd. Method and device for identifying communication engineering drawings: CN202111320690.5[P]. 2023-05-12. Summary of the Invention
[0010] The purpose of this invention is to address the shortcomings of existing technologies by providing a method, apparatus, and equipment for automatic identification and physical information extraction of PLC wiring diagrams. This invention utilizes machine vision and text parsing technologies to process images and text in the diagrams, analyzes the topology between graphic elements, and extracts the physical information of industrial systems, thus having practical application value.
[0011] The objective of this invention is achieved through the following technical solution:
[0012] According to the first aspect of this specification, a method for automatic identification of PLC wiring diagrams and extraction of physical information is provided, including:
[0013] S1. Export the PLC wiring diagram as a PDF file. Extract text information by parsing the PDF and divide the extracted text into four categories: PLC attributes, component text symbols, I / O addresses, and I / O descriptions, thus obtaining a set of text-text boxes corresponding to the four categories.
[0014] S2, by matching the elements between the text-text box sets corresponding to the I / O address category and the I / O description category, the mapping relationship between I / O address and I / O description is obtained. The I / O address value and I / O data type of each I / O address are extracted. The physical device information, including device name, device ID, execution action and monitoring status, is extracted by parsing the syntax of each I / O description to obtain the I / O address-physical device information set.
[0015] S3. After deleting the text content from the PDF file of the PLC wiring diagram, convert it into an image format and perform binarization to obtain the pre-processed drawing image.
[0016] S4. Extract images containing only horizontal lines and images containing only vertical lines through morphological opening operations. Extract the positions of line segments in the images using a line segment detector. Obtain the set of connecting lines by filtering out the set of line segments that can form a rectangle.
[0017] S5 utilizes a multi-scale window mechanism guided by component text symbols, combined with an object detection model to detect and locate components in drawing images, and matches the text symbols and image symbols of components through clustering and voting mechanisms to output a set of component information.
[0018] S6 analyzes the topological relationship between the I / O address-physical device information set, the connection line set, and the component information set, and extracts and outputs the physical information table of the PLC wiring diagram based on connectivity.
[0019] Furthermore, S1 categorizes the extracted text information as follows:
[0020] By searching the PLC database, a collection of text-text boxes belonging to the PLC attribute category is selected;
[0021] By searching the electrical component database, a set of text-text boxes belonging to the component text symbol category is selected;
[0022] The text-text box set belonging to the I / O address category is filtered out using regular expression matching.
[0023] The remaining text content constitutes a text-text box set belonging to the I / O description category.
[0024] Furthermore, the specific steps of S2 are as follows:
[0025] Matching the I / O description and the I / O address according to the minimum distance of the text box;
[0026] Parsing the I / O address by using a regular matching method, and extracting the binary tuple information <I / O address value, I / O data type> of the I / O address;
[0027] Parsing each I / O description by using a syntax parser corresponding to the I / O description language, and extracting the quadruple information of the physical device <device name, [device ID], [execution action], [monitoring status]>;
[0028] Outputting an I / O address-physical device information set, where each element in the set contains tuple information of the following 6 fields: I / O address value, I / O data type, device name, device ID, execution action, monitoring status, and the corresponding text box position.
[0029] Further, an I / O description language that conforms to the Backus-Naur Form and the habits of developers is designed, the language is used to guide developers to write I / O descriptions, and the syntax parser corresponding to the language is used to automatically parse each I / O description.
[0030] Further, the specific steps of S5 are as follows:
[0031] For each component text symbol, calculating the center point coordinate of its text box, taking the coordinate as the center point, cropping local images of multiple sizes in the drawing image to obtain a local image set;
[0032] Traversing the local images, detecting components in the local images by using a pre-trained YOLOv5 model, where the detection result includes the category, bounding box coordinate and confidence score of each component; traversing the local image set to obtain a detection result set;
[0033] Clustering the detection results by using the intersection over union of bounding boxes as a metric to obtain a clustered set;
[0034] For the cluster obtained after clustering, calculating the sum of the category scores of each component in the cluster, voting to select the component category with the highest total score as the detection result of the cluster, screening out the bounding box with the highest confidence from all bounding boxes of the detection result of this category as the final bounding box; obtaining a set of component detection results in all local images corresponding to the component text symbol;
[0035] Matching the text symbol and the image symbol of the component by using the minimum distance principle;
[0036] Traversing the text-text box set corresponding to the component text symbol category obtained in S1, obtaining the matching relationship between the text symbol and the image symbol of the component, and outputting a component information set.
[0037] Further, the specific steps of S6 are as follows:
[0038] Calculate the connectivity matrix for each graphic element in the I / O address-physical device information set, connection line set, and component information set. If two graphic elements intersect, they are considered connected, the matrix element is 1, otherwise it is 0;
[0039] Extract the graphic element connection tree from the connectivity matrix, where the leaf nodes are the graphic elements in the I / O address-physical device information set; traverse the paths of the graphic element connection tree, and convert the information on each path from the root node to the leaf node into a row of the physical information table;
[0040] Output the physical information table of the PLC wiring diagram, which includes seven fields: <I / O address value, I / O data type, device name, [device ID], [execution action], [monitoring status], [component information]>, where [] indicates that the field information is optional.
[0041] According to the second aspect of this specification, a device for automatic PLC wiring diagram identification and physical information extraction is provided, comprising:
[0042] Text extraction and classification module: export the PLC wiring diagram into a PDF format file, extract text information by parsing the PDF, classify the extracted text into four categories: PLC attributes, component text symbols, I / O addresses, and I / O descriptions, and obtain the text-text box sets corresponding to the four categories;
[0043] Text matching and parsing module: match the elements between the text-text box sets corresponding to the I / O address category and the I / O description category to obtain the mapping relationship between I / O addresses and I / O descriptions, extract the I / O address value and I / O data type of each I / O address, perform grammatical parsing on each I / O description to extract physical device information, including device name, device ID, execution action and monitoring status, and obtain the I / O address-physical device information set;
[0044] Image preprocessing module: after deleting the text content of the PDF format file of the PLC wiring diagram, convert it into an image format and perform binarization processing to obtain a preprocessed drawing image;
[0045] Connection line extraction module: extract an image containing only horizontal lines and an image containing only vertical lines through morphological opening operation, use a line segment detector to extract the positions of line segments in the image, and obtain a connection line set by screening out the line segment sets that can form rectangles;
[0046] Component identification and matching module: use a multi-scale window mechanism guided by component text symbols, combined with a target detection model to detect and locate components in the drawing image, and match the text symbols and image symbols of the components through a clustering and voting mechanism, and output a component information set;
[0047] Physical Information Extraction Module: Analyzes the topological relationship between the I / O address-physical device information set, the connection line set, and the component information set, and extracts and outputs the physical information table of the PLC wiring diagram based on connectivity.
[0048] According to a third aspect of this specification, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the PLC wiring diagram automatic identification and physical information extraction method as described in the first aspect.
[0049] According to a fourth aspect of this specification, a storage medium containing computer-executable instructions is provided, which, when executed by a computer processor, implement the PLC wiring diagram automatic identification and physical information extraction method as described in the first aspect.
[0050] The beneficial effects of this invention are as follows: First, this invention extracts and classifies text information from PLC wiring diagrams, parses the text content to extract system information such as input / output addresses and information on connected physical devices; it utilizes a text-guided multi-scale window mechanism combined with a target detection model to detect and locate components in the drawing image, and matches the text symbols and image symbols of the components through clustering and voting mechanisms; it then uses image processing technology to extract connecting lines. Secondly, it performs topology analysis to match and associate graphic elements, integrates and outputs the physical information of the PLC wiring diagram, and stores it in the form of a data table. This invention achieves automatic recognition and physical information extraction from PLC wiring diagrams, converting drawings into structured data that can be digitally stored and processed, effectively improving the efficiency of operation, debugging, maintenance, and updating of industrial control systems, and contributing to the integration, sharing, and reuse of industrial system information. Attached Figure Description
[0051] Figure 1 This is a flowchart of the method of the present invention.
[0052] Figure 2 This is an example of a PLC wiring diagram identified by the method of the present invention.
[0053] Figure 3 This is the syntax of the I / O description language (IO-DL) designed in this invention.
[0054] Figure 4 This refers to the physical information of the industrial control system extracted by the method of this invention.
[0055] Figure 5 This is a schematic diagram of an electronic device structure provided by the present invention. Detailed Implementation
[0056] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0057] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0058] like Figure 1 As shown in the figure, this embodiment of the invention provides a method for automatic identification of PLC wiring diagrams and extraction of physical information. The method includes the following steps:
[0059] S1. Text Extraction and Classification. This step first exports the PLC wiring diagram drawn using engineering drawing software (such as AutoCAD Electrical) as a PDF file as input, and then extracts text information by parsing the PDF. For example... Figure 2 As shown, the PLC wiring diagram contains various types of structured text (PLC attributes, I / O addresses, etc.) and unstructured text (I / O descriptions). This invention combines database retrieval and regular expression matching strategies to categorize the extracted text into four types: PLC attributes, component text symbols, I / O addresses, and I / O descriptions. The specific steps are as follows:
[0060] 1) Convert the PLC wiring diagram into a PDF file;
[0061] 2) Use a PDF text parsing tool (such as pdfminer) to extract all text content and corresponding text box positions from the PLC wiring diagram, and construct a text-text box set T; the text extraction method can be through PDF file parsing or through Optical Character Recognition (OCR) technology;
[0062] 3) By searching the PLC database, filter out the text-text box set T that belongs to the PLC attribute category (e.g., PLC supplier, model code, etc.). PLC ;
[0063] 4) By searching the electrical component database, filter out the text-text box set T that belongs to the component text symbol category (e.g., the S corresponding to a switch). componemt ;
[0064] 5) Use regular expression matching to filter out the set of text boxes that belong to the I / O address category.
[0065] 6) The remaining text content forms the text-text box set belonging to the I / O description category
[0066] S2. Text matching and parsing. In this step, by matching the and elements in between obtained in step S1, the mapping relationship between the I / O address and the I / O description is obtained, the I / O address value and I / O data type of each I / O address are extracted, each I / O description is syntactically parsed, physical device information including device name, device ID, execution action and monitoring state is extracted from the unstructured text and converted into structured data for storage, and finally the I / O address-physical device information set P is obtained.
[0067] The specific steps are as follows:
[0068] 1) For each I / O description text box in , calculate its distance from each I / O address text box in , and match the I / O description and the I / O address according to the minimum distance;
[0069] 2) Parse the I / O address using the regular matching method, and extract the tuple information <I / O address value, I / O data type> of the I / O address;
[0070] 3) Due to the space limitation of the PLC wiring diagram, most I / O descriptions are short incomplete sentences, and parsing these unstructured texts using natural language processing technology is prone to problems such as ambiguity and poor effect; the present invention designs an I / O Description Language (IO-DL) that conforms to Backus-Naur Form (BNF) and matches the habits of developers as shown in Figure 3 , and uses this language to guide developers to write I / O descriptions; the I / O-DL syntax parser automatically parses each I / O description, and extracts the quadruple information of the physical device <device name, [device ID], [execution action], [monitoring state]>;
[0071] 4) Merge and output the I / O address-physical device information set P, where each element in the set includes tuple information of the following 6 fields: I / O address value, I / O data type, device name, device ID, execution action, monitoring state, and the corresponding text box position.
[0072] S3. Image preprocessing. In this step, after deleting the text content of the PDF format file of the PLC wiring diagram, it is converted into an image format, and binarization processing is performed to enhance the image contour, making it easier for subsequent segmentation and recognition, and output the preprocessed drawing image I.
[0073] S4. Connector Extraction. PLC wiring diagrams only contain horizontal and vertical connectors. This step uses morphological opening operations (erosion, dilation) to extract images containing only horizontal and vertical lines. Then, a Line Segment Detector (LSD) is used to extract the positions of line segments in the images. Finally, by filtering out line segments that form rectangles, the final set of connectors, L, is obtained. The specific steps are as follows:
[0074] 1) Using rectangular image kernels (matrices) of different sizes, perform morphological opening operations (erosion followed by dilation) on the drawing image I to extract image I containing only horizontal lines. H And an image containing only vertical lines I V ;
[0075] 2) Extract images I using a line segment detector (LSD). H and Image I V The positions of all line segments are determined by merging them to obtain the line segment set L′.
[0076] 3) Traverse the line segments in L′ and filter out the set L of line segments that can form a rectangle by matching opposite and adjacent sides. Rect ;
[0077] 4) Filter line segment set L Rect Obtain the set of connection lines L = L′ - L from the PLC wiring diagram. Rect .
[0078] S5. Component Identification and Matching. Step S1 has already extracted the component text symbols and their text box positions, but the text symbols mainly describe the type of component (e.g., the single character "S" indicates a switch component). Only through component identification can more detailed physical information be obtained (e.g., whether it is a normally open switch). This step utilizes a multi-scale window mechanism guided by the component text symbols, combined with a target detection model (e.g., the YOLOv5 model), to detect and locate components in drawing image I, and matches the component text symbols and image symbols through clustering and voting mechanisms, outputting a component information set C. The specific steps are as follows:
[0079] 1) For each component text symbol T i ∈T component Calculate the coordinates of the center point of the corresponding text box. Using these coordinates as the center point, crop multiple sizes of local images from drawing image I (for example, cropping with side lengths of 500, 600, 700, and 800 pixels respectively to obtain a set of local images). The set of local images is... m is the preset number of local images;
[0080] 2) Traverse the local image Detecting local image I using a pre-trained YOLOv5 model j The detection results for each element include its category (cls), bounding box coordinates (box), and confidence score. The bounding box coordinates (box) require normalization processing from image I. j The local coordinate system is transformed into the global coordinate system of image I. Traversal... The resulting set of detection results is: R = {r1, r2, ..., r} n}, where r i =[cls i ,box i score i ], where n is the number of detected components;
[0081] 3) Considering the duplication within the detection result set (the same element is detected repeatedly in different local images, and since the model accuracy cannot reach 100%, the classification results for the same element may differ in different local images), the Intersection over Union (IoU) of bounding boxes is used as a metric to cluster the detection results. IoU measures the degree of overlap between two bounding boxes by calculating the ratio of the intersection area to the union area. Based on this, detection results with high bounding box overlap can be grouped into one class. The clustered set is R. cluster ={R1,R2,…,R k}, where R i It is a cluster after clustering (a set of similar data), for any R i ,R j ∈R cluster i≠j, and k is the number of clusters after clustering;
[0082] 4) For the clusters R obtained after clustering i ∈R cluster Calculate the sum of scores for each element category in the cluster, and vote to select the element category cls with the highest total score. max(scores) This is then used as the detection result for that cluster. For this category, cls max(scores) All bounding boxes from the detection results are selected using the Non-Maximum Suppression (NMS) algorithm, with the highest confidence bounding box being chosen as the final bounding box. After this processing, the component text symbol T is obtained. i The set of element detection results in all corresponding local images is R′={r′1,r′2,…,r′ k};
[0083] 5) Match the text symbols and graphic symbols of components using the proximity principle. Calculate the center point coordinates of the bounding box of each detection result in R' and the center point coordinates of the component text symbols [[the]] distance The detection result with the smallest distance is taken as the final detection result, r=min(d i );
[0084] 6) Repeat the above steps 1) to 5), traverse T identified in step S1 component to obtain the matching relationship between the text symbols and graphic symbols of the components, and output the component information set C.
[0085] S6. Physical information extraction. In this step, the topological relationship among the I / O address-physical device information set P extracted in step S2, the connection line set L extracted in step S4, and the component information set C extracted in step S5 is analyzed, and the physical information table of the PLC wiring diagram is extracted and output according to connectivity. The specific steps are as follows:
[0086] 1) Calculate the connectivity matrix M between each graphic primitive in the sets P, L and C. If the graphic primitive i intersects with the graphic primitive j, it is determined to be connected, the matrix element M(i,j)=1, otherwise M(i,j)=0;
[0087] 2) Extract the graphic primitive connection tree from the connectivity matrix M, where the leaf nodes are the graphic primitives in the set P. Traverse the paths of the graphic primitive connection tree, and convert the information on each path from the root node to the leaf node into a row of the physical information table;
[0088] 3) Output the physical information table of the PLC wiring diagram, as shown in Figure 4 [[the figure]], the table contains seven fields: <I / O address value, I / O data type, device name, [device ID], [execution action], [monitoring status], [component information]>, where "[]" indicates that the field information is optional.
[0089] Corresponding to the foregoing embodiment of the method for automatically identifying a PLC wiring diagram and extracting physical information, the present invention further provides an embodiment of an apparatus for automatically identifying a PLC wiring diagram and extracting physical information. The apparatus for automatically identifying a PLC wiring diagram and extracting physical information provided by the embodiment of the present invention includes:
[0090] Text extraction and classification module: export the PLC wiring diagram into a PDF format file, extract text information by parsing the PDF, divide the extracted text into four categories: PLC attribute, component text symbol, I / O address, and I / O description, so as to obtain the text-text box sets corresponding to the four categories;
[0091] Text matching and parsing module: By matching the elements between the text-text box sets corresponding to the I / O address category and the I / O description category, the mapping relationship between I / O address and I / O description is obtained. The I / O address value and I / O data type of each I / O address are extracted. The syntax of each I / O description is parsed to extract physical device information, including device name, device ID, execution action and monitoring status, to obtain the I / O address-physical device information set.
[0092] Image preprocessing module: After deleting the text content from the PDF file of the PLC wiring diagram, it is converted into an image format and binarized to obtain the preprocessed drawing image;
[0093] The connector extraction module extracts images containing only horizontal lines and images containing only vertical lines through morphological opening operations, extracts the positions of line segments in the image using a line segment detector, and obtains a set of connector lines by filtering out line segments that can form rectangles.
[0094] Component recognition and matching module: It uses a multi-scale window mechanism guided by component text symbols, combined with a target detection model to detect and locate components in the drawing image, and matches the text symbols and image symbols of the components through clustering and voting mechanisms, and outputs a set of component information.
[0095] Physical Information Extraction Module: Analyzes the topological relationship between the I / O address-physical device information set, the connection line set, and the component information set, and extracts and outputs the physical information table of the PLC wiring diagram based on connectivity.
[0096] All relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.
[0097] Corresponding to the aforementioned embodiments of the automatic PLC wiring diagram identification and physical information extraction method, the present invention also provides an electronic device, including one or more processors, for implementing the automatic PLC wiring diagram identification and physical information extraction method in the above embodiments.
[0098] like Figure 5 The diagram shown is a hardware structure diagram of any device with data processing capabilities, where the PLC wiring diagram automatic identification and physical information extraction device provided by this invention is located. (Except for...) Figure 5 In addition to the processor, memory, network interface, and non-volatile memory shown, any data processing device in the embodiment may also include other hardware depending on the actual function of the data processing device, which will not be described in detail here.
[0099] This invention also provides a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements the PLC wiring diagram automatic identification and physical information extraction method described in the above embodiments.
[0100] The computer-readable storage medium can be an internal storage unit of any data processing device described in any of the foregoing embodiments, such as a hard disk or memory. The computer-readable storage medium can also be any data processing device, such as a plug-in hard disk, smart media card (SMC), SD card, flash card, etc., mounted on the device. Furthermore, the computer-readable storage medium can include both internal storage units of any data processing device and external storage devices. The computer-readable storage medium is used to store the computer program and other programs and data required by the data processing device, and can also be used to temporarily store data that has been output or will be output.
[0101] The above embodiments are used to explain and illustrate the present invention, not to limit it. Those skilled in the art can make other variations or modifications based on the above description. It is not necessary to exhaustively describe all embodiments here. Any modifications and changes made to the present invention within the spirit and scope of the claims fall within the protection scope of the present invention.
Claims
1. A method for automatic identification of PLC wiring diagrams and extraction of physical information, characterized in that, comprising the following steps: In S1, the PLC wiring diagram is exported as a PDF format file, text information is extracted by parsing the PDF, the extracted text is divided into four categories: PLC attributes, component text symbols, I / O addresses, and I / O descriptions, so as to obtain text-textbox sets corresponding to the four categories; In S2, by matching elements between the text-textbox sets corresponding to the I / O address category and the I / O description category, the mapping relationship between I / O addresses and I / O descriptions is obtained, the I / O address value and I / O data type of each I / O address are extracted, and syntax parsing is performed on each I / O description to extract physical device information, including device name, device ID, execution action and monitoring state, so as to obtain an I / O address-physical device information set; In S3, the PDF format file of the PLC wiring diagram is converted into an image format after the text content is deleted, and binarization processing is performed to obtain a preprocessed drawing image; In S4, an image containing only horizontal lines and an image containing only vertical lines are extracted through morphological opening operation, a line segment detector is used to extract the positions of line segments in the images, and a connection line set is obtained by screening out line segment sets that can form rectangles; In S5, a multi-scale window mechanism guided by component text symbols is used, combined with a target detection model to detect and locate components in the drawing image, and a clustering and voting mechanism is used to match the text symbols and image symbols of the components, so as to output a component information set; In S6, the topological relationship among the I / O address-physical device information set, the connection line set and the component information set is analyzed, and the physical information table of the PLC wiring diagram is extracted and output according to connectivity.
2. The method according to claim 1, characterized in that, Classifying the extracted text information in S1 specifically includes: screening out the text-textbox set belonging to the PLC attribute category by retrieving the PLC database; screening out the text-textbox set belonging to the component text symbol category by retrieving the electrical component database; screening out the text-textbox set belonging to the I / O address category by a regular matching method; the remaining text content forms the text-textbox set belonging to the I / O description category.
3. The method according to claim 1, characterized in that, The specific steps of S2 are as follows: matching I / O descriptions and I / O addresses according to the minimum distance of text boxes; parsing I / O addresses by using a regular matching method, and extracting binary group information <I / O address value, I / O data type> of the I / O addresses; parsing each I / O description by using a syntax parser corresponding to the I / O description language, and extracting quaternary group information <device name, [device ID], [execution action], [monitoring state]> of the physical device; outputting the I / O address-physical device information set, wherein each element in the set contains tuple information of the following 6 fields: I / O address value, I / O data type, device name, device ID, execution action, monitoring state, and the corresponding text box position.
4. The method according to claim 3, characterized in that, designing an I / O description language that conforms to the Backus-Naur Form and the habits of developers, using the language to guide developers to write I / O descriptions, and using the syntax parser corresponding to the language to automatically parse each I / O description.
5. The method according to claim 1, characterized in that, The specific steps of S5 are as follows: For each component text symbol, calculate the center point coordinate of its text box, take this coordinate as the center point, crop local images of multiple sizes in the drawing image, and obtain a local image set; Traverse the local images, and use the pre-trained YOLOv5 model to detect components in the local images. The detection results include the category, bounding box coordinate and confidence score of each component; Traverse the local image set to obtain a detection result set; Use the Intersection over Union of bounding boxes as a metric to cluster the detection results, and obtain a clustered set; For the clusters obtained after clustering, calculate the sum of the category scores of each component in the cluster, vote to select the component category with the highest total score as the detection result of the cluster, and for all bounding boxes of the detection result of this category, screen out the bounding box with the highest confidence as the final bounding box; Obtain the set of component detection results in all local images corresponding to the component text symbol; Use the minimum distance principle to match the text symbol and the image symbol of the component; Traverse the text-text box set corresponding to the component text symbol category obtained in S1, obtain the matching relationship between the text symbol and the image symbol of the component, and output the component information set.
6. The method according to claim 1, characterized in that, The specific steps of S6 are as follows: Calculate the connectivity matrix between each graphic element in the I / O address-physical device information set, the connection line set and the component information set. If two graphic elements intersect, they are connected, the matrix element is 1, otherwise it is 0; Extract the graphic element connection tree from the connectivity matrix, where the leaf nodes are the graphic elements in the I / O address-physical device information set; traverse the paths of the graphic element connection tree, and convert the information on each path from the root node to the leaf node into a row of the physical information table; Output the physical information table of the PLC wiring diagram, which contains seven fields: <I / O address value, I / O data type, device name, [device ID], [execution action], [monitoring state], [component information]>, where [] indicates that the information of the field is optional.
7. A device for automatic identification and physical information extraction of PLC wiring diagrams, characterized in that, Includes: Text extraction and classification module: Export the PLC wiring diagram into a PDF format file, extract text information by parsing the PDF, divide the extracted text into four categories: PLC attribute, component text symbol, I / O address, and I / O description, and obtain the text-text box sets corresponding to the four categories; Text matching and parsing module: By matching the elements between the text-text box sets corresponding to the I / O address category and the I / O description category, the mapping relationship between the I / O address and the I / O description is obtained, the I / O address value and I / O data type of each I / O address are extracted, and syntax parsing is performed on each I / O description to extract physical device information, including device name, device ID, execution action and monitoring state, so as to obtain the I / O address-physical device information set; Image preprocessing module: After deleting the text content of the PDF format file of the PLC wiring diagram, convert it into an image format and perform binarization processing to obtain a preprocessed drawing image; Connection line extraction module: Extract an image containing only horizontal lines and an image containing only vertical lines through morphological opening operation, use a line segment detector to extract the positions of line segments in the image, and screen out the line segment sets that can form a rectangle to obtain a connection line set; Component recognition and matching module: It uses a multi-scale window mechanism guided by component text symbols, combined with a target detection model to detect and locate components in the drawing image, and matches the text symbols and image symbols of the components through clustering and voting mechanisms, and outputs a set of component information. Physical Information Extraction Module: Analyzes the topological relationship between the I / O address-physical device information set, the connection line set, and the component information set, and extracts and outputs the physical information table of the PLC wiring diagram based on connectivity.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the PLC wiring diagram automatic identification and physical information extraction method as described in any one of claims 1-6.
9. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, implement the PLC wiring diagram automatic identification and physical information extraction method as described in any one of claims 1-6.
Citation Information
Patent Citations
Power grid wiring diagram element and line identification system and method based on artificial intelligence
CN114299533A
Power grid wiring graph primitive identification method based on overlapped sliding window mechanism and YOLOV4
CN114359948A
Power grid plant station wiring diagram automatic identification and conversion storage method
CN115082950A
Communication engineering drawing identification method and device
CN116110070A
Physical loop modeling method for intelligent substation drawing
CN114547968A