Skip to main content

Automatic conversion from fault trees into behavior trees

Project description

Fault Tree to Behavior Tree Converter

Overview

This project focuses on the conversion of fault trees, represented in draw.io diagram XML files, into behavior tree XML files compatible with the BehaviorTree.CPP library. It enables users to transform their fault tree diagrams into actionable behavior trees, facilitating integration with systems that utilize the BehaviorTree.CPP framework for managing complex behaviors.

Installation

Install with PyPI:

pip install ft2bt

Usage

The tool is designed to convert fault trees from draw.io diagram XML files into behavior tree XML files compatible with the BehaviorTree.CPP library. Here's how to use it:

Preparing Your Fault Tree Diagram

  1. Create or Open Your Fault Tree Diagram in Draw.io:
    • First, visit draw.io to create or edit your fault tree diagram. You may refer to their documentation for guidance on using the tool.
  2. Diagram Structure & Symbols:
    • Hazards: Represent hazards using rectangles. This is a required element in your diagram.
    • Events: Depict events using circles. These are also required elements.
    • AND/OR Gates: Use the respective symbols for AND/OR gates in your diagram. These are required for depicting logical relationships in the fault tree.
    • Probabilities: Use text below the events to indicate the correspondent probability. Example: p = 0.1. These elements are not required.
  3. Exporting the Diagram as XML:
    • Once your fault tree diagram is ready, you need to export it in XML format. In draw.io, go to File > Export as > XML to save your diagram as an XML file.

Fault Tree Example

Warning!: All fault tree elements, with the exception of text probabilities, should be connected by directional arrows. Ensure that each arrow is physically attached to its corresponding elements to maintain clarity and accuracy in the diagram.

Preparing Your Hazard Analysis and Risk Assessment (Optional)

Create a *.csv file with some required column names:

  1. Item_ID: Identificator of the Item analyzed.
  2. Hazard_ID: Identificator of the possible Hazard. The ID must match with the name of the correspondent Hazard in the Fault Tree.
  3. Operating_Scenario_ID: Identificator of the Operating Scenario.
  4. ASIL: Automotive Safety Integrity Level. Options: A, B, C, D
  5. Safety_State_ID: Identificator of the Safety State action.

HARA Example

Running the Conversion Tool

Run the conversion command:

ft2bt [-h] -f FTA_FILEPATH [-v] [-c] [-r] [-o OUTPUT_FOLDER] [-p] [-H HARA_FILEPATH] [-os] [-ctl]

Where:

  • -f: (Required, str) Specifies the XML global filepath name of the draw.io diagram.
  • -v: (Optional, bool) Automatically shows and saves the renders. Defaults to False.
  • -c: (Optional, bool) Generate a cpp ROS node template for the behavior tree. Defaults to False.
  • -r: (Optional, bool) Replaces current code if previously generated and -c is set to True.
  • -o: (Optional, str) Specifies the global folder path, where the behavior tree XML diagram is saved.
  • -p: (Optional, bool) Probabilities are considered to sort the behavior tree nodes. Defaults to False.
  • -H: (Optional, str) Specifies the CSV global file name of the Hazard Analysis and Risk Assessment (HARA).
  • -os: (Optional, bool) Generate a BT that includes events to check the Operating Scenario.
  • -ctl: (Optional, bool) Generate a SMV file to get the functional safety CTL specifications.

Output Example: Behavior Tree Diagram

Below is an example of the behavior tree diagrams generated from the fault tree. The XML file is loaded using Groot:

The order of the events is randomly selected in this version of the software. Future versions will sort the events by probability of occurrence.

Behavior Tree Conversion Example

Contact Information and Acknowledgement

For further information regarding this project, please feel free to reach out to Carlos Conejo.

This project was developed at the Institut de Robòtica i Informàtica Industrial (IRI), a joint university research center of the Polytechnic University of Catalonia (UPC) and the Spanish National Research Council (CSIC).

Research partially funded by the Spanish State Research Agency (AEI) and the European Regional Development Fund (ERFD) through the SaCoAV project (ref. PID2020-114244RB-I00). Also funded by Renault Group through the Industrial Doctorate "Safety of Autonomous Vehicles" (ref. C12507).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ft2bt-0.3.5.4.tar.gz (135.8 kB view details)

Uploaded Source

Built Distribution

ft2bt-0.3.5.4-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file ft2bt-0.3.5.4.tar.gz.

File metadata

  • Download URL: ft2bt-0.3.5.4.tar.gz
  • Upload date:
  • Size: 135.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.10

File hashes

Hashes for ft2bt-0.3.5.4.tar.gz
Algorithm Hash digest
SHA256 73ad73851280d54d652e70e1ef7561065b60b7f68c74a6016a9bcec94cf58f75
MD5 c9a94e44999dcc09208e1e3811de37eb
BLAKE2b-256 751902459fe5b385f729e3b823913e9dbe422cdd8d81d19eed3a8c46f466dc00

See more details on using hashes here.

File details

Details for the file ft2bt-0.3.5.4-py3-none-any.whl.

File metadata

  • Download URL: ft2bt-0.3.5.4-py3-none-any.whl
  • Upload date:
  • Size: 34.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.10

File hashes

Hashes for ft2bt-0.3.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 de37a3e931c2723c12f31a339ee9c189c0f377dd30277ebef4d882cd4e375b15
MD5 b75bfb09f282c9795c0616afc452f881
BLAKE2b-256 96e9a0fe8b13520fe60368210019d4b6231012d541ab619627ceda7da01d58dd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page