How do I start a counter based on a threshold value in Simulink?
Show older comments
I am implementing some fault detection logic, i.e i am comparing some incoming digital data with the threshold value using comparator in Simulink. When incoming data crosses threshold value, a counter has to start. If that counter value is greater than 20 mili sec then counter has to send a step signal until the comparison using comparator is done.
How do I do this?
2 Comments
Todd Flanagan
on 27 May 2011
Could you give us a screenshot of what you have now?
abdelkader mahmoudi
on 4 Nov 2020
hello if you get the solution please tell usabout it i'm really need it
Accepted Answer
More Answers (1)
Fangjun Jiang
on 31 May 2011
2 votes
It sounds like that you don't need to re-set your integrator. Let's say your input signal is greater than the threshold for 10 mili sec, then goes below the threshold for 20 mili sec, and then greater than the threshold for 30 mili sec, what is your expected output?
1. You want the output to increase from 0 to 0.01 for the first 10 mili sec, then stay at 0.01 for 20 mili sec time period, then goes from 0.01 to 0.04 for the rest of 30 mili sec time period. You don't need the re-setting. Disable the re-setting option of the integrator block.
2. You want the output to increase from 0 to 0.01 for the first 10 mili sec, then re-set to 0 for 20 mili sec time period, then goes from 0 to 0.03 for the rest of 30 mili sec time period. You need the re-setting. Use the opposite of the comparator block output to re-set the integrator block.
4 Comments
harish bharadwaj
on 6 Jun 2011
Fangjun Jiang
on 6 Jun 2011
Please show a screenshot of your Simulink model.
harish bharadwaj
on 7 Jun 2011
Walter Roberson
on 7 Jun 2011
For locations you can upload to, please see
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
Categories
Find more on General Applications in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!