- Create a new Stateflow chart by right-clicking on the Simulink canvas and selecting "Add->Stateflow chart".
- Create two input ports for your input signal and your delay time.
- Create two output ports for your output signal and your timer value.
- Add a state in your Stateflow chart to represent the initial state of your system. This state will be active when the simulation starts.
- 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.
- 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.
- Add a transition from the falling edge state back to the rising edge state.
- Connect the input and output ports of your Stateflow chart to the appropriate blocks in your Simulink model.
- Set the parameters of the Stateflow chart to match your system requirements.
TurnOffDelay delays a falling edge of the input signal on Simulink
조회 수: 18 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
Meet
2023년 4월 4일
You can implement the function you described using a Stateflow chart in Simulink. Here are the steps to do so:
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!