- Change the fixed-step sample time in the Simulink model to a smaller value, such as 0.001 seconds. This will ensure that the delays introduced are incorporated accurately.
- Adjust your delay logic to work with the new sample time. Since the delay logic only takes integer numbers of samples, "Discrete-Time Integrator" block or a counter that will keep track of the number of samples corresponding to the desired delay in milliseconds can be used.
- Now to ensure the correct timing for the test scenario, introduce a counter or a timer in the model that will keep the track of the number of seconds elapsed. This counter will be incremented by 1 every millisecond (based on the new sample time).
- Connect the counter or timer output to the signal editor block to control the timing of the input signal changes.
How to implement millisecond delays in Simulink model while using signal editor?
13 ビュー (過去 30 日間)
古いコメントを表示
I have currently built a Simulink model and used signal editor to inject signals in a time sequence to confirm my expected logic operation.
During this I had the Solver set for Fixed step with a fixed-step sample time of 1.0.
This worked fine as the signals from the signal editor changed every second.
The problem I have now, is that I would like to introduce some delay logic in my model which includes delays from 50 to 100 milliseconds.
The delay logic uses samples, but only takes integer numbers.
I can reduce fixed-step sample time, however this is causing problems with my test scenario which is given in seconds as mentioned.
How could I go about showing the correct timing on the scope output from my test scenario where each of the inputs change every second, whilst implementing my delay logic which is in milliseconds?
0 件のコメント
回答 (1 件)
arushi
2024 年 8 月 21 日 3:29
Hi Daniel
I understand that you are trying to implement millisecond delays in Simulink Model while using the signal editor. To accurately achieve this please try to follow these steps :-
I hope it helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Sources についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!