S function not accepting Input port Sample time
All,
I am using a S function for a counter logic which input sample time is converted by Rate transistion block to 20ms (original is 1 ms). When I run this, counter not incrementing for 20ms..
I have this below code snippet written for this in S function.. Any more functions to be added to enable my S function to get the correct Input Sample time?
Any inputs to crack on will be appreciated.
/*************************************************************************************************/
static void mdlInitializeSampleTimes(SimStruct *S)
{
ssSetSampleTime(S, 0, INHERITED_SAMPLE_TIME);
ssSetInputPortSampleTime(S,0,INHERITED_SAMPLE_TIME);
ssSetOffsetTime(S, 0, 0.0);
}
#define MDL_SET_INPUT_PORT_SAMPLE_TIME
static void mdlSetInputPortSampleTime(SimStruct *S,
int_T portIdx,
real_T sampleTime,
real_T offsetTime)
{
ssSetInputPortSampleTime(S,portIdx,sampleTime);
}
/*************************************************************************************************/All,
I am using a S function for a counter logic which input sample time is converted by Rate transistion block to 20ms (original is 1 ms). When I run this, counter not incrementing for 20ms..
I have this below code snippet written for this in S function.. Any more functions to be added to enable my S function to get the correct Input Sample time?
Any inputs to crack on will be appreciated.
/*************************************************************************************************/
static void mdlInitializeSampleTimes(SimStruct *S)
{
ssSetSampleTime(S, 0, INHERITED_SAMPLE_TIME);
ssSetInputPortSampleTime(S,0,INHERITED_SAMPLE_TIME);
ssSetOffsetTime(S, 0, 0.0);
}
#define MDL_SET_INPUT_PORT_SAMPLE_TIME
static void mdlSetInputPortSampleTime(SimStruct *S,
int_T portIdx,
real_T sampleTime,
real_T offsetTime)
{
ssSetInputPortSampleTime(S,portIdx,sampleTime);
}
/*************************************************************************************************/ All,
I am using a S function for a counter logic which input sample time is converted by Rate transistion block to 20ms (original is 1 ms). When I run this, counter not incrementing for 20ms..
I have this below code snippet written for this in S function.. Any more functions to be added to enable my S function to get the correct Input Sample time?
Any inputs to crack on will be appreciated.
/*************************************************************************************************/
static void mdlInitializeSampleTimes(SimStruct *S)
{
ssSetSampleTime(S, 0, INHERITED_SAMPLE_TIME);
ssSetInputPortSampleTime(S,0,INHERITED_SAMPLE_TIME);
ssSetOffsetTime(S, 0, 0.0);
}
#define MDL_SET_INPUT_PORT_SAMPLE_TIME
static void mdlSetInputPortSampleTime(SimStruct *S,
int_T portIdx,
real_T sampleTime,
real_T offsetTime)
{
ssSetInputPortSampleTime(S,portIdx,sampleTime);
}
/*************************************************************************************************/ s-function MATLAB Answers — New Questions