Skip to content

System Module ​

The System Module is the bridge between RELAP5 and ADS. All data communication between ADS and RELAP5 needs to go through the System Module. Every ADS time step, the data in the System Module are updated to be consistent with the RELAP5 generated up-to-date data. The following activities of all other ADS modules are based on the data resides in the System Module.

A Bridge Between ADS and RELAP5 ​

The system module (i.e., class SystemModule) access RELAP5 calculation data and provides input to affect RELAP5 calculation. The user specified system related information (specified in the RELAP5_channels.txt) are stored in various arrays declared both in FORTAN and C++ but sharing the same memory location. As a result, change the values within a FORTRAN array would change the values within the C++ array. The arrays in the FORTRAN side is declared in the file R5Par.for. The arrays in the C++ side is declared in the file fmodule.h. Update of the system related data (i.e., RELAP5  system module) is carried out by the subroutine R5ParUpdate.for. System module updates RELAP5 data (i.e., system module  RELAP5) is carried by finteract.for.

Within R5Par.for a module, r5par, is declared. It contains all parameters required for the communication between RELAP5 and ADS and places them in the common block r5pars. On the C++ side, fmodule.h declares a struct with the same members in the same order, named r5pars_, which is the symbol of that common block. For example, the C++ counterpart of real*8 mass_fr(500) in R5Par.for is the member double mass_fr[500], accessed as r5pars_.mass_fr. Changing mass_fr(1) in Fortran changes r5pars_.mass_fr[0], because the two share the same address. Note: Fortran counts an array from one and C++ from zero. See Fortran/C++ Interface.

Since FORTRAN requires to pre-declare the size of an array, currently each type of data specified in the system module is set to five hundred. If necessary, the analyst can change the size settings within the R5Par.for and fmodule.h.

Information Specified in System Module ​

Seven types of information are specified in the system module. Each type of information is declared in an array (i.e., vector in C++ terminology). In C++, there is no limitation on the number of elements to be included in a vector; however, the size of any of these array should never exceeds the maximum size of an array content specified in ??. Since the vector size is declared automatically, the size of the vectors will be same as the number of elements declared in the RELAP5_channels.txt. The programmer does not need to worry the array oversize issue. These seven arrays are:

vector<ControlVariable*> control_variable_array;
vector<HeatStructure*> heat_structure_array;
vector<HydraulicJunction*> hydraulic_junction_array;
vector<HydraulicVolume*> hydraulic_volume_array;
vector<InteractiveVariable*> interactive_variable_array;
vector<LogicalTrip*> logical_trip_array;
vector<VariableTrip*> variable_trip_array;

Figure shows the class hierarch of the objects declared in the System Module. All of which inherit a common class THElement. The THElement contains information for use of the map to search a desired object.

Figure The class hierarch and information for object identification of the objects in the SystemModule.

The ID of each individual element within these arrays are unique. As mentioned before, the ADS code use string comparison to identify a specific element. In order to increase efficiency of searching for a specific component, a map is constructed. A map is a binary tree. Each element in the map consists of two attributes: element name and a pointer to the element location within the seven arrays listed above. The map is declared as:

map<string, THElement *> system_map;

The seven types of information are described below: • ControlVariable: RELAP5 models a plant by a number of nodes. At each RELAP5 time step, the mass, momentum, and energy conservative equations and a two-phase interaction equation are calculated for each node to determine the states of the node. Some parameters shown in the control panel only can be calculated with combination of a number of nodes (e.g., PZR or SG water level typically consists of several nodes). Within the RELAP5 input deck, the analyst can create a Control Variable to calculate a parameter whose value is calculated from a number of nodes. For detail information about setting the control variable cards in the RELAP5 input deck please see Section A15 CARD 205CCCNN OR 205CCCCN of RELAP5 Volume 2. The Control Variables are used in RELAP5 mainly for specifying automatic system controls (See A15 of RELAP5 Volume 2 for details).

Within ADS, only the value of a variable (i.e., cnvarn, see Table 10.10-1 of RELAP5 Volume 8, Page 104) is obtained from a control variable for ADS calculation.

The values of control variables are stored in the CTRLVAR_VAL(500) declared in the R5Par.for.

• HeatStructure: represents the metal (structural) properties (i.e., fuel or RPV vessel wall). A series of heat structure node is typically used to represent the structural thermal profile along a vertical or horizontal dimension. Each heat structure node can contain a number of “mesh points” to represent the thermal profile along the radial dimension. See A10 of [2] for the specification of heat structure nodes.

Current declaration in ADS code for heat structure has the following number restriction: o The number of heat structure nodes can not exceed 10, and o The mesh (radial) temperature of a single heat structure node can not exceed 10. This can be changed by editing the number declared in the R5Par.for and fmodule.h. The array shown below are declared within R5Par.for:

  1. integer HEAT_STR_CN(10), HEAT_STR_OBJ(10)
  2. integer N_MESH(10)
  3. real*8 MESH_T(100)

Change the array size of Item1 above would change the maximum number of heat structure nodes to be accessed by ADS. Item 2 represents the maximum number of mesh temperature of a heat structure could have. Item 3 indicates the maximum number of mesh temperature in total that could be accessed by ADS.

See Table 10.23-1 (page 118) of [4] to access additional data from heat structure nodes, if necessary.
• HydraulicJunction: the hydraulic components modeled by RELAP5 include Time-dependent volume, time-dependent junction, single-volume, single-junction, pipe, branch, pump, jet pump, valves, separator, turbine, accumulator, annulus, and ECC mixer (see Section 2 of [3] for detail). These components can be divided into two groups: volumes (including time-dependent volume, single-volume, and pipe) and junctions (including the rest of the components).

Currently the ADS obtains three types of data from a junction node including mass flow rate, liquid velocity, and vapor velocity. See Table 10.27-1 of [4] for accessing additional information, if necessary. • HydraulicVolume: ADS accesses the following parameters from a hydraulic volume node: o Liquid temperature o Vapor temperature o Saturation temperature o Boron density o Equilibrium quality o Flow regime number o Pressure If necessary, the analyst can adding code into ADS to access additional data specified in the Table 10.73-1 of [4]. • InteractiveVariable: is the channels that allows external world to change RELAP5 simulation. ADS uses the channels to perform operators’ actions and component failure events. See A6 of [2] for RELAP5 input specifications. See also Table 10.24-1 of [4] for attributes of the interactive variable modeled in RELAP5. • LogicalTrip and VariableTrip: RELAP5 uses two types of trip to setup the control logics: logical trip and variable trip. A logical trip evaluates a logical statement relating two trip quantities with the operations AND, OR (inclusive), or XOR (exclusive) [3]. A variable trip evaluates a comparison statement relating two variables and a constant using one of the relationships, equal (EQ), not equal (NE), greater than or equal (GE), greater than (GT), less than or equal (LE), or less than (LT) [3].

When a trip statement is false, the trip returns value -1. When the trip statement is true, the trip return the time at which the statement becomes true. See Section 4.1 of [3] for more detail information regarding trip, and Section 10.67 of [4] for attributes of trip cards.

  1. Information Systems Laboratories Inc., RELAP5/MOD3 code manual Volume II: Appendix A input requirements 2002, NUREG/CR-5535/Rev 1-Vol II App A, U.S. Nuclear Regulatory Commission: Washington DC.
  2. Information Systems Laboratories Inc., RELAP5/MOD3.3 code manual Volume II: user's guide and input requirements. 2001, NUREG/CR-5535/Rev 1-Vol II, U.S. Nuclear Regulatory Commission: Washington DC.
  3. Information Systems Laboratories Inc., RELAP5/MOD3.3 code manual Volume VIII: Programmers Manual. 2001, NUREG/CR-5535/Rev 1-Vol VIII, U.S. Nuclear Regulatory Commission: Washington DC.

Update System Module Data ​

All information relating to accessing and storing RELAP5 data are declared in R5Par.for. Take the hydraulic junction as an example, the arrays declared in R5Par.for relating to hydraulic junctions include the following five arrays:

integer HYDRO_J_CN(500), HYDRO_J_OBJ(500)
real*8 MASS_FR(500), LIQ_VEL(500), VAP_VEL(500)

The HYDRO_J_CN(500) contains the Card Number (e.g., 151000000) which the user entered in RELAP5_channels.txt. The HYDRO_J_OBJ(500) stores the memory location in which the RELAP5 stores the information of the hydraulic junction specified in HYDRO_J_CN(500). Using C++ terminology, the programmer can think the HYDRO_J_OBJ(500) contains the “pointers” pointing to the objects specified in HYDRO_J_CN(500). Identifying the pointer from the Card number is performed in R5ParFind.for.

The arrays MASS_FR(500), LIQ_VEL(500), VAP_VEL(500) store the values of mass flow rate, liquid velocity, and vapor velocity of the hydraulic junctions. These values are updated by R5ParUpdate.for.

The routines in R5ParFind.for and R5ParUpdate.for are called from RELAP5 (see dtstep.f). Every 0.5 second of simulated time RELAP5 calls R5ParUpdate to update all data used by the system module and then calls the Interfc function of ADS (interfc_() in ADSIDAC.cpp).

The Plant.updateParametersValues() in interfc update the data of system module. The element sequence of the vectors declared in the System Module is identical as the sequence of Card Number declared in R5Par (e.g., the element sequence in the vector<HydraulicJunction*> hydraulic_junction_array declared in the System Module is identical as the element sequence within the HYDRO_J_CN(500) declared in R5Par).

Memory Control in System Module ​

Objects are created (i.e., memory for these objects are claimed) for all element of the System Module. As a result, when the System Module is destructed this memory needs to be released. Since the sizes of the arrays declared in the System Module remains constant through whole simulation, starting for another sequence only requires the System Module to link the “pointers” to the corresponding memory declared by RELAP5 in the new sequence. Starting a new simulation sequence is specified in initiationForRestart() in the ADS-IDAC.cpp.

ADS-IDAC Engine Documentation