How can I implement a timer interruption in Simulink with a variable time?

2 visualizzazioni (ultimi 30 giorni)
Hi! I have been working on this model which consists on a timer that sets and resets a variable. The C Matlab function on the image gets a variable (time2cut). I need that, when time2cut is greater than 0, the output sets to 1, and after the time2cut value time is passed (for example, if time2cut is 20, the timer will last 20 miliseconds), the output sets to 0 again. I have tried it with C libraries such as #include <time.h> and #include <pthread.h>, but matlab seems to not support it as results are not as expected. How could I implement this timer in simulink, via simulink blocks matlab functions or s-functions? Thank you.

Risposte (0)

Categorie

Scopri di più su Simulink Coder in Help Center e File Exchange

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by