Lamp intensity gradually decreases - stateflow logic

5 visualizaciones (últimos 30 días)
Aarti
Aarti el 21 de En. de 2025
Respondida: Kanishk el 24 de En. de 2025
Switch ON - Lamp ON, Switch OFF - Lamp intensity decreases upto 30sec after 30sec lamp OFF.: stateflow logic

Respuestas (1)

Kanishk
Kanishk el 24 de En. de 2025
Hi @Aarti,
To create a stateflow logic which decreases the Lamp intensity gradually you can use the "after" function in stateflow to execute a state after some elapsed time.
I have designed this stateflow chart which switches state based on the switch "s" to three states:
  • LampOff
  • LampOn
  • LampDimming
The Lamp Dimming state gradually decreases the lamp intensity each second and the state changes when intensity crosses certain threshold.
This is the output of Lamp intensity signal from the stateflow chart.
To increase the smoothness of decay you have decrease the delay in the "after" function and also decrease the step size in the fixed step solver. I have also attached the Simulink model for better understanding.
You can learn more about "after" function by accessing the official MathWorks Documentation by executing the following command.
web(fullfile(docroot, 'stateflow/ref/after.html'))

Categorías

Más información sobre Decision Logic en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by