### CMP – Comparator with hysteresis

Block SymbolLicensing group: STANDARD

Function Description
The CMP block compares the inputs u1 and u2 with the hysteresis h as follows:

$\begin{array}{rcll}{Y}_{-1}& =& 0,& \text{}\\ {Y}_{k}& =& hyst\left({e}_{k}\right),\phantom{\rule{1em}{0ex}}k=0,1,2,\dots & \text{}\end{array}$

where

$\begin{array}{rcll}{e}_{k}=u{1}_{k}-u{2}_{k}& & & \text{}\end{array}$

and

The indexed variables refer to the values of the corresponding signal in the cycle defined by the index, i.e. ${Y}_{k-1}$ denotes the value of output in the previous cycle/step. The value ${Y}_{-1}$ is used only once when the block is initialized ($k=0$) and the difference of the input signals ${e}_{k}$ is within the hysteresis limits.

Inputs

 hys Hysteresis  $\odot$0.5 double