Eng.Salwa1
Newbie level 4
Hello everyone
I m trying to detect sag,swell and interruption using the user defined function block.
I am able to detect sag ,swell but the only problem i am facing is with the interruption.
As you can see from the figure, the first subplot is a filtered sine wave (Lowpass filter Fn=8) when there is an interruption my script doesnt understand it is an interruption so when filtered sinewave starts to gradually decrease , my sag detector interprets this decline as a sag. How can i modify it so it would only read interruption?
Ts=1e-6
Sag detector script
Interruption detector
Thank you
https://obrazki.elektroda.pl/6504222800_1458145147.jpg
I m trying to detect sag,swell and interruption using the user defined function block.
I am able to detect sag ,swell but the only problem i am facing is with the interruption.
As you can see from the figure, the first subplot is a filtered sine wave (Lowpass filter Fn=8) when there is an interruption my script doesnt understand it is an interruption so when filtered sinewave starts to gradually decrease , my sag detector interprets this decline as a sag. How can i modify it so it would only read interruption?
Ts=1e-6
Sag detector script
Code:
function y = fcn(u)
if (u<=293) && (u>=260.5);
y=0.5;
elseif (u<260.5) && (u>=228);
y=1;
elseif (u<228) && (u>=195.5);
y=1.5;
elseif (u<195.5) && (u>=163);
y=2;
elseif (u<163) && (u>=130.5);
y=2.5;
elseif (u<130.5) && (u>=98);
y=3;
elseif (u<98) && (u>=33);
y=3.5;
else
y=0;
end
Interruption detector
Code:
function y = fcn(u)
if abs(u<=0.5);
y=1;
else
y=0;
end
Thank you
https://obrazki.elektroda.pl/6504222800_1458145147.jpg
Last edited by a moderator: