Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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

Respuesta aceptada

Kaustubha Govind
Kaustubha Govind el 29 de Ag. de 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.

Más respuestas (1)

George
George el 29 de Ag. de 2012
Thank you. My example ahead dose actually work.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by