/* Function: mdlInitializeSizes =============================================== * Abstract: * Setup sizes of the various vectors. */ static void mdlInitializeSizes(SimStruct *S) { DECL_AND_INIT_DIMSINFO(inputDimsInfo); DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) { return; /* Parameter mismatch will be reported by Simulink */ } ssSetNumContStates(S, NUM_CONT_STATES); ssSetNumDiscStates(S, NUM_DISC_STATES); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; /*Input Port 0 */ /* Register xref_bus datatype for Input port 0 */ #if defined(MATLAB_MEX_FILE) if (ssGetSimMode(S) != SS_SIMMODE_SIZES_CALL_ONLY) { DTypeId dataTypeIdReg; ssRegisterTypeFromNamedObject(S, "xref_bus", &dataTypeIdReg); if(dataTypeIdReg == INVALID_DTYPE_ID) return; ssSetInputPortDataType(S,0, dataTypeIdReg); } #endif ssSetInputPortWidth(S, 0, INPUT_0_WIDTH); ssSetInputPortComplexSignal(S, 0, INPUT_0_COMPLEX); ssSetInputPortDirectFeedThrough(S, 0, INPUT_0_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 0, 1); /*direct input signal access*/ ssSetBusInputAsStruct(S, 0,IN_0_BUS_BASED); ssSetInputPortBusMode(S, 0, SL_BUS_MODE); /*Input Port 1 */ /* Register x_bus datatype for Input port 1 */ #if defined(MATLAB_MEX_FILE) if (ssGetSimMode(S) != SS_SIMMODE_SIZES_CALL_ONLY) { DTypeId dataTypeIdReg; ssRegisterTypeFromNamedObject(S, "x_bus", &dataTypeIdReg); if(dataTypeIdReg == INVALID_DTYPE_ID) return; ssSetInputPortDataType(S,1, dataTypeIdReg); } #endif ssSetInputPortWidth(S, 1, INPUT_1_WIDTH); ssSetInputPortComplexSignal(S, 1, INPUT_1_COMPLEX); ssSetInputPortDirectFeedThrough(S, 1, INPUT_1_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 1, 1); /*direct input signal access*/ ssSetBusInputAsStruct(S, 1,IN_1_BUS_BASED); ssSetInputPortBusMode(S, 1, SL_BUS_MODE); if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; /* Register u_bus datatype for Output port 0 */ #if defined(MATLAB_MEX_FILE) if (ssGetSimMode(S) != SS_SIMMODE_SIZES_CALL_ONLY) { DTypeId dataTypeIdReg; ssRegisterTypeFromNamedObject(S, "u_bus", &dataTypeIdReg); if(dataTypeIdReg == INVALID_DTYPE_ID) return; ssSetOutputPortDataType(S,0, dataTypeIdReg); } #endif ssSetBusOutputObjectName(S, 0, (void *) "u_bus"); ssSetOutputPortWidth(S, 0, OUTPUT_0_WIDTH); ssSetOutputPortComplexSignal(S, 0, OUTPUT_0_COMPLEX); ssSetBusOutputAsStruct(S, 0,OUT_0_BUS_BASED); ssSetOutputPortBusMode(S, 0, SL_BUS_MODE); if (ssRTWGenIsCodeGen(S)) { isSimulationTarget = GetRTWEnvironmentMode(S); if (isSimulationTarget==-1) { ssSetErrorStatus(S, " Unable to determine a valid code generation environment mode"); return; } isSimulationTarget |= ssRTWGenIsModelReferenceSimTarget(S); } /* Set the number of dworks */ if (!isDWorkPresent) { if (!ssSetNumDWork(S, 0)) return; } else { if (!ssSetNumDWork(S, 3)) return; } if (isDWorkPresent) { /* * Configure the dwork 0 (u0."BUS") */ #if defined(MATLAB_MEX_FILE) if (ssGetSimMode(S) != SS_SIMMODE_SIZES_CALL_ONLY) { DTypeId dataTypeIdReg; ssRegisterTypeFromNamedObject(S, "xref_bus", &dataTypeIdReg); if (dataTypeIdReg == INVALID_DTYPE_ID) return; ssSetDWorkDataType(S, 0, dataTypeIdReg); } #endif ssSetDWorkUsageType(S, 0, SS_DWORK_USED_AS_DWORK); ssSetDWorkName(S, 0, "u0BUS"); ssSetDWorkWidth(S, 0, DYNAMICALLY_SIZED); ssSetDWorkComplexSignal(S, 0, COMPLEX_NO); /* * Configure the dwork 1 (u1."BUS") */ #if defined(MATLAB_MEX_FILE) if (ssGetSimMode(S) != SS_SIMMODE_SIZES_CALL_ONLY) { DTypeId dataTypeIdReg; ssRegisterTypeFromNamedObject(S, "x_bus", &dataTypeIdReg); if (dataTypeIdReg == INVALID_DTYPE_ID) return; ssSetDWorkDataType(S, 1, dataTypeIdReg); } #endif ssSetDWorkUsageType(S, 1, SS_DWORK_USED_AS_DWORK); ssSetDWorkName(S, 1, "u1BUS"); ssSetDWorkWidth(S, 1, DYNAMICALLY_SIZED); ssSetDWorkComplexSignal(S, 1, COMPLEX_NO); /* * Configure the dwork 2 (y0BUS) */ #if defined(MATLAB_MEX_FILE) if (ssGetSimMode(S) != SS_SIMMODE_SIZES_CALL_ONLY) { DTypeId dataTypeIdReg; ssRegisterTypeFromNamedObject(S, "u_bus", &dataTypeIdReg); if (dataTypeIdReg == INVALID_DTYPE_ID) return; ssSetDWorkDataType(S, 2, dataTypeIdReg); } #endif ssSetDWorkUsageType(S, 2, SS_DWORK_USED_AS_DWORK); ssSetDWorkName(S, 2, "y0BUS"); ssSetDWorkWidth(S, 2, DYNAMICALLY_SIZED); ssSetDWorkComplexSignal(S, 2, COMPLEX_NO); } ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_USE_TLC_WITH_ACCELERATOR | SS_OPTION_WORKS_WITH_CODE_REUSE)); }
/* Function: mdlInitializeSizes =============================================== * Abstract: * Setup sizes of the various vectors. */ static void mdlInitializeSizes(SimStruct *S) { DECL_AND_INIT_DIMSINFO(inputDimsInfo); DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) { return; /* Parameter mismatch will be reported by Simulink */ } ssSetNumContStates(S, NUM_CONT_STATES); ssSetNumDiscStates(S, NUM_DISC_STATES); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; /*Input Port 0 */ ssSetInputPortWidth(S, 0, INPUT_0_WIDTH); /* */ ssSetInputPortDataType(S, 0, SS_UINT8); ssSetInputPortComplexSignal(S, 0, INPUT_0_COMPLEX); ssSetInputPortDirectFeedThrough(S, 0, INPUT_0_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 0, 1); /*direct input signal access*/ /*Input Port 1 */ ssSetInputPortWidth(S, 1, INPUT_1_WIDTH); ssSetInputPortDataType(S, 1, SS_UINT8); ssSetInputPortComplexSignal(S, 1, INPUT_1_COMPLEX); ssSetInputPortDirectFeedThrough(S, 1, INPUT_1_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 1, 1); /*direct input signal access*/ /*Input Port 2 */ ssSetInputPortWidth(S, 2, INPUT_2_WIDTH); /* */ ssSetInputPortDataType(S, 2, SS_UINT8); ssSetInputPortComplexSignal(S, 2, INPUT_2_COMPLEX); ssSetInputPortDirectFeedThrough(S, 2, INPUT_2_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 2, 1); /*direct input signal access*/ if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; /* Output Port 0 */ ssSetOutputPortWidth(S, 0, OUTPUT_0_WIDTH); ssSetOutputPortDataType(S, 0, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 0, OUTPUT_0_COMPLEX); /* Output Port 1 */ ssSetOutputPortWidth(S, 1, OUTPUT_1_WIDTH); ssSetOutputPortDataType(S, 1, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 1, OUTPUT_1_COMPLEX); ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); ssSetSimulinkVersionGeneratedIn(S, "8.4"); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_USE_TLC_WITH_ACCELERATOR | SS_OPTION_WORKS_WITH_CODE_REUSE)); }
/* Function: mdlInitializeSizes =============================================== * Abstract: * Setup sizes of the various vectors. */ static void mdlInitializeSizes(SimStruct *S) { DECL_AND_INIT_DIMSINFO(inputDimsInfo); DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) { return; /* Parameter mismatch will be reported by Simulink */ } ssSetNumContStates(S, NUM_CONT_STATES); ssSetNumDiscStates(S, NUM_DISC_STATES); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; /*Input Port 0 */ inputDimsInfo.width = INPUT_0_WIDTH; ssSetInputPortDimensionInfo(S, 0, &inputDimsInfo); ssSetInputPortMatrixDimensions( S , 0, INPUT_0_WIDTH, INPUT_DIMS_0_COL); ssSetInputPortFrameData(S, 0, IN_0_FRAME_BASED); ssSetInputPortDataType(S, 0, SS_SINGLE); ssSetInputPortComplexSignal(S, 0, INPUT_0_COMPLEX); ssSetInputPortDirectFeedThrough(S, 0, INPUT_0_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 0, 1); /*direct input signal access*/ /*Input Port 1 */ inputDimsInfo.width = INPUT_1_WIDTH; ssSetInputPortDimensionInfo(S, 1, &inputDimsInfo); ssSetInputPortMatrixDimensions( S , 1, INPUT_1_WIDTH, INPUT_DIMS_1_COL); ssSetInputPortFrameData(S, 1, IN_1_FRAME_BASED); ssSetInputPortDataType(S, 1, SS_INT32); ssSetInputPortComplexSignal(S, 1, INPUT_1_COMPLEX); ssSetInputPortDirectFeedThrough(S, 1, INPUT_1_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 1, 1); /*direct input signal access*/ if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_WORKS_WITH_CODE_REUSE)); }
/* Function: mdlInitializeSizes =============================================== * Abstract: * Setup sizes of the various vectors. */ static void mdlInitializeSizes(SimStruct *S) { DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) { return; /* Parameter mismatch will be reported by Simulink */ } ssSetNumContStates(S, NUM_CONT_STATES); ssSetNumDiscStates(S, NUM_DISC_STATES); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; ssSetOutputPortWidth(S, 0, OUTPUT_0_WIDTH); ssSetOutputPortDataType(S, 0, SS_INT32); ssSetOutputPortComplexSignal(S, 0, OUTPUT_0_COMPLEX); ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_WORKS_WITH_CODE_REUSE)); }
static void mdlSetInputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo) { boolean_T isNotVector = ((dimsInfo->numDims == 2 ) && (dimsInfo->dims[0] > 1 && dimsInfo->dims[1] > 1)) ; if(isNotVector){ ssSetErrorStatus(S, "The block only accepts vector signals. " "It does not accept a [mxn] matrix signal " "where m > 1 and n > 1."); }else{ int otherPort = (port == 0) ? 1 : 0; if(!ssSetInputPortDimensionInfo(S, port, dimsInfo)) return; /* * If other port width is unknown, set the other port width. * Note1: we cannot update other port dimension info. * Note2: For simplicity, this block cannot accept partial dimension, * however, it may partially set other port dimension info. */ if(ssGetInputPortWidth(S, otherPort) == DYNAMICALLY_SIZED && ssGetInputPortWidth(S, port) != DYNAMICALLY_SIZED){ DECL_AND_INIT_DIMSINFO(dimsInfo); dimsInfo.width = ssGetInputPortWidth (S, port); dimsInfo.numDims = ssGetInputPortNumDimensions(S, otherPort); dimsInfo.dims = ssGetInputPortDimensions (S, otherPort); if(!ssSetInputPortDimensionInfo(S, otherPort, &dimsInfo)) return; } } }
/* Function: mdlInitializeSizes =============================================== * Abstract: * Setup sizes of the various vectors. */ static void mdlInitializeSizes(SimStruct *S) { DECL_AND_INIT_DIMSINFO(inputDimsInfo); DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); /* Number of expected parameters */ #if defined(MATLAB_MEX_FILE) if (ssGetNumSFcnParams(S) == ssGetSFcnParamsCount(S)) { mdlCheckParameters(S); if (ssGetErrorStatus(S) != NULL) { return; } } else { return; /* Parameter mismatch will be reported by Simulink */ } #endif ssSetNumContStates(S, NUM_CONT_STATES); ssSetNumDiscStates(S, NUM_DISC_STATES); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; inputDimsInfo.width = INPUT_0_WIDTH; ssSetInputPortDimensionInfo(S, 0, &inputDimsInfo); ssSetInputPortFrameData(S, 0, IN_0_FRAME_BASED); ssSetInputPortDataType(S, 0, SS_UINT32); ssSetInputPortComplexSignal(S, 0, INPUT_0_COMPLEX); ssSetInputPortDirectFeedThrough(S, 0, INPUT_0_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 0, 1); /*direct input signal access*/ if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; outputDimsInfo.width = OUTPUT_0_WIDTH; ssSetOutputPortDimensionInfo(S, 0, &outputDimsInfo); ssSetOutputPortFrameData(S, 0, OUT_0_FRAME_BASED); ssSetOutputPortDataType(S, 0, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 0, OUTPUT_0_COMPLEX); ssSetOutputPortComplexSignal(S, 0, OUTPUT_0_COMPLEX); ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_WORKS_WITH_CODE_REUSE)); }
/* Function: mdlInitializeSizes =============================================== * Abstract: * Setup sizes of the various vectors. */ static void mdlInitializeSizes(SimStruct *S) { DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) { return; /* Parameter mismatch will be reported by Simulink */ } ssSetNumContStates(S, NUM_CONT_STATES); ssSetNumDiscStates(S, NUM_DISC_STATES); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; /* Output Port 0 */ ssSetOutputPortWidth(S, 0, OUTPUT_0_WIDTH); ssSetOutputPortDataType(S, 0, SS_SINGLE); ssSetOutputPortComplexSignal(S, 0, OUTPUT_0_COMPLEX); /* Output Port 1 */ ssSetOutputPortWidth(S, 1, OUTPUT_1_WIDTH); ssSetOutputPortDataType(S, 1, SS_SINGLE); ssSetOutputPortComplexSignal(S, 1, OUTPUT_1_COMPLEX); /* Output Port 2 */ ssSetOutputPortWidth(S, 2, OUTPUT_2_WIDTH); ssSetOutputPortDataType(S, 2, SS_SINGLE); ssSetOutputPortComplexSignal(S, 2, OUTPUT_2_COMPLEX); /* Output Port 3 */ ssSetOutputPortWidth(S, 3, OUTPUT_3_WIDTH); ssSetOutputPortDataType(S, 3, SS_SINGLE); ssSetOutputPortComplexSignal(S, 3, OUTPUT_3_COMPLEX); /* Output Port 4 */ ssSetOutputPortWidth(S, 4, OUTPUT_4_WIDTH); ssSetOutputPortDataType(S, 4, SS_SINGLE); ssSetOutputPortComplexSignal(S, 4, OUTPUT_4_COMPLEX); /* Output Port 5 */ ssSetOutputPortWidth(S, 5, OUTPUT_5_WIDTH); ssSetOutputPortDataType(S, 5, SS_SINGLE); ssSetOutputPortComplexSignal(S, 5, OUTPUT_5_COMPLEX); /* Output Port 6 */ ssSetOutputPortWidth(S, 6, OUTPUT_6_WIDTH); ssSetOutputPortDataType(S, 6, SS_SINGLE); ssSetOutputPortComplexSignal(S, 6, OUTPUT_6_COMPLEX); ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); ssSetSimulinkVersionGeneratedIn(S, "8.6"); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_USE_TLC_WITH_ACCELERATOR | SS_OPTION_WORKS_WITH_CODE_REUSE)); }
static void mdlInitializeSizes(SimStruct *S) { const real_T *P1 = mxGetData(PARAM_DEF3(S)); const real_T *P2 = mxGetData(PARAM_DEF2(S)); DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); /* Number of expected parameters */ #if defined(MATLAB_MEX_FILE) if (ssGetNumSFcnParams(S) == ssGetSFcnParamsCount(S)) { if (ssGetErrorStatus(S) != NULL) { return; } } else { return; /* Parameter mismatch will be reported by Simulink */ } #endif ssSetNumContStates(S, NUM_CONT_STATES); ssSetNumDiscStates(S, NUM_DISC_STATES); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; /* Output Port 0 */ outputDimsInfo.width = *P1; ssSetOutputPortDimensionInfo(S, 0, &outputDimsInfo); ssSetOutputPortMatrixDimensions( S ,0, *P1, *P2); ssSetOutputPortFrameData(S, 0, OUT_0_FRAME_BASED); ssSetOutputPortDataType(S, 0, SS_UINT8); ssSetOutputPortComplexSignal(S, 0, OUTPUT_0_COMPLEX); /* Output Port 1 */ outputDimsInfo.width = *P1; ssSetOutputPortDimensionInfo(S, 1, &outputDimsInfo); ssSetOutputPortMatrixDimensions( S ,1, *P1, *P2); ssSetOutputPortFrameData(S, 1, OUT_1_FRAME_BASED); ssSetOutputPortDataType(S, 1, SS_UINT8); ssSetOutputPortComplexSignal(S, 1, OUTPUT_1_COMPLEX); /* Output Port 2 */ outputDimsInfo.width = *P1; ssSetOutputPortDimensionInfo(S, 2, &outputDimsInfo); ssSetOutputPortMatrixDimensions( S ,2, *P1, *P2); ssSetOutputPortFrameData(S, 2, OUT_2_FRAME_BASED); ssSetOutputPortDataType(S, 2, SS_UINT8); ssSetOutputPortComplexSignal(S, 2, OUTPUT_2_COMPLEX); ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_WORKS_WITH_CODE_REUSE)); }
/* Function: mdlInitializeSizes =============================================== * Abstract: * Setup sizes of the various vectors. */ static void mdlInitializeSizes(SimStruct *S) { DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) { return; /* Parameter mismatch will be reported by Simulink */ } ssSetNumContStates(S, NUM_CONT_STATES); ssSetNumDiscStates(S, NUM_DISC_STATES); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; /* Output Port 0 */ outputDimsInfo.width = OUTPUT_0_WIDTH; ssSetOutputPortDimensionInfo(S, 0, &outputDimsInfo); ssSetOutputPortMatrixDimensions( S ,0, OUTPUT_0_WIDTH, OUTPUT_DIMS_0_COL); ssSetOutputPortFrameData(S, 0, OUT_0_FRAME_BASED); ssSetOutputPortDataType(S, 0, SS_UINT8); ssSetOutputPortComplexSignal(S, 0, OUTPUT_0_COMPLEX); /* Output Port 1 */ outputDimsInfo.width = OUTPUT_1_WIDTH; ssSetOutputPortDimensionInfo(S, 1, &outputDimsInfo); ssSetOutputPortMatrixDimensions( S ,1, OUTPUT_1_WIDTH, OUTPUT_DIMS_1_COL); ssSetOutputPortFrameData(S, 1, OUT_1_FRAME_BASED); ssSetOutputPortDataType(S, 1, SS_UINT8); ssSetOutputPortComplexSignal(S, 1, OUTPUT_1_COMPLEX); /* Output Port 2 */ outputDimsInfo.width = OUTPUT_2_WIDTH; ssSetOutputPortDimensionInfo(S, 2, &outputDimsInfo); ssSetOutputPortMatrixDimensions( S ,2, OUTPUT_2_WIDTH, OUTPUT_DIMS_2_COL); ssSetOutputPortFrameData(S, 2, OUT_2_FRAME_BASED); ssSetOutputPortDataType(S, 2, SS_UINT8); ssSetOutputPortComplexSignal(S, 2, OUTPUT_2_COMPLEX); /* Output Port 3 */ outputDimsInfo.width = OUTPUT_3_WIDTH; ssSetOutputPortDimensionInfo(S, 3, &outputDimsInfo); ssSetOutputPortMatrixDimensions( S ,3, OUTPUT_3_WIDTH, OUTPUT_DIMS_3_COL); ssSetOutputPortFrameData(S, 3, OUT_3_FRAME_BASED); ssSetOutputPortDataType(S, 3, SS_UINT16); ssSetOutputPortComplexSignal(S, 3, OUTPUT_3_COMPLEX); ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_WORKS_WITH_CODE_REUSE)); }
void mdlSetDefaultPortDimensionInfo(SimStruct *S) { DECL_AND_INIT_DIMSINFO(dimsInfo); /* Either 2nd input or 2nd output should be already known */ if (ssGetOutputPortWidth(S, 0) != DYNAMICALLY_SIZED) { /* It is the output that is known, get the dimensions first */ dimsInfo.width = ssGetOutputPortWidth(S, 0); dimsInfo.numDims = ssGetOutputPortNumDimensions(S, 0); dimsInfo.dims = ssGetOutputPortDimensions(S, 0); /*set second input, first output if unknown */ if (ssGetInputPortWidth(S, 0) == DYNAMICALLY_SIZED) { if(!ssSetInputPortDimensionInfo(S, 0, &dimsInfo)) return; } return; } else { if (ssGetInputPortWidth(S, 0) != DYNAMICALLY_SIZED) { /* It is the input that is known, get the dimensions */ dimsInfo.width = ssGetInputPortWidth(S, 0); dimsInfo.numDims = ssGetInputPortNumDimensions(S, 0); dimsInfo.dims = ssGetInputPortDimensions(S, 0); /*set first and second output if unknown */ if (ssGetOutputPortWidth(S, 0) == DYNAMICALLY_SIZED) { if(!ssSetOutputPortDimensionInfo(S, 0, &dimsInfo)) return; } return; } else { /* Default everything to a scalar signal */ ssSetOutputPortVectorDimension(S, 0, 1); ssSetInputPortVectorDimension(S, 0, 1); return; } } } /* end mdlSetDefaultPortDimensionInfo */
static void mdlSetDefaultPortDimensionInfo(SimStruct *S) { DECL_AND_INIT_DIMSINFO(portDimsInfo); int_T dims[2] = { INPUT_0_WIDTH, 1 }; bool frameIn = ssGetInputPortFrameData(S, 0) == FRAME_YES; /* Neither the input nor the output ports have been set */ portDimsInfo.width = INPUT_0_WIDTH; portDimsInfo.numDims = frameIn ? 2 : 1; portDimsInfo.dims = frameIn ? dims : &portDimsInfo.width; if (ssGetInputPortNumDimensions(S, 0) == (-1)) { ssSetInputPortDimensionInfo(S, 0, &portDimsInfo); } portDimsInfo.width = OUTPUT_0_WIDTH; dims[0] = OUTPUT_0_WIDTH; dims[1] = 1; portDimsInfo.dims = frameIn ? dims : &portDimsInfo.width; if (ssGetOutputPortNumDimensions(S, 0) == (-1)) { ssSetOutputPortDimensionInfo(S, 0, &portDimsInfo); } return; }
/* Function: mdlInitializeSizes =============================================== * Abstract: * Setup sizes of the various vectors. */ static void mdlInitializeSizes(SimStruct *S) { DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); /* Number of expected parameters */ #if defined(MATLAB_MEX_FILE) if (ssGetNumSFcnParams(S) == ssGetSFcnParamsCount(S)) { mdlCheckParameters(S); if (ssGetErrorStatus(S) != NULL) { return; } } else { return; /* Parameter mismatch will be reported by Simulink */ } #endif ssSetNumContStates(S, NUM_CONT_STATES); ssSetNumDiscStates(S, NUM_DISC_STATES); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; ssSetOutputPortWidth(S, 0, OUTPUT_0_WIDTH); ssSetOutputPortDataType(S, 0, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 0, OUTPUT_0_COMPLEX); ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_USE_TLC_WITH_ACCELERATOR | SS_OPTION_WORKS_WITH_CODE_REUSE)); }
/* Function: mdlInitializeSizes =============================================== * Abstract: * The sizes information is used by Simulink to determine the S-function * block's characteristics (number of inputs, outputs, states, etc.). */ static void mdlInitializeSizes(SimStruct *S) { DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) { return; /* Parameter mismatch will be reported by Simulink */ } ssSetNumContStates(S, NUM_CONT_STATES); ssSetNumDiscStates(S, NUM_DISC_STATES); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; /* Output Port 0 */ ssSetOutputPortWidth(S, 0, OUTPUT_0_WIDTH); ssSetOutputPortDataType(S, 0, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 0, OUTPUT_0_COMPLEX); /* Output Port 1 */ /* Register SL_ROS_SUB_MSG datatype for Output port 1 */ #if defined(MATLAB_MEX_FILE) if (ssGetSimMode(S) != SS_SIMMODE_SIZES_CALL_ONLY) { DTypeId dataTypeIdReg; ssRegisterTypeFromNamedObject(S, "SL_ROS_SUB_MSG", &dataTypeIdReg); if(dataTypeIdReg == INVALID_DTYPE_ID) return; ssSetOutputPortDataType(S,1, dataTypeIdReg); } #endif ssSetBusOutputObjectName(S, 1, (void *) "SL_ROS_SUB_MSG"); ssSetOutputPortWidth(S, 1, OUTPUT_1_WIDTH); ssSetOutputPortComplexSignal(S, 1, OUTPUT_1_COMPLEX); ssSetBusOutputAsStruct(S, 1, OUT_1_BUS_BASED); ssSetOutputPortBusMode(S, 1, SL_BUS_MODE); if (ssRTWGenIsCodeGen(S)) { isSimulationTarget = GetRTWEnvironmentMode(S); if (isSimulationTarget == -1) { ssSetErrorStatus(S, " Unable to determine a valid code generation environment mode"); return; } isSimulationTarget |= ssRTWGenIsModelReferenceSimTarget(S); } /* Set the number of dworks */ if (!isDWorkPresent) { if (!ssSetNumDWork(S, 0)) return; } else { if (!ssSetNumDWork(S, 1)) return; } if (isDWorkPresent) { /* * Configure the dwork 0 (y1BUS) */ #if defined(MATLAB_MEX_FILE) if (ssGetSimMode(S) != SS_SIMMODE_SIZES_CALL_ONLY) { DTypeId dataTypeIdReg; ssRegisterTypeFromNamedObject(S, "SL_ROS_SUB_MSG", &dataTypeIdReg); if (dataTypeIdReg == INVALID_DTYPE_ID) return; ssSetDWorkDataType(S, 0, dataTypeIdReg); } #endif ssSetDWorkUsageType(S, 0, SS_DWORK_USED_AS_DWORK); ssSetDWorkName(S, 0, "y1BUS"); ssSetDWorkWidth(S, 0, DYNAMICALLY_SIZED); ssSetDWorkComplexSignal(S, 0, COMPLEX_NO); } ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); ssSetSimulinkVersionGeneratedIn(S, "8.7"); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, 0); }
/* Function: mdlInitializeSizes =============================================== * Abstract: * Setup sizes of the various vectors. */ static void mdlInitializeSizes(SimStruct *S) { DECL_AND_INIT_DIMSINFO(inputDimsInfo); DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); /* Number of expected parameters */ #if defined(MATLAB_MEX_FILE) if (ssGetNumSFcnParams(S) == ssGetSFcnParamsCount(S)) { mdlCheckParameters(S); if (ssGetErrorStatus(S) != NULL) { return; } } else { return; /* Parameter mismatch will be reported by Simulink */ } #endif ssSetNumContStates(S, NUM_CONT_STATES); ssSetNumDiscStates(S, NUM_DISC_STATES); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; /*Input Port 0 */ ssSetInputPortWidth(S, 0, INPUT_0_WIDTH); /* */ ssSetInputPortDataType(S, 0, SS_DOUBLE); ssSetInputPortComplexSignal(S, 0, INPUT_0_COMPLEX); ssSetInputPortDirectFeedThrough(S, 0, INPUT_0_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 0, 1); /*direct input signal access*/ /*Input Port 1 */ ssSetInputPortWidth(S, 1, INPUT_1_WIDTH); /* */ ssSetInputPortDataType(S, 1, SS_DOUBLE); ssSetInputPortComplexSignal(S, 1, INPUT_1_COMPLEX); ssSetInputPortDirectFeedThrough(S, 1, INPUT_1_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 1, 1); /*direct input signal access*/ /*Input Port 2 */ ssSetInputPortWidth(S, 2, INPUT_2_WIDTH); /* */ ssSetInputPortDataType(S, 2, SS_DOUBLE); ssSetInputPortComplexSignal(S, 2, INPUT_2_COMPLEX); ssSetInputPortDirectFeedThrough(S, 2, INPUT_2_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 2, 1); /*direct input signal access*/ /*Input Port 3 */ ssSetInputPortWidth(S, 3, INPUT_3_WIDTH); /* */ ssSetInputPortDataType(S, 3, SS_DOUBLE); ssSetInputPortComplexSignal(S, 3, INPUT_3_COMPLEX); ssSetInputPortDirectFeedThrough(S, 3, INPUT_3_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 3, 1); /*direct input signal access*/ /*Input Port 4 */ ssSetInputPortWidth(S, 4, INPUT_4_WIDTH); /* */ ssSetInputPortDataType(S, 4, SS_DOUBLE); ssSetInputPortComplexSignal(S, 4, INPUT_4_COMPLEX); ssSetInputPortDirectFeedThrough(S, 4, INPUT_4_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 4, 1); /*direct input signal access*/ /*Input Port 5 */ ssSetInputPortWidth(S, 5, INPUT_5_WIDTH); /* */ ssSetInputPortDataType(S, 5, SS_DOUBLE); ssSetInputPortComplexSignal(S, 5, INPUT_5_COMPLEX); ssSetInputPortDirectFeedThrough(S, 5, INPUT_5_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 5, 1); /*direct input signal access*/ /*Input Port 6 */ ssSetInputPortWidth(S, 6, INPUT_6_WIDTH); /* */ ssSetInputPortDataType(S, 6, SS_DOUBLE); ssSetInputPortComplexSignal(S, 6, INPUT_6_COMPLEX); ssSetInputPortDirectFeedThrough(S, 6, INPUT_6_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 6, 1); /*direct input signal access*/ /*Input Port 7 */ ssSetInputPortWidth(S, 7, INPUT_7_WIDTH); /* */ ssSetInputPortDataType(S, 7, SS_DOUBLE); ssSetInputPortComplexSignal(S, 7, INPUT_7_COMPLEX); ssSetInputPortDirectFeedThrough(S, 7, INPUT_7_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 7, 1); /*direct input signal access*/ /*Input Port 8 */ ssSetInputPortWidth(S, 8, INPUT_8_WIDTH); /* */ ssSetInputPortDataType(S, 8, SS_DOUBLE); ssSetInputPortComplexSignal(S, 8, INPUT_8_COMPLEX); ssSetInputPortDirectFeedThrough(S, 8, INPUT_8_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 8, 1); /*direct input signal access*/ /*Input Port 9 */ ssSetInputPortWidth(S, 9, INPUT_9_WIDTH); /* */ ssSetInputPortDataType(S, 9, SS_DOUBLE); ssSetInputPortComplexSignal(S, 9, INPUT_9_COMPLEX); ssSetInputPortDirectFeedThrough(S, 9, INPUT_9_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 9, 1); /*direct input signal access*/ if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; /* Output Port 0 */ ssSetOutputPortWidth(S, 0, OUTPUT_0_WIDTH); ssSetOutputPortDataType(S, 0, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 0, OUTPUT_0_COMPLEX); /* Output Port 1 */ ssSetOutputPortWidth(S, 1, OUTPUT_1_WIDTH); ssSetOutputPortDataType(S, 1, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 1, OUTPUT_1_COMPLEX); /* Output Port 2 */ ssSetOutputPortWidth(S, 2, OUTPUT_2_WIDTH); ssSetOutputPortDataType(S, 2, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 2, OUTPUT_2_COMPLEX); /* Output Port 3 */ ssSetOutputPortWidth(S, 3, OUTPUT_3_WIDTH); ssSetOutputPortDataType(S, 3, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 3, OUTPUT_3_COMPLEX); /* Output Port 4 */ ssSetOutputPortWidth(S, 4, OUTPUT_4_WIDTH); ssSetOutputPortDataType(S, 4, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 4, OUTPUT_4_COMPLEX); /* Output Port 5 */ ssSetOutputPortWidth(S, 5, OUTPUT_5_WIDTH); ssSetOutputPortDataType(S, 5, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 5, OUTPUT_5_COMPLEX); /* Output Port 6 */ ssSetOutputPortWidth(S, 6, OUTPUT_6_WIDTH); ssSetOutputPortDataType(S, 6, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 6, OUTPUT_6_COMPLEX); /* Output Port 7 */ ssSetOutputPortWidth(S, 7, OUTPUT_7_WIDTH); ssSetOutputPortDataType(S, 7, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 7, OUTPUT_7_COMPLEX); ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); /*initialzation of sizes related to DWork Vectors*/ ssSetNumDWork(S,NDWORKS); /*DWork vector 1*/ ssSetDWorkWidth(S, 0, DWORK_0_WIDTH); ssSetDWorkDataType(S, 0, SS_DOUBLE); ssSetDWorkWidth(S, 1, DWORK_1_WIDTH); ssSetDWorkDataType(S, 1, SS_DOUBLE); ssSetDWorkWidth(S, 2, DWORK_2_WIDTH); ssSetDWorkDataType(S, 2, SS_DOUBLE); ssSetDWorkWidth(S, 3, DWORK_3_WIDTH); ssSetDWorkDataType(S, 3, SS_DOUBLE); ssSetDWorkWidth(S, 4, DWORK_4_WIDTH); ssSetDWorkDataType(S, 4, SS_DOUBLE); ssSetDWorkWidth(S, 5, DWORK_5_WIDTH); ssSetDWorkDataType(S, 5, SS_DOUBLE); ssSetDWorkWidth(S, 6, DWORK_6_WIDTH); ssSetDWorkDataType(S, 6, SS_DOUBLE); ssSetDWorkWidth(S, 7, DWORK_7_WIDTH); ssSetDWorkDataType(S, 7, SS_DOUBLE); ssSetDWorkWidth(S, 8, DWORK_8_WIDTH); ssSetDWorkDataType(S, 8, SS_DOUBLE); ssSetDWorkWidth(S, 9, DWORK_9_WIDTH); ssSetDWorkDataType(S, 9, SS_DOUBLE); ssSetDWorkWidth(S, 10, DWORK_10_WIDTH); ssSetDWorkDataType(S, 10, SS_DOUBLE); ssSetDWorkWidth(S, 11, DWORK_11_WIDTH); ssSetDWorkDataType(S, 11, SS_DOUBLE); ssSetDWorkWidth(S, 12, DWORK_12_WIDTH); ssSetDWorkDataType(S, 12, SS_DOUBLE); ssSetDWorkWidth(S, 13, DWORK_13_WIDTH); ssSetDWorkDataType(S, 13, SS_DOUBLE); ssSetDWorkWidth(S, 14, DWORK_14_WIDTH); ssSetDWorkDataType(S, 14, SS_DOUBLE); ssSetDWorkWidth(S, 15, DWORK_15_WIDTH); ssSetDWorkDataType(S, 15, SS_DOUBLE); ssSetDWorkWidth(S, 16, DWORK_16_WIDTH); ssSetDWorkDataType(S, 16, SS_DOUBLE); ssSetDWorkWidth(S, 17, DWORK_17_WIDTH); ssSetDWorkDataType(S, 17, SS_DOUBLE); ssSetDWorkWidth(S, 18, DWORK_18_WIDTH); ssSetDWorkDataType(S, 18, SS_DOUBLE); ssSetDWorkWidth(S, 19, DWORK_19_WIDTH); ssSetDWorkDataType(S, 19, SS_DOUBLE); ssSetDWorkWidth(S, 20, DWORK_20_WIDTH); ssSetDWorkDataType(S, 20, SS_DOUBLE); ssSetDWorkWidth(S, 21, DWORK_21_WIDTH); ssSetDWorkDataType(S, 21, SS_DOUBLE); ssSetDWorkWidth(S, 22, DWORK_22_WIDTH); ssSetDWorkDataType(S, 22, SS_DOUBLE); ssSetDWorkWidth(S, 23, DWORK_23_WIDTH); ssSetDWorkDataType(S, 23, SS_DOUBLE); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_USE_TLC_WITH_ACCELERATOR | SS_OPTION_WORKS_WITH_CODE_REUSE)); }
static void mdlInitializeSizes(SimStruct *S) { int_T param; ssSetNumSFcnParams(S, NPARAMS); /* Number of expected parameters */ # if defined(MATLAB_MEX_FILE) if (ssGetNumSFcnParams(S) == ssGetSFcnParamsCount(S)) { mdlCheckParameters(S); if (ssGetErrorStatus(S) != NULL) return; } else return; /* Parameter mismatch will be reported by Simulink */ # endif for( param=0; param<NPARAMS; param++ ) { ssSetSFcnParamTunable(S,param,false); } ssSetNumContStates(S, 0); ssSetNumDiscStates(S, 1); ssAllowSignalsWithMoreThan2D(S); if (!ssSetNumInputPorts(S, 0)) return; if (!ssSetNumOutputPorts(S, 2)) return; { DECL_AND_INIT_DIMSINFO(di); int_T dims[3]; di.numDims = (intval(mxGetPr(paramPixelFormat)[0]) == 1 ? 2 : 3); dims[0] = intval(mxGetPr(paramImageSizeXYN)[1]); dims[1] = intval(mxGetPr(paramImageSizeXYN)[0]); dims[2] = (intval(mxGetPr(paramPixelFormat)[0]) == 1 ? 1 : 3); if ((mxGetNumberOfElements(paramImageSizeXYN) == 3) && (intval(mxGetPr(paramImageSizeXYN)[2])) > 1) { dims[1] *= intval(mxGetPr(paramImageSizeXYN)[2]); } di.dims = dims; di.width = dims[0]*dims[1]*dims[2]; ssSetOutputPortDimensionInfo(S, 0, &di); } ssSetOutputPortDataType( S, 0, SS_UINT8 ); ssSetOutputPortComplexSignal(S, 0, 0); ssSetOutputPortOptimOpts(S, 0, SS_NOT_REUSABLE_AND_GLOBAL); ssSetOutputPortWidth(S, 1, 1); ssSetOutputPortDataType( S, 1, SS_UINT32 ); ssSetOutputPortComplexSignal(S, 1, 0); ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); /* Reserve place for C objects */ ssSetNumPWork(S, 1); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE); }
/* Function: mdlInitializeSizes =============================================== * Abstract: * Setup sizes of the various vectors. */ static void mdlInitializeSizes(SimStruct *S) { DECL_AND_INIT_DIMSINFO(inputDimsInfo); DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); /* Number of expected parameters */ #if defined(MATLAB_MEX_FILE) if (ssGetNumSFcnParams(S) == ssGetSFcnParamsCount(S)) { mdlCheckParameters(S); if (ssGetErrorStatus(S) != NULL) { return; } } else { return; /* Parameter mismatch will be reported by Simulink */ } #endif ssSetSimStateCompliance(S, USE_DEFAULT_SIM_STATE); ssSetNumContStates(S, NUM_CONT_STATES); ssSetNumDiscStates(S, NUM_DISC_STATES); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; /*Input Port 0 */ ssSetInputPortWidth(S, 0, INPUT_0_WIDTH); /* */ ssSetInputPortDataType(S, 0, SS_DOUBLE); ssSetInputPortComplexSignal(S, 0, INPUT_0_COMPLEX); ssSetInputPortDirectFeedThrough(S, 0, INPUT_0_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 0, 1); /*direct input signal access*/ /*Input Port 1 */ ssSetInputPortWidth(S, 1, INPUT_1_WIDTH); /* */ ssSetInputPortDataType(S, 1, SS_DOUBLE); ssSetInputPortComplexSignal(S, 1, INPUT_1_COMPLEX); ssSetInputPortDirectFeedThrough(S, 1, INPUT_1_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 1, 1); /*direct input signal access*/ /*Input Port 2 */ ssSetInputPortWidth(S, 2, INPUT_2_WIDTH); /* */ ssSetInputPortDataType(S, 2, SS_DOUBLE); ssSetInputPortComplexSignal(S, 2, INPUT_2_COMPLEX); ssSetInputPortDirectFeedThrough(S, 2, INPUT_2_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 2, 1); /*direct input signal access*/ /*Input Port 3 */ ssSetInputPortWidth(S, 3, INPUT_3_WIDTH); /* */ ssSetInputPortDataType(S, 3, SS_DOUBLE); ssSetInputPortComplexSignal(S, 3, INPUT_3_COMPLEX); ssSetInputPortDirectFeedThrough(S, 3, INPUT_3_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 3, 1); /*direct input signal access*/ /*Input Port 4 */ ssSetInputPortWidth(S, 4, INPUT_4_WIDTH); /* */ ssSetInputPortDataType(S, 4, SS_DOUBLE); ssSetInputPortComplexSignal(S, 4, INPUT_4_COMPLEX); ssSetInputPortDirectFeedThrough(S, 4, INPUT_4_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 4, 1); /*direct input signal access*/ if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; /* Output Port 0 */ ssSetOutputPortWidth(S, 0, OUTPUT_0_WIDTH); ssSetOutputPortDataType(S, 0, SS_DOUBLE); ssSetOutputPortComplexSignal(S, 0, OUTPUT_0_COMPLEX); ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_USE_TLC_WITH_ACCELERATOR | SS_OPTION_WORKS_WITH_CODE_REUSE)); }
/* Function: mdlInitializeSizes =============================================== * Abstract: * Setup sizes of the various vectors. */ static void mdlInitializeSizes(SimStruct *S) { DECL_AND_INIT_DIMSINFO(inputDimsInfo); DECL_AND_INIT_DIMSINFO(outputDimsInfo); ssSetNumSFcnParams(S, NPARAMS); if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) { return; /* Parameter mismatch will be reported by Simulink */ } ssSetNumContStates(S, NUM_CONT_STATES); ssSetNumDiscStates(S, NUM_DISC_STATES); if (!ssSetNumInputPorts(S, NUM_INPUTS)) return; /*Input Port 0 */ inputDimsInfo.width = INPUT_0_WIDTH; ssSetInputPortDimensionInfo(S, 0, &inputDimsInfo); ssSetInputPortMatrixDimensions( S , 0, INPUT_0_WIDTH, INPUT_DIMS_0_COL); ssSetInputPortFrameData(S, 0, IN_0_FRAME_BASED); ssSetInputPortDataType(S, 0, SS_DOUBLE); ssSetInputPortComplexSignal(S, 0, INPUT_0_COMPLEX); ssSetInputPortDirectFeedThrough(S, 0, INPUT_0_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 0, 1); /*direct input signal access*/ /*Input Port 1 */ inputDimsInfo.width = INPUT_1_WIDTH; ssSetInputPortDimensionInfo(S, 1, &inputDimsInfo); ssSetInputPortMatrixDimensions( S , 1, INPUT_1_WIDTH, INPUT_DIMS_1_COL); ssSetInputPortFrameData(S, 1, IN_1_FRAME_BASED); ssSetInputPortDataType(S, 1, SS_DOUBLE); ssSetInputPortComplexSignal(S, 1, INPUT_1_COMPLEX); ssSetInputPortDirectFeedThrough(S, 1, INPUT_1_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 1, 1); /*direct input signal access*/ /*Input Port 2 */ inputDimsInfo.width = INPUT_2_WIDTH; ssSetInputPortDimensionInfo(S, 2, &inputDimsInfo); ssSetInputPortMatrixDimensions( S , 2, INPUT_2_WIDTH, INPUT_DIMS_2_COL); ssSetInputPortFrameData(S, 2, IN_2_FRAME_BASED); ssSetInputPortDataType(S, 2, SS_DOUBLE); ssSetInputPortComplexSignal(S, 2, INPUT_2_COMPLEX); ssSetInputPortDirectFeedThrough(S, 2, INPUT_2_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 2, 1); /*direct input signal access*/ /*Input Port 3 */ inputDimsInfo.width = INPUT_3_WIDTH; ssSetInputPortDimensionInfo(S, 3, &inputDimsInfo); ssSetInputPortMatrixDimensions( S , 3, INPUT_3_WIDTH, INPUT_DIMS_3_COL); ssSetInputPortFrameData(S, 3, IN_3_FRAME_BASED); ssSetInputPortDataType(S, 3, SS_DOUBLE); ssSetInputPortComplexSignal(S, 3, INPUT_3_COMPLEX); ssSetInputPortDirectFeedThrough(S, 3, INPUT_3_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 3, 1); /*direct input signal access*/ /*Input Port 4 */ inputDimsInfo.width = INPUT_4_WIDTH; ssSetInputPortDimensionInfo(S, 4, &inputDimsInfo); ssSetInputPortMatrixDimensions( S , 4, INPUT_4_WIDTH, INPUT_DIMS_4_COL); ssSetInputPortFrameData(S, 4, IN_4_FRAME_BASED); ssSetInputPortDataType(S, 4, SS_DOUBLE); ssSetInputPortComplexSignal(S, 4, INPUT_4_COMPLEX); ssSetInputPortDirectFeedThrough(S, 4, INPUT_4_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 4, 1); /*direct input signal access*/ /*Input Port 5 */ ssSetInputPortWidth(S, 5, INPUT_5_WIDTH); /* */ ssSetInputPortDataType(S, 5, SS_DOUBLE); ssSetInputPortComplexSignal(S, 5, INPUT_5_COMPLEX); ssSetInputPortDirectFeedThrough(S, 5, INPUT_5_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 5, 1); /*direct input signal access*/ /*Input Port 6 */ ssSetInputPortWidth(S, 6, INPUT_6_WIDTH); /* */ ssSetInputPortDataType(S, 6, SS_DOUBLE); ssSetInputPortComplexSignal(S, 6, INPUT_6_COMPLEX); ssSetInputPortDirectFeedThrough(S, 6, INPUT_6_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 6, 1); /*direct input signal access*/ /*Input Port 7 */ inputDimsInfo.width = INPUT_7_WIDTH; ssSetInputPortDimensionInfo(S, 7, &inputDimsInfo); ssSetInputPortMatrixDimensions( S ,7, INPUT_7_WIDTH, INPUT_DIMS_7_COL); ssSetInputPortFrameData(S, 7, IN_7_FRAME_BASED); ssSetInputPortDataType(S, 7, SS_DOUBLE); ssSetInputPortComplexSignal(S, 7, INPUT_7_COMPLEX); ssSetInputPortDirectFeedThrough(S, 7, INPUT_7_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 7, 1); /*direct input signal access*/ /*Input Port 8 */ inputDimsInfo.width = INPUT_8_WIDTH; ssSetInputPortDimensionInfo(S, 8, &inputDimsInfo); ssSetInputPortMatrixDimensions( S ,8, INPUT_8_WIDTH, INPUT_DIMS_8_COL); ssSetInputPortFrameData(S, 8, IN_8_FRAME_BASED); ssSetInputPortDataType(S, 8, SS_DOUBLE); ssSetInputPortComplexSignal(S, 8, INPUT_8_COMPLEX); ssSetInputPortDirectFeedThrough(S, 8, INPUT_8_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 8, 1); /*direct input signal access*/ /*Input Port 9 */ inputDimsInfo.width = INPUT_9_WIDTH; ssSetInputPortDimensionInfo(S, 9, &inputDimsInfo); ssSetInputPortMatrixDimensions( S ,9, INPUT_9_WIDTH, INPUT_DIMS_9_COL); ssSetInputPortFrameData(S, 9, IN_9_FRAME_BASED); ssSetInputPortDataType(S, 9, SS_DOUBLE); ssSetInputPortComplexSignal(S, 9, INPUT_9_COMPLEX); ssSetInputPortDirectFeedThrough(S, 9, INPUT_9_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 9, 1); /*direct input signal access*/ /*Input Port 10 */ inputDimsInfo.width = INPUT_10_WIDTH; ssSetInputPortDimensionInfo(S, 10, &inputDimsInfo); ssSetInputPortMatrixDimensions( S ,10, INPUT_10_WIDTH, INPUT_DIMS_10_COL); ssSetInputPortFrameData(S, 10, IN_10_FRAME_BASED); ssSetInputPortDataType(S, 10, SS_UINT8); ssSetInputPortComplexSignal(S, 10, INPUT_10_COMPLEX); ssSetInputPortDirectFeedThrough(S, 10, INPUT_10_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 10, 1); /*direct input signal access*/ /*Input Port 11 */ inputDimsInfo.width = INPUT_11_WIDTH; ssSetInputPortDimensionInfo(S, 11, &inputDimsInfo); ssSetInputPortMatrixDimensions( S ,11, INPUT_11_WIDTH, INPUT_DIMS_11_COL); ssSetInputPortFrameData(S, 11, IN_11_FRAME_BASED); ssSetInputPortDataType(S, 11, SS_UINT8); ssSetInputPortComplexSignal(S, 11, INPUT_11_COMPLEX); ssSetInputPortDirectFeedThrough(S, 11, INPUT_11_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 11, 1); /*direct input signal access*/ /*Input Port 12 */ inputDimsInfo.width = INPUT_12_WIDTH; ssSetInputPortDimensionInfo(S, 12, &inputDimsInfo); ssSetInputPortMatrixDimensions( S ,12, INPUT_12_WIDTH, INPUT_DIMS_12_COL); ssSetInputPortFrameData(S, 12, IN_12_FRAME_BASED); ssSetInputPortDataType(S, 12, SS_UINT8); ssSetInputPortComplexSignal(S, 12, INPUT_12_COMPLEX); ssSetInputPortDirectFeedThrough(S, 12, INPUT_12_FEEDTHROUGH); ssSetInputPortRequiredContiguous(S, 12, 1); /*direct input signal access*/ if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return; ssSetNumSampleTimes(S, 1); ssSetNumRWork(S, 0); ssSetNumIWork(S, 0); ssSetNumPWork(S, 0); ssSetNumModes(S, 0); ssSetNumNonsampledZCs(S, 0); /* Take care when specifying exception free code - see sfuntmpl_doc.c */ ssSetOptions(S, (SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_WORKS_WITH_CODE_REUSE)); }