Branch Generation
Overall Process
ADS uses a three-stage information processing mechanism to handle three functions for a probabilistic simulation. The three functions and their corresponding handling classes are:
- Probability and branch handling (i.e., by instance branch_center of class BranchRecord)
- Time delay (i.e., by CommandControlCenter)
- Information sharing (i.e., by CommunicationPlace)
This section only discusses the first bullet. The second and third bullets are discussed in Section 12. The left hand side Figure 33 shows a loop of the information processing modeled by the ADS. All the information to be shown in the event tree has to go through the process. The information generated by the crew, control panel, and hard ware reliability modules is first delivered to the Branch_center (declared from the class BranchRecord). In the Branch_center, branches are generated for all combinations and corresponding probabilities are calculated. The information of a corresponding branch is then sent to the Command_handler (declared by class CommandControlCenter). The Command_handler controls the time delay to execute the branch information. Once the specified time delay is reached, the command_handler sends the information to the Communication_place (declared by the class CommunicationPlace). The Communication_place is a white board that keeps current information and to be perceived by the crew and control panel modules.
Figure 35 The process of carrying out an activity
Figure 34 shows the functions involved in the modules shown in Figure 33 for the information handling. As shown in Figure 34, on the top the control panel check whether there are new alarms generated. The generated alarms will be sent to the Branch_center. The Branch_center calculates the total number of branches that need to be generated and create objects to carry the information of all events sent to the center. The information of a branch is represented by an object of class BranchProbability. The class BranchCluster is used to contain all branch information following the same branching node. The branches generation and probabilities calculation are performed by the unction BranchRecord::checkAndAddBranchCluster().
The function BranchProbability::sendBranchInfoToCommandCenter() sends the branch information to the Command_handler. The function CommandControlCenter::senInfoToCommunicationPlace() sends information individually to the Communication_place when the time delay of the information has been reached. Then the function Operator::receiveNewInformation() check the relevant information to the operator in the Communication_place to be processed further.
In order to conserve the computer memory, only one set of objects are created with memory in the information communication process shown in Figures 33 and 34. AS shown in Figure 34, the memory is located in the Branch_center. The Command_handler and Communication_place only generate pointers pointing to the corresponding information. Such practice also enhances the code performance. The information
Figure 36 The information flow for communication and relevant functions.
***Note*********************************
Information on the branches associated with a branching node is stored in a BranchCluster. Within a BranchCluster, each BranchProbability stores the information of a branch. The branching node information corresponding to a BranchCluster is stored in a RestartNodeInfo. The RestartNodeInfo is for the purpose of restarting the ADS simulation from a specific point. As a result, only if the total number of branches associated with a BranchCluster is greater than one, a corresponding RestartNodeInfo is generated. See function Interfc() in the C++ file where the main calling function is located (e.g., ADSConsole2.cpp).
**********************************************************
DET Construction
Figure 35 is a picture representation of ADS modeling branch control. On the left hand side are three classes relevant to the branch handling:
- BranchRecords: contains information of all branches (corresponding to the whole DET on the right hand side of Figure 35)
- BranchCluster: contains information of branches following a same branching node (corresponding to a BranchCluster shown in the DET on the upper right hand side of Figure 35)
- BranchProbability: contains information of a branch (corresponding to a Branch_n shown in the DET on the upper right hand side of Figure 35)
Each class has a set of parameters to indicate their relationship to form a DET as shown on the left hand side of Figure 35. The information allows a two-way (i.e., forward and backward) search for the relevant objects. The forward search is mainly for post simulation process to construct a DET. The backward search is necessary during simulation to identify the next scenario to be simulated when current sequence is terminated. The upper part and low part of the right hand side of Figure 35 shows the ADS DET modeling structure and the DET shown in the ADS GUI.
The attributes in the BranchRecord keeps the up-to-date value fro the numbering system used in constructing a DET. They are explained as the following:
- ID_of_recent_generated_branch: is the number to be used as PE_N in the DET shown by the ADS GUI. The value started at zero (i.e., typically for the first generated initiating event). Using the DET as an example, the value of this parameter changes from negative one (i.e., the initial value) to seven during the simulation.
- ID_of_recent_generated_ES: is the number to be used as ES_N in the DET shown by the ADS GUI. Using the DET as an example, the value of this parameter changes from negative one (i.e., the initial value) to four during the simulation.
- ID_of_recent_generated_branch_cluster: indicates the number of “branching node” has been generated.
- ID_of_mother_cluster: giving a simulation moment, this parameter indicates the mother BranchCluster. For example, using Figure 35 as an example, when the simulation is between BranchCluster_1 and BranchCluster_3, the value of ID_of_mother_cluster is one (1).
- ID_of_mother_branch: indicates the specific branch of the current simulation. Using the same example, when the simulation is between BranchCluster_1 and BranchCluster_3, the value of ID_of_mother_branch is four (4).
- recent_unconditional_branch_probability: the probability of the BranchCluster to which the current branch belongs to. Using the same example, when the simulation is between BranchCluster_1 and BranchCluster_3, the value of recent_unconditional_branch_probability is the Probability of BranchCluster_1 which equals to Probability of the initiating event (IE).
The attributes of a BranchCluster carry information relating to a branching node in a DET. These attributes are explained as the following:
- ID_of_the_mother_branch: Using the example DET shown in Figure 35, for the BranchCluster_3, the value of ID_of_the_mother_branch is four(4). This value is stored and is fix in BranchCluster_3.
- ID_of_the_mother_cluster: Using the example DET shown in Figure 35, for the BranchCluster_3, the value of ID_of_the_mother_cluster is one (1). This value is stored and is fix in BranchCluster_3.
- Current_branch_num: is used during simulation to indicate the number of branches of a BranchCluster have been simulated. This attribute has nothing to do with DET construction.
- ID_of_this_branch_cluster: the ID of BranchCluster_3 is three (3). This value is stored and is fix in BranchCluster_3.
- n_count_for_restart_RELAP5: the identification to call RELAP5 to restart from a certain point. Each BranchCluster has its own value of n_count_for_restart_RELAP5.
The attributes of a BranchProbability carry information relating to a specific branch in the DET. These attributes are explained as the following:
- ID_of_this_branch: Using the example DET shown in Figure 35, the ID_of_this_branch equals to four (4) for the second branch in the BranchCluster_1.
- ID_of_the_associated_branch_cluster: Using the example DET shown in Figure 35, the value of ID_of_the_associated_branch_cluster equals to one (1) for the Branch 4.
- ID_of_the_child_branch_cluster: Using the example DET shown in Figure 35, the value of ID_of_the_child_branch_cluster is three (3).
- unconditional_branch_probability: is the conditional branch probability. Using the example DET shown in Figure 35, the value of unconditional_branch_probability for Branch_4 is Probability(Branch_4 | Cluster_1). Adding the values of unconditional_branch_probability for all branches generated within a BranchCluster should be equals to one (1.0).
- type_of_child: indicates the types of child following the branch. The options are: branch (i.e., a branch cluster) or ES (i.e., end state). Only one option is possible for a branch.
Figure 37 Comparing the IDAC branches modeling and shown in a DDET
****About retrieving a branching node to restart another simulation sequence****
Produce an exact copy of an object during simulation is essential for the ADS to restart itself to simulate another sequence from a branching point. For single processor, the branching node information is stored in the computer memory. Each class is cdeclared a function copy<Class Name>(<Class Name> &) (e.g., void BranchAction::copyBranchAction (BranchAction &)) to produce an exact copy of the object in computer memory. In some instances, due to the use of pointers some classes have functions of copy<Class Name>ToRestartInfo() and copy<Class Name>FromRestartInfo() to copy information to the branching node and retrieve information from the branching node, respectively (e.g., ShortTermMemory::copyShortTermMemoryToRestartInfo(ShortTermMemory &) and ShortTermMemory::copyShortTermMemoryFromRestartInfo(ShortTermMemory &)).
For the multi-processor ADS, the branching node information is save to hard disk. Two coupled functions save<Class Name>ToFile() and retrieve<Class Name>FromFile() are used for saving or retrieving the branching node information to or from the restart info node (e.g., ShortTermMemory::saveShortTermMemoryToFile(ofstream &fout) and ShortTermMemory::retrieveShortTermMemoryFromFile(ifstream &fin)).
The function readInfoFromFile() declared in various classes is typically for reading information from a hard disk to initialize objects. As a result, the function is typically only called at the beginning og a simulation.
******************************************************************
Branches Control
This section provides an example to show the mechanism of ADS control branches generation given the context that during a time step branches could be generated simultaneously by different actors. Currently in the ADS code, branches could be generated by:
- Decision Maker
- Action Taker
- Control Panel (only alarm information)
- Hardware reliability
The Consultant currently is not activated, Appendix A provides a step-by-step instruction on how to add a branch generation source into the ADS code.
As mentioned before, a BranchProbability carries the information of a branch. As a result, corresponding number of BranchProbability objects are created within a BranchCluster to carry all branches’ information of the BranchCluster. The class hierarchy of BranchProbability is:
BranchProbability : CommunicationPlace : BranchUnit
BranchUnit carries the possible branches generated by crew. CommunicationPlace adds possible branches from the control panel and hardware reliability module.
Using Figure 36 as an example, three sources generate branches at a give time step. These branches include:
- Source A: Branches A and B (e.g., “Open Valve-A” and “Not open Valve-A)
- Source B: Branches a, b, and c (e.g., having diagnosis of “LOCA”, “MSLB”, or “SGTR”)
- Source C: Branches x and y (e.g., HPI success and HPI failure)
Each of the above branches is associating to a conditional probability. The total number of combinations (i.e., the number of branches) is twelve. As a result, twelve BranchProbability are created to carry the information of these branches.
The following procedure provides a step-by-step instruction to having a complete mix of branches:
- Calculate the Unit Size for repeating the individual branch an the pack of branches generated by a branch source.
- The initial Unit Size for the first branch source is the total number of branches from all branch sources (i.e., 12 for Source A).
- The Unit size for the second branch source is the total number of branches divided by the number of branches of the first branch source (i.e., 6 for source B).
- The Unit size for the third branch source is the total number of branches divided by the number of branches of the first branch source and the second branch source (i.e., 2 for Source C)
- The process continues until the Unit Size for all branches sources are calculated.
- Calculate the number of repeat of a single branch element generated by a branch source
- Use the Unit Size divided by the number of branches of the first source (i.e., 6 = 12 / 2 for Source A)
- Use the Unit Size divided by the number of branches of the second source (i.e., 2 = 6/3)
- Use the Unit Size divided by the number of branches of the third source (i.e., 1 = 2/2)
- The process continues applying to all branch sources
- Calculate the number of repeat of the branch pack (all branches) of a branch source by dividing the total number of branches with the number of repeat for a single branch element calculated in STEP 2 and the number of branches of the branch source.
- For Source A is 1 (= 12/6/2)
- For Source B is 2 (= 12/2/3)
- For Source C is 6 (= 12/1/2)
- for the first Branch Source to the last Branch Source in sequence:
- repeat single branch element the number of time shown in STEP 1 for all branch element of the branch source
- repeat Item (a) the number of times calculated in STEP 3
As a result, the content of the twelve branches are:
- (A, a, x) 2. (A, a, y) 3. (A, b x) 4. (A, b, y) 5. (A, c, x) 6. (A, c, y) 7. (B, a, x) 8. (B, a, y) 9. (B, b, x) 10. (B, b, y) 11. (B, c, x) 12. (B, c, y)
Within the ADS code, the memory of the objects created for the twelve branches are located. In this example, thirty six ( equals to three times twelve) branch object memory are located. These memory is released when the branches container (i.e., BranchCluster) is no longer needed. Figure 38 The branches generation management
Memory Control
The Branch Center (declared from class BranchRecord) is the container for storing all branching related information. The key elements include:
- branch_cluster
- end_state
- HW_reliability_branch
- system_branch
- ODM_branch
- ODM_branch
- OAT_branch
- OCT_branch
Only the first element (i.e., branch_cluster) store the information for controlling the simulation sequence. The branch_cluster is an array of pointers to BranchCluster objects. When a BranchCluster object is no longer needed for simulation, the object’s memory is released during simulation. Prior to releasing the memory located for a BranchCluster, the function BranchCluster::savePENodeToFile() is called to save all the branches information (i.e., PE_n.txt) to hard disk.
The end_state is an array of pointers to BranchEndState objects. In current ADS code, once an end state is generated its content is immediately saved into the had disk. As a result, there is no need for the end_state during a simulation. The rest six elements are temporary containers for holding the branches generated by the corresponding sources. When the simulation is finished, the destructor of the Branch_center is called that in turn calls the function BranchRecord::clearBranchRecordAll() to release all residual memory in the Branch_center.
Table 13 shows the memory control related functions of the Branch_center.
Table 15 the memory management of Branch Control Center
| Main function | Sub sequential function | Objects and Pointers | Pointers |
|---|---|---|---|
| clearBranchRecordAll() | branch_cluster | X | |
| end_state | X | ||
| HW_reliability_branch | X | ||
| system_branch | X | ||
| ODM_branch | X | ||
| OAT_branch | X | ||
| OCT_branch | X | ||
| clearBranches() or clearBranchRecordForRestart() | branch_cluster | -- | |
| end_state | -- | ||
| HW_reliability_branch | X | ||
| system_branch | X | ||
| ODM_branch | X | ||
| OAT_branch | X | ||
| OCT_branch | X | ||
| copyBranchRecord() | branch_cluster | X | |
| end_state | X | ||
| HW_reliability_branch | X | ||
| system_branch | X | ||
| ODM_branch | X | ||
| OAT_branch | X | ||
| OCT_branch | X |