Azzera filtri
Azzera filtri

S-function sampling time, is it possible to use several sampling time ?

1 visualizzazione (ultimi 30 giorni)
Hi all,
I'm working with a C S-function. I want to call two different function at fixe frequenties. One every 125.06 µs and one at 250µs.
I have tried setting several sampling times :
ssSetSampleTime(S, 0, CONTINUOUS_SAMPLE_TIME);
ssSetOffsetTime(S, 0, 0.0);
ssSetSampleTime(S, 1 , 0.00012506 );
ssSetOffsetTime(S, 1 , 0.0);
ssSetSampleTime(S, 2 , 0.000250);
ssSetOffsetTime(S, 2 , 0.0);
And to call the functions I've been using:
if (ssIsSampleHit(S , 1, tid ))
function1()
if (ssIsSampleHit(S , 2, tid ))
function2()
But this does work at all, has someone got any idea how I can do ? The ssIsSampleHit doesn't seen to detect the right times.
Thank you,
George

Risposta accettata

Kaustubha Govind
Kaustubha Govind il 29 Ago 2012
I don't have much experience with multi-rate S-functions, but I thought I would recommend that you look at the demo sfcndemo_sfun_multirate.mdl. Just type the model name at the MATLAB prompt to open it up:
>> sfcndemo_sfun_multirate
Hopefully the example will give you some tips about how to use ssIsSampleHit.

Più risposte (1)

George
George il 29 Ago 2012
Thank you. My example ahead dose actually work.

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by