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

4 visualizaciones (últimos 30 días)
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

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 9 de Mayo de 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.

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Productos


Versión

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by