Multiple of Inherited Sample Time

  • Follow


I have been using this syntax in my S-Function that I found somewhere in one of the examples:
static void mdlInitializeSampleTimes(SimStruct *S)
{
    if (mxGetScalar(ssGetSFcnParam(S, 0)) == -1.0) {
        ssSetSampleTime(S, 0, INHERITED_SAMPLE_TIME);
        ssSetOffsetTime(S, 0, FIXED_IN_MINOR_STEP_OFFSET);
    } else {
        ssSetSampleTime(S, 0, mxGetScalar(ssGetSFcnParam(S, 0)));
        ssSetOffsetTime(S, 0, 0.0);
    }
}

However what I am looking for is a way to take the parameter (Let's say it contains a 2) and have my Sample time be 2 time the Inherited Sample Time.  Is this possible?  I would like to have a single rate for the simulation but have certain blocks go slower but not hardcoded.  The above seems to put the sample time period at 2 seconds instead of 2 times the inherited sample time.

Thanks,
Matt
0
Reply Matthew 3/5/2010 1:45:23 PM


0 Replies
305 Views

(page loaded in 0.015 seconds)

Similiar Articles:













7/25/2012 12:23:15 AM


Reply: