Fault Tree Analysis using BDDs
Project description
Faultree
A Python tool for Fault Tree Analysis (FTA) using Ordered Binary Decision Diagrams (OBDD).
Overview
- Converts a Fault Tree (FTA) JSON into an Ordered BDD using the
ddpackage. - Supports logic gates: AND, OR, XOR, K-of-N.
- Outputs algebraic and symbolic expressions.
- Computes Top Event and Intermediate Event probabilities from Basic Event probabilities.
- Supports internal event cloning via
ref(reference nodes).
Tree Format
- Fields:
id(string): Unique identifier for the event.name(string): Descriptive name.event_type:top,intermediate,basic, orundeveloped.gate:AND,OR,XOR,K_OF_N, ornull/BASICfor leaves.children(list): Child nodes.k(int): Required forK_OF_Ngates.prob(float): Probability for basic/undeveloped events.ref(string): ID of another node to clone/reference.
Supported Formats
Faultree supports two JSON formats:
- Recursive Tree (Standard): Nodes nested within
children. - Flat List (New): Nodes defined in
ft_nodesandbe_nodeslists, withbranchesreferencing child IDs. This format is automatically detected.
Usage
-
Install Dependencies:
python3 -m venv .venv . .venv/bin/activate pip install -r requirements.txt
-
Run Analysis:
python faultree_cli.py examples/sample_tree.json
-
Override Probabilities (optional):
python faultree_cli.py examples/sample_tree.json --probs '{"BE1": 0.05}'
-
Reliability Analysis (Success Mode): Calculate reliability (Success Probability) from a Fault Tree model. This mode interprets the input tree as a Fault Tree (Failure Logic) but computes the Dual (Success) Tree and expects reliability values as input.
python faultree_cli.py examples/sample_tree_success.json --reliability
-
Run API Server:
python faultree_cli.py --serve
Example Request:
curl -X POST http://localhost:8000/analyze \ -H "Content-Type: application/json" \ -d '{ "tree": { "id": "TOP", "gate": "OR", "children": [ {"id": "A", "prob": 0.1}, {"id": "B", "prob": 0.2} ] } }'
Features
- Logic Gates: AND, OR, XOR (Exactly One), K-of-N (At least K).
- Probability Calculation: Uses Weighted Model Counting (WMC) on the BDD.
- Symbolic Output: Prints algebraic expressions (e.g.,
(A + B * C)). - Ref/Clones: Supports reusing events within the same tree using
{"ref": "ID"}. - API: Built-in FastAPI server for integrating with other tools.
Backlog
- Transfer Symbols: Support splitting trees across multiple files/trees (e.g.,
transfer_inpointing to a separate file). - Minimal Cut Sets: Extract and report minimal cut sets.
- Variable Ordering: Implement heuristics (sifting, metaheuristics) for BDD optimization.
- Advanced Distributions: Support
dist/parameters(Exponential, Weibull) for time-dependent analysis. - Data Sampling: Estimate probabilities from sample data.
- Frontend: Web UI for visualization and analysis.
Notes
- Assumes independent basic events.
- Variable ordering is currently based on traversal order unless specified.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file faultree-0.2.1.tar.gz.
File metadata
- Download URL: faultree-0.2.1.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e0670156b2b8fde894d3ce4a29e194da9f01c0b14f9b4ec252ccb869fa31f07
|
|
| MD5 |
d2659a746c8ce118ce120f157fe610a1
|
|
| BLAKE2b-256 |
4a42574d4b40b8e53f3bb67b82cf5590a99c06e5ebd8ba9c832108268d503484
|
File details
Details for the file faultree-0.2.1-py3-none-any.whl.
File metadata
- Download URL: faultree-0.2.1-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3333d33ab11548bb76055418566885a2feaa54ded421438d48dea7c6ee6577eb
|
|
| MD5 |
839c4dc5c43615a31b0e14cdf20d78c2
|
|
| BLAKE2b-256 |
c7df443cf2ea24340cad559f77ae25741d38300c442bfdcf2b43a00ed5e1c06a
|