Code part
static void mdlInitializeSizes(SimStruct *S)
{
ssSetNumSFcnParams(S, 0);
if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S))
{ }
ssSetNumContStates(S, 18);
ssSetNumDiscStates(S, 0);
if (!ssSetNumInputPorts(S, 4)) return;
ssSetInputPortWidth(S, 0, 1);
ssSetInputPortWidth(S, 1, 1);
ssSetInputPortWidth(S, 2, 1);
ssSetInputPortWidth(S, 3, 1);
ssSetInputPortDirectFeedThrough(S, 0, 1);
if (!ssSetNumOutputPorts(S, 18)) return;
ssSetOutputPortWidth(S, 0, 1);
ssSetOutputPortWidth(S, 1, 1);
ssSetOutputPortWidth(S, 2, 1);
ssSetOutputPortWidth(S, 3, 1);
ssSetOutputPortWidth(S, 4, 1);
ssSetOutputPortWidth(S, 5, 1);
ssSetOutputPortWidth(S, 6, 1);
ssSetOutputPortWidth(S, 7, 1);
ssSetOutputPortWidth(S, 8, 1);
ssSetOutputPortWidth(S, 9, 1);
ssSetOutputPortWidth(S, 10, 1);
ssSetOutputPortWidth(S, 11, 1);
ssSetOutputPortWidth(S, 12, 1);
ssSetOutputPortWidth(S, 13, 1);
ssSetOutputPortWidth(S, 14, 1);
ssSetOutputPortWidth(S, 15, 1);
ssSetOutputPortWidth(S, 16, 1);
ssSetOutputPortWidth(S, 17, 1);
ssSetNumSampleTimes(S, 1);
ssSetNumRWork(S, 0);
ssSetNumIWork(S, 0);
ssSetNumPWork(S, 0);
ssSetNumModes(S, 0);
ssSetNumNonsampledZCs(S, 0);
ssSetSimStateCompliance(S, USE_DEFAULT_SIM_STATE);
ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE);
}
static void mdlInitializeSampleTimes(SimStruct *S)
{
ssSetSampleTime(S, 0, CONTINUOUS_SAMPLE_TIME);
ssSetOffsetTime(S, 0, 0.0);
ssSetModelReferenceSampleTimeDefaultInheritance(S);
}
#define MDL_INITIALIZE_CONDITIONS
static void mdlInitializeConditions(SimStruct *S)
{
real_T *x0 = ssGetContStates(S);
int_T lp;
for (lp=0;lp<2;lp++) {
*x0++=0.0;
}
}
static void mdlOutputs(SimStruct *S, int_T tid)
{
real_T *y = ssGetOutputPortRealSignal(S,0);
real_T *x = ssGetContStates(S);
InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S,0);
UNUSED_ARG(tid);
y[0]=x[0];
y[1]=x[1];
y[2]=x[2];
y[3]=x[3];
y[4]=x[4];
y[5]=x[5];
y[6]=x[6];
y[7]=x[7];
y[8]=x[8];
y[9]=x[9];
y[10]=x[10];
y[11]=x[11];
y[12]=x[12];
y[13]=x[13];
y[14]=x[14];
y[15]=x[15];
y[16]=x[16];
y[17]=x[17];
}
#define MDL_DERIVATIVES
static void mdlDerivatives(SimStruct *S)
{
real_T *dx = ssGetdX(S);
real_T *x = ssGetContStates(S);
InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S,0);
time_T dt = ssGetFixedStepSize(S);
....
}