- Initial condition as Input port
- Enable port
- External reset port
check if input data in simulink changes by a certain specific value
조회 수: 5 (최근 30일)
이전 댓글 표시
I am working in Simulink where I have a few discharge profiles as input data. The input data varies randomly like a drive cycle. say my starting value is 70. If I want to now check when the value changes to 60 and trigger another system. But this trigger should happen every interval of change in value by 10. So first trigger happens when the value reaches 60, next happens at 50 and so on. I tried creating a Matlab function block using stored memory read write blocks to store these value but not able figure out how to actually make this work.
Looking for help here. thanks
댓글 수: 0
답변 (1개)
Andy Bartlett
2022년 4월 19일
Hi Aadithya,
Some suggestions.
Study and experiment with the full set of capabilities of the Delay block including
Put a copy of Detect Rise Positive block in your model. Then "Look Under Mask" by selecting the block and doing Control-U. This should give you some initial ideas on how to achieve your solution.
Your solution will need to be more complicated than Detect Rise Positive. You'll probably want to capture the last input value that produced a trigger using the Delay block. Then you'll compare if the current input is different from the last trigger by some threshold. If a change of 10 or more is what you want for a trigger, then that should be fairly straightforward. If you want the trigger condition to be about crossing exact multiples of 10, then that will require a little more manipulation such as rounding.
Pay special attention to what you want to happen at the very first time step, and after a reset. Resets can occur if your block is inside a resetable subsystem. Should your block always output true at first time step and after a reset, or? What value should be stored in the unit delay at first time step and after a reset? These are detailed design decisions you'll need to make.
Andy
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Event Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!