/* Function: mdlInitializeSampleTimes ========================================= * Abstract: * Discrete sample time of 0.1 seconds and specify that we are doing * function-call's on the 1st and 2nd elements of the 1st output port. */ static void mdlInitializeSampleTimes(SimStruct *S) { ssSetSampleTime(S, 0, 0.1); ssSetOffsetTime(S, 0, 0.0); ssSetCallSystemOutput(S,0); /* call on first element */ ssSetCallSystemOutput(S,1); /* call on second element */ ssSetModelReferenceSampleTimeDefaultInheritance(S); }
/* Function: mdlInitializeSampleTimes ========================================= * Abstract: * This function is used to specify the sample time(s) for your * S-function. You must register the same number of sample times as * specified in ssSetNumSampleTimes. */ static void mdlInitializeSampleTimes(SimStruct *S) { int idx; // Just set this to avoid Simulink whinging ssSetSampleTime(S, 0, INHERITED_SAMPLE_TIME); ssSetOffsetTime(S, 0, 0.0); /* Outport 0 is a function call trigger */ ssSetCallSystemOutput(S,0); }