A method and device for generating a function diagram of a DCS system, and a storage medium
By converting the POU of the DCS system into an XML file and obtaining real-time data of the function block diagram, an intuitive function diagram is generated, which solves the problem of the lack of intuitiveness and structural clarity of the DCS system function diagram, and improves the maintainability and reliability of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING HELISHI CONTROL TECH CO LTD
- Filing Date
- 2026-03-05
- Publication Date
- 2026-06-26
AI Technical Summary
The functional diagrams of existing DCS systems lack intuitiveness and structural clarity, making it difficult for operators and maintenance engineers to quickly understand the control logic and locate faults, thus affecting operational efficiency and system maintainability.
The POU in the controller project is converted into an XML file, the function block symbols in the graphical editing software are obtained, and real-time data is obtained through pin identifiers. The input and output connection relationships are parsed to generate an intuitive function diagram.
It enables intuitive visualization of control logic, improves the efficiency of system status understanding and fault location speed, and enhances the maintainability and reliability of DCS systems.
Smart Images

Figure CN122289436A_ABST
Abstract
Description
Technical Field
[0001] This article relates to DCS system control technology, and in particular to a method, device and storage medium for generating function diagrams of a DCS system. Background Technology
[0002] Nuclear power plant DCS systems bear the crucial responsibility of real-time monitoring of the reactor and critical equipment throughout the plant. In the event of an anomaly, the system must respond swiftly and accurately, executing critical safety actions such as emergency shutdowns to ensure the safe and stable operation of the reactor. In this process, the functional diagram, as the graphical representation of the control logic within the DCS system, serves as the core bridge connecting control logic design and on-site operation. Its generation quality and online monitoring effectiveness directly impact the performance, availability, and reliability of the entire control system.
[0003] However, in existing related technologies, the system is usually only displayed as a configurable Program Organization Unit (POU), lacking an intuitive and clearly structured functional diagram. This makes it difficult for operators and maintenance engineers to quickly understand the control logic, locate faults, or conduct effective monitoring, which seriously affects operational efficiency and system maintainability. Summary of the Invention
[0004] This disclosure provides a method, apparatus, and storage medium for generating functional diagrams of a DCS system. The DCS system can be displayed in the form of functional diagrams, thereby enabling intuitive visualization of control logic, improving the efficiency of system status understanding and fault location speed, ensuring accurate execution of safe operations, ensuring the safe and stable operation of the reactor, and enhancing the maintainability and reliability of the DCS system.
[0005] This disclosure provides a method for generating a functional diagram of a DCS system, including: Convert the POUs configured in the controller project into XML files; Retrieve the function block symbols created and labeled with pins in the graphical editing software interface; wherein, the function block symbols correspond one-to-one with the function blocks in the XML file. After the function diagram is generated, the real-time data of the pins on the corresponding function blocks is retrieved from the DCS system according to the graphical editing software and the pin labels, and displayed on the pins of the corresponding function block symbols. Extract the input and output connection relationships of each element from the obtained XML file; Based on the obtained function block diagram, the input connection relationship and output connection relationship of each element, the logical connection between the elements in the POU is performed to generate the function diagram corresponding to the POU.
[0006] In one exemplary instance, converting the POU configured in the controller project into an XML file includes: Write the start tag of the POU content and the attributes of the POU into the XML file; The API call writes the attributes of the components in the POU to the XML file; Write the end tag of the POU content into the XML file and close the XML file.
[0007] In one exemplary instance, the calling interface writes the attributes of the elements in the POU to the XML file, including: Obtain the type of all components in the POU; For each type of component, the corresponding interface is called to write the attributes of that type of component into the XML file.
[0008] In one exemplary instance, obtaining the input and output connection relationships of each element in the obtained XML file includes: Traverse the child nodes under the cfc node in the obtained XML file, and parse the attributes of each element in the POU to obtain the element list of the POU; Based on the obtained component list, construct the mapping relationship from component identifier to component, and obtain the input connection information of each component; The obtained component list is traversed. During the traversal, the input component list and output component list of each component are obtained based on the obtained mapping relationship and the input connection information of each component. The obtained list of input components for each element is used as the input connection relationship, and the obtained list of output components for each element is used as the output connection relationship.
[0009] In one exemplary instance, the attributes of each component include: the component's identifier, position, text content, the identifier of the input component, and whether the pins are inverted; When the component is a function block component, the input connection information of the component includes: the identifier of the component to which the component is connected, the serial number of the pin of the input connection component among all the input pins of the component, and whether the pin of the input connection component is inverted; when the component is a component other than a function block component, the input information of the component includes: the identifier of the component to which the component is connected.
[0010] In one exemplary instance, the traversal of the obtained component list, during the traversal process, involves acquiring the input component list and output component list of each component based on the obtained mapping relationship and the input connection information of each component, including: When traversing to a function block element in the element list, obtain the input connection information of that function block element, identify the element for each input connection in the obtained input connection information, and obtain the corresponding input element according to the obtained mapping relationship; Determine whether the obtained input element exists in the input element list of the function block element. If it is determined that the obtained input element does not exist in the input element list of the function block element, add the obtained input element to the input element list of the function block element and add the function block element to the output element list of the obtained input element.
[0011] In one exemplary instance, the traversal of the obtained component list, during the traversal process, involves acquiring the input component list and output component list of each component based on the obtained mapping relationship and the input connection information of each component, including: When traversing to other components in the component list, obtain the input connection information of the other component, identify the component connected to the input connection of the other component, obtain the corresponding input component according to the obtained mapping relationship, add the obtained input component to the input component list of the other component, and add the other component to the output component list of the obtained input component.
[0012] In one exemplary instance, the step of performing logical connections between components in the POU based on the obtained function block diagram, the input connection relationships and output connection relationships of each component, and generating a function diagram corresponding to the POU includes: Retrieve the element located between the configuration start tag and configuration end tag in the XML file; The obtained components are arranged sequentially according to a preset direction. When the arranged component is a function block corresponding to the obtained function block icon, the obtained function block icon is retrieved and the arranged function block is drawn according to the retrieved function block icon. When the arranged component is another component, the other arranged component is drawn. For each component's input and output connections, calculate the inflection points along the connections between components, draw the connections between components, and generate the function diagram corresponding to the POU.
[0013] This disclosure provides a functional diagram generation apparatus for a DCS system, including: a memory and a processor, wherein the memory is used to store an executable program; The processor is used to read and execute the executable program, and to execute the DCS system function diagram generation method as described above.
[0014] This disclosure also provides a storage medium storing a computer program, wherein when the computer program is executed by a processor, it can implement the function diagram generation method of the DCS system as described above.
[0015] The functional diagram generation method, apparatus, and storage medium for a DCS system provided in this disclosure convert the POU (Power Operation Unit) configured in the controller project into an XML file; obtain the function block symbols created and labeled with pins in the interface of a graphical editing software; wherein, the function block symbols correspond one-to-one with the function blocks in the XML file; after the functional diagram is generated, real-time data of the pins on the corresponding function blocks are obtained from the DCS system through the graphical editing software and by means of the pin labels, and displayed on the pins of the corresponding function block symbols; the input connection relationships and output connection relationships of each component are obtained from the obtained XML file; based on the obtained function block symbols, the input connection relationships and output connection relationships of each component, logical connections are made between the components in the POU to generate the functional diagram corresponding to the POU. Therefore, through POU to XML conversion, integration of function block symbols and pin labels, and parsing of component connection relationships, the control logic is made intuitively visualized, significantly improving the efficiency of system status understanding and fault location speed, thereby effectively addressing the maintenance challenges of complex control logic in DCS systems and greatly enhancing the maintainability and reliability of the system.
[0016] Other features and advantages of this application will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the application. Other advantages of this application can be realized and obtained by means of the embodiments described in the description and the accompanying drawings. Attached Figure Description
[0017] The accompanying drawings are used to provide an understanding of the technical solutions of this application and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of this application and do not constitute a limitation on the technical solutions of this application.
[0018] Figure 1 This is a flowchart illustrating a method for generating a functional diagram of a DCS system according to an embodiment of the present disclosure. Figure 2 This is a flowchart illustrating another method for generating a functional diagram of a DCS system according to an embodiment of this disclosure. Figure 3 This is a schematic diagram illustrating a process for converting a POU into an XML format file according to an embodiment of the present disclosure; Figure 4 This is a schematic diagram of a GCM functional block according to an embodiment of the present disclosure; Figure 5 This is a schematic diagram of an embodiment of the present disclosure of converting an XML file into a flowchart screen; Figure 6 This is a schematic diagram of the structure of a DCS system functional diagram generation device according to an embodiment of the present disclosure. Detailed Implementation
[0019] This application describes several embodiments, but these descriptions are exemplary and not limiting, and it will be apparent to those skilled in the art that many more embodiments and implementations are possible within the scope of the embodiments described herein. Although many possible combinations of features are shown in the drawings and discussed in the detailed description, many other combinations of the disclosed features are also possible. Unless specifically limited, any feature or element of any embodiment may be used in combination with, or may replace, any feature or element of any other embodiment.
[0020] This application includes and contemplates combinations of features and elements known to those skilled in the art. The embodiments, features, and elements disclosed in this application can also be combined with any conventional features or elements to form unique inventive solutions. Any feature or element of any embodiment can also be combined with features or elements from other inventive solutions to form another unique inventive solution. Therefore, it should be understood that any feature shown and / or discussed in this application can be implemented individually or in any suitable combination. Therefore, the embodiments are not limited except by the limitations imposed by the appended claims and their equivalents. Furthermore, various modifications and changes can be made within the scope of the appended claims.
[0021] Furthermore, in describing representative embodiments, the specification may have presented methods and / or processes as a specific sequence of steps. However, the method or process should not be limited to the specific order of steps described herein, to the extent that it does not depend on such a specific order. As will be understood by those skilled in the art, other sequences of steps are also possible. Therefore, the specific order of steps set forth in the specification should not be construed as a limitation of the claims. Moreover, the claims concerning the method and / or process should not be limited to the steps performed in the written order, and those skilled in the art will readily understand that these orders can be varied and still remain within the spirit and scope of the embodiments of this application.
[0022] Among related technologies, nuclear power plants, as an efficient and clean energy production method, occupy an important position in the global energy structure. The nuclear power plant's DCS system bears the crucial responsibility of real-time monitoring of the reactor and all critical equipment operating in the plant. In the event of an anomaly, it can react quickly and accurately, executing critical operations such as emergency shutdown to ensure reactor safety. The functional diagram, as a key graphical carrier of the DCS, is a vital bridge connecting control logic design and on-site operation; its generation quality and online monitoring effectiveness directly determine the performance and reliability of the control system.
[0023] Existing nuclear power plant control tools have significant limitations: static flowcharts can only display equipment layout and cannot link real-time parameters; fragmented monitoring and programming tools lead to information gaps between design, commissioning, and operation, increasing the difficulty of troubleshooting and the risk of human error. The dynamic function chart generation method proposed in this solution can achieve real-time status visualization, logical graphical representation, and fault early warning, effectively addressing these shortcomings.
[0024] Therefore, this disclosure provides a method for generating a functional diagram of a DCS system, such as... Figure 1 As shown, it includes: Step 100: Convert the POU configured in the controller project into an XML file; Step 101: Obtain the function block icon created and with pin identifiers added in the interface of the graphical editing software; wherein, the function block icon corresponds one-to-one with the function block in the XML file. After the function diagram is generated, the real-time data of the pins on the corresponding function block is obtained from the DCS system according to the graphical editing software and through the pin identifiers, and displayed on the pins of the corresponding function block icon. Step 102: Obtain the input and output connection relationships of each element from the obtained XML file; Step 103: Based on the obtained function block diagram, the input connection relationship and output connection relationship of each element, perform logical connections between the elements in the POU to generate the function diagram corresponding to the POU.
[0025] For example, the input and output connection relationships of each component can be accurately extracted from the XML file to fully restore the signal flow of the control logic. This process can be based on predefined connection rules to ensure accurate mapping of logical relationships, provide reliable data support for the generation of function diagrams, and avoid errors that may be introduced by manual configuration.
[0026] For example, based on the acquired function block diagram and its input / output connections, the logical connections between components in the POU are completed, generating a function diagram that perfectly matches the original POU. This function diagram not only intuitively displays the topology of the control logic, but also clearly presents the signal transmission path in a graphical way, making the complex control logic readily apparent.
[0027] For example, after designing and adding pin identifiers to a function block symbol in graphical editing software, the generated function diagram needs to be downloaded to the operator station. When the operator station is running online, it obtains the dynamic data of the function block pins in real time and dynamically updates the display by calling the point value reading interface provided by the server. Therefore, this function block symbol, due to its real-time data interaction capability, can be called a "dynamic function block symbol." Specifically, after the function diagram is generated, the real-time data of the pins on the corresponding function block is obtained from the DCS system according to the graphical editing software and through the pin identifiers, and displayed on the pins of the corresponding function block symbol. This can be achieved in the following way: The graphical editing software integrates a VBA development environment and creates a corresponding VBA project for each page file. In each VBA project, the corresponding page component files are imported. These files include editable document class submodules and several type library files, as well as pre-created page component definition and page component calling submodules based on the DCS. The page component definition submodules include dynamic characteristic definition and interactive characteristic definition submodules; similarly, the page component calling submodules also include dynamic characteristic calling and interactive characteristic calling submodules. Dynamic characteristics are added to components within the page component definition submodules and invoked through the calling functions contained in the dynamic characteristic calling submodules, thereby realizing the invocation of dynamic characteristics of graphical objects in the page file. For example, configuring color changes or analog value display characteristics for graphical objects in the page file.
[0028] Graphics editing software defines frequently used display functions as dynamic characteristic sets, which can be configured through a dedicated window. The dynamic characteristic definition submodule supports one or any combination of the following dynamic characteristics: text characteristics (setting the text value of graphic objects on the page, such as dynamically updating displayed text based on DCS point values); color-changing characteristics (setting the color of graphic objects or combined objects when DCS point values meet certain conditions); blinking characteristics (setting the blinking state of graphic objects based on DCS point value status); hiding characteristics, fill characteristics, rotation characteristics, horizontal movement characteristics, operation enable characteristics, analog value characteristics, and switch value characteristics.
[0029] When the operator station opens the function chart page, the page file's open event function (Open()) is triggered. The page file execution then jumps to the VBA project, triggering the page file's start event function (OnStartOnLine()), which initializes the variables used by the page file. After initializing the VBA project for the page file, periodic processing operations are performed, including periodic event response functions and periodic page refreshes. During periodic page refreshes, the dynamic display effects of all graphic objects are rendered in real time, including the display of numerical values, color changes, and blinking light effects for various graphic objects.
[0030] The functional diagram generation method for a DCS system provided in this disclosure converts the POU (Power Operation Unit) configured in the controller project into an XML file; obtains the function block symbols created and labeled with pins in the interface of a graphical editing software; wherein, the function block symbols correspond one-to-one with the function blocks in the XML file; after the functional diagram is generated, real-time data of the pins on the corresponding function blocks are obtained from the DCS system through the graphical editing software and by means of the pin labels, and displayed on the pins of the corresponding function block symbols; the input connection relationships and output connection relationships of each component are obtained from the obtained XML file; based on the obtained function block symbols, the input connection relationships and output connection relationships of each component, logical connections are made between the components in the POU to generate the functional diagram corresponding to the POU. Therefore, through POU to XML conversion, integration of function block symbols and pin labels, and parsing of component connection relationships, the control logic is made intuitively visualized, significantly improving the efficiency of system status understanding and fault location speed, thereby effectively addressing the maintenance challenges of complex control logic in DCS systems and greatly enhancing the maintainability and reliability of the system.
[0031] In one exemplary instance, converting the POU configured in the controller project into an XML file includes: Write the start tag of the POU content and the attributes of the POU into the XML file; The API call writes the attributes of the components in the POU to the XML file; Write the end tag of the POU content into the XML file and close the XML file.
[0032] For example, in the DCS system function diagram generation process, the first step in converting the POUs (Program Organization Units) configured in the controller project into XML files is to write the start tag of the POU content and embed the POU's attribute information. This process can be achieved by specifying... <pou name="ControlLogic" type="FunctionBlock">The system uses tags to structure and store key metadata such as the name, type, version number, and device to which the POU belongs, establishing a standardized data framework for subsequent logical processing and ensuring the integrity and traceability of the control logic.
[0033] Then, the preset API interface is invoked to write the detailed attributes (including pin name, component type, component location, input component identifier, and whether to invert) of each component (such as input / output pins and internal variables) in the POU into an XML file. Through this step, the logical details of the components are accurately captured and associated with the corresponding functional blocks, providing high-precision data source support for the graphical editing software.
[0034] Finally, write the closing tag of the POU content in the XML file (e.g.,< / pou> The process then closes the file, completing the generation of a structurally complete and grammatically compliant document. This conversion mechanism transforms unstructured POU configuration data into parsable XML format, meeting the DCS system's data standardization requirements and laying the technical foundation for subsequent function block symbol generation and real-time data mapping, effectively improving system maintenance efficiency and reliability.
[0035] In one exemplary instance, the calling interface writes the attributes of the elements in the POU to the XML file, including: Obtain the type of all components in the POU; For each type of component, the corresponding interface is called to write the attributes of that type of component into the XML file.
[0036] For example, by traversing the internal structure of the POU, the type of all components (such as input pins, output pins, internal variables or timers, etc.) can be automatically identified and obtained. The metadata parsing based on the POU configuration provides an accurate type basis for subsequent attribute writing.
[0037] For each identified component type, a predefined dedicated interface function is called (for example, the writeInputPin() interface is used for input pins, the writeOutputPin() interface is used for output pins, and the writeInternalVariable() interface is used for internal variables) to write the attribute data of that type of component (including component type, component position, input component identifier, whether to invert, etc.) into an XML file in a structured format to ensure accurate mapping and consistency of attribute data.
[0038] During the attribute writing process, the preset XML format specifications are strictly followed. For example, the "data type" attribute of the input footer is encoded as follows: <datatype> integer< / datatype> The "connection direction" attribute of the output pin is... <direction> output< / direction> This standardized storage method avoids data format chaos and provides a high-precision data source that can be directly parsed by graphical editing software.
[0039] This step efficiently completes the structured storage of component attributes through a typed interface call mechanism, laying the foundation for subsequent function diagram generation. It enables graphical editing software to accurately match function block symbols with component attributes in XML and supports real-time data dynamic acquisition through pin identifiers, significantly improving the visualization efficiency and maintenance reliability of DCS control logic.
[0040] In one exemplary instance, obtaining the input and output connection relationships of each element in the obtained XML file includes: Traverse the child nodes under the cfc node in the obtained XML file, and parse the attributes of each element in the POU to obtain the element list of the POU; Based on the obtained component list, construct the mapping relationship from component identifier to component, and obtain the input connection information of each component; The obtained component list is traversed. During the traversal, the input component list and output component list of each component are obtained based on the obtained mapping relationship and the input connection information of each component. The obtained list of input components for each element is used as the input connection relationship, and the obtained list of output components for each element is used as the output connection relationship.
[0041] For example, in the process of generating the DCS system function diagram, all child nodes under the cfc node in the XML file are first traversed, and the attribute information of each child node (such as component ID, type, name and port identifier) is parsed to extract detailed data of all components in the POU, construct a complete component list, and ensure that each component unit in the control logic is accurately identified and recorded.
[0042] Based on the constructed component list, a mapping relationship is established between component identifiers (such as IDs) and component objects to achieve rapid component location; at the same time, the input connection information of each component (such as the IDs of other components associated with the input ports) is extracted from XML to provide basic data support for subsequent logical relationship parsing.
[0043] During the process of traversing the component list, the input component list (i.e., the set of all components that provide input signals) and output component list (i.e., the set of components connected to the output signal of the component) of each component are dynamically generated by using the pre-established mapping relationship and input connection information. The logical flow is automatically deduced by parsing the connection nodes in the XML.
[0044] Finally, the input component list of all components is summarized into input connection relationships (indicating signal flow direction), and the output component list is summarized into output connection relationships (indicating signal destination). These relationships are directly used in the graphical editing software to draw the logical connections between components, ensuring that the generated function diagram is completely consistent with the original POU control logic topology, and providing accurate data support for real-time system monitoring and fault location.
[0045] In one exemplary instance, the attributes of each component include: the component's identifier, position, text content, the identifier of the input component, and whether the pins are inverted; When the component is a function block component, the input connection information of the component includes: the identifier of the component to which the component is connected, the serial number of the pin of the input connection component among all the input pins of the component, and whether the pin of the input connection component is inverted; when the component is a component other than a function block component, the input information of the component includes: the identifier of the component to which the component is connected.
[0046] For example, during the generation of the DCS system function diagram, the attributes of each component define its basic characteristics and connection basis in the control logic. Specifically, these include the component's unique identifier (for accurate matching and positioning), its coordinate position in the graphical interface (to ensure layout rationality), the displayed text content (such as function block name or parameters), the component identifier of the input connection (to record the signal source), and whether the pin is inverted (to indicate the signal processing logic, such as whether a logic NOT operation needs to be applied).
[0047] When the component is a function block component (such as a PID controller, timer, or other complex logic unit with multiple input / output pins), its input connection information is further refined into the component identifier of the input connection, the specific sequence number of the pin of the input connection component among all the input pins of the target component (e.g., the input signal comes from the "IN1" pin of the function block, with sequence number 1), and whether the pin of the input connection component needs to be inverted (e.g., whether the "IN1" pin needs to invert the signal). This ensures that the signal flow can be accurately drawn and the logical operations can be correctly processed in the function diagram. When the component is a non-function block component (such as a simple unit such as a constant, sensor, or actuator, which usually has only one input port), its input information only needs to record the component identifier of the input connection, without specifying the pin sequence number, because the input structure of such components is simple and does not require additional pin positioning. This design that distinguishes between attributes and connection information enables the system to intelligently adapt to different component types when parsing XML files, avoiding connection errors and providing high-precision data support for the logical connection of the function diagram, thereby ensuring that the generated function diagram is completely consistent with the original POU control logic.
[0048] In one exemplary instance, the traversal of the obtained component list includes, during the traversal process, obtaining the input component list and output component list of each component based on the obtained mapping relationship and the input connection information of each component, including: When traversing to a function block element in the element list, obtain the input connection information of that function block element, identify the element for each input connection in the obtained input connection information, and obtain the corresponding input element according to the obtained mapping relationship; Determine whether the obtained input element exists in the input element list of the function block element. If it is determined that the obtained input element does not exist in the input element list of the function block element, add the obtained input element to the input element list of the function block element and add the function block element to the output element list of the obtained input element.
[0049] For example, during the process of traversing the component list, when a function block component is processed, its input connection information is first obtained, including a list of component identifiers of the input signal source. Through the pre-established mapping relationship between component identifiers and component objects, each component identifier is parsed into the corresponding input component object to ensure the accurate positioning of the connection relationship between components.
[0050] For each element identifier in the input connection information, check whether the input element already exists in the input element list of the current function block element; if not, add the input element to the input element list of the function block element, and at the same time add the current function block element to the output element list of the input element, thereby dynamically maintaining the bidirectional connection relationship.
[0051] This mechanism effectively avoids adding duplicate connections, ensures the uniqueness and integrity of the input and output component lists, and provides high-precision data support for drawing the logic connections in the function diagram by accurately capturing the signal flow between components.
[0052] Ultimately, the generated input and output component lists fully reflect the signal transmission paths of the control logic, ensuring that the function diagram is completely consistent with the original POU control logic topology, thereby improving the intuitiveness of DCS system monitoring and the efficiency of fault diagnosis.
[0053] In one exemplary instance, the traversal of the obtained component list includes, during the traversal process, obtaining the input component list and output component list of each component based on the obtained mapping relationship and the input connection information of each component, including: When traversing to other components in the component list, obtain the input connection information of the other component, identify the component connected to the input connection of the other component, obtain the corresponding input component according to the obtained mapping relationship, add the obtained input component to the input component list of the other component, and add the other component to the output component list of the obtained input component.
[0054] For example, during the process of traversing the component list, when dealing with non-functional block components (such as simple components like constants, sensors, or actuators), the process first obtains their input connection information. This information only includes the component identifier of the input signal source (since these components typically have only one input port, pin numbers do not need to be specified). Based on the pre-established mapping relationship between component identifiers and component objects, the component identifier is accurately parsed into the corresponding input component object. Subsequently, the input component is added to the input component list of the current non-functional block component, and the current non-functional block component is added to the output component list of the input component. This bidirectional maintenance mechanism effectively avoids connection duplication, ensures the integrity and uniqueness of the input and output component lists, provides a high-precision data foundation for drawing the logical connections of the function diagram, and enables the generated function diagram to accurately reflect the signal flow of the original POU control logic, thereby significantly improving the intuitiveness of DCS system monitoring and the efficiency of fault diagnosis.
[0055] In one exemplary instance, the step of performing logical connections between components in the POU based on the obtained function block diagram, the input connection relationships and output connection relationships of each component, and generating a function diagram corresponding to the POU includes: Retrieve the element located between the configuration start tag and configuration end tag in the XML file; The obtained components are arranged sequentially according to a preset direction. When the arranged component is a function block corresponding to the obtained function block icon, the obtained function block icon is retrieved and the arranged function block is drawn according to the retrieved function block icon. When the arranged component is another component, the other arranged component is drawn. For each component's input and output connections, calculate the inflection points along the connections between components, draw the connections between components, and generate the function diagram corresponding to the POU.
[0056] For example, the configuration start marker can be "flag hmi begin", and the configuration end marker can be "flag hmi end". In generating the function diagram corresponding to the POU, the function block data located between the annotation markers "flag hmi begin" and "flag hmi end" is first precisely extracted from the XML file. These markers serve as logical boundaries to ensure that only the control modules to be visualized are included, avoiding interference from redundant information. Subsequently, these components are arranged sequentially according to a preset layout direction (such as from left to right or from top to bottom) to achieve a structured organization of the graphical interface, effectively improving logical clarity and readability. Finally, on each function block symbol, connection points are precisely located based on pin identifiers (such as the names or numbers of input / output ports), and logical connections between components are drawn based on the parsed component input / output connection relationships. This accurately reflects the signal flow and interaction logic in the POU, generating a function diagram that perfectly matches the original control logic, significantly improving the intuitive monitoring capability of the DCS system's operating status and the efficiency of fault location.
[0057] The functional diagram generation method for a DCS system provided in this disclosure includes: exporting the POU configured in the logic configuration software AutoThink as an XML format file when compiling the project on the engineering station; drawing control algorithm block (such as PID controller) symbols in the graphical editing configuration software and adding corresponding dynamic characteristics to the symbol pins; parsing the XML file conforming to the functional diagram format using Document Object Model (DOM) technology through a middleware program, and then converting the file into a flowchart page based on the parsing. The overall functional flowchart of this solution is as follows: Figure 2 As shown, it includes the following steps: Step 200: Configure the control scheme POU in the logic configuration software AutoThink; Step 201: In the graphics editing software, create the corresponding function block symbol library based on the control algorithm block; Step 202: In the engineering workstation software, check the "Generate Dynamic Function Chart" option and execute the project compilation; Step 203: When compiling the control station, instruct the AutoThink software to export the POU as an XML file; Step 204: Use DOM technology to parse the XML format POU and call the graphical editing software interface to draw a dynamic function diagram.
[0058] The method for generating a functional diagram of a DCS system provided in this disclosure mainly includes the following three parts: 1. Convert the POUs configured in the controller project into XML format files. The conversion flowchart is as follows: Figure 3 As shown, it includes the following steps: 300. Traverse all POUs under the site; 301. For each POU, write the POU start tag and related attributes (scheduling cycle, drawing size, etc.) to an XML file; 302. For each CFC type POU, iterate through all components of the current POU. The components of a CFC program include input components, output components, function block components, jump components, comment components, and variables.
[0059] Based on the type of POU, the POU logic is written to an XML file by calling the interface of the POU subclass. Nuclear power DCS systems mainly use two types of POUs: Structured Text (ST) and Continuous Function Chart (CFC). Dynamic Function Charts are only generated for CFC type POUs. 303. For different types of components, call the corresponding interface to write the relevant attributes of the component into the XML file; 304. For each POU, write the closing tag of the POU content to the XML file and close the file. The conversion from POU to XML file is now complete. The XML file format is as follows: Figure 3 As shown.
[0060] 2. Draw the corresponding symbols for the control algorithm blocks in the graphical editing software.
[0061] To achieve dynamic mapping of control logic, it is necessary to create corresponding icons for function blocks in graphical editing software, add text attributes to the pins of the function blocks, and call relevant server interfaces to read the real-time values of the function block's pins when online, thus visualizing the real-time status of the function block's pins. Taking the GCM function block as an example, the drawn icons can be as follows: Figure 4As shown, the module has multiple ports distributed on both sides. The left side is for input signals, and the right side is for output signals. All ports are named with abbreviations, such as "MIDMOD", "MMGMOD", "MAGMOD", etc. "MOD" stands for "Mode". Prefixes such as MI, MM, MA, FI, FA, FM, and C correspond to different states or sources, such as manual, maintenance, automatic, feedback, and command, respectively. Overall, they are used to manage the switching of equipment operating modes and status feedback. For example, "CM" may be the main control command input, and "AGMOD" may be the output indication of the automatic global mode.
[0062] 3. Parse the XML file corresponding to POU and convert it into a flowchart. The process can be as follows: Figure 5 As shown.
[0063] 400. Traverse each XML file exported from the site project; 401. For each XML file, first traverse all child nodes under pou; 402. For the CFC child nodes under the POU node, traverse the child nodes under the CFC node, parse the attributes of each element in the POU, such as element ID, position, text content, input element, whether the pins are inverted, etc., to form a component list of the POU. If the element is a box and there are multiple inputs, form a list of input connection points (recording the ID of the connection block, the sequence number of the connection point in the connection block, and whether it is inverted, etc.). If it is another element, only the input element ID is recorded. 403. Sort the parsed elements according to their IDs to form a map structure with the element ID as the key and the element as the value. Sort the annotation elements according to their Y coordinates. 404. Traverse the component list and populate the input and output connection blocks of the components, as follows: 404a. If the element is an output element, jump element, or return element (type is output, jump, or returnValue), find the corresponding input element in the element map structure according to the input element ID (inputid attribute under element in the XML file), add the input element to the input element list of the current element, and add the current element to the output element list of the input element. 404b. If the component is a block component (type is box), iterate through the component's input connection point list, find the corresponding input component in the component map structure according to the ID of the connection block, and if the input component is a box and is not found in the input component list of the component connection or the input component is not a box component, add the input component to the input component list of the current component, and at the same time add the component to the output component list of the input component.
[0064] 405. For each POU, create a Page, add the function blocks within the function diagram range (located in the annotation elements flag hmibegin and flag hmi end) to the element list, and sort them according to the X coordinate to prepare for drawing; 406. Call the graphical editing software interface to create a flowchart screen, and draw function blocks from left to right according to the X coordinate. 407. Using the A* pathfinding algorithm, calculate the connections between functional blocks and call the interface to draw the connections. The steps are as follows: 407a. Initialize the grid according to the page size, with each grid cell containing 20 pixels; 407b. Traverse the component list of the Page, and form a list of connection lines based on the input / output relationships of the component records. The coordinate calculation rules for the component connection lines are as follows: The x-coordinate of the starting point of the connector line is: the x-coordinate of the top left corner of the starting block plus the actual width of the starting block after it is drawn. The x-coordinate of the endpoint of the connector: the x-coordinate of the top left corner of the terminating block.
[0065] (1) Neither the start nor the end block is of type box. The y-coordinate of the starting point of the connecting line is: the y-coordinate of the top left corner of the starting block + the height of a node in CFC * 0.5; The y-coordinate of the endpoint of the connecting line is: the y-coordinate of the top left corner of the endpoint + the height of a node in cfc * 0.5.
[0066] (2) Both the start and end blocks are of type box. The y-coordinate of the starting point of the connector line is: the y-coordinate of the top left corner of the starting block + the y-coordinate of the first node in the block + the height of the block header + the sequence number of the block input node * the height of a single node; The y-coordinate of the endpoint of the connector is: the y-coordinate of the top left corner of the terminating block + the y-coordinate of the first node in the block + the height of the block header + the sequence number of the output node in the block * the height of a single node.
[0067] (3) Only the starting block is of type box The y-coordinate of the starting point of the connector line is: the y-coordinate of the top left corner of the starting block + the y-coordinate of the first node in the block + the height of the block header + the sequence number of the block input node * the height of a single node; The y-coordinate of the endpoint of the connecting line is: the y-coordinate of the top left corner of the endpoint + the height of a node in cfc * 0.5.
[0068] (4) Only the terminating block is of type box The y-coordinate of the starting point of the connecting line is: the y-coordinate of the top left corner of the starting block + the height of a node in CFC * 0.5; The y-coordinate of the endpoint of the connector is: the y-coordinate of the top left corner of the terminating block + the y-coordinate of the first node in the block + the height of the block header + the sequence number of the output node in the block * the height of a single node.
[0069] 407c. Sort the connecting lines in ascending order of their starting points to form a map structure; 407d. Traverse the connecting line map and use the A* algorithm to generate a list of points for each connecting line; 407e. Use the line segment drawing object interface of the graphical editing software to draw connecting lines; 408. Traverse the component list. If the negate attribute (negate attribute tag in the XML file) of the function block is TRUE, call the drawing ellipse object interface of the graphical editing software to draw the reverse pin. 409. Based on the drawing, set the page size and save the flowchart. At this point, the dynamic function diagram is complete.
[0070] The method for generating a function diagram of a DCS system provided in this disclosure has the following advantages: 1. Real-time status visualization The online monitoring screen synchronously displays the real-time status of all functional blocks in the dynamic function diagram, including input / output signal values, on / off status of switch quantities, and operating modes, allowing operators to grasp the overall plant operating status in a short time and promptly detect abnormalities.
[0071] 2. Intelligent early warning and fault diagnosis By integrating big data analytics to predict the health of key parameters of functional blocks, potential anomalies can be identified and warnings issued in advance, allowing operators sufficient response time. Forced value assignment tests can be performed after authorization during engineering, and observing the output of functional blocks can pinpoint design flaws or signal transmission failures.
[0072] 3. Consistency After modifying the control logic, the dynamic function diagram will automatically update as soon as the project is compiled, avoiding inconsistencies between the logic configuration and the display.
[0073] This disclosure provides a functional diagram generation device for a DCS system, such as... Figure 6 The above includes: Conversion module 51 is used to convert the POU configured in the controller project into an XML file; The receiving module 52 is used to obtain the function block icon created and pin identifiers added in the interface of the graphical editing software; wherein, the function block icon corresponds one-to-one with the function block in the XML file. After the function diagram is generated, the real-time data of the pins on the corresponding function block is obtained from the DCS system according to the graphical editing software and through the pin identifiers, and displayed on the pins of the corresponding function block icon. The acquisition module 53 is used to obtain the input connection relationship and output connection relationship of each element in the obtained XML file; The generation module 54 is used to perform logical connections between components in the POU based on the obtained function block diagram, the input connection relationship and the output connection relationship of each component, and generate the function diagram corresponding to the POU.
[0074] In one exemplary instance, the conversion module 51 is further configured to: Write the start tag of the POU content and the attributes of the POU into the XML file; The API call writes the attributes of the components in the POU to the XML file; Write the end tag of the POU content into the XML file and close the XML file.
[0075] In one exemplary instance, the conversion module 21 is further configured to: Obtain the type of all components in the POU; For each type of component, the corresponding interface is called to write the attributes of that type of component into the XML file.
[0076] In one exemplary instance, the acquisition module 53 is further configured to: Traverse the child nodes under the cfc node in the obtained XML file, and parse the attributes of each element in the POU to obtain the element list of the POU; Based on the obtained component list, construct the mapping relationship from component identifier to component, and obtain the input connection information of each component; The obtained component list is traversed. During the traversal, the input component list and output component list of each component are obtained based on the obtained mapping relationship and the input connection information of each component. The obtained list of input components for each element is used as the input connection relationship, and the obtained list of output components for each element is used as the output connection relationship.
[0077] In one exemplary instance, the attributes of each component include: the component's identifier, position, text content, the identifier of the input component, and whether the pins are inverted; When the component is a function block component, the input connection information of the component includes: the identifier of the component to which the component is connected, the serial number of the pin of the input connection component among all the input pins of the component, and whether the pin of the input connection component is inverted; when the component is a component other than a function block component, the input information of the component includes: the identifier of the component to which the component is connected.
[0078] In one exemplary instance, the acquisition module 53 is further configured to: When traversing to a function block element in the element list, obtain the input connection information of that function block element, identify the element for each input connection in the obtained input connection information, and obtain the corresponding input element according to the obtained mapping relationship; Determine whether the obtained input element exists in the input element list of the function block element. If it is determined that the obtained input element does not exist in the input element list of the function block element, add the obtained input element to the input element list of the function block element and add the function block element to the output element list of the obtained input element.
[0079] In one exemplary instance, the acquisition module 53 is further configured to: When traversing to other components in the component list, obtain the input connection information of the other component, identify the component connected to the input connection of the other component, obtain the corresponding input component according to the obtained mapping relationship, add the obtained input component to the input component list of the other component, and add the other component to the output component list of the obtained input component.
[0080] In one exemplary instance, the generation module 54 is further configured to: Retrieve the element located between the configuration start tag and configuration end tag in the XML file; The obtained components are arranged sequentially according to a preset direction. When the arranged component is a function block corresponding to the obtained function block icon, the obtained function block icon is retrieved and the arranged function block is drawn according to the retrieved function block icon. When the arranged component is another component, the other arranged component is drawn. For each component's input and output connections, calculate the inflection points along the connections between components, draw the connections between components, and generate the function diagram corresponding to the POU.
[0081] The functional diagram generation device for a DCS system provided in this embodiment converts the POU (Power Operation Unit) configured in the controller project into an XML file; it obtains the function block symbols created and labeled with pins in the interface of a graphical editing software; wherein, the function block symbols correspond one-to-one with the function blocks in the XML file; after the functional diagram is generated, it obtains the real-time data of the pins on the corresponding function blocks from the DCS system according to the graphical editing software and through the pin labels, and displays it on the pins of the corresponding function block symbols; it obtains the input connection relationships and output connection relationships of each component from the obtained XML file; based on the obtained function block symbols, the input connection relationships and output connection relationships of each component, it performs logical connections between components in the POU to generate the functional diagram corresponding to the POU. Therefore, through POU to XML conversion, integration of function block symbols and pin labels, and parsing of component connection relationships, it achieves intuitive visualization of control logic, significantly improves the efficiency of system status understanding and fault location speed, thereby effectively addressing the maintenance challenges of complex control logic in DCS systems and greatly enhancing the maintainability and reliability of the system.
[0082] This disclosure provides a functional diagram generation apparatus for a DCS system, comprising: a memory and a processor, wherein the memory is used to store an executable program; The processor is used to read and execute the executable program, and execute the function diagram generation method of the DCS system as described in any of the above embodiments.
[0083] This disclosure provides a storage medium storing a computer program, wherein when the computer program is executed by a processor, it can implement the function diagram generation method of the DCS system as described in any of the above embodiments.
[0084] It will be understood by those skilled in the art that all or some of the steps, systems, or apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term "computer storage medium" includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
Claims
1. A method for generating a functional diagram of a DCS system, characterized in that, include: Convert the POUs configured in the controller project into XML files; Retrieve the function block symbols created and labeled with pins in the graphical editing software interface; wherein, the function block symbols correspond one-to-one with the function blocks in the XML file. After the function diagram is generated, the real-time data of the pins on the corresponding function blocks is retrieved from the DCS system according to the graphical editing software and the pin labels, and displayed on the pins of the corresponding function block symbols. Extract the input and output connection relationships of each element from the obtained XML file; Based on the obtained function block diagram, the input connection relationship and output connection relationship of each element, the logical connection between the elements in the POU is performed to generate the function diagram corresponding to the POU.
2. The method according to claim 1, characterized in that, The process of converting the POU configured in the controller project into an XML file includes: Write the start tag of the POU content and the attributes of the POU into the XML file; The API call writes the attributes of the components in the POU to the XML file; Write the end tag of the POU content into the XML file and close the XML file.
3. The method according to claim 2, characterized in that, The calling interface writes the attributes of the components in the POU to the XML file, including: Obtain the type of all components in the POU; For each type of component, the corresponding interface is called to write the attributes of that type of component into the XML file.
4. The method according to claim 1, characterized in that, The step of obtaining the input and output connection relationships of each element from the obtained XML file includes: Traverse the child nodes under the cfc node in the obtained XML file, and parse the attributes of each element in the POU to obtain the element list of the POU; Based on the obtained component list, construct the mapping relationship from component identifier to component, and obtain the input connection information of each component; The obtained component list is traversed. During the traversal, the input component list and output component list of each component are obtained based on the obtained mapping relationship and the input connection information of each component. The obtained list of input components for each element is used as the input connection relationship, and the obtained list of output components for each element is used as the output connection relationship.
5. The method according to claim 4, characterized in that, The attributes of each component include: the component's identifier, location, text content, the identifier of the input component, and whether the pins are inverted; When the component is a function block component, the input connection information of the component includes: the identifier of the component to which the component is connected, the serial number of the pin of the input connection component among all the input pins of the component, and whether the pin of the input connection component is inverted; when the component is a component other than a function block component, the input information of the component includes: the identifier of the component to which the component is connected.
6. The method according to claim 5, characterized in that, The traversal of the obtained component list, during which the input component list and output component list of each component are obtained based on the obtained mapping relationship and the input connection information of each component, includes: When traversing to a function block element in the element list, obtain the input connection information of that function block element, identify the element for each input connection in the obtained input connection information, and obtain the corresponding input element according to the obtained mapping relationship; Determine whether the obtained input element exists in the input element list of the function block element. If it is determined that the obtained input element does not exist in the input element list of the function block element, add the obtained input element to the input element list of the function block element and add the function block element to the output element list of the obtained input element.
7. The method according to claim 5, characterized in that, The traversal of the obtained component list, during which the input component list and output component list of each component are obtained based on the obtained mapping relationship and the input connection information of each component, includes: When traversing to other components in the component list, obtain the input connection information of the other component, identify the component connected to the input connection of the other component, obtain the corresponding input component according to the obtained mapping relationship, add the obtained input component to the input component list of the other component, and add the other component to the output component list of the obtained input component.
8. The method according to claim 1, characterized in that, Based on the obtained function block diagram, the input connection relationships and output connection relationships of each element, the logical connections between elements in the POU are performed to generate the function diagram corresponding to the POU, including: Retrieve the element located between the configuration start tag and configuration end tag in the XML file; The obtained components are arranged sequentially according to a preset direction. When the arranged component is a function block corresponding to the obtained function block icon, the obtained function block icon is retrieved and the arranged function block is drawn according to the retrieved function block icon. When the arranged component is another component, the other arranged component is drawn. For each component's input and output connections, calculate the inflection points along the connections between components, draw the connections between components, and generate the function diagram corresponding to the POU.
9. A functional diagram generation device for a DCS system, characterized in that, include: A memory and a processor, wherein the memory is used to store an executable program; The processor is used to read and execute the executable program, and to execute the function diagram generation method of the DCS system as described in any one of claims 1-8.
10. A storage medium, characterized in that, The storage medium contains a computer program, which, when executed by a processor, can implement the function diagram generation method for the DCS system as described in any one of claims 1-8.