/* 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: * 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) { /* Number of expected parameters */ ssSetNumSFcnParams(S, 0); /* * Set the number of pworks. */ ssSetNumPWork(S, 0); /* * Set the number of dworks. */ if (!ssSetNumDWork(S, 0)) return; /* * Set the number of input ports. */ if (!ssSetNumInputPorts(S, 1)) return; /* * Configure the input port 1 */ ssSetInputPortDataType(S, 0, SS_INT32); ssSetInputPortWidth(S, 0, 1); ssSetInputPortComplexSignal(S, 0, COMPLEX_NO); ssSetInputPortDirectFeedThrough(S, 0, 1); ssSetInputPortAcceptExprInRTW(S, 0, 1); ssSetInputPortOverWritable(S, 0, 1); ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL); ssSetInputPortRequiredContiguous(S, 0, 1); /* * Set the number of output ports. */ if (!ssSetNumOutputPorts(S, 1)) return; /* * Configure the output port 1 */ ssSetOutputPortDataType(S, 0, SS_INT32); ssSetOutputPortWidth(S, 0, 1); ssSetOutputPortComplexSignal(S, 0, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 0, 1); /* * Register reserved identifiers to avoid name conflict */ if (ssRTWGenIsCodeGen(S)) { /* * Register reserved identifier for StartFcnSpec */ ssRegMdlInfo(S, (char*)"createAdder", MDL_INFO_ID_RESERVED, 0, 0, (void*) ssGetPath(S)); /* * Register reserved identifier for OutputFcnSpec */ ssRegMdlInfo(S, (char*)"adderOutput", MDL_INFO_ID_RESERVED, 0, 0, (void*) ssGetPath(S)); /* * Register reserved identifier for TerminateFcnSpec */ ssRegMdlInfo(S, (char*)"deleteAdder", MDL_INFO_ID_RESERVED, 0, 0, (void*) ssGetPath(S)); /* * Register reserved identifier for wrappers */ if (ssRTWGenIsModelReferenceSimTarget(S)) { /* * Register reserved identifier for StartFcnSpec for SimulationTarget */ ssRegMdlInfo(S, (char*)"sldemo_sfun_adder_cpp_wrapper_start", MDL_INFO_ID_RESERVED, 0, 0, (void*) ssGetPath(S)); /* * Register reserved identifier for OutputFcnSpec for SimulationTarget */ ssRegMdlInfo(S, (char*)"sldemo_sfun_adder_cpp_wrapper_output", MDL_INFO_ID_RESERVED, 0, 0, (void*) ssGetPath(S)); /* * Register reserved identifier for TerminateFcnSpec for SimulationTarget */ ssRegMdlInfo(S, (char*)"sldemo_sfun_adder_cpp_wrapper_terminate", MDL_INFO_ID_RESERVED, 0, 0, (void*) ssGetPath(S)); } } /* * This S-function can be used in referenced model simulating in normal mode. */ ssSetModelReferenceNormalModeSupport(S, MDL_START_AND_MDL_PROCESS_PARAMS_OK); /* * Set the number of sample time. */ ssSetNumSampleTimes(S, 1); /* * All options have the form SS_OPTION_<name> and are documented in * matlabroot/simulink/include/simstruc.h. The options should be * bitwise or'd together as in * ssSetOptions(S, (SS_OPTION_name1 | SS_OPTION_name2)) */ ssSetOptions(S, SS_OPTION_CAN_BE_CALLED_CONDITIONALLY | SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_WORKS_WITH_CODE_REUSE | SS_OPTION_SFUNCTION_INLINED_FOR_RTW | SS_OPTION_DISALLOW_CONSTANT_SAMPLE_TIME); }
/* 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: * 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) { /* Number of expected parameters */ ssSetNumSFcnParams(S, 0); /* * Set the number of pworks. */ ssSetNumPWork(S, 0); /* * Set the number of dworks. */ if (!ssSetNumDWork(S, 0)) return; /* * Set the number of input ports. */ if (!ssSetNumInputPorts(S, 0)) return; /* * Set the number of output ports. */ if (!ssSetNumOutputPorts(S, 1)) return; /* * Configure the output port 1 */ ssSetOutputPortDataType(S, 0, SS_SINGLE); ssSetOutputPortWidth(S, 0, 1); ssSetOutputPortComplexSignal(S, 0, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 0, 1); /* * Register reserved identifiers to avoid name conflict */ if (ssRTWGenIsCodeGen(S) || ssGetSimMode(S)==SS_SIMMODE_EXTERNAL) { /* * Register reserved identifier for StartFcnSpec */ ssRegMdlInfo(S, "Magneto_Initialization", MDL_INFO_ID_RESERVED, 0, 0, ssGetPath(S)); /* * Register reserved identifier for OutputFcnSpec */ ssRegMdlInfo(S, "Magneto_Get_X", MDL_INFO_ID_RESERVED, 0, 0, ssGetPath(S)); /* * Register reserved identifier for wrappers */ if (ssRTWGenIsModelReferenceSimTarget(S)) { /* * Register reserved identifier for StartFcnSpec for SimulationTarget */ ssRegMdlInfo(S, "ARDrone_Magneto_X_wrapper_start", MDL_INFO_ID_RESERVED, 0, 0, ssGetPath(S)); /* * Register reserved identifier for OutputFcnSpec for SimulationTarget */ ssRegMdlInfo(S, "ARDrone_Magneto_X_wrapper_output", MDL_INFO_ID_RESERVED, 0, 0, ssGetPath(S)); } } /* * This S-function can be used in referenced model simulating in normal mode. */ ssSetModelReferenceNormalModeSupport(S, MDL_START_AND_MDL_PROCESS_PARAMS_OK); /* * Set the number of sample time. */ ssSetNumSampleTimes(S, 1); /* * All options have the form SS_OPTION_<name> and are documented in * matlabroot/simulink/include/simstruc.h. The options should be * bitwise or'd together as in * ssSetOptions(S, (SS_OPTION_name1 | SS_OPTION_name2)) */ ssSetOptions(S, SS_OPTION_USE_TLC_WITH_ACCELERATOR | SS_OPTION_CAN_BE_CALLED_CONDITIONALLY | SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_WORKS_WITH_CODE_REUSE | SS_OPTION_SFUNCTION_INLINED_FOR_RTW | SS_OPTION_DISALLOW_CONSTANT_SAMPLE_TIME); }
/* 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) { /* Number of expected parameters */ ssSetNumSFcnParams(S, 0); /* * Set the number of pworks. */ ssSetNumPWork(S, 0); /* * Set the number of dworks. */ if (!ssSetNumDWork(S, 0)) return; /* * Set the number of input ports. */ if (!ssSetNumInputPorts(S, 1)) return; /* * Configure the input port 1 */ ssSetInputPortDataType(S, 0, SS_UINT32); ssSetInputPortWidth(S, 0, 2); ssSetInputPortComplexSignal(S, 0, COMPLEX_NO); ssSetInputPortDirectFeedThrough(S, 0, 1); ssSetInputPortAcceptExprInRTW(S, 0, 0); ssSetInputPortOverWritable(S, 0, 0); ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL); ssSetInputPortRequiredContiguous(S, 0, 1); /* * Set the number of output ports. */ if (!ssSetNumOutputPorts(S, 22)) return; /* * Configure the output port 1 */ ssSetOutputPortDataType(S, 0, SS_UINT32); ssSetOutputPortWidth(S, 0, 1); ssSetOutputPortComplexSignal(S, 0, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 0, 0); /* * Configure the output port 2 */ ssSetOutputPortDataType(S, 1, SS_UINT32); ssSetOutputPortWidth(S, 1, 1); ssSetOutputPortComplexSignal(S, 1, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 1, 0); /* * Configure the output port 3 */ ssSetOutputPortDataType(S, 2, SS_UINT32); ssSetOutputPortWidth(S, 2, 1); ssSetOutputPortComplexSignal(S, 2, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 2, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 2, 0); /* * Configure the output port 4 */ ssSetOutputPortDataType(S, 3, SS_UINT32); ssSetOutputPortWidth(S, 3, 1); ssSetOutputPortComplexSignal(S, 3, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 3, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 3, 0); /* * Configure the output port 5 */ ssSetOutputPortDataType(S, 4, SS_DOUBLE); ssSetOutputPortWidth(S, 4, 1); ssSetOutputPortComplexSignal(S, 4, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 4, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 4, 0); /* * Configure the output port 6 */ ssSetOutputPortDataType(S, 5, SS_DOUBLE); ssSetOutputPortWidth(S, 5, 1); ssSetOutputPortComplexSignal(S, 5, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 5, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 5, 0); /* * Configure the output port 7 */ ssSetOutputPortDataType(S, 6, SS_DOUBLE); ssSetOutputPortWidth(S, 6, 1); ssSetOutputPortComplexSignal(S, 6, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 6, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 6, 0); /* * Configure the output port 8 */ ssSetOutputPortDataType(S, 7, SS_DOUBLE); ssSetOutputPortWidth(S, 7, 1); ssSetOutputPortComplexSignal(S, 7, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 7, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 7, 0); /* * Configure the output port 9 */ ssSetOutputPortDataType(S, 8, SS_DOUBLE); ssSetOutputPortWidth(S, 8, 1); ssSetOutputPortComplexSignal(S, 8, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 8, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 8, 0); /* * Configure the output port 10 */ ssSetOutputPortDataType(S, 9, SS_DOUBLE); ssSetOutputPortWidth(S, 9, 1); ssSetOutputPortComplexSignal(S, 9, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 9, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 9, 0); /* * Configure the output port 11 */ ssSetOutputPortDataType(S, 10, SS_DOUBLE); ssSetOutputPortWidth(S, 10, 1); ssSetOutputPortComplexSignal(S, 10, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 10, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 10, 0); /* * Configure the output port 12 */ ssSetOutputPortDataType(S, 11, SS_DOUBLE); ssSetOutputPortWidth(S, 11, 1); ssSetOutputPortComplexSignal(S, 11, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 11, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 11, 0); /* * Configure the output port 13 */ ssSetOutputPortDataType(S, 12, SS_DOUBLE); ssSetOutputPortWidth(S, 12, 1); ssSetOutputPortComplexSignal(S, 12, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 12, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 12, 0); /* * Configure the output port 14 */ ssSetOutputPortDataType(S, 13, SS_DOUBLE); ssSetOutputPortWidth(S, 13, 1); ssSetOutputPortComplexSignal(S, 13, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 13, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 13, 0); /* * Configure the output port 15 */ ssSetOutputPortDataType(S, 14, SS_DOUBLE); ssSetOutputPortWidth(S, 14, 1); ssSetOutputPortComplexSignal(S, 14, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 14, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 14, 0); /* * Configure the output port 16 */ ssSetOutputPortDataType(S, 15, SS_DOUBLE); ssSetOutputPortWidth(S, 15, 1); ssSetOutputPortComplexSignal(S, 15, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 15, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 15, 0); /* * Configure the output port 17 */ ssSetOutputPortDataType(S, 16, SS_DOUBLE); ssSetOutputPortWidth(S, 16, 1); ssSetOutputPortComplexSignal(S, 16, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 16, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 16, 0); /* * Configure the output port 18 */ ssSetOutputPortDataType(S, 17, SS_DOUBLE); ssSetOutputPortWidth(S, 17, 1); ssSetOutputPortComplexSignal(S, 17, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 17, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 17, 0); /* * Configure the output port 19 */ ssSetOutputPortDataType(S, 18, SS_DOUBLE); ssSetOutputPortWidth(S, 18, 1); ssSetOutputPortComplexSignal(S, 18, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 18, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 18, 0); /* * Configure the output port 20 */ ssSetOutputPortDataType(S, 19, SS_DOUBLE); ssSetOutputPortWidth(S, 19, 1); ssSetOutputPortComplexSignal(S, 19, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 19, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 19, 0); /* * Configure the output port 21 */ ssSetOutputPortDataType(S, 20, SS_DOUBLE); ssSetOutputPortWidth(S, 20, 1); ssSetOutputPortComplexSignal(S, 20, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 20, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 20, 0); /* * Configure the output port 22 */ ssSetOutputPortDataType(S, 21, SS_UINT32); ssSetOutputPortWidth(S, 21, 1); ssSetOutputPortComplexSignal(S, 21, COMPLEX_NO); ssSetOutputPortOptimOpts(S, 21, SS_REUSABLE_AND_LOCAL); ssSetOutputPortOutputExprInRTW(S, 21, 0); /* * Register reserved identifiers to avoid name conflict */ if (ssRTWGenIsCodeGen(S)) { /* * Register reserved identifier for StartFcnSpec */ ssRegMdlInfo(S, "openFile", MDL_INFO_ID_RESERVED, 0, 0, ssGetPath(S)); /* * Register reserved identifier for OutputFcnSpec */ ssRegMdlInfo(S, "DrugLibraryReader", MDL_INFO_ID_RESERVED, 0, 0, ssGetPath(S)); /* * Register reserved identifier for TerminateFcnSpec */ ssRegMdlInfo(S, "closeFile", MDL_INFO_ID_RESERVED, 0, 0, ssGetPath(S)); } /* * This S-function can be used in referenced model simulating in normal mode. */ ssSetModelReferenceNormalModeSupport(S, MDL_START_AND_MDL_PROCESS_PARAMS_OK); /* * Set the number of sample time. */ ssSetNumSampleTimes(S, 1); /* * All options have the form SS_OPTION_<name> and are documented in * matlabroot/simulink/include/simstruc.h. The options should be * bitwise or'd together as in * ssSetOptions(S, (SS_OPTION_name1 | SS_OPTION_name2)) */ ssSetOptions(S, SS_OPTION_USE_TLC_WITH_ACCELERATOR | SS_OPTION_CAN_BE_CALLED_CONDITIONALLY | SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_WORKS_WITH_CODE_REUSE | SS_OPTION_SFUNCTION_INLINED_FOR_RTW | SS_OPTION_DISALLOW_CONSTANT_SAMPLE_TIME); }
/* 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) { /* Number of expected parameters */ ssSetNumSFcnParams(S, 0); /* * Set the number of pworks. */ ssSetNumPWork(S, 0); /* * Set the number of dworks. */ if (!ssSetNumDWork(S, 0)) return; /* * Set the number of input ports. */ if (!ssSetNumInputPorts(S, 0)) return; /* * Set the number of output ports. */ if (!ssSetNumOutputPorts(S, 0)) return; /* * Register reserved identifiers to avoid name conflict */ if (ssRTWGenIsCodeGen(S) || ssGetSimMode(S)==SS_SIMMODE_EXTERNAL) { /* * Register reserved identifier for StartFcnSpec */ ssRegMdlInfo(S, "Actuator_Initialization", MDL_INFO_ID_RESERVED, 0, 0, ssGetPath(S)); /* * Register reserved identifier for TerminateFcnSpec */ ssRegMdlInfo(S, "Actuator_Stop", MDL_INFO_ID_RESERVED, 0, 0, ssGetPath(S)); } /* * This S-function can be used in referenced model simulating in normal mode. */ ssSetModelReferenceNormalModeSupport(S, MDL_START_AND_MDL_PROCESS_PARAMS_OK); /* * Set the number of sample time. */ ssSetNumSampleTimes(S, 1); /* * All options have the form SS_OPTION_<name> and are documented in * matlabroot/simulink/include/simstruc.h. The options should be * bitwise or'd together as in * ssSetOptions(S, (SS_OPTION_name1 | SS_OPTION_name2)) */ ssSetOptions(S, SS_OPTION_USE_TLC_WITH_ACCELERATOR | SS_OPTION_CAN_BE_CALLED_CONDITIONALLY | SS_OPTION_EXCEPTION_FREE_CODE | SS_OPTION_WORKS_WITH_CODE_REUSE | SS_OPTION_SFUNCTION_INLINED_FOR_RTW | SS_OPTION_DISALLOW_CONSTANT_SAMPLE_TIME); ssSetSimulinkVersionGeneratedIn(S, "8.3"); }