FaultTree v0.1.0 FaultTree View Source

Main module for creating and interacting with fault trees.

Link to this section Summary

Functions

Add an AND gate to the fault tree. All children must fail for this node to fail.

Add an ATLEAST/VOTING gate to the fault tree. This rqeuires that a minimum of K out of N child nodes fail in order to be marked as failing.

Add a basic node to the fault tree with a pre-defined probability.

Add a logic gate to the fault tree.

Add a node to the fault tree. Some validations are performed to make sure the node can logically be added to the tree.

Add an OR gate to the fault tree. Any child nodes failing will cause this node to fail.

Add a transfer node. This is a reference to a node that already exists in the tree. Transfer nodes cannot have anything modified, changes must happen on the source.

Create a new fault tree with an OR gate as the root.

Create a new fault tree and generate a node of the given type for the root.

Convert from a string containing fault tree logic into the tree object.

Convert a tree to JSON.

Validate that ATLEAST gates have their parameters set.

Validate that the name of the node is unique in the fault tree.

Perform some validation for a new node against the existing tree.

Validate that the gate types allow setting this node as a child of its listed parent.

Validate that a probability is only set on basic nodes. Logic gates will have their probability calculated when the tree is built.

Validate that TRANSFER gates have a source that exists in the tree.

Link to this section Types

Link to this type

error_type() View Source
error_type() :: {:error, String.t()}

Link to this type

t() View Source
t() :: %FaultTree{next_id: integer(), nodes: [FaultTree.Node.t()]}

Link to this section Functions

Link to this function

add_and_gate(tree, parent, name, description \\ nil) View Source

Add an AND gate to the fault tree. All children must fail for this node to fail.

Link to this function

add_atleast_gate(tree, parent, min, total, name, description \\ nil) View Source

Add an ATLEAST/VOTING gate to the fault tree. This rqeuires that a minimum of K out of N child nodes fail in order to be marked as failing.

Link to this function

add_basic(tree, probability, name) View Source

Add a basic node to the fault tree with a pre-defined probability.

Link to this function

add_basic(tree, parent, probability, name) View Source

Link to this function

add_basic(tree, parent, probability, name, description) View Source

Link to this function

add_logic(tree, parent, type, name, description \\ nil) View Source

Add a logic gate to the fault tree.

Add a node to the fault tree. Some validations are performed to make sure the node can logically be added to the tree.

Link to this function

add_or_gate(tree, parent, name, description \\ nil) View Source

Add an OR gate to the fault tree. Any child nodes failing will cause this node to fail.

Link to this function

add_transfer(tree, parent, source) View Source

Add a transfer node. This is a reference to a node that already exists in the tree. Transfer nodes cannot have anything modified, changes must happen on the source.

Create a new fault tree with an OR gate as the root.

Link to this function

create(root) View Source
create(FaultTree.Node.t()) :: t()
create(atom()) :: t()

Create a new fault tree and generate a node of the given type for the root.

Link to this function

find_children(node, nodes) View Source

Convert from a string containing fault tree logic into the tree object.

Link to this function

to_json(tree) View Source
to_json(t() | map()) :: String.t()

Convert a tree to JSON.

Link to this function

validate_atleast(tree, node) View Source

Validate that ATLEAST gates have their parameters set.

Link to this function

validate_name(tree, map) View Source

Validate that the name of the node is unique in the fault tree.

Link to this function

validate_node(tree, node) View Source

Perform some validation for a new node against the existing tree.

Link to this function

validate_parent(tree, node) View Source

Validate that the gate types allow setting this node as a child of its listed parent.

Link to this function

validate_probability(tree, node) View Source

Validate that a probability is only set on basic nodes. Logic gates will have their probability calculated when the tree is built.

Link to this function

validate_transfer(tree, node) View Source

Validate that TRANSFER gates have a source that exists in the tree.