A thermal hydraulic calculation method based on nuclear power simulation platform
By defining shared memory in the nuclear power simulation platform, real-time interaction and synchronous operation of thermal hydraulic programs and nuclear power simulation platforms is achieved, problems such as time synchronization and data exchange are solved, and the synchronization accuracy of computing and resource utilization efficiency are improved.
Patent Information
- Application Number
- CN202111577840.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2041-12-22
AI Technical Summary
In the nuclear power simulation platform, there are problems such as time synchronization, control synchronization, data exchange and reset operation between the thermal hydraulic program and the nuclear power simulation platform, which affects the efficiency of design iterative optimization and control R&D costs.
By defining shared memory, the nuclear power simulation platform and thermal hydraulic programs can interact, synchronize and run in real time, and respond to the teaching and control instructions of the nuclear power simulation platform to realize the independent operation of snapshots and reset subroutines.
Real-time data interaction between the nuclear power simulation platform and the heat pipe technology program is realized, the synchronization accuracy of calculations and the accuracy of time advancement is improved, resource consumption is reduced, and the stability of real-time calculation is ensured.
Smart Images

Figure CN116341163B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of thermal hydraulic simulation of nuclear power plants, and in particular to a thermal hydraulic calculation method based on a nuclear power simulation platform. Background Art
[0002] The 21st century is a period of new development for unmanned submersibles. At present, the industry generally believes that autonomous unmanned submersibles with long flight time, good maneuverability and flexible carrying platforms are the main direction of future development of unmanned submersibles. Compared with traditional chemical power, nuclear power has strong endurance and high power. However, traditional pressurized water reactor nuclear power has circulation systems and rotating equipment, large size and poor stealth performance, which limits its application in unmanned submersibles. Small silent heat pipe reactor technology uses heat pipes to export the heat generated by nuclear fission in the core, and then uses a temperature difference power generation device to convert heat energy into electrical energy. This overall solution of nuclear heating pipes plus temperature difference power generation has the characteristics of inherent safety, long endurance, intelligent autonomous control and ultra-quietness, which can effectively meet the power requirements of new marine equipment.
[0003] In the research, development and design process of new reactor systems, nuclear power simulation platforms and thermal-hydraulic programs play key roles respectively. The nuclear power simulation platform can use advanced virtual simulation technology to verify system characteristics, and feed back simulation results to each system for iteration and optimization to improve conceptual design. The thermal-hydraulic program is an independently operated engineering analysis program used for transient calculations of heat pipes. After reading the input card, the program will continue to calculate until the calculation time required by the input card is completed or the calculation fails before exiting. If the thermal-hydraulic program is to be used in the nuclear power simulation platform for simulation calculations of thermal-hydraulic characteristics, there are issues such as time synchronization, control synchronization, data exchange and reset operation that need to be coordinated. However, in order to speed up design iteration optimization and control R&D costs, it is necessary to design and develop an integrated simulation platform coupled with thermal-hydraulic programs for the core components of the heat pipe reactor, namely the core and heat pipes. Summary of the invention
[0004] The purpose of the present invention is to provide a thermal-hydraulic calculation method based on a nuclear power simulation platform, which can realize real-time interaction, synchronization and real-time operation between the thermal-hydraulic program and the nuclear power simulation platform, and respond to the teaching and control instructions of the nuclear power simulation platform.
[0005] The technical solution of the present invention is as follows: A thermal hydraulic calculation method based on a nuclear power simulation platform, comprising:
[0006] Defining a shared memory, generating shared data that can be recognized by both the nuclear power simulation platform and the thermal hydraulic program, and making the thermal hydraulic program work according to the instructions of the nuclear power simulation platform based on the shared memory, including the following steps:
[0007] S1 obtains a user instruction sent by the nuclear power simulation platform, wherein the user instruction includes one or a combination of multiple instructions such as run, freeze, reset, and snapshot;
[0008] S2: the thermal hydraulic program executes the user instruction.
[0009] S2 includes:
[0010] If it is determined that the user instruction is a snapshot instruction, the thermal hydraulic program will maintain the current calculation state and continue to run, and restart the file writing at the same time;
[0011] If it is determined in step S22 that the user instruction is a frozen instruction, the current periodic scheduling is skipped, and the thermal hydraulic program directly enters a dormant state and waits for the nuclear power simulation platform to be scheduled again and the user instruction is converted to other instructions;
[0012] If it is determined in step S23 that the user instruction is a run and / or reset instruction, it is further determined whether the thermal hydraulic software needs to be initialized. If so, the thermal hydraulic program executes the user instruction after initializing the memory. If not, it proceeds to step S24 to perform transient calculation.
[0013] S24 performs transient calculation on the designated pipeline according to the initialized model and the preset calculation time step until the calculation is completed, and the program enters a dormant state, waiting for the re-scheduling of the nuclear power simulation platform, including: performing transient calculation according to the initialized model, and judging whether the calculation result converges; if not, continuing the transient calculation until it is confirmed that the calculation result converges; if converged, entering into a single scheduling time judgment, including: judging whether the time step of a single calculation cycle changes.
[0014] S23 includes:
[0015] S231 If the user instruction is a running instruction, then read the input card and determine the designated pipeline for this operation according to the input card, initialize the model parameters of the designated pipeline and then proceed to step S24;
[0016] If the user instruction in S232 is a reset instruction, the input card and the restart file are read, the designated pipeline is determined according to the input card, and the model parameters of the designated pipeline are initialized according to the reset information recorded in the restart file, and then the process goes to step S24.
[0017] S24 includes:
[0018] S241 When the time step of a single calculation cycle remains unchanged, a loop scheduling counter is set, and the counting target value = calculation cycle / time step. During each loop scheduling process, the counter value is accumulated by 1. When the counter value reaches the technical target value, the calculation completion flag is set to yes;
[0019] S242 When the time step of a single calculation cycle changes, the counting target value is updated to (calculation cycle - calculated completion time) / new time step (integer) + 1, and the counter value is cleared and restarted. At the last step, the time step will be modified to the remaining duration of the calculation cycle and restored to the new time step used before in the next scheduling cycle.
[0020] In the method of using an automatic code generation tool, the code automatic generation tool will read the user definition file and generate an interactive program and a variable addition file according to the interactive variable requirements specified by the user to define the shared memory definition, including the following:
[0021] Load the code file;
[0022] Scan the code text and load the preset public variable declaration rules;
[0023] According to the public variable declaration rule, replace the public variables specified in the code text;
[0024] Generate a new code dynamic library.
[0025] In the step S23, an initialization flag is set. If the initialization flag is yes, the process continues to step S23. If the initialization flag is no, the process jumps to step S24 to perform transient calculation.
[0026] In the step S21, a mirror image is created for the current computing program memory and the mirror image data is used to write a restart file.
[0027] The beneficial effects of the present invention are: it can realize real-time data interaction between the nuclear power simulation platform and the heat pipe technology program, and the calculation data of the thermal hydraulic program can be shared with other running programs according to the data interaction frequency of the simulation platform; the synchronization and real-time operation simulation platform synchronizer can wake up the thermal hydraulic program at a set frequency, and wait for the heat pipe program to complete the calculation before entering the next calculation cycle, thereby realizing synchronous operation; when the CPU time consumed by each calculation of the thermal hydraulic program is less than the calculation time, real-time operation can be realized; the teaching and control instruction response, the thermal hydraulic program can respond to the simulation platform issued by the simulation platform to run, freeze, step, snapshot, reset, backtrack, replay and other simulation instructions. In the method shown in the present invention, snapshot and reset subroutines are added. The snapshot and reset subroutines should be independent of the entry program and share global variables with the entry program, but their scheduling is independently controlled by the simulation platform. The awakening and function execution of the subroutine depend on the simulation platform scheduling mechanism and the storage and restart mechanism of the heat pipe stack design respectively; the reading of the input card is limited to the program initialization process, and is only read once before the start of the transient calculation. The restart file is used during the reset process and is only read once during the reset process. It is then closed and no longer used. With this setting, the program does not need to consume a large amount of system resources for file input storage operations during transient calculations, ensuring the stability of resource consumption of the calculation program during real-time calculations. The snapshot is an independent running branch that does not participate in the transient calculation process of the program, so it does not need to occupy the current calculation space, which improves the speed of program calculations. At the same time, during the snapshot generation process, a memory image is first created and then data is extracted from the image to compile a file, which can ensure the real-time performance of program calculations during the snapshot process. During transient calculations, setting the time step correction step can effectively correct the deviation and make up the time step, making the synchronization more accurate and the time advancement more precise. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a schematic diagram of the integrated data transformation method of the thermal hydraulic program in the present invention;
[0029] Figure 2 A schematic diagram of a shared memory definition process of the present invention;
[0030] Figure 3 It is a schematic diagram of the overall flow of thermal hydraulic calculation of the present invention. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the following is a description with reference to the accompanying drawings and embodiments.
[0032] In this embodiment, the simulation platform is the RINSIM simulation platform (hereinafter referred to as the platform), and the thermal hydraulic program (hereinafter referred to as the program) is mainly developed based on the FORTRAN90 language.
[0033] Currently available thermal hydraulic programs have only a small number of global variables that are partially defined in the common data area in the FORTRAN77 format, and most global variables are defined in the module and instantiated according to program reference requirements. Since there are many thermal hydraulic program codes, the variable definition methods and types are also diverse. In order to make the calculation data of the thermal hydraulic program share with other running programs according to the data interaction frequency of the simulation platform. This application first transforms the shared memory, loads the global variables of the thermal hydraulic program and other variables that need to be saved into the shared memory, and manages the shared memory through the simulation platform, so that the global variables can interact with other platform programs.
[0034] like Figure 1 As shown, in this embodiment, an automatic code generation tool is used. The code automatic generation tool will read the user definition file and generate the interactive program and variable addition file according to the interactive variable requirements specified by the user. Specifically, the following steps are included:
[0035] (a) Load the code file;
[0036] (b) Scanning the code text and loading the preset public variable declaration rules;
[0037] (c) replacing and updating the public variable definition method specified in the code text according to the public variable declaration rule;
[0038] (d) Generate a new code dynamic library.
[0039] The transformation of program variables is mainly aimed at the extraction and management of shared variables. To this end, a special variable definition script is developed to realize the automatic import of detailed definitions of the variable list into the database, and the previously generated variable list is defined in the DBM data management tool of the RINSIM simulation platform. The data interaction function within the platform is realized through the platform shared memory location, and the variable I / O function outside the platform is realized through Redis.
[0040] After the shared memory is defined, the simulation platform and the thermal hydraulic program can interact with each other in real time. The above data definition transformation can provide a basic method for real-time data sharing and teaching and control instruction transmission. On the basis of the above transformation, the corresponding Figure 2 As shown, a thermal hydraulic calculation method based on a nuclear power simulation platform of the present invention comprises the following steps:
[0041] S1 obtains a user instruction sent by the nuclear power simulation platform, wherein the user instruction includes one or a combination of multiple instructions such as run, freeze, reset, and snapshot;
[0042] S2 The thermal hydraulic program executes the user instruction, including:
[0043] If it is determined at step S21 that the user instruction is a snapshot instruction, the thermal hydraulic program will maintain the current computing state and continue to run, and at the same time, perform restart file writing, that is, create a mirror image of the current computing program memory and use the mirror image data to write the restart file;
[0044] If it is determined in step S22 that the user instruction is a frozen instruction, the current periodic scheduling is skipped, and the thermal hydraulic program directly enters a dormant state and waits for the nuclear power simulation platform to be scheduled again and the user instruction is converted to other instructions;
[0045] If it is determined in step S23 that the user instruction is a run and / or reset instruction, it is further determined whether the thermal hydraulic software needs to be initialized. If so, the thermal hydraulic program executes the user instruction after initializing the memory. If not, it proceeds to step S24 to perform transient calculation.
[0046] S231: If the user instruction is a running instruction, then read the input card and determine the designated pipeline for this operation according to the input card, initialize the model parameters of the designated pipeline and then proceed to step S233;
[0047] If the user instruction in step S232 is a reset instruction, the input card and the restart file (IC file) are read, the designated pipeline is determined according to the input card, and the model parameters of the designated pipeline are initialized according to the reset information recorded in the restart file, and then the process goes to step S233;
[0048] S233 performs transient calculation on the designated pipeline according to the initialized model and the preset calculation time step until the calculation is completed, and the program enters a dormant state, waiting for the re-scheduling of the nuclear power simulation platform, including: performing transient calculation according to the initialized model, and judging whether the calculation result converges, if not, continuing the transient calculation until the calculation result converges; if converged, entering into a single scheduling time judgment, including: judging whether the time step of a single calculation cycle changes;
[0049] S2331 When the time step of a single calculation cycle remains unchanged, a loop scheduling counter is set, and the counting target value = calculation cycle / time step. During each loop scheduling process, the counter value is accumulated by 1. When the counter value reaches the technical target value, the calculation completion flag is set to yes;
[0050] S2332 When the time step of a single calculation cycle changes, the counting target value is updated to (calculation cycle - calculated completion time) / new time step (rounded to an integer) + 1, and the counter value is cleared and restarted. At the last step, the time step will be modified to the remaining duration of the calculation cycle and restored to the new time step used previously in the next scheduling cycle.
[0051] In step S21, the snapshot is to store the current running status data into a file as an initial condition for calling during reset; in this embodiment, the snapshot is set independently and does not participate in the transient calculation process of the program, so there is no need to occupy the current calculation space, which improves the speed of program calculation. At the same time, further, as a preferred solution, in the process of executing the snapshot instruction, in this embodiment, a mirror is created for the current calculation program memory and the mirror data is used to restart the file writing, that is, a memory mirror is created first and then data is extracted from the mirror to compile a file. This setting can ensure the real-time performance of program calculation during the snapshot process.
[0052] In step S23, the existing thermal hydraulic calculation program is further modified so that the heat pipe stack design program is controlled by the simulation platform and runs according to the rules of the simulation platform. The program calculation is provided in real time and synchronously, and a code-controllable scheduling method is provided and a response method for teaching and control instructions is implemented; specifically, in this embodiment, initialization and transient calculation are distinguished, and a jump mark is set. In order to respond to the scheduling of the simulation platform, the program is initialized when it is first run, and the transient calculation is directly entered in the subsequent scheduling. After the calculation time specified by the transient calculation simulation platform, it goes into sleep and waits for the next scheduling.
[0053] At the same time, considering that the file input and output of the program often consume a lot of system resources due to storage operations, in order to ensure the stability of resource consumption of the computing program during real-time computing, in step S23, the present application also controls the file input and output of the program.
[0054] In this embodiment, in step S231 and step S232, the input file of the program is transformed as follows. There are two input files, namely, the input card and the restart file (IC file). The reading of the input card will be limited to the program initialization process, and it is only read once before the transient calculation starts. The restart file is used in the reset process, and is only read once in the reset process, and is closed and no longer used. As a preferred solution, in this embodiment, the programs associated with reading the input card and the restart file will set up jump marks to ensure that the files are only read on demand.
[0055] As a preferred solution, in this embodiment, the generation of output files is also modified, and there are two output files, namely, output text information and restart files. The output file is a text file that the program prints out the calculation information according to the single-machine calculation requirements and the calculation output frequency set by the user. In the integrated modification, the printing of this file will be marked and set. The mark is set as a global variable, which can be controlled by the simulation platform. This variable ensures that the user prints the output information file only when needed, and the output process can be shielded during normal calculation.
[0056] The restart file is generated by the program during the snapshot process described in step S21, and records all the parameter information required by the program during the calculation process. This file is only written during the snapshot process (including the snapshot instructions initiated by the user and the automatic snapshot process of the platform during the backtracking process). In this embodiment, a memory image is first created during the snapshot process, and then data is extracted from the image to compile a file to ensure the real-time calculation of the program during the snapshot process. As a preferred solution, in this step, a snapshot subroutine dedicated to the heat pipe program is developed and placed in the simulation platform synchronization scheduler to run to obtain the teaching and control instructions issued by the simulation platform. After receiving the snap snapshot instruction, the snapshot subroutine will create a memory image for the global used by the thermal program in the shared memory of the running platform. Then write the data in the image into the restart file, and the written variables and format must meet the requirements of the initialization program. The entire writing process does not interfere with the normal calculation flow of the program.
[0057] The above modification of the program file reading and writing method can realize the format definition and reading and writing of the reset snapshot file in the teaching and control instructions, and reduce unnecessary I / O output to improve the program calculation efficiency to realize real-time program calculation.
[0058] In addition, in step S24, during the transient calculation process, a time step correction method is added: the preset calculation time step is an upper and lower limit specified by the user, and the simulation program itself changes within this range according to the convergence of the calculation state.
[0059] At the beginning of a single calculation cycle, set the loop scheduling counter, the counting target value = calculation cycle / time step, each loop scheduling process, the counter value is accumulated by 1, and when the counter value reaches the technical target value, the calculation completion flag is set to yes. When the convergence of the program in a single calculation cycle does not change, the counter algorithm is maintained unchanged; when the convergence changes within a single calculation cycle and the time step needs to change accordingly, the counting target value is updated to (calculation cycle - completed calculation time) / new time step (integer) + 1, and the counter value is cleared and restarted. At the last step, the time step will be modified to the remaining duration of the calculation cycle and restored to the new time step used before in the next scheduling cycle. This setting can effectively correct the deviation and make up the time step, making the synchronization more accurate and the time advancement more precise.
[0060] The present invention is described with reference to specific embodiments, but it will be appreciated by those skilled in the art that various changes and equivalent substitutions may be made without departing from the scope of the present invention. In addition, to adapt to specific occasions or materials of the present invention, the present invention may be modified in many ways without departing from its scope. Therefore, the present invention is not limited to the specific embodiments disclosed herein, but includes all embodiments falling within the scope of the claims.
Claims
1. A thermal hydraulic calculation method based on a nuclear power simulation platform, characterized in that: include: Defining a shared memory, generating shared data that can be recognized by both the nuclear power simulation platform and the thermal hydraulic program, and making the thermal hydraulic program work according to the instructions of the nuclear power simulation platform based on the shared memory, including the following steps: S1 obtains a user instruction sent by the nuclear power simulation platform, wherein the user instruction includes one or a combination of multiple instructions such as run, freeze, reset, and snapshot; S2 the thermal hydraulic program executes the user instruction; S2 includes: If it is determined that the user instruction is a snapshot instruction, the thermal hydraulic program will maintain the current calculation state and continue to run, and restart the file writing at the same time; If it is determined in step S22 that the user instruction is a frozen instruction, the current periodic scheduling is skipped, and the thermal hydraulic program directly enters a dormant state and waits for the nuclear power simulation platform to be scheduled again and the user instruction is converted to other instructions; If it is determined in step S23 that the user instruction is a run and / or reset instruction, it is further determined whether the thermal hydraulic program needs to be initialized. If so, the thermal hydraulic program executes the user instruction after initializing the memory. If not, it proceeds to step S24 to perform transient calculation. S23 includes: S231 If the user instruction is a running instruction, then read the input card and determine the designated pipeline for this operation according to the input card, initialize the model parameters of the designated pipeline and then proceed to step S24; S232 If the user instruction is a reset instruction, read the input card and the restart file, determine the designated pipeline according to the input card, and initialize the model parameters of the designated pipeline according to the reset information recorded in the restart file, and then go to step S24; S24 performs transient calculation on the designated pipeline according to the initialized model of the designated pipeline and the preset calculation time step, until the calculation is completed, the program enters a dormant state, and waits for the re-scheduling of the nuclear power simulation platform, including: performing transient calculation according to the initialized model of the designated pipeline, and judging whether the calculation result converges, if not, continuing the transient calculation until it is confirmed that the calculation result converges; if converged, entering into a single scheduling time judgment, including: judging whether the time step of a single calculation cycle changes; S24 includes: S241 When the time step of a single calculation cycle remains unchanged, a loop scheduling counter is set, and the counting target value = calculation cycle / time step. During each loop scheduling process, the counter value is accumulated by 1. When the counter value reaches the counting target value, the calculation completion flag is set to yes; S242 When the time step of a single calculation cycle changes, the counting target value is updated to (calculation cycle - calculated completion time) / (new time step (integer) + 1), and the counter value is cleared and restarted to accumulate. At the last step, the time step will be modified to the remaining duration of the calculation cycle, and will be restored to the new time step used before in the next scheduling cycle.
2. A thermal hydraulic calculation method based on a nuclear power simulation platform as claimed in claim 1, characterized in that: In the method of using an automatic code generation tool, the code automatic generation tool will read the user definition file and generate an interactive program and a variable loading file according to the interactive variable requirements specified by the user to define the shared memory definition, including the following: Load the code file; Scan the code text and load the preset public variable declaration rules; According to the public variable declaration rule, replace the public variables specified in the code text; Generate a new code dynamic library.
3. The thermal hydraulic calculation method based on the nuclear power simulation platform according to claim 1, characterized in that: In the step S23, an initialization flag is set. If the initialization flag is yes, the process continues to step S23. If the initialization flag is no, the process jumps to step S24 to perform transient calculation.
4. The thermal hydraulic calculation method based on the nuclear power simulation platform according to claim 1, characterized in that: In the step S21, a mirror image is created for the current computing program memory and the mirror image data is used to write a restart file.
Citation Information
Patent Citations
MAAP5 program and nuclear power plant simulator integrating method
CN109976185A