diff --git a/embedded_c_book/Self_Checking/copy.tex b/embedded_c_book/Self_Checking/copy.tex index b5a9937..8523181 100644 --- a/embedded_c_book/Self_Checking/copy.tex +++ b/embedded_c_book/Self_Checking/copy.tex @@ -1,31 +1,49 @@ +\section{Variables Bounds checks} -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex -copy.tex +Variables read are often expected to fall within a certain range. +A voltage reading for instance might be expected to be, say 2.5V. +It may be necessary to check this periodically. +Because of niose and acceptable drift factors of components as they age +expecting it to read exactly 2.5V would be impractical, and would +probably cause a nuisance failure at some time in the future. +The solution to this is to apply a range, or a plus minus acceptable value. + +$$ diff = signal - expected $$ + +The absolute value of this difference can be used and compared to +the acceptable range. + +The C ABS macro is useful for this. + +\begin{verbatim} + #define ABS(x) if (x > 0) : (x) : (-x) +\end{verbatim} + +Care must be taken however when passing parameters. + +For instance this may look acceptable in C + +\begin{verbatim} + if (ABS(signal - expected) > THRESHOLD ) + raise_error(); +\end{verbatim} + +It expands to + +\begin{verbatim} + if ( signal - expected ? (signal - expected) : -(signal - expected) > THRESHOLD ) + raise_error(); +\end{verbatim} + +What ths has done is put \textbf{-(signal - expected) > THRESHOLD} as the final argument to the macro. + +The C operator greater than, $>$, binds higher than than $?:$ so the results you will get will +not be what you expect. The correct way to perform put the ABS call in brackets. + +\begin{verbatim} + if ( (ABS(signal - expected)) > THRESHOLD ) + raise_error(); +\end{verbatim} \ No newline at end of file diff --git a/embedded_c_book/book.tex b/embedded_c_book/book.tex index bad09bc..c7879d9 100644 --- a/embedded_c_book/book.tex +++ b/embedded_c_book/book.tex @@ -73,8 +73,10 @@ %\typeout{>>--------------------->> introduction} \chapter{Introduction} \input{CH1_introduction/copy} + \chapter{Self Checking} \input{Self_Checking/copy} + \chapter{Monitors and instrument loops} \input{Monitors_intrument_loops/copy} \chapter{Binary Scaling} diff --git a/papers/JOURNAL_fmea_sw_hw/sw_hw_fmea.tex b/papers/JOURNAL_fmea_sw_hw/sw_hw_fmea.tex index 974cabd..5c99f35 100644 --- a/papers/JOURNAL_fmea_sw_hw/sw_hw_fmea.tex +++ b/papers/JOURNAL_fmea_sw_hw/sw_hw_fmea.tex @@ -413,7 +413,7 @@ For instance should the signal path be followed, with all components encountere \paragraph{Exhaustive Single Failure FMEA.} %\fmmdglossXFMEA % -To XFMEA, every possible interaction +To perform XFMEA, every possible interaction of a failure mode with all other components in a system would have to be examined. % Or in other words, all possible failure scenarios considered. @@ -449,14 +449,14 @@ double failure scenarios (for burner lock-out scenarios).} Where $RD_{double}$ is the reasoning~distance for double failure scenarios: \begin{equation} \label{eqn:fmea_double} - RD_{double} = N.(N-1).(N-2).f . % \\ + RD_{double} = N.(N-1).(N-2).{f}^{2}% \\ %(N^2 - N).f \end{equation} % For a theoretical system with 100 components and a fixed 3 failure modes each, this gives reasoning distance of -$100 \times 99 \times 98 \times 3 = 2,910,600$. % failure mode scenarios. +$100 \times 99 \times 98 \times 9 = 8,731,800 $. % failure mode scenarios. % -In practise there is an additional complication here, that of +In practise there is an additional complication; that of the circuit topology changes that {\fms} can cause. \paragraph{Reliance on experts for meaningful FMEA Analysis.}