FaultTree is a library for performing fault tree analysis. It includes a small HTTP server capable of graphing the resulting FTA, or returning it as JSON.
The FaultTree package can be installed from Hex
by adding fault_tree
to your list of dependencies in mix.exs
:
def deps do
[
{:fault_tree, "~> 0.2.0"}
]
end
Documentation can be found at https://hexdocs.pm/fault_tree.
Run the server with mix trot.server
, or iex -S mix
for an interactive shell. The analysis can be run by uploading XML at http://localhost:4000/.
The expected input is an XML document matching the SCRAM/openpsa format. Alternatively, the fault tree can be created using Elixir code. Example:
FaultTree.create(:or)
|> FaultTree.add_basic("root", "0.01", "foo")
|> FaultTree.add_basic("root", "0.01", "bar")
|> FaultTree.build()
Will build the following tree:
%FaultTree.Node{
atleast: nil,
children: [
%FaultTree.Node{
atleast: nil,
children: [],
description: nil,
id: 2,
name: "bar",
parent: "root",
probability: #Decimal<0.01>,
source: nil,
type: :basic
},
%FaultTree.Node{
atleast: nil,
children: [],
description: nil,
id: 1,
name: "foo",
parent: "root",
probability: #Decimal<0.01>,
source: nil,
type: :basic
}
],
description: nil,
id: 0,
name: "root",
parent: nil,
probability: #Decimal<0.0199>,
source: nil,
type: :or
}