Effacer les filtres
Effacer les filtres

TurnOffDelay delays a falling edge of the input signal on Simulink

21 vues (au cours des 30 derniers jours)
Giulia
Giulia le 28 Mar 2023
Commenté : Giulia le 4 Avr 2023
Hello,
I'm working on a simulink model and I have to compute a function which basically delay the falling edge of my input signal.
This is what the function have to do :
  • if signal switch from true to false, a timer is initialised with a given delay Time.
  • On being false the timer is decremented by the given sampling time.
The output should be:
  • False if the input signal is false and timer <0.
  • Otherwise is set to true.
Thanks in advace.

Réponses (1)

Meet
Meet le 4 Avr 2023
You can implement the function you described using a Stateflow chart in Simulink. Here are the steps to do so:
  1. Create a new Stateflow chart by right-clicking on the Simulink canvas and selecting "Add->Stateflow chart".
  2. Create two input ports for your input signal and your delay time.
  3. Create two output ports for your output signal and your timer value.
  4. Add a state in your Stateflow chart to represent the initial state of your system. This state will be active when the simulation starts.
  5. Add a transition from the initial state to a state that will handle the rising edge of your input signal. In this state, set the timer value to the delay time.
  6. Add a transition from the rising edge state to a state that will handle the falling edge of your input signal. In this state, check if the timer value is greater than or equal to zero. If it is, output true and decrement the timer value by the sampling time. If it is not, output false.
  7. Add a transition from the falling edge state back to the rising edge state.
  8. Connect the input and output ports of your Stateflow chart to the appropriate blocks in your Simulink model.
  9. Set the parameters of the Stateflow chart to match your system requirements.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by