Public Fault Tree Analyser (PFTA)
Project description
Public Fault Tree Analyser (PFTA)
Free and open-source fault tree analysis.
- For rudimentary documentation, see
DOCS.md. - For an overview of the mathematics, see
MATHS.md. - For example fault trees, see
examples/.
Features
- Enforces declaration of at least one value of time
t. - Supports the general fault tree analysis framework where objects can have
both a failure probability
q(t)and a failure intensityω(t)(with failure rateλ(t) = ω(t) / (1 − q(t))). - Supports Monte Carlo (sampling of distributions) for failure parameters out of the box.
Limitations
- Does not support negative logic (NOT gates). Only supports coherent fault trees (i.e. those whose logic is reducible to AND gates and OR gates).
- Does not support common cause failure groups.
Textual input
PFTA reads a textual representation of a fault tree. For example:
- times: 1, 2, 3, 5, 10, 100, 1000
- time_unit: h
- seed: candle
- sample_size: 1000
Gate: CAN
- label: Candlelight fails
- type: OR
- inputs: IGN, EXP, EXT
Gate: IGN
- label: Candle fails to ignite
- type: AND
- inputs: MAT, LTR
Event: MAT
- label: Single match fails to ignite candle
- model_type: Fixed
- probability: triangular(lower=0.1, upper=0.3, mode=0.2)
- intensity: 0
Event: LTR
- label: Lighter fails to ignite candle
- model_type: Fixed
- probability: loguniform(lower=0.001, upper=0.01)
- intensity: 0
Event: EXP
- label: Candle explodes on ignition
- appearance: Undeveloped
- model_type: Fixed
- probability: 0
- intensity: 0
Event: EXT
- label: Candle extinguishes
- model_type: ConstantRate
- mean_failure_time: 3
- mean_repair_time: inf
This allows for text-based version control of a fault tree.
Output
Output files consist of:
- a table (TSV) of events,
- a table (TSV) of gates,
- a table (TSV) of cut sets under each gate, and
- vector graphics (SVG) for each top gate and paged gate at each value of time.
Installation
$ pip3 install pfta
- If simply using as a command line tool, do
pipxinstead ofpip3to avoid having to set up a virtual environment. - If using Windows, do
pipinstead ofpip3.
Usage (command line)
$ pfta [-h] [-v] ft.txt
Perform a fault tree analysis.
positional arguments:
ft.txt fault tree text file; output is written to `{ft.txt}.out/`
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
Usage (scripting example)
from pfta.core import FaultTree
fault_tree = FaultTree('''
- times: nan
Event: A
- model_type: Fixed
- probability: 0
- intensity: 0.9
Event: B
- model_type: Fixed
- probability: 0.7
- intensity: 0
Event: C
- model_type: Fixed
- probability: 0
- intensity: 1e-4
Gate: AB
- type: AND
- inputs: A, B
Gate: AB_OR_C
- type: OR
- inputs: AB, C
''')
fault_tree.gates[0]
# Gate(id_='AB', label=None, is_paged=False, type_=<GateType.AND: 2>, vote_threshold=None, input_ids=['A', 'B'], input_ids_line_number=21, comment=None, is_top_gate=False, flattened_indexer=FlattenedIndexer(time_count=1, sample_size=1, flattened_size=1), computed_expression=Expression(Term(0b11)), computed_probabilities=[0.0], computed_intensities=[0.63], computed_rates=[0.63], computed_expected_probabilities=[0.0], computed_expected_intensities=[0.63], computed_expected_rates=[0.63])
fault_tree.gates[0].computed_rates
# [0.63]
fault_tree.gates[1]
# Gate(id_='AB_OR_C', label=None, is_paged=False, type_=<GateType.OR: 1>, vote_threshold=None, input_ids=['AB', 'C'], input_ids_line_number=25, comment=None, is_top_gate=True, flattened_indexer=FlattenedIndexer(time_count=1, sample_size=1, flattened_size=1), computed_expression=Expression(Term(0b11), Term(0b100)), computed_probabilities=[0.0], computed_intensities=[0.6301], computed_rates=[0.6301], computed_expected_probabilities=[0.0], computed_expected_intensities=[0.6301], computed_expected_rates=[0.6301])
fault_tree.gates[1].computed_rates
# [0.6301]
Licence
Copyright 2025 Conway.
Licensed under the GNU General Public License v3.0 (GPL-3.0-only).
This is free software with NO WARRANTY etc. etc., see LICENSE.
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 pfta-0.3.1.tar.gz.
File metadata
- Download URL: pfta-0.3.1.tar.gz
- Upload date:
- Size: 43.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71c3163046a694fdc304fe5c4a0db17b472a7e2152aaadb84f03a41eda1e3fc3
|
|
| MD5 |
81c36f1956506dd6b44fe6442657e0eb
|
|
| BLAKE2b-256 |
55e86545f900640602d227841282c434aeb60a5560f143e14641b465de60a400
|
Provenance
The following attestation bundles were made for pfta-0.3.1.tar.gz:
Publisher:
publish.yml on public-fta/pfta
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pfta-0.3.1.tar.gz -
Subject digest:
71c3163046a694fdc304fe5c4a0db17b472a7e2152aaadb84f03a41eda1e3fc3 - Sigstore transparency entry: 210579291
- Sigstore integration time:
-
Permalink:
public-fta/pfta@45101418922080de7073597a702674f87be2b6a3 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/public-fta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@45101418922080de7073597a702674f87be2b6a3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pfta-0.3.1-py3-none-any.whl.
File metadata
- Download URL: pfta-0.3.1-py3-none-any.whl
- Upload date:
- Size: 48.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5cef81abfeb3a5e5c390463d4be71b33fd536399ace124e3d81334f6aca9c35
|
|
| MD5 |
c35b8231dece3d517c256fafb587d38d
|
|
| BLAKE2b-256 |
50cda44ceb5301970eef82b735bbe7d292b0aee573780c5889e74c09f40328e7
|
Provenance
The following attestation bundles were made for pfta-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on public-fta/pfta
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pfta-0.3.1-py3-none-any.whl -
Subject digest:
d5cef81abfeb3a5e5c390463d4be71b33fd536399ace124e3d81334f6aca9c35 - Sigstore transparency entry: 210579292
- Sigstore integration time:
-
Permalink:
public-fta/pfta@45101418922080de7073597a702674f87be2b6a3 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/public-fta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@45101418922080de7073597a702674f87be2b6a3 -
Trigger Event:
push
-
Statement type: