## 3 Dynamic Reliability Framework
### Stochastic Hybrid Fault Tree Automaton
This represents a powerful feature as it alleviates the efforts of engineers and risk practitioners as far it concerns the modelling of a dynamic system. The coupling of the SHyFTOO library with Simulink is achieved by an additional software component named SHyFTA.slx that has to describe the deterministic process characterizing the physical dynamics of the model. In order to work, the Simulink file SHyFTA.slx has to contain some built-in SHyFTOO blocks, which are compulsory. To simplify the coding of the SHyFTA.slx, the SHyFTOO library package provides a template model (file SHyFTA_TEMPLATE.slx) containing, as said, the basic components. Figure 3 shows the SHyFTA_TEMPLATE.slx model. Figure 3: SHyFTA_TEMPLATE.slx file of the SHyFTOO library package. Figure 2: Example of fault tree with the SHyFTOO library. The important Simulink components shown in Figure 3 are needed to implement the shared variables that couple the stochastic components defined in the Fault Tree model (initFaultTree.m file) with the physical model. To better understand the functioning of these components, the following details are assumed:  
* The \"iter evolution\" (see Table 1) has to be used without any change. In fact, it is the block that controls, for each iteration, the simulation clock of Matlab(r) and verifies if the time of mission T\({}_{\text{m}}\) has been reached to start automatically a new iteration;
* The \"race condition\" (see Table 2) must be used without any change. This block is needed to verify, among the traditional Basic Event (handled in the Fault Tree) and the Hybrid Basic Events (which play a role also in the physical process), which component will cause the next firing event. To achieve this task, this block is in a race condition against all the \"generic hybrid basic event\" blocks (one for each Hybrid Basic Event) as reported in Table 4. If the nextEvent time-point is higher than the Simulink clock it means that the Basic Event of the Fault Tree model has triggered sooner than a Hybrid Basic Event. In this case, the iteration is paused, and the status of the Fault Tree is evaluated. Otherwise, as soon a \"generic hybrid basic event\" triggers (before the race condition) it means that a Hybrid Basic Event is causing the next firing event. * The \"stop iteration\" (see Table 3) is the block that ends the iteration when the Top Event occurs, and the fault tree model is set for evaluating the system reliability. In fact, in that case, a failure of the Top Event cannot be reverted if a component is repaired. \begin{table}
\begin{tabular}{c c} \hline \hline
**Block/Variable** & **Description** \\ \hline Mission Time T\({}_{\text{m}}\) & Mission time of the process. This variable is defined in the SHyFTAmain.m \\ Clock & Clock of Simulink. This is a built-in component of Matlab/Simulink. \\ TimeSimulationClock & This block evaluates if the mission time has been reached and restarts a new iteration. \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Main elements of the “iter evolution” block. \begin{table}
\begin{tabular}{c c} \hline \hline
**Block/Variable** & **Description** \\ \hline STOP & This is a Simulink built-in block assertion. When a condition is verified the STOP simulation is triggered and a new iteration is restarted. \\ TOP STATUS & This is the shared variable that contains the information of the Top Event status (failed or working) \\ TOP\_ISFAILURE & This shared variable is set with the IsFailureGate property of the TOP Gate. If the IsFailureGate is True and the top event gets failed (TOP STATUS = True), then the STOP Assertion is raised. \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Main elements of the “stop iteration” block. As said, for each Hybrid Basic Event, the SHyFTA (.slx) Simulink model has to contain a block of type \"generic hybrid basic event\". The task of this block is to verify the status of the generic hybrid basic event that is in race condition against all the other hybrid basic events and the regular basic events.