How to Hold the sensor values for 10s and update the output value (boolean) using simulink

1 view (last 30 days)
I receive value from temperature sensor continously at 100ms step size.
If the value from sensor is same for continous 10s, then the output value should be 1
If the value from sensor is not same, then the output value should be 0.
Can anyone help me on this with the simulink design or atleast the blocks to be used to hold the values for 10s

Answers (1)

Fangjun Jiang
Fangjun Jiang on 9 May 2023
Use a Unit Delay block to store the previous value. I assume that is what you will use to compare "If the value from sensor is same".
The comparison will generate a TRUE or FALSE signal. Feed this signal to an Integrator block, which has its Reset option enabled. If the comparison output is FALSE, use it to reset the integrator. The comparison output is also always feed into the input of the integrator. If the comparison is always TRUE, the output of the integrator will keep increasing. Compare it with 10, you will get the desired output.

Categories

Find more on Simulink in Help Center and File Exchange

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!