Logic help for fault detection

6 views (last 30 days)
Asmaa Hassanein
Asmaa Hassanein on 13 Aug 2023
Answered: Tejas on 21 Oct 2024
Dear all,
kindly i need the help regarding an issue i am encountring. the issue basically is that i belt a fault detection logic which if the value of any current phase is greater than a certain value the comparsion logic will give one starting from the instant the fault is happenning and then zero at the fault clearing time.
what i need the help in it is that i want to make a certain logic that sees if the signal which is the output of the fault detection logic has changed to zero i want the logic to be able to make this signal holding the value 1 from the time zero to the end of the simulation time and if the signal is zero all the time (meaning there is no fault at this current phase), then it should keep it unchaged.
i want this logic to help me get the value zero all the time meanning there is no fault and i want the same logic to give me all the time when a fault occurs so that i have one and zero to be send the next phase to classify the type of fault.
your time and effort are higly appreciated
attached the signal when there is no fault and the signal when there is a fault at a certain time
i want the no fault signal to be the same and i want the fault signal to be one but from the instant zero

Answers (1)

Tejas
Tejas on 21 Oct 2024
Hello Asmaa,
It seems the question is about finding a way to ensure that if there is a fault in the input signal, the output remains 1 throughout the sample time. Conversely, if there is no fault, the output should remain 0 throughout the sample time.
Here is an example on how this can be achieved:
  • Add a 'Constant' block that stores a vector as the input signal.
  • Use a 'Relational Operator' block to check if any input value crosses a certain threshold.
  • Utilize a 'MATLAB Function' block to set the output signal to 1 if any fault occurs, and 0 otherwise. For more information on this block, refer to this documentation: https://www.mathworks.com/help/simulink/slref/matlabfunction.html .
function y = fcn(u)
y = 0;
for itr = 1:length(u)
if u(itr) == 1
y = 1;
end
end
end
Here is a screenshot of the example Simulink model:

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!