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.
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.
tidyfault represents a fault tree as two tables:
nodes: one row per gate or basic
event, with columns id, event, and
type ("top", "and",
"or", or "not").edges: directed links between node
id values (from, to), forming a
DAG with a single top event. The top event has exactly one child, an
and or or gate; curate() stops
with a message otherwise.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)")| id | event | type |
|---|---|---|
| 1 | T | top |
| 2 | G1 | or |
| 3 | G2 | and |
| 4 | G3 | or |
| 5 | G4 | and |
| 6 | DC | not |
| from | to |
|---|---|
| 1 | 14 |
| 14 | 2 |
| 2 | 6 |
| 2 | 7 |
| 14 | 3 |
| 3 | 8 |
From nodes and edges you typically:
curate()
— build a gates table (one row per gate, boolean set,
list-column items).equate()
— substitute gates recursively into one top-level boolean string.formulate()
— turn that string into an R function with one argument per basic
event.calculate()
(optional) — enumerate the full truth table when the number of basic
events is moderate.concentrate()
— minimal cutsets (default MOCUS backend: Rcpp).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().
curate()#> # 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).
equate()#> [1] " ( ( (DC + AF) + (SF * BF) + (NF + AUF) + (HF * MF) ) ) "
formulate()#> [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).
calculate()When \(2^n\) rows is acceptable, calculate()
expands every combination of basic events:
#> [1] 256 9
#> [1] 247
concentrate() and
tabulate()concentrate()
returns a character vector of minimal cutset expressions. The default
method matches the Rcpp MOCUS expansion used by mocus().
#> [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:
| 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.
| 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.