observer
Defines the abstract observer interface for safety analysis visualization.
SafetyObserver
Bases: ABC
Abstract base class for all observers in the safety system.
Allows the separation of calculation logic (Model) from visualization or reporting (View), implementing the Observer design pattern.
Source code in src/ecc_analyzer/interfaces/observer.py
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 | |
on_block_computed(block, input_ports, spfm_in, lfm_in, spfm_out, lfm_out)
abstractmethod
Triggered after a hardware block completes its FIT rate transformation.
The observer acts upon this event (e.g., drawing the block in a diagram) and returns the new visual connection points (ports).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
BlockInterface
|
The instance of the logic block (defines shape and type). |
required |
input_ports
|
dict
|
Mapping of fault types to incoming node IDs (defines edge origins). |
required |
spfm_in
|
dict[FaultType, float]
|
Dictionary of incoming residual/SPFM FIT rates. |
required |
lfm_in
|
dict[FaultType, float]
|
Dictionary of incoming latent/LFM FIT rates. |
required |
spfm_out
|
dict[FaultType, float]
|
Updated dictionary of outgoing residual/SPFM FIT rates. |
required |
lfm_out
|
dict[FaultType, float]
|
Updated dictionary of outgoing latent/LFM FIT rates. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary containing the newly created output ports (node IDs) to be |
dict
|
used as inputs for the next block in the chain. |
Source code in src/ecc_analyzer/interfaces/observer.py
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 | |