sfta


Namesfta JSON
Version 0.9.1 PyPI version JSON
download
home_pageNone
SummarySlow Fault Tree Analyser (SFTA)
upload_time2024-11-18 15:01:03
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords fault tree minimal cutsets
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Slow Fault Tree Analyser (SFTA)

A slow (also shitty) fault tree analyser inspired by the idea presented in:

- Wheeler et al. (1977). Fault Tree Analysis Using Bit Manipulation.
  IEEE Transactions on Reliability, Volume R-26, Issue 2.
  <<https://doi.org/10.1109/TR.1977.5220060>>


## Text-driven

SFTA reads a textual representation of a fault tree. For example:

```txt
- time_unit: yr

Gate: FB
- label: Conway causeth floor to be buttered
- type: OR
- inputs: BF, TFBSD

Event: BF
- label: Conway knocketh butter onto floor
- rate: 0.1

Gate: TFBSD
- label: Conway knocketh toast onto floor butter side down
- type: AND
- inputs: TF, TB, BSD

Event: TF
- label: Conway knocketh toast onto floor
- rate: 0.2

Event: TB
- label: Falling toast is buttered
- probability: 0.75

Event: BSD
- label: Buttered toast landeth butter side down
- probability: 0.9
```

This allows for sensible diffing between two versions of a fault tree.


## Output

Output consists of:
- an events summary,
- a gates summary,
- cut set listings, and
- SVGs for all top gates and paged gates.

For the example above, we get the following SVG for the top gate `FB`:

<img
  alt="Nice looking SVG showing the example fault tree."
  src="https://raw.githubusercontent.com/yawnoc/sfta/master/demos/readme-example.txt.out/figures/FB.svg"
  width="640">


## Limitations

- Only supports coherent fault trees, which have only AND gates and OR gates.

- The probability or rate for a gate is approximated by simply summing the
  contributions from each minimal cut set (rare event approximation).
  The higher-order terms (subtraction of pairwise intersections, addition of
  triplet-wise intersections, etc.) have been neglected. This is conservative,
  as the first-order sum is an upper bound for the actual probability or rate.


## Installation

```bash
$ pip3 install sfta
```

- If simply using as a command line tool, do `pipx` instead of `pip3`
  to avoid having to set up a virtual environment.
- If using Windows, do `pip` instead of `pip3`.


## Usage (command line)

```bash
$ sfta [-h] [-v] ft.txt

Perform a slow fault tree analysis.

positional arguments:
  ft.txt         name of fault tree text file; output is written unto the
                 directory `{ft.txt}.out/`

optional arguments:
  -h, --help     show this help message and exit
  -v, --version  show program's version number and exit
```


## Usage (scripting example)

```python
from sfta.core import FaultTree, Gate

fault_tree = FaultTree('''
Event: A
- rate: 0.9

Event: B
- probability: 0.7

Event: C
- rate: 1e-4

Gate: AB
- label: This be an AND gate.
- type: AND
- inputs: A, B

Gate: AB_C
- label: This be an OR gate.
- type: OR
- inputs: AB, C
''')

fault_tree.gate_from_id['AB'].quantity_value
# 0.63

fault_tree.gate_from_id['AB_C'].quantity_value
# 0.6301

fault_tree.gate_from_id['AB_C'].input_ids
# ['AB', 'C']

fault_tree.gate_from_id['AB_C'].type_ == Gate.TYPE_OR
# True
```


## License

**Copyright 2022–2024 Conway** <br>
Licensed under the GNU General Public License v3.0 (GPL-3.0-only). <br>
This is free software with NO WARRANTY etc. etc., see LICENSE. <br>


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sfta",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "fault tree, minimal cutsets",
    "author": null,
    "author_email": "Conway <pypi.sheep257@passmail.net>",
    "download_url": "https://files.pythonhosted.org/packages/fc/93/72a2a1a036287294bac28dba814cd799b642bc416c501abfa08823807a88/sfta-0.9.1.tar.gz",
    "platform": null,
    "description": "# Slow Fault Tree Analyser (SFTA)\n\nA slow (also shitty) fault tree analyser inspired by the idea presented in:\n\n- Wheeler et al. (1977). Fault Tree Analysis Using Bit Manipulation.\n  IEEE Transactions on Reliability, Volume R-26, Issue\u00a02.\n  <<https://doi.org/10.1109/TR.1977.5220060>>\n\n\n## Text-driven\n\nSFTA reads a textual representation of a fault tree. For example:\n\n```txt\n- time_unit: yr\n\nGate: FB\n- label: Conway causeth floor to be buttered\n- type: OR\n- inputs: BF, TFBSD\n\nEvent: BF\n- label: Conway knocketh butter onto floor\n- rate: 0.1\n\nGate: TFBSD\n- label: Conway knocketh toast onto floor butter side down\n- type: AND\n- inputs: TF, TB, BSD\n\nEvent: TF\n- label: Conway knocketh toast onto floor\n- rate: 0.2\n\nEvent: TB\n- label: Falling toast is buttered\n- probability: 0.75\n\nEvent: BSD\n- label: Buttered toast landeth butter side down\n- probability: 0.9\n```\n\nThis allows for sensible diffing between two versions of a fault tree.\n\n\n## Output\n\nOutput consists of:\n- an events summary,\n- a gates summary,\n- cut set listings, and\n- SVGs for all top gates and paged gates.\n\nFor the example above, we get the following SVG for the top gate `FB`:\n\n<img\n  alt=\"Nice looking SVG showing the example fault tree.\"\n  src=\"https://raw.githubusercontent.com/yawnoc/sfta/master/demos/readme-example.txt.out/figures/FB.svg\"\n  width=\"640\">\n\n\n## Limitations\n\n- Only supports coherent fault trees, which have only AND gates and OR gates.\n\n- The probability or rate for a gate is approximated by simply summing the\n  contributions from each minimal cut set (rare event approximation).\n  The higher-order terms (subtraction of pairwise intersections, addition of\n  triplet-wise intersections, etc.) have been neglected. This is conservative,\n  as the first-order sum is an upper bound for the actual probability or rate.\n\n\n## Installation\n\n```bash\n$ pip3 install sfta\n```\n\n- If simply using as a command line tool, do `pipx` instead of `pip3`\n  to avoid having to set up a virtual environment.\n- If using Windows, do `pip` instead of `pip3`.\n\n\n## Usage (command line)\n\n```bash\n$ sfta [-h] [-v] ft.txt\n\nPerform a slow fault tree analysis.\n\npositional arguments:\n  ft.txt         name of fault tree text file; output is written unto the\n                 directory `{ft.txt}.out/`\n\noptional arguments:\n  -h, --help     show this help message and exit\n  -v, --version  show program's version number and exit\n```\n\n\n## Usage (scripting example)\n\n```python\nfrom sfta.core import FaultTree, Gate\n\nfault_tree = FaultTree('''\nEvent: A\n- rate: 0.9\n\nEvent: B\n- probability: 0.7\n\nEvent: C\n- rate: 1e-4\n\nGate: AB\n- label: This be an AND gate.\n- type: AND\n- inputs: A, B\n\nGate: AB_C\n- label: This be an OR gate.\n- type: OR\n- inputs: AB, C\n''')\n\nfault_tree.gate_from_id['AB'].quantity_value\n# 0.63\n\nfault_tree.gate_from_id['AB_C'].quantity_value\n# 0.6301\n\nfault_tree.gate_from_id['AB_C'].input_ids\n# ['AB', 'C']\n\nfault_tree.gate_from_id['AB_C'].type_ == Gate.TYPE_OR\n# True\n```\n\n\n## License\n\n**Copyright 2022\u20132024 Conway** <br>\nLicensed under the GNU General Public License v3.0 (GPL-3.0-only). <br>\nThis is free software with NO WARRANTY etc. etc., see LICENSE. <br>\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Slow Fault Tree Analyser (SFTA)",
    "version": "0.9.1",
    "project_urls": {
        "changelog": "https://github.com/yawnoc/sfta/blob/master/CHANGELOG.md",
        "issues": "https://github.com/yawnoc/sfta/issues",
        "repository": "https://github.com/yawnoc/sfta"
    },
    "split_keywords": [
        "fault tree",
        " minimal cutsets"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1928df7195c765edd7ba2bc8a556a61668d8343ea0d5653fe5a3ef7316a6c4e",
                "md5": "ae799798f6da3f0bd8f0f7111b551050",
                "sha256": "c6a0fff8932a604f3416f2802fd75f1dd72b7b5a534198308cdd9f544024520b"
            },
            "downloads": -1,
            "filename": "sfta-0.9.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ae799798f6da3f0bd8f0f7111b551050",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 18734,
            "upload_time": "2024-11-18T15:01:01",
            "upload_time_iso_8601": "2024-11-18T15:01:01.117142Z",
            "url": "https://files.pythonhosted.org/packages/b1/92/8df7195c765edd7ba2bc8a556a61668d8343ea0d5653fe5a3ef7316a6c4e/sfta-0.9.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fc9372a2a1a036287294bac28dba814cd799b642bc416c501abfa08823807a88",
                "md5": "74f0a152603996efc69d09388cba31e0",
                "sha256": "7fe93db1207b80393f8cb74eb60504758317ddf40a22a00291a7f946b6542001"
            },
            "downloads": -1,
            "filename": "sfta-0.9.1.tar.gz",
            "has_sig": false,
            "md5_digest": "74f0a152603996efc69d09388cba31e0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 18547,
            "upload_time": "2024-11-18T15:01:03",
            "upload_time_iso_8601": "2024-11-18T15:01:03.436335Z",
            "url": "https://files.pythonhosted.org/packages/fc/93/72a2a1a036287294bac28dba814cd799b642bc416c501abfa08823807a88/sfta-0.9.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-18 15:01:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yawnoc",
    "github_project": "sfta",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "sfta"
}
        
Elapsed time: 0.65129s