The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Core workflow

This vignette walks through the standard tidyfault pipeline from tidy node and edge tables to minimal cutsets and a coverage summary, using the bundled database failure example.

Represent the fault tree

tidyfault represents a fault tree as two tables:

The objects db_nodes and db_edges model a small database system whose top event is overall system failure. Load them and inspect the first few rows:

library(tidyfault)
library(dplyr)

data("db_nodes")
data("db_edges")

knitr::kable(head(db_nodes, 6), caption = "Nodes (excerpt)")
Nodes (excerpt)
id event type
1 T top
2 G1 or
3 G2 and
4 G3 or
5 G4 and
6 DC not
knitr::kable(head(db_edges, 6), caption = "Edges (excerpt)")
Edges (excerpt)
from to
1 14
14 2
2 6
2 7
14 3
3 8

Pipeline overview

From nodes and edges you typically:

  1. curate() — build a gates table (one row per gate, boolean set, list-column items).
  2. equate() — substitute gates recursively into one top-level boolean string.
  3. formulate() — turn that string into an R function with one argument per basic event.
  4. calculate() (optional) — enumerate the full truth table when the number of basic events is moderate.
  5. concentrate() — minimal cutsets (default MOCUS backend: Rcpp).
  6. tabulate() — coverage of each minimal cutset against failing scenarios in the truth table.

The next sections run steps 1–3 and 5–6 on db_*; see the quantify binary vignette for evaluation with quantify().


Gates table: curate()

gates <- curate(nodes = db_nodes, edges = db_edges)
gates
#> # A tibble: 6 × 6
#>   gate  type  class     n set                     items    
#>   <chr> <fct> <fct> <int> <chr>                   <list>   
#> 1 T     top   top       1 " (G0) "                <chr [1]>
#> 2 G0    or    gate      4 " (G1 + G2 + G3 + G4) " <chr [4]>
#> 3 G1    or    gate      2 " (DC + AF) "           <chr [2]>
#> 4 G2    and   gate      2 " (SF * BF) "           <chr [2]>
#> 5 G3    or    gate      2 " (NF + AUF) "          <chr [2]>
#> 6 G4    and   gate      2 " (HF * MF) "           <chr [2]>

Each row is a gate (including the top); set encodes children with * (AND) and + (OR).


Boolean equation: equate()

equation <- equate(gates)
equation
#> [1] " ( ( (DC + AF)  +  (SF * BF)  +  (NF + AUF)  +  (HF * MF) ) ) "

Executable structure: formulate()

f <- formulate(equation)
sort(names(formals(f)))
#> [1] "AF"  "AUF" "BF"  "DC"  "HF"  "MF"  "NF"  "SF"

f() evaluates the top event for one scenario when you pass named binary inputs (see the quantify vignettes).


Optional: full truth table with calculate()

When \(2^n\) rows is acceptable, calculate() expands every combination of basic events:

truth <- calculate(f)
dim(truth)
#> [1] 256   9
sum(truth$outcome) # failure scenarios
#> [1] 247

Minimal cutsets: concentrate() and tabulate()

concentrate() returns a character vector of minimal cutset expressions. The default method matches the Rcpp MOCUS expansion used by mocus().

mymin <- concentrate(gates)
mymin
#> [1] "AF"    "AUF"   "DC"    "NF"    "BF*SF" "HF*MF"

tabulate() joins these cutsets to the truth table implied by f and reports how many failing rows each cutset explains:

mytab <- tabulate(mymin, formula = f)
knitr::kable(mytab, digits = 4)
mincut cutsets failures coverage
AF 128 247 0.5182
AUF 128 247 0.5182
BF*SF 64 247 0.2591
DC 128 247 0.5182
HF*MF 64 247 0.2591
NF 128 247 0.5182

Each row is one minimal cutset; coverage is the share of all failure scenarios (failures) that the cutset matches.


Summary

Step Role
curate Nodes/edges → gates data frame
equate Gates → single boolean string
formulate String → R function f
calculate f → full truth table (optional)
concentrate Gates → minimal cutset strings
tabulate Cutsets + f → coverage table

For visualization, see Visualizing fault trees.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.