### S1OF2 – One of two analog signals selector

Function Description
The S1OF2 block assesses the validity of two input signals u1 and u2 separately. The validation method is equal to the method used in the SAI block. If the signal u1 (or u2) is marked invalid, the output E1 (or E2) is set to on and the error code is sent to the iE1 (or iE2) output. The S1OF2 block also evaluates the difference between the two input signals. The internal flag D is set to on if the differences $|\mathtt{\text{u1}}-\mathtt{\text{u2}}|$ in the last nd samples exceed the given limit, which is given by the following inequation

$|\mathtt{\text{u1}}-\mathtt{\text{u2}}|>\mathtt{\text{pdev}}\frac{\mathtt{\text{vmax}}-\mathtt{\text{vmin}}}{100},$

where vmin and vmax are the minimal and maximal limits of the inputs u1 and u2 and pdev is the allowed percentage difference with respect to the overall range of the input signals. The value of the output y depends on the validity of the input signals (flags E1 and E2) and the internal difference flag D as follows:

(i) If $\mathtt{\text{E1}}=\mathtt{\text{off}}$ and $\mathtt{\text{E2}}=\mathtt{\text{off}}$ and $\mathtt{\text{D}}=\mathtt{\text{off}}$
, then the output y depends on the mode parameter:
$\mathtt{\text{y}}=\left\{\begin{array}{cc}\frac{\mathtt{\text{u1}}+\mathtt{\text{u2}}}{2},\hfill & for\mathtt{\text{mode}}=1,\hfill \\ min\left(\mathtt{\text{u1}},\mathtt{\text{u2}}\right),\hfill & for\mathtt{\text{mode}}=2,\hfill \\ max\left(\mathtt{\text{u1}},\mathtt{\text{u2}}\right),\hfill & for\mathtt{\text{mode}}=3,\hfill \\ \hfill \end{array}\right\$

and the output E is set to off unless set to on earlier.

(ii) If $\mathtt{\text{E1}}=\mathtt{\text{off}}$ and $\mathtt{\text{E2}}=\mathtt{\text{off}}$ and $\mathtt{\text{D}}=\mathtt{\text{on}}$
, then $\mathtt{\text{y}}=\mathtt{\text{sv}}$ and $\mathtt{\text{E}}=\mathtt{\text{on}}$.
(iii) If $\mathtt{\text{E1}}=\mathtt{\text{on}}$ and $\mathtt{\text{E2}}=\mathtt{\text{off}}$ ($\mathtt{\text{E1}}=\mathtt{\text{off}}$ and $\mathtt{\text{E2}}=\mathtt{\text{on}}$)
, then $\mathtt{\text{y}}=\mathtt{\text{u2}}$ ($\mathtt{\text{y}}=\mathtt{\text{u1}}$) and the output E is set to off unless set to on earlier.
(iv) If $\mathtt{\text{E1}}=\mathtt{\text{on}}$ and $\mathtt{\text{E2}}=\mathtt{\text{on}}$
, then $\mathtt{\text{y}}=\mathtt{\text{sv}}$ and $\mathtt{\text{E}}=\mathtt{\text{on}}$.

The input R resets the inner error flags FlF4 (see the SAI block) and the D flag. For the input R set permanently to on, the invalidity indicator E1 (E2) is set to on for only one cycle period whenever some invalidity condition is fulfilled. On the other hand, for $\mathtt{\text{R}}=0$, the output E1 (E2) is set to on and remains true until the reset (Roff$\to$on). A similar rule holds for the E output. For the input R set permanently to on, the E output is set to on for only one cycle period whenever a rising edge occurs in the internal D flag ($\mathtt{\text{D}}=\mathtt{\text{off}}\to \mathtt{\text{on}}$). On the other hand, for $\mathtt{\text{R}}=0$, the output E is set to on and remains true until the reset (rising edge Roff$\to$on). The output W is set to on only in the (iii) or (iv) cases, i.e. at least one input signal is invalid.

Inputs

 u1 First analog input of the block double u2 Second analog input of the block double sv Substitute value for an error case, i.e. $\mathtt{\text{E}}=\mathtt{\text{on}}$ double HF1 Hardware error flag for signal u1 bool off .. The input module of the signal works normally on ... Hardware error of the input module occurred HF2 Hardware error flag for signal u2 bool off .. The input module of the signal works normally on ... Hardware error of the input module occurred R Reset inner error flags of the input signals u1 and u2 bool

Outputs

 y Analog output of the block double E Output signal invalidity indicator bool off .. Signal is valid on ... Signal is invalid E1 Invalidity indicator for input u1 bool off .. Signal is valid on ... Signal is invalid, $\mathtt{\text{y}}=\mathtt{\text{u2}}$ E2 Invalidity indicator for input u2 bool off .. Signal is valid on ... Signal is invalid, $\mathtt{\text{y}}=\mathtt{\text{u1}}$ iE1 Reason of input u1 invalidity long 0 .... Signal valid 1 .... Signal out of range 2 .... Signal varies too little 3 .... Signal varies too little and signal out of range 4 .... Signal varies too much 5 .... Signal varies too much and signal out of range 6 .... Signal varies too much and too little 7 .... Signal varies too much and too little and signal out of range 8 .... Hardware error iE2 Reason of input u2 invalidity, see the iE1 output long W Warning flag (invalid input signal) bool off .. Both input signals u1 and u2 are valid on ... At least one of the input signals is invalid

Parameters

 nb Number of samples which are not included in the validity assessment of the signals u1 and u2 after initialization of the block  $\odot$10 long nc Number of samples for invariability testing (see the SAI block, condition F2)  $\odot$10 long nbits Number of A/D converter bits (source of the signals u1 and u2)  $\odot$12 long nr Number of samples for variability testing (see the SAI block, condition F3)  $\odot$10 long prate Maximum allowed percentage change of the input u1 (u2) within the last nr samples (with respect to the overall range of the input signals $\mathtt{\text{vmax}}-\mathtt{\text{vmin}}$, see the SAI block)  $\odot$10.0 double nv Number of samples for out-of-range testing (see the SAI block, condition F4)  $\odot$1 long vmin Lower limit for the input signals u1 and u2  $\odot$-1.0 double vmax Upper limit for the input signals u1 and u2  $\odot$1.0 double nd Number of samples for deviation testing (inner flag D; D is always off for $\mathtt{\text{nd}}=0$)  $\odot$5 long pdev Maximum allowed percentage deviation of the inputs u1 and u2 with respect to the overall range of the input signals $\mathtt{\text{vmax}}-\mathtt{\text{vmin}}$  $\odot$10.0 double mode Defines how to compute the output signal y when both input signals are valid ($\mathtt{\text{E1}}=\mathtt{\text{off}}$, $\mathtt{\text{E2}}=\mathtt{\text{off}}$ and $\mathtt{\text{D}}=\mathtt{\text{off}}$)  $\odot$1 long 1 .... Average, $\mathtt{\text{y}}=\frac{\mathtt{\text{u1}}+\mathtt{\text{u2}}}{2}$ 2 .... Minimum, $\mathtt{\text{y}}=min\left(\mathtt{\text{u1}},\mathtt{\text{u2}}\right)$ 3 .... Maximum, $\mathtt{\text{y}}=max\left(\mathtt{\text{u1}},\mathtt{\text{u2}}\right)$

2019 © REX Controls s.r.o., www.rexygen.com