Documentation about Sliding Mode Observer says that "Z" is calculated as:
Z=K*sign(Iest-I)
and that should be a bang-bang control.
However, the code look like this:
_iq E0 =_IQ(0.5);
if (_IQabs(v.IalphaError) < E0) \
v.Zalpha = _IQmpy(v.Kslide,_IQmpy(v.IalphaError,invE0)); \
else if (v.IalphaError >= E0) \
v.Zalpha = v.Kslide; \
else if (v.IalphaError <= -E0) \
v.Zalpha = -v.Kslide;
So, if difference between estimated and measured current is less than 0.5, this behaves as linear multiplication, and not like bang-bang (sign operator).
I tried to plot Z on scope, and expected to see -K/+K steps, but I got continuous sine waves...
What am I missing here?