Nuclear power plant instrument control system control algorithm simulation device and simulation method thereof

The simulation device for the control algorithm of the instrumentation and control system of nuclear power plants solved the problem of lagging verification of the control algorithm function, realized online simulation and visual interaction, improved development efficiency and ensured the accuracy of simulation results.

CN120928719APending Publication Date: 2025-11-11NUCLEAR POWER INSTITUTE OF CHINA +1

Patent Information

Application Number
CN202510859573.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-25
Publication Date
2025-11-11

AI Technical Summary

Technical Problem

Functional verification of control algorithms in nuclear power plant instrumentation and control systems lags behind code generation. Reliance on hardware platforms leads to low development efficiency, and the lack of direct correlation between models and running code makes it difficult to detect logical errors early.

Method used

A simulation device for control algorithms of nuclear power plant instrumentation and control systems is provided, including a user interface, a code generation engine, and model entities. By constructing the model structure, parsing XML files to generate source code, performing simulation runs, and displaying the results, the device enables online simulation and visual interaction of control algorithms.

Benefits of technology

This enables early logic verification and debugging of the control algorithm, improving development efficiency, reducing dependence on embedded hardware, ensuring consistency between simulation results and actual code, and improving the accuracy of software verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120928719A_ABST
    Figure CN120928719A_ABST
Patent Text Reader

Abstract

The invention discloses a nuclear power plant instrument control system control algorithm simulation device and a simulation method thereof, and relates to the technical field of nuclear power plant instrument control software. The device comprises a user interface used for responding to user interaction operation, constructing a model structure of a control algorithm and receiving user input data as input data of the model structure; the code generation engine is used for analyzing the xml file corresponding to the model structure and obtaining source code implementation of a main operator of the model structure based on an analysis result; and the model entity is used for packaging and compiling the source code of the main operator to obtain an executable program of the model structure, executing the executable program based on the input data of the model structure to obtain a simulation result of the model structure, and sending the simulation result to the user interface for display. According to the device, the software verification process can get rid of dependence on embedded hardware equipment, and the software development and debugging efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of nuclear power plant instrumentation and control software technology, and in particular to a simulation device and simulation method for a control algorithm of a nuclear power plant instrumentation and control system. Background Technology

[0002] As the core control hub of a nuclear power plant, the digital instrumentation and control system undertakes critical functions such as equipment monitoring, logic execution, and safety protection. Its reliability directly affects the safe and stable operation of the nuclear power plant. With the rapid development of nuclear power technology, the control logic of the instrumentation and control system is becoming increasingly complex, and the scale and role of the software are also expanding significantly. The design quality of the application software is directly related to the operating efficiency and fault tolerance of the nuclear power plant.

[0003] Currently, the nuclear power industry generally adopts a model-based development approach, which involves constructing the control logic of the actual project through predefined basic logic function blocks, generating code through the model structure after construction, and then compiling and downloading the code into the microcontroller to realize the actual logic control and functional testing of the control algorithm.

[0004] However, during testing, there is a lack of direct correlation between the model and the running code. Furthermore, the verification of the instrumentation logic functional blocks can only be performed on the embedded platform after the code is generated and compiled into binary files. This results in logical errors in the design phase not being detected early in the model building process, causing a significant delay in the verification phase. In addition, embedded platforms have limited resources and physical operations are time-consuming. Downloading the software to the microcontroller for testing leads to developers frequently waiting for hardware responses, significantly reducing software development efficiency. Summary of the Invention

[0005] In view of this, the present application provides a simulation device and simulation method for the control algorithm of the instrumentation and control system of a nuclear power plant. The main purpose is to solve the technical problems of lagging verification of the control algorithm function of the instrumentation and control system, dependence on hardware platform for testing operations, and low software development efficiency.

[0006] According to one aspect of this application, a simulation device for control algorithm of instrumentation and control system of nuclear power plant is provided, the device comprising:

[0007] A user interface is used to respond to user interaction operations, construct the model structure of the control algorithm, and receive user input data as input data for the model structure.

[0008] A code generation engine is used to parse the XML file corresponding to the model structure and obtain the source code implementation of the main operator of the model structure based on the parsing results;

[0009] The model entity is used to encapsulate and compile the source code implementation of the main operator to obtain an executable program of the model structure, execute the executable program based on the input data of the model structure, obtain the simulation result of the model structure, and send the simulation result to the user interface for display.

[0010] Optionally, the user interface is specifically used for: responding to user interaction operations to construct a model structure of the control algorithm; receiving user input data through table editing and using the user input data as input data for the model structure; displaying the model structure, and after receiving the simulation results of the model structure, marking the specific values ​​of the simulation results for the current period on the input end, output end, and each line of the model structure.

[0011] Optionally, the user interface is also used to plot the timing diagram of the output data and / or intermediate variables of the model structure based on the simulation results of multiple cycles, and to display the timing diagram.

[0012] Optionally, the code generation engine is specifically used to: parse the XML file corresponding to the model structure to obtain an abstract syntax tree, and determine the call chain and assignment relationship of the model structure based on the abstract syntax tree; sort the sub-algorithm blocks in the model structure based on the call chain and assignment relationship of the model structure, and determine the name of the main operator according to the sorting result of the sub-algorithm blocks; encapsulate the input data, intermediate variables and output data of the model structure, and copy the code implementation corresponding to the main operator and the code implementation corresponding to each sub-algorithm block in the model structure; and concatenate the custom types, custom constants, code implementation corresponding to the main operator and the code implementation corresponding to each sub-algorithm block used in the model structure into a C source code file as the source code implementation of the main operator of the model structure.

[0013] Optionally, the model entity is specifically used for: performing secondary encapsulation of the source code implementation of the main operator to obtain a simulation framework; compiling and linking the simulation framework and the source code implementation of the main operator to obtain an executable program of the model structure; obtaining input data of the model structure through the user interface, and executing the executable program based on the input data of the model structure to obtain the output data and intermediate variables of the model structure as the simulation result of the model structure for a single simulation, and sending the simulation result to the user interface for display.

[0014] Optionally, the model entity obtains the input data of the model structure through the user interface, including: after receiving the user input data, the user interface copies the user input data to the input buffer of the model entity; after obtaining the executable program of the model structure, the model entity reads the user input data from the input buffer of the model entity as the input data of the model structure.

[0015] Optionally, the model entity sends the simulation results to the user interface for display, including: after obtaining the simulation results of the model structure for a single time, the model entity updates the input data, output data, and intermediate variables of the model structure to the XML file corresponding to the model structure; the user interface displays the simulation results of the model structure according to the updated XML file.

[0016] Optionally, the user interface is further configured to display control buttons to simulate control flow, wherein the control buttons include at least one of simulation start / stop buttons, reset buttons, single-step buttons, and multi-step buttons; the model entity is further configured to receive control commands issued by the control buttons, and control at least one of the start / stop, reset, and execution frequency of the simulation process according to the control commands.

[0017] Optionally, the user interface and the code generation engine transmit the model structure through the XML file, wherein the XML file includes multiple object instances and the attributes corresponding to each object instance; the code generation engine and the model entity transmit the implementation of the model structure through a C source code file, wherein the C source code file includes the code implementation of the custom types, custom constants, main operators, and sub-algorithm blocks used in the model structure.

[0018] According to another aspect of this application, a simulation method for a control algorithm of a nuclear power plant instrumentation and control system is provided, the method comprising:

[0019] The user interface responds to user interaction operations, constructs the model structure of the control algorithm, and receives user input data as input data for the model structure;

[0020] The code generation engine parses the XML file corresponding to the model structure and obtains the source code implementation of the main operator of the model structure based on the parsing results;

[0021] The model entity encapsulates and compiles the source code implementation of the main operator to obtain an executable program of the model structure, executes the executable program based on the input data of the model structure, obtains the simulation result of the model structure, and sends the simulation result to the user interface for display.

[0022] Technical Effects: The simulation device and method for control algorithms in a nuclear power plant instrumentation and control system provided in this application can simulate and run control algorithms online and graphically display the simulation results, facilitating user interaction and intuitive display of simulation results. It also allows developers to debug and verify the logical correctness of application software in the early stages of development, enabling early detection and correction of problems. Furthermore, it frees the software verification process from dependence on embedded hardware devices, improving software development efficiency. In addition, simulation based on entity code ensures consistency with the model implementation; that is, the code simulated in the model is the code that will run in the embedded device in the future, thereby improving the accuracy of software verification.

[0023] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0024] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0025] Figure 1 This paper shows a schematic diagram of the structure of a simulation device for a control algorithm of a nuclear power plant instrumentation and control system provided in an embodiment of this application;

[0026] Figure 2 A flowchart illustrating a simulation method for a control algorithm of a nuclear power plant instrumentation and control system provided in an embodiment of this application is shown. Detailed Implementation

[0027] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.

[0028] In one embodiment, such as Figure 1As shown, a simulation device for the control algorithm of a nuclear power plant instrumentation and control system is provided. The device includes: a user interface 10, which can be used to respond to user interaction operations, construct the model structure of the control algorithm, and receive user input data as input data for the model structure; a code generation engine 20, which can be used to parse the XML file corresponding to the model structure and obtain the source code implementation of the main operator of the model structure based on the parsing result; and a model entity 30, which can be used to encapsulate and compile the source code implementation of the main operator to obtain an executable program of the model structure, execute the executable program based on the input data of the model structure, obtain the simulation result of the model structure, and send the simulation result to the user interface for display.

[0029] Specifically, users can perform interactive operations through the user interface 10 to construct the model structure of the control algorithm (i.e., Figure 1 The design model is input, and then simulation parameters are input. Subsequently, the code generation engine 20 reads the XML configuration file corresponding to the model structure and performs syntax parsing to extract the logical relationships and parameter configurations of the main operators in the model structure, generating a C source code file corresponding to the model structure. After receiving the C source code file, the model entity 30 calls the compilation toolchain to encapsulate dynamic link libraries and optimize compilation to generate an independent executable program. Then, it reads the user input data through the user interface as input data for the model structure, executes the executable program to complete numerical calculations, and finally sends the simulation result data stream back to the user interface through a shared memory mechanism, dynamically rendering and displaying the simulation results through the interface. The entire testing process, through modular design, achieves a closed-loop data flow. Users can dynamically adjust input parameters and observe simulation behavior through the user interface, while developers can verify and debug control logic in an environment independent of embedded hardware.

[0030] In this embodiment, the aforementioned device seamlessly integrates model structure analysis and code generation, enabling online simulation and visual interaction of the control algorithm, significantly improving debugging efficiency during the development phase. Simultaneously, simulation verification based on entity code can directly reuse code deployed on future embedded devices, eliminating differences between the model structure and code implementation and ensuring the accuracy of the verification results. Furthermore, the graphical user interface lowers the debugging threshold, allowing developers to intuitively locate and quickly correct logical defects, thereby shortening the development cycle and reducing dependence on physical hardware platforms.

[0031] By applying the nuclear power plant instrumentation and control system control algorithm simulation device proposed in this embodiment, the control algorithm can be simulated and run online, and the simulation results can be graphically displayed, facilitating user interaction and intuitive display of simulation results. This also allows developers to debug and verify the logical correctness of the application software in the early stages of development, enabling early detection and correction of problems. Furthermore, it frees the software verification process from dependence on embedded hardware devices, improving software development efficiency. In addition, entity code-based simulation ensures consistency with the model implementation; that is, the code simulated in the model is the code that will run in the embedded device in the future, thereby improving the accuracy of software verification.

[0032] In one embodiment, such as Figure 1 As shown, the user interface can be used to perform the following operations: respond to user interaction operations and construct the model structure of the control algorithm; receive user input data through table editing and use the user input data as input data for the model structure; display the model structure and, after receiving the simulation results of the model structure, mark the specific values ​​of the simulation results for the current period on the input end, output end, and each line of the model structure.

[0033] Specifically, the user interface can respond to user interactions, constructing the model structure of the control algorithm through drag-and-drop or configuration methods. It then receives user input data, such as sensor analog values ​​and control parameters, through a table editing function, and uses this user input data as input data for the model structure. In this embodiment, the user interface can display the model structure graphically (e.g., ...). Figure 1 The design model (in the simulation) allows users to observe the model's topology and parameter configuration in real time. When the model structure is being simulated, the user interface can display the model structure during the simulation process (e.g., ...). Figure 1 The simulation model is dynamically labeled with the simulation results of the current cycle, such as input data, intermediate variables, and output data, on the model's input, output, and connection lines. During this process, users can dynamically adjust the input parameters or model structure based on the labeled results and trigger a new round of simulation calculations to form an interactive debugging loop. This allows for the verification and optimization of control logic without relying on an embedded hardware platform.

[0034] The above embodiments, by obtaining input parameters through tables and graphically annotating the model structure, can enhance the interactivity of the control algorithm simulation process, enabling developers to intuitively locate and quickly correct anomalies in the model's input and output. Simultaneously, binding and annotating input data and simulation results strengthens the correlation between model behavior and parameter configuration, thereby improving the efficiency of logic verification in the early development stages. Furthermore, an independent simulation environment, separate from the hardware platform, can reduce software development costs, and the graphical dynamic display function can further shorten the software debugging cycle, thus ensuring the consistency between the control algorithm design and actual deployment.

[0035] In one embodiment, such as Figure 1 As shown, the user interface can also be used to plot the timing diagrams of the output data and / or intermediate variables of the model structure based on the simulation results of multiple cycles, and to display the timing diagrams.

[0036] Specifically, in addition to displaying the model structure and simulation results for each period, the user interface can dynamically plot time series diagrams of model output data and intermediate variables for multiple periods based on simulation results from multiple periods, including intermediate variables and output data for each period. The dynamic changes of the time series diagrams are then displayed synchronously in the graphical interface. Furthermore, the user interface allows users to observe variable behavior under different periods by sliding the time axis or zooming. Simultaneously, users can dynamically adjust the model's input parameters or model structure based on the trends in the time series diagrams, thereby triggering a new round of simulation calculations. This forms an interactive debugging loop, enabling dynamic behavior verification of the control logic without relying on an embedded hardware platform.

[0037] The above embodiments, through the dynamic drawing and display of timing diagrams, can enhance the visualization and analysis capabilities of the dynamic behavior of variables during control algorithm simulation. This allows developers to intuitively identify abnormal fluctuations in model outputs and intermediate variables, and quickly locate logic defects. Simultaneously, the cumulative display function of multi-period data can enhance the verification depth of the timing characteristics of the control logic and improve debugging efficiency in the early development stages.

[0038] In one embodiment, such as Figure 1As shown, the code generation engine is specifically used for: parsing the XML file corresponding to the model structure to obtain an abstract syntax tree, and determining the call chain and assignment relationship of the model structure based on the abstract syntax tree; sorting the sub-algorithm blocks in the model structure based on the call chain and assignment relationship of the model structure, and determining the name of the main operator according to the sorting result of the sub-algorithm blocks; encapsulating the input data, intermediate variables and output data of the model structure, and copying the code implementation corresponding to the main operator and the code implementation corresponding to each sub-algorithm block in the model structure; and concatenating the custom types, custom constants, code implementation corresponding to the main operator and the code implementation corresponding to each sub-algorithm block used in the model structure into a C source code file, which serves as the source code implementation of the main operator of the model structure.

[0039] Specifically, after the model structure is built, the code generation engine can parse the corresponding XML file and extract the syntactic features of the model structure to generate a corresponding abstract syntax tree. Then, based on the abstract syntax tree, it analyzes the call chain and assignment relationships of the model structure. Subsequently, it performs topological sorting of the sub-algorithm blocks in the model structure according to the call chain and assignment relationships to determine the execution order of the sub-algorithm blocks, and then derives the name of the main operator based on the sorting result. Afterward, the code generation engine can encapsulate the input data, intermediate variables, and output data of the model structure into independent structures. Then, it copies the code implementation of the main operator and each sub-algorithm block. Finally, it modularly splices together the custom types, custom constants, main operator code, and sub-algorithm block code in the model structure to generate a complete C source code file as the source code implementation of the main operator, thus providing the basic code framework for the compilation and execution of the model entity.

[0040] The above embodiments, through the parsing of abstract syntax trees and call chain analysis, can accurately sort the execution order of sub-algorithm blocks in the model structure, ensuring the logical consistency of the main operator code. Simultaneously, through modular encapsulation and code concatenation, input / output data, intermediate variables, and custom types can be integrated into the C source code, thereby improving the completeness and portability of code generation. This ensures the consistency between model simulation results and embedded device code implementation, improving the accuracy of software verification and software development efficiency.

[0041] In one embodiment, such as Figure 1 As shown, the model entity is specifically used for: secondary encapsulation of the source code implementation of the main operator to obtain the simulation framework; compilation and linking of the source code implementation of the simulation framework and the main operator to obtain the executable program of the model structure; obtaining the input data of the model structure through the user interface, executing the executable program based on the input data of the model structure, obtaining the output data and intermediate variables of the model structure as the simulation result of a single simulation of the model structure, and sending the simulation result to the user interface for display.

[0042] Specifically, after the code generation engine generates the source code implementation of the main operator, the model entity can further encapsulate the source code implementation of the main operator to generate an independent simulation framework, thereby isolating the model logic from the external environment. Subsequently, the model entity can compile and link the simulation framework and the source code implementation of the main operator to generate an executable program for the model structure. Finally, the model entity can obtain the input data of the model structure through the user interface and execute the aforementioned executable program based on the input data to obtain the output data and intermediate variables of the model structure as the single simulation result, which is then fed back to the user interface in real time for graphical display.

[0043] The above embodiments, through secondary encapsulation and compilation linking of the source code implementation, decouple the model structure code and simulation framework, thereby ensuring the independence of the simulation environment. Simultaneously, directly reusing the source code implementation of the main operator for the model entities ensures consistency between simulation results and future embedded deployment code, thus improving the accuracy of software verification. Furthermore, the bidirectional data interaction mechanism between the user interface and model entities simplifies the data input / output process, enabling developers to quickly locate and iteratively correct model logic defects, thereby shortening the debugging cycle and reducing hardware dependency costs.

[0044] In one embodiment, such as Figure 1 As shown, the model entity can obtain the input data of the model structure through the user interface in the following way: after receiving the user input data, the user interface copies the user input data to the input buffer of the model entity; after obtaining the executable program of the model structure, the model entity reads the user input data from the input buffer of the model entity as the input data of the model structure.

[0045] Specifically, after receiving user input data, the user interface can copy the input data to the input buffer of the model entity in real time, and ensure the consistency of data transmission through memory mapping or a queue mechanism. Subsequently, after the model entity completes the compilation and linking of the main operator source code, it can detect the data status of the input buffer, read the user input data in the buffer as the initial input parameters of the model structure, and then call the executable program to perform simulation calculations to generate the output data and intermediate variables of the model structure.

[0046] The above embodiments, by setting up an input buffer as a data isolation and transmission mechanism, can decouple the data between the user interface and the model entities, thereby ensuring the real-time performance and consistency of the input data during the simulation process. Simultaneously, the model entities directly read data from the buffer as model input data, which simplifies the data transmission path and reduces system latency, thereby improving the response efficiency of the simulation calculation.

[0047] In one embodiment, such as Figure 1 As shown, the model entity sends the simulation results to the user interface for display, which can be achieved in the following way: After obtaining the simulation results of a single simulation of the model structure, the model entity updates the input data, output data, and intermediate variables of the model structure to the corresponding XML file of the model structure; the user interface displays the simulation results of the model structure based on the updated XML file.

[0048] Specifically, after completing a single simulation calculation, the model entity can write the input data, output data, and intermediate variables of the model structure into the corresponding XML file in real time. Then, it updates the data nodes in the XML file through key-value mapping or structured tags. Furthermore, the user interface can periodically read and parse the updated XML file and dynamically render the simulation results of the model structure based on the parsing results. This includes the configuration status of input parameters, numerical changes in output data, and temporal fluctuations of intermediate variables. The user interface can then visualize the simulation results through graphical components and support users to view detailed information about specific data through interactive operations (such as clicking on variable names or switching data views). At the same time, the model entity and the user interface can ensure the consistency of data updates through the version control mechanism of the XML file, thus forming a closed-loop link between simulation execution, data updates, and interface display.

[0049] The above embodiments utilize a dynamic update mechanism for XML files to establish data association between model entities and the user interface, ensuring the synchronization of simulation results across the software and visualization layers. Simultaneously, the user interface parses the XML files for result display, simplifying data transmission paths and reducing system coupling, thereby improving the efficiency and accuracy of simulation result display. Furthermore, as a data carrier for the model structure, XML files support structured storage of multi-dimensional variable states, providing a standardized data foundation for subsequent simulation data analysis and model iterative optimization, thus enhancing the traceability of the control algorithm verification process.

[0050] In one embodiment, the user interface is further configured to display control buttons to simulate control flow, wherein the control buttons include at least one of simulation start / stop buttons, reset buttons, single-step buttons, and multi-step buttons; the model entity is further configured to receive control commands issued by the control buttons and control at least one of the start / stop, reset, and execution frequency of the simulation process according to the control commands.

[0051] Specifically, while displaying the model structure and simulation results, the user interface can dynamically render and display a control panel containing simulation start / stop buttons, a reset button, a single-step button, and a multi-step button. When the user operates any button, the user interface can encapsulate the corresponding control command into a standardized protocol message and send it to the model entity through the communication interface. After receiving the control command, the model entity can parse the command type and trigger the corresponding simulation control logic. For example, if a start / stop command is received, the running state of the simulation thread is switched; if a reset command is received, the simulation clock and data buffer are reset; if a single-step or multi-step command is received, the iteration step size and time interval of the simulation loop are adjusted. Furthermore, after completing the command processing, the model entity can send status feedback to the user interface through a callback function. The user interface can update the button states of the control panel and the dynamic display area of ​​the simulation results based on the feedback results, thus forming a closed-loop link of user operation, model response, and interface refresh.

[0052] The above embodiments, through a two-way command interaction mechanism between control buttons and model entities, enable accurate control of the simulation process's start, stop, reset, and execution frequency, thereby enhancing the user's ability to proactively intervene in the simulation process. Simultaneously, the model entities, based on standardized command parsing and providing status feedback, ensure the real-time performance and stability of the control logic, thus improving the efficiency of simulation debugging.

[0053] In one embodiment, such as Figure 1 As shown, the user interface and code generation engine pass the model structure through an XML file, which includes various object instances and their corresponding attributes. The code generation engine and model entities pass the implementation of the model structure through a C source code file, which includes the code implementation of custom types, custom constants, main operators, and sub-algorithm blocks used in the model structure.

[0054] Specifically, the user interface can generate an XML file containing various object instances and their attributes based on the model structure. Object instances can include inputs, outputs, connections, and operators, while attributes can include the names of inputs and outputs and their associated connections, the names of the connections, the names of operators and their input pins, output pins and their associated connections, etc. Through the structured tags of XML, the code generation engine can parse the topological relationships and constraints between model elements, mapping object instances to custom C language structures, converting attribute values ​​into structure member variables, and generating corresponding function implementations based on the main operator logic. Simultaneously, it converts constant values ​​defined in the XML file into C language `const` macro definitions or enumeration types. Furthermore, after receiving the C source code file output by the code generation engine, the model entity can be compiled into an executable program by the compiler, which uses the main operator function to drive dynamic calculations of the model structure. During this process, each sub-algorithm module can share model state data through structure pointers. Furthermore, the user interface can listen to the execution logs and output files of the model entities, reverse map the calculation results to update nodes of the XML file, and refresh the interface in real time to display the model behavior, thus forming a closed loop from model definition to code implementation to visual feedback.

[0055] The above embodiments, through the structured description of XML files and the modular implementation of C source code, achieve a strong binding between model structure and code logic, thereby ensuring data consistency between the design and implementation phases. Simultaneously, the code generation engine generates source code based on XML files, reducing the manual coding workload from model to code and improving cross-platform compatibility. Furthermore, the encapsulation design of custom types and algorithm modules in the C source code files supports efficient compilation and loosely coupled operation of model entities, effectively shortening the model verification cycle and enhancing the scalability and maintainability of the simulation system.

[0056] In one embodiment, such as Figure 2 As shown, a simulation method for the control algorithm of a nuclear power plant instrumentation and control system is also provided. The method includes:

[0057] Step 101: The user interface responds to user interaction operations, constructs the model structure of the control algorithm, and receives user input data as input data for the model structure.

[0058] Step 102: The code generation engine parses the XML file corresponding to the model structure and obtains the source code implementation of the main operator of the model structure based on the parsing results.

[0059] Step 103: The model entity encapsulates and compiles the source code implementation of the main operator to obtain the executable program of the model structure, executes the executable program based on the input data of the model structure, obtains the simulation results of the model structure, and sends the simulation results to the user interface for display.

[0060] Specifically, when implementing the simulation method using the aforementioned nuclear power plant instrumentation and control system control algorithm simulation device, the user interface can respond to user interactions, such as dragging and dropping modules and configuring parameters, dynamically constructing the model structure of the control algorithm. Then, user input data is injected in real-time into the XML file corresponding to the model structure. Subsequently, the code generation engine can read the XML file and, based on the parsed model topology and attribute parameters, generate C language source code containing the main operator logic, saving the source code as a separate C source file. Further, after receiving the C source file, the model entity can encapsulate and compile the code implementation of the main operator through a compiler, generating an executable program. User input data is then injected into the program's runtime environment as model input data, and the output results and intermediate variable values ​​of the model structure are dynamically calculated during the simulation. After completing a single simulation iteration, the model entity can feed back the result data to the user interface through a predefined data interface. The user interface, after parsing the feedback data, can update the graphical display of the model structure in real-time and assist users in analyzing algorithm behavior by highlighting outliers or dynamically annotating key nodes, thus forming a closed-loop chain of model construction, code generation, simulation execution, and result feedback.

[0061] In this embodiment, the aforementioned device seamlessly integrates model structure analysis and code generation, enabling online simulation and visual interaction of the control algorithm, significantly improving debugging efficiency during the development phase. Simultaneously, simulation verification based on entity code can directly reuse code deployed on future embedded devices, eliminating differences between the model structure and code implementation and ensuring the accuracy of the verification results. Furthermore, the graphical user interface lowers the debugging threshold, allowing developers to intuitively locate and quickly correct logical defects, thereby shortening the development cycle and reducing dependence on physical hardware platforms.

[0062] By applying the simulation method for the control algorithm of the nuclear power plant instrumentation and control system proposed in this embodiment, the control algorithm can be simulated and run online, and the simulation results can be graphically displayed, facilitating interaction with users and providing an intuitive view of the simulation results. This also allows developers to debug and verify the logical correctness of the application software in the early stages of development, enabling early detection and correction of problems. Furthermore, it frees the software verification process from dependence on embedded hardware devices, improving software development efficiency. In addition, simulation based on entity code ensures consistency with the model implementation; that is, the code simulated in the model is the code that will run in the embedded device in the future, thereby improving the accuracy of software verification.

[0063] For other implementation methods of the nuclear power plant instrumentation and control system control algorithm simulation method, refer to the nuclear power plant instrumentation and control system control algorithm simulation device described in any of the above embodiments, which will not be repeated here.

[0064] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the labels corresponding to each step in the above embodiments are only for identification purposes and are not intended to limit the order of execution of the steps. The order of execution of the steps in each embodiment can be set according to the actual situation.

[0065] This application also provides a computer device, specifically a personal computer, server, network device, etc. The computer device includes a bus, processor, memory, and communication interface, and may also include input / output interfaces and a display device. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device stores location information. The network interface of the computer device is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in the various method embodiments.

[0066] Those skilled in the art will understand that the structure of the computer device described above is only a partial structure related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components, or combine certain components, or have different component arrangements.

[0067] In one embodiment, a computer-readable storage medium is provided, which may be non-volatile or volatile, having stored thereon a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0068] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0069] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0070] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0071] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A simulation device for control algorithm of instrumentation and control system of nuclear power plant, characterized in that, The device includes: A user interface is used to respond to user interaction operations, construct the model structure of the control algorithm, and receive user input data as input data for the model structure. A code generation engine is used to parse the XML file corresponding to the model structure and obtain the source code implementation of the main operator of the model structure based on the parsing results; The model entity is used to encapsulate and compile the source code implementation of the main operator to obtain an executable program of the model structure, execute the executable program based on the input data of the model structure, obtain the simulation result of the model structure, and send the simulation result to the user interface for display.

2. The simulation device for the control algorithm of the nuclear power plant instrumentation and control system according to claim 1, characterized in that, The user interface is specifically used for: The model structure of the control algorithm is constructed in response to user interaction. User input data is received via table editing, and this user input data is used as input data for the model structure. The model structure is displayed, and after receiving the simulation results of the model structure, the specific values ​​of the simulation results for the current period are marked on the input end, output end, and each line of the model structure.

3. The simulation device for the control algorithm of the nuclear power plant instrumentation and control system according to claim 2, characterized in that, The user interface is also used to plot the timing diagram of the output data and / or intermediate variables of the model structure based on the simulation results of multiple cycles, and to display the timing diagram.

4. The simulation device for the control algorithm of the nuclear power plant instrumentation and control system according to claim 1, characterized in that, The code generation engine is specifically used for: The XML file corresponding to the model structure is parsed to obtain an abstract syntax tree, and the call chain and assignment relationship of the model structure are determined based on the abstract syntax tree. Based on the call chain and assignment relationship of the model structure, the sub-algorithm blocks in the model structure are sorted, and the name of the main operator is determined according to the sorting result of the sub-algorithm blocks; The input data, intermediate variables, and output data of the model structure are encapsulated, and the code implementations corresponding to the main operator and each sub-algorithm block in the model structure are copied. The custom types, custom constants, code implementations of the main operator, and code implementations of each sub-algorithm block used in the model structure are concatenated into a C source code file, which serves as the source code implementation of the main operator of the model structure.

5. The simulation device for the control algorithm of the nuclear power plant instrumentation and control system according to claim 1, characterized in that, The model entity is specifically used for: The source code implementation of the main operator is encapsulated a second time to obtain the simulation framework; The source code implementations of the simulation framework and the main operator are compiled and linked to obtain the executable program of the model structure; The user interface is used to obtain the input data of the model structure, and the executable program is executed based on the input data of the model structure to obtain the output data and intermediate variables of the model structure as the simulation result of the model structure for a single run. The simulation result is then sent to the user interface for display.

6. The simulation device for the control algorithm of the nuclear power plant instrumentation and control system according to claim 5, characterized in that, The model entity obtains input data for the model structure through the user interface, including: After receiving the user input data, the user interface copies the user input data to the input buffer of the model entity; After obtaining the executable program of the model structure, the model entity reads the user input data from the input buffer of the model entity as the input data of the model structure.

7. The simulation device for the control algorithm of the nuclear power plant instrumentation and control system according to claim 5, characterized in that, The model entity sends the simulation results to the user interface for display, including: After obtaining the simulation results of the model structure in a single run, the model entity updates the input data, output data, and intermediate variables of the model structure to the XML file corresponding to the model structure. The user interface displays the simulation results of the model structure based on the updated XML file.

8. The simulation device for the control algorithm of the instrumentation and control system of a nuclear power plant according to any one of claims 1 to 7, characterized in that, The user interface is also used to display control buttons to simulate control flow, wherein the control buttons include at least one of simulated start / stop buttons, reset buttons, single-step buttons, and multi-step buttons; The model entity is also used to receive control commands issued by the control button, and to control at least one of the following: start / stop, reset, and execution frequency of the simulation process according to the control commands.

9. The simulation device for the control algorithm of the instrumentation and control system of a nuclear power plant according to any one of claims 1 to 7, characterized in that, The user interface and the code generation engine transmit the model structure through the XML file, wherein the XML file includes multiple object instances and the attributes corresponding to each object instance; The code generation engine and the model entity transmit the implementation of the model structure through C source code files, wherein the C source code files include the code implementation of the custom types, custom constants, main operators and sub-algorithm blocks used in the model structure.

10. A simulation method for control algorithm of instrumentation and control system of nuclear power plant, characterized in that, The method includes: The user interface responds to user interaction operations, constructs the model structure of the control algorithm, and receives user input data as input data for the model structure; The code generation engine parses the XML file corresponding to the model structure and obtains the source code implementation of the main operator of the model structure based on the parsing results; The model entity encapsulates and compiles the source code implementation of the main operator to obtain an executable program of the model structure, executes the executable program based on the input data of the model structure, obtains the simulation result of the model structure, and sends the simulation result to the user interface for display.

Citation Information

Patent Citations

  • Off-line simulation method and device for configuration of DCS graphical algorithm

    CN109144515A

  • Simulation model development system of nuclear power device and analysis method

    CN110705078A

  • Method and system for generating cross-platform code from graphic configuration picture

    CN112579065A

  • Software configuration debugging and packaging integrated method for instrument control system of nuclear power plant

    CN113688037A

  • Instrument control logic automatic simulation modeling method based on XML analysis

    CN115774919A

Cited By

  • Register and memory operation code unified generation method

    CN121166094A

  • Agile development method, device and equipment for vehicle-mounted air conditioner control software and medium

    CN121957545A