Index
Exposes the core logic blocks for the Beachlore Safety framework.
AsilBlock
Evaluates final system metrics and determines the achieved ASIL level.
Calculates Single-Point Fault Metric (SPFM) and Latent Fault Metric (LFM) according to ISO 26262 requirements.
Source code in src/ecc_analyzer/core/asil_block.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
__init__(name)
Initializes the ASIL calculation block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The descriptive name of the calculation block. |
required |
Source code in src/ecc_analyzer/core/asil_block.py
26 27 28 29 30 31 32 | |
compute_metrics(lambda_total, final_spfm_dict, final_lfm_dict)
Calculates final ISO 26262 metrics using result dictionaries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lambda_total
|
float
|
The total FIT rate of the entire system. |
required |
final_spfm_dict
|
dict[FaultType, float]
|
Dictionary containing final residual and dangerous FIT rates. |
required |
final_lfm_dict
|
dict[FaultType, float]
|
Dictionary containing final latent FIT rates. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: A dictionary containing: - "SPFM" (float): Single-Point Fault Metric. - "LFM" (float): Latent Fault Metric. - "Lambda_RF_Sum" (float): Residual FIT Rate Sum. - "ASIL_Achieved" (str): The determined ASIL level. |
Source code in src/ecc_analyzer/core/asil_block.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
Base
Bases: BlockInterface, ABC
Abstract base class for hardware components.
Provides a structured way to define internal logic hierarchies by wrapping complex logic into a single modular unit.
Source code in src/ecc_analyzer/core/base.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
__init__(name)
Initializes the component and triggers the internal block configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The descriptive name of the hardware component. |
required |
Source code in src/ecc_analyzer/core/base.py
18 19 20 21 22 23 24 25 26 | |
compute_fit(spfm_rates, lfm_rates)
Delegates the FIT rate transformation to the internal root block.
This allows the component to be treated as a single modular unit within the system, hiding its internal complexity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spfm_rates
|
dict[FaultType, float]
|
Current residual failure rates. |
required |
lfm_rates
|
dict[FaultType, float]
|
Current latent failure rates. |
required |
Returns:
| Type | Description |
|---|---|
dict[FaultType, float]
|
tuple[dict[FaultType, float], dict[FaultType, float]]: Updated FIT rates |
dict[FaultType, float]
|
processed by the internal root block. |
Source code in src/ecc_analyzer/core/base.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
configure_blocks()
abstractmethod
Abstract method to define the internal logic structure (root block).
Must be implemented by subclasses to specify the internal tree of blocks (e.g., using SumBlock, PipelineBlock).
Source code in src/ecc_analyzer/core/base.py
28 29 30 31 32 33 34 35 | |
BasicEvent
Bases: BlockInterface
Represents a source of a fault (Basic Event) that injects a specific FIT rate.
This class handles the mathematical addition of failure rates to the fault dictionaries.
Source code in src/ecc_analyzer/core/basic_event.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
__init__(fault_type, rate, is_spfm=True)
Initializes the BasicEvent fault source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fault_type
|
FaultType
|
The type of fault (Enum) this event produces. |
required |
rate
|
float
|
The FIT rate of this basic event. |
required |
is_spfm
|
bool
|
Whether this rate counts towards SPFM (True) or LFM (False). Defaults to True. |
True
|
Source code in src/ecc_analyzer/core/basic_event.py
14 15 16 17 18 19 20 21 22 23 24 25 | |
compute_fit(spfm_rates, lfm_rates)
Transforms the input fault rate dictionaries by injecting the defined FIT rate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spfm_rates
|
dict[FaultType, float]
|
Dictionary containing current SPFM/residual fault rates. |
required |
lfm_rates
|
dict[FaultType, float]
|
Dictionary containing current LFM/latent fault rates. |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict[FaultType, float], dict[FaultType, float]]
|
tuple[dict[FaultType, float], dict[FaultType, float]]: A tuple containing: - Updated SPFM rates dictionary. - Updated LFM rates dictionary. |
Source code in src/ecc_analyzer/core/basic_event.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
CoverageBlock
Bases: BlockInterface
Applies diagnostic coverage (DC) to a fault type.
Splits FIT rates into residual and latent components based on the defined coverage values (c_R, c_L).
Source code in src/ecc_analyzer/core/coverage_block.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
__init__(target_fault, dc_rate_c_or_cR, dc_rate_latent_cL=None, is_spfm=True)
Initializes the CoverageBlock with specific diagnostic coverage parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_fault
|
FaultType
|
The fault type (Enum) to which coverage is applied. |
required |
dc_rate_c_or_cR
|
float
|
The diagnostic coverage for residual faults (typically denoted as K_DC or c_R). |
required |
dc_rate_latent_cL
|
Optional[float]
|
Optional specific coverage for latent faults (c_L). If None, standard ISO 26262 logic (1 - c_R) is assumed. |
None
|
is_spfm
|
bool
|
Indicates if this block processes the SPFM/residual path. Defaults to True. |
True
|
Source code in src/ecc_analyzer/core/coverage_block.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
compute_fit(spfm_rates, lfm_rates)
Transforms the input fault rate dictionaries by applying diagnostic coverage logic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spfm_rates
|
dict[FaultType, float]
|
Current residual failure rates. |
required |
lfm_rates
|
dict[FaultType, float]
|
Current latent failure rates. |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict[FaultType, float], dict[FaultType, float]]
|
tuple[dict[FaultType, float], dict[FaultType, float]]: A tuple containing: - Updated SPFM rates dictionary. - Updated LFM rates dictionary. |
Source code in src/ecc_analyzer/core/coverage_block.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
ObservableBlock
Bases: ObservableInterface
A wrapper class that encapsulates a logic block.
Manages both mathematical results (via the wrapped block) and visual output ports (via observers).
Source code in src/ecc_analyzer/core/observable_block.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
__init__(logic_block)
Initializes the observable wrapper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logic_block
|
BlockInterface
|
The pure mathematical block to be wrapped. |
required |
Source code in src/ecc_analyzer/core/observable_block.py
15 16 17 18 19 20 21 22 | |
attach(observer)
Registers an observer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observer
|
SafetyObserver
|
The SafetyObserver instance to be registered. |
required |
Source code in src/ecc_analyzer/core/observable_block.py
24 25 26 27 28 29 30 31 | |
notify(input_ports, spfm_in, lfm_in, spfm_out, lfm_out)
Broadcasts results and returns the visual ports created by the observer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_ports
|
dict
|
Incoming visual ports. |
required |
spfm_in
|
dict[FaultType, float]
|
Incoming SPFM rates. |
required |
lfm_in
|
dict[FaultType, float]
|
Incoming LFM rates. |
required |
spfm_out
|
dict[FaultType, float]
|
Outgoing SPFM rates. |
required |
lfm_out
|
dict[FaultType, float]
|
Outgoing LFM rates. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
The visual output ports created by the observers. |
Source code in src/ecc_analyzer/core/observable_block.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
run(spfm_in, lfm_in, input_ports)
Executes calculation and collects output ports from the observer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spfm_in
|
dict[FaultType, float]
|
Incoming SPFM fault rates. |
required |
lfm_in
|
dict[FaultType, float]
|
Incoming LFM fault rates. |
required |
input_ports
|
dict
|
Mapping of incoming node IDs for visualization. |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict[FaultType, float], dict[FaultType, float], dict]
|
tuple[dict[FaultType, float], dict[FaultType, float], dict]: A tuple containing: - Updated SPFM rates. - Updated LFM rates. - Output ports dictionary from the observer. |
Source code in src/ecc_analyzer/core/observable_block.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
PipelineBlock
Bases: BlockInterface
Executes a sequence of blocks where the output of one block becomes the input of the next.
This block type is used to model serial hardware paths or sequential processing steps (e.g., Source -> ECC -> Trim).
Source code in src/ecc_analyzer/core/pipeline_block.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
__init__(name, blocks)
Initializes the PipelineBlock with a sequence of sub-blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The descriptive name of the pipeline. |
required |
blocks
|
list[BlockInterface]
|
A list of blocks implementing BlockInterface to be executed in strict sequential order. |
required |
Source code in src/ecc_analyzer/core/pipeline_block.py
15 16 17 18 19 20 21 22 23 24 | |
compute_fit(spfm_rates, lfm_rates)
Sequentially processes all blocks in the pipeline.
Passes the output rates of one block as the input to the next block in the list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spfm_rates
|
dict[FaultType, float]
|
Initial residual failure rates entering the pipeline. |
required |
lfm_rates
|
dict[FaultType, float]
|
Initial latent failure rates entering the pipeline. |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict[FaultType, float], dict[FaultType, float]]
|
tuple[dict[FaultType, float], dict[FaultType, float]]: A tuple containing: - Final SPFM rates after the last block. - Final LFM rates after the last block. |
Source code in src/ecc_analyzer/core/pipeline_block.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
SplitBlock
Bases: BlockInterface
Distributes the FIT rate of a specific fault type across multiple other fault types.
The distribution is based on a defined percentage mapping. This is typically used to model how a generic fault (like "DRAM Error") manifests as specific sub-types (e.g., SBE, DBE) based on physical probabilities.
Source code in src/ecc_analyzer/core/split_block.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
__init__(name, fault_to_split, distribution_rates, is_spfm=True)
Initializes the SplitBlock with a distribution mapping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The descriptive name of the split operation. |
required |
fault_to_split
|
FaultType
|
The source fault type (Enum) to be distributed. |
required |
distribution_rates
|
dict[FaultType, float]
|
Dictionary mapping target FaultTypes to their probability (0.0 - 1.0). |
required |
is_spfm
|
bool
|
Indicates if this split occurs on the SPFM/residual path. Defaults to True. |
True
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the sum of the provided distribution rates exceeds 1.0. |
Source code in src/ecc_analyzer/core/split_block.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
compute_fit(spfm_rates, lfm_rates)
Transforms the input fault rate dictionaries by redistributing the source fault rate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spfm_rates
|
dict[FaultType, float]
|
Current residual failure rates. |
required |
lfm_rates
|
dict[FaultType, float]
|
Current latent failure rates. |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict[FaultType, float], dict[FaultType, float]]
|
tuple[dict[FaultType, float], dict[FaultType, float]]: A tuple containing: - Updated SPFM rates. - Updated LFM rates. |
Source code in src/ecc_analyzer/core/split_block.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
SumBlock
Bases: BlockInterface
Parallel block that aggregates FIT rates from multiple sub-blocks.
Manages path junctions by executing sub-blocks in parallel (starting from the same input state) and calculating the sum of their individual contributions (deltas) to the total system rates.
Source code in src/ecc_analyzer/core/sum_block.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
__init__(name, sub_blocks)
Initializes the SumBlock with a list of parallel sub-blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The descriptive name of the aggregation block. |
required |
sub_blocks
|
list[BlockInterface]
|
List of blocks whose results will be summed. |
required |
Source code in src/ecc_analyzer/core/sum_block.py
16 17 18 19 20 21 22 23 24 | |
compute_fit(spfm_rates, lfm_rates)
Aggregates the FIT rate transformations from all internal parallel blocks.
Calculates the delta contribution of each block relative to the input state and sums these deltas to produce the final output state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spfm_rates
|
dict[FaultType, float]
|
Current residual failure rates (Input state). |
required |
lfm_rates
|
dict[FaultType, float]
|
Current latent failure rates (Input state). |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict[FaultType, float], dict[FaultType, float]]
|
tuple[dict[FaultType, float], dict[FaultType, float]]: A tuple containing: - Final aggregated SPFM rates. - Final aggregated LFM rates. |
Source code in src/ecc_analyzer/core/sum_block.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
TransformationBlock
Bases: BlockInterface
Transfers a portion of one fault type's rate to another fault type.
This operation adds a calculated rate to the target fault type based on the source fault type, without removing the rate from the source (unlike SplitBlock).
Source code in src/ecc_analyzer/core/transformation_block.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
__init__(source_fault, target_fault, factor)
Initializes the transformation block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_fault
|
FaultType
|
The fault type from which the rate is calculated. |
required |
target_fault
|
FaultType
|
The fault type to which the calculated rate is added. |
required |
factor
|
float
|
The multiplication factor applied to the source rate. |
required |
Source code in src/ecc_analyzer/core/transformation_block.py
15 16 17 18 19 20 21 22 23 24 25 | |
compute_fit(spfm_rates, lfm_rates)
Transforms the input fault rate dictionaries by transferring a portion of the source rate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spfm_rates
|
dict[FaultType, float]
|
Current residual failure rates. |
required |
lfm_rates
|
dict[FaultType, float]
|
Current latent failure rates. |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict[FaultType, float], dict[FaultType, float]]
|
tuple[dict[FaultType, float], dict[FaultType, float]]: A tuple containing: - Updated SPFM rates (target fault increased). - Unchanged LFM rates. |
Source code in src/ecc_analyzer/core/transformation_block.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |