# DPL Fault Tree Programs

Fault trees can be defined graphically or in code using the DPL Fault Tree programming language. Graphical trees are easier to build and understand, but there are some advantages to working with code:

• All of the information stored in individual nodes of a fault tree is visible in a single DPL Fault Tree program.
• Fault tree nodes and influence diagram nodes can interact easily in a few lines of code which may be simpler than embedding graphically.
It is possible to view the code for a model that was generated graphically, or to build the entire model as a DPL Fault Tree program.

Viewing a Graphic Fault Tree as a DPL Fault Tree Program

To view a graphic fault tree as a DPL Fault Tree Program, select HOME | Add to WS | Program from Fault Tree. DPL will create program equivalent to the graphical fault tree.

Writing DPL Fault Tree Programs

The DPL Fault Tree code defining a fault tree starts with the basic events and bottom level values and works its way up the tree. It can have as many intermediate events as desired, or can be a single nested expression in terms of all of the basic events. Fault tree code is entirely data definitions; it makes no contribution to the sequence section of a program. There are three types of variables in fault tree code: binary events, probability values and values.

Defining Binary Events, Probability Values and Values in DPL Fault Tree Code

This code defines a fault tree with a top node, two binary events, and a probability value:

```binary A = 0.1;		//defines a binary event named A with assigned probability 0.1//
prob Bprob = 0.2;	//defines a probability value named Bprob, with assigned value 0.2//
binary B = Bprob;	//defines a binary event named B, with the value held by the variable Bprob (0.2) assigned to it//
binary top = or(A,B);	//defines a binary event named top as the result of the operator OR applied to A,B//```

Defining Time Series in DPL Fault Tree Code

The following piece of code defines a binary event named A for time periods 1 through 10:
```value b = 1.2;
binary A =
from 1: .1,
from 2: .2,
from 4: b*A[\$-1],
from 7 to 10: A*b^[\$];```

In this case, the expression "from 1" indicates the interval from 1 to 1, since the end of the interval is implied by the next statement. The "to" can only show up in the last line. All time intervals in a series definition must be adjacent. The relative subscript [\$] takes on the value of the index, which is the time period the variable is in at the time. The expression A[\$-1] represents the value of the variable A in the previous time period. The expression b^[\$] represents b^7 in period 7, etc.

Versions: DPL Fault Tree