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
error_type()
View Source
error_type() :: {:error, String.t()}
error_type() :: {:error, String.t()}
result()
View Source
result() :: t() | error_type()
result() :: t() | error_type()
t()
View Source
t() :: %FaultTree{next_id: integer(), nodes: [FaultTree.Node.t()]}
t() :: %FaultTree{next_id: integer(), nodes: [FaultTree.Node.t()]}
Link to this section Functions
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.
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.
add_basic(tree, probability, name) View Source
Add a basic node to the fault tree with a pre-defined probability.
add_basic(tree, parent, probability, name) View Source
add_basic(tree, parent, probability, name, description) View Source
add_logic(tree, parent, type, name, description \\ nil) View Source
Add a logic gate to the fault tree.
add_node(tree, node)
View Source
add_node(FaultTree.t(), FaultTree.Node.t()) :: result()
add_node(FaultTree.t(), FaultTree.Node.t()) :: result()
Add a node to the fault tree. Some validations are performed to make sure the node can logically be added to the tree.
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.
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.
build(tree) View Source
create()
View Source
create() :: t()
create() :: t()
Create a new fault tree with an OR
gate as the root.
create(root)
View Source
create(FaultTree.Node.t()) :: t()
create(atom()) :: t()
create(FaultTree.Node.t()) :: t()
create(atom()) :: t()
Create a new fault tree and generate a node of the given type for the root.
find_children(node, nodes) View Source
parse(doc) View Source
Convert from a string containing fault tree logic into the tree object.
to_json(tree) View Source
Convert a tree to JSON.
validate_atleast(tree, node) View Source
Validate that ATLEAST gates have their parameters set.
validate_name(tree, map) View Source
Validate that the name of the node is unique in the fault tree.
validate_node(tree, node) View Source
Perform some validation for a new node against the existing tree.
validate_parent(tree, node) View Source
Validate that the gate types allow setting this node as a child of its listed parent.
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.
validate_transfer(tree, node) View Source
Validate that TRANSFER gates have a source that exists in the tree.