本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

配置 C/C++ S-Function 功能

配置 C/C++ S-Function 的模块功能

C/C++ S-Function 允许您通过各种回调和 SimStruct 方法配置扩展的模块功能。

  • 创建和配置输入/输出端口。

  • 指定基于模块和基于端口的采样时间。

  • 将对话框参数传递给 S-Function。

  • 对过零情况建模并为 S-Function 分配内存。

  • 配置 S-Function 的代码生成设置。

S-Function 回调方法

全部展开

初始化、输出、终止

mdlInitializeSizesSpecify the number of inputs, outputs, states, parameters, and other characteristics of the C MEX S-function
mdlInitializeSampleTimesSpecify the sample rates at which this C MEX S-function operates
mdlOutputsCompute the signals that this block emits
mdlUpdateUpdate a block's states
mdlTerminatePerform any actions required at termination of the simulation

信号规范

mdlSetDefaultPortComplexSignalsSet the numeric types (real, complex, or inherited) of ports whose numeric types cannot be determined from block connectivity
mdlSetDefaultPortDataTypesSet the data types of ports whose data types cannot be determined from block connectivity
mdlSetDefaultPortDimensionInfoSet the default dimensions of the signals accepted or emitted by a C MEX S-function's ports
mdlSetInputPortComplexSignalSet the numeric types (real, complex, or inherited) of the signals accepted by an input port
mdlSetInputPortDataTypeSet the data types of the signals accepted by an input port
mdlSetInputPortSampleTimeSet the sample time of an input port that inherits its sample time from the port to which it is connected
mdlSetOutputPortComplexSignalSet the numeric types (real, complex, or inherited) of the signals accepted by an output port
mdlSetOutputPortDataTypeSet the data type of the signals emitted by an output port
mdlSetOutputPortSampleTimeSet the sample time of an output port that inherits its sample time from the port to which it is connected

信号维度

mdlSetInputPortDimensionInfoSet the dimensions of the signals accepted by an input port
mdlSetInputPortDimensionsModeFcnPropagate the dimensions mode
mdlSetInputPortWidthSet the width of an input port that accepts 1-D (vector) signals
mdlSetOutputPortDimensionInfoSet the dimensions of the signals accepted by an output port
mdlSetOutputPortWidthSet the width of an output port that outputs 1-D (vector) signals

信号访问权限

mdlSetWorkWidthsSpecify the sizes of the work vectors and create the run-time parameters required by this C MEX S-function
mdlSetInputPortSampleTimeSet the sample time of an input port that inherits its sample time from the port to which it is connected
mdlSetOutputPortSampleTimeSet the sample time of an output port that inherits its sample time from the port to which it is connected
mdlSetWorkWidthsSpecify the sizes of the work vectors and create the run-time parameters required by this C MEX S-function
mdlCheckParametersCheck the validity of a C MEX S-function's parameters
mdlProcessParametersProcess the C MEX S-function's parameters
mdlStartInitialize the state vectors of this C MEX S-function
mdlProcessParametersProcess the C MEX S-function's parameters
mdlSetWorkWidthsSpecify the sizes of the work vectors and create the run-time parameters required by this C MEX S-function

仿真信息

mdlGetOpeartingPointReturn C MEX S-function's simulation operating point as a MATLAB data structure
mdlSetOperatingPointRestore operating point of C MEX S-function

错误处理

mdlGetTimeOfNextVarHitDetermine the time of the next sample time hit
mdlDerivativesCompute the C MEX S-function's derivatives
mdlSetWorkWidthsSpecify the sizes of the work vectors and create the run-time parameters required by this C MEX S-function
mdlZeroCrossingsUpdate zero-crossing vector
mdlInitializeConditionsInitialize the state vectors of this C MEX S-function

SimStruct 函数

全部展开

信号设定

ssSetNumInputPortsSpecify the number of input ports that a block has
ssSetInputPortComplexSignalSet the numeric type (real or complex) of an input port
ssSetInputPortDataTypeSet the data type of an input port
ssSetInputPortDirectFeedThroughSpecify the direct feedthrough status of a block's ports
ssSetInputPortOffsetTimeSpecify the offset time of an input port
ssSetInputPortRequiredContiguousSpecify that the signal elements entering a port must be contiguous
ssSetInputPortSampleTimeSpecify the sample time of an input port
ssRegisterUnitFromExprRegister unit from unit expression
ssSetInputPortUnitSpecify unit of input port
ssSetNumOutputPortsSpecify the number of output ports that a block has
ssSetOutputPortComplexSignalSet the numeric type (real or complex) of an output port
ssSetOutputPortDataTypeSet the data type of an output port
ssSetOutputPortOffsetTimeSpecify the offset time of an output port
ssSetOutputPortSampleTimeSpecify the sample time of an output port
ssSetOutputPortUnitSpecify unit of output port
ssGetInputPortComplexSignalDetermine whether an input port accepts complex signals.
ssGetInputPortDataTypeGet the data type of an input port
ssGetInputPortDirectFeedThroughDetermine whether a port has direct feedthrough
ssGetInputPortFrameDataDetermine whether a port accepts signal frames
ssGetInputPortOffsetTimeGet the offset time of an input port
ssGetInputPortRequiredContiguousDetermine whether the signal elements entering a port must be contiguous
ssGetInputPortSampleTimeGet the sample time of an input port
ssGetInputPortSampleTimeIndexGet the sample time index of an input port
ssGetInputPortUnitGet unit of input port
ssGetOutputPortComplexSignalGet the numeric type (complex or real) of an output port
ssGetOutputPortDataTypeGet the data type of an output port
ssGetOutputPortFrameDataDetermine whether a port outputs signal frames
ssGetOutputPortOffsetTimeGet the offset time of an output port
ssGetOutputPortSampleTimeGet the sample time of an output port
ssGetOutputPortUnitGet unit of output port
ssAllowSignalsWithMoreThan2DEnable S-function to work with multidimensional signals
ssSetOneBasedIndexInputPortSpecify that an input port expects one-based indices
ssSetOneBasedIndexOutputPortSpecify that an output port emits one-based indices.
ssSetZeroBasedIndexInputPortSpecify that an input port expects zero-based indices
ssSetZeroBasedIndexOutputPortSpecify that an output port emits zero-based indices.

信号访问权限

ssGetNumInputPortsGet the number of input ports that a block has
ssGetNumOutputPortsGet the number of output ports that a block has
ssGetInputPortBufferDstPortDetermine the output port that is sharing this input port's buffer
ssGetInputPortConnectedDetermine whether a port is connected to a nonvirtual block
ssGetInputPortOptimOptsGet the reusability setting of the memory allocated to the input port of an S-function
ssGetInputPortOverWritableDetermine whether an input port can be overwritten
ssGetInputPortRealSignalGet the address of a real, contiguous signal entering an input port
ssGetInputPortRealSignalPtrsGet pointers to signals of type double connected to an input port
ssGetInputPortSignalGet the address of a contiguous signal entering an input port
ssGetInputPortSignalPtrsGet pointers to an input port's signal elements
ssGetOutputPortConnectedDetermine whether an output port is connected to a nonvirtual block
ssGetOutputPortBeingMergedDetermine whether the output of this block is connected to a Merge block
ssGetOutputPortOptimOptsGet the reusability setting of the memory allocated to the output port of an S-function
ssGetOutputPortRealSignalGet a pointer to an output signal of type double (real_T)
ssGetOutputPortSignalGet the vector of signal elements emitted by an output port
ssSetInputPortOptimOptsSpecify reusability of the memory allocated to the input port of an S-function
ssSetInputPortOverWritableSpecify whether one of an S-function's input ports can be overwritten by one of its output ports
ssSetOutputPortOptimOptsSpecify reusability of the memory allocated to the output port of an S-function
ssSetOutputPortOverwritesInputPortSpecify whether an output port can share its memory buffer with an input port

信号维度

ssSetInputPortDimensionInfoSpecify information about the dimensionality of an input port
ssSetInputPortDimensionsModeSet the dimensions mode of the input port indexed by pIdx
ssSetInputPortDimsSameAsOutputPortDimsSet the dimensions of output port outIdx to be equal to the dimensions of input port inpIdx. This method is called from mdlSetWorkWidths.
ssSetInputPortMatrixDimensionsSpecify dimension information for an input port that accepts matrix signals
ssSetInputPortVectorDimensionSpecify dimension information for an input port that accepts vector signals
ssSetInputPortWidthSpecify the width of an input port
ssPruneNDMatrixSingletonDimsPrune trailing singleton dimensions
ssSetCurrentOutputPortDimensionsSet the current size corresponding to dimension dIdx of the output signal at port pIdx.
ssSetOutputPortDimensionInfoSpecify information about the dimensionality of an output port
ssSetOutputPortDimensionsModeSet the dimensions mode of the output port indexed by pIdx
ssSetOutputPortMatrixDimensionsSpecify dimension information for an output port that emits matrix signals
ssSetOutputPortVectorDimensionSpecify dimension information for an output port that emits vector signals
ssSetOutputPortWidthSpecify the width of an output port
ssSetOutputPortMatrixDimensionsSpecify dimension information for an output port that emits matrix signals
ssAddOutputDimsDependencyRuleRegister a method to handle current dimensions update.
ssAddVariableSizeSignalsRuntimeCheckerRegister a method to check the current input dimensions
ssAllowSignalsWithMoreThan2DEnable S-function to work with multidimensional signals
ssRegMdlSetInputPortDimensionsModeFcnRegister the method to handle dimensions mode propagation for each input port.
ssSetDWorkRequireResetForSignalSizeSet the block flag for resetting the dIndex Dwork size upon subsystem reset.
ssSetSignalSizesComputeTypeSet the type of output dependency on the input signal.
ssSetVectorModeSpecify the vector mode that an S-function supports
ssGetCurrentInputPortDimensionsGet the current size of dimension dIdx of input port pIdx
ssGetCurrentInputPortWidthGet the total width (total number of elements) of the signal at input port pIdx
ssGetInputPortDimensionsGet the dimensions of the signal accepted by an input port
ssGetInputPortDimensionSizeGet the size of one dimension of the signal entering an input port
ssGetInputPortDimensionsModeGet the dimensions mode of the input port indexed by pIdx
ssGetInputPortNumDimensionsGet the dimensionality of the signals accepted by an input port
ssGetInputPortWidthGet the width of an input port
ssGetCurrentOutputPortDimensionsGet the current size of dimension dIdx of the signal at output port pIdx.
ssGetCurrentOutputPortWidthGet the total width (total number of elements) of the signal at output port pIdx.
ssGetOutputPortDimensionsGet the dimensions of the signal leaving an output port
ssGetOutputPortDimensionSizeGet the size of one dimension of the signal leaving an output port
ssGetOutputPortDimensionsModeGet the dimensions mode of the output port indexed by pIdx
ssGetOutputPortNumDimensionsGet the number of dimensions of an output port
ssGetOutputPortWidthGet the width of an output port

信号区域

ssCallSelectedSignalsFcnInvoke the selected signals function for an S-function
ssCallSigListCreateFcnInvoke the signal list creation function for an S-function
ssCallSigListDestroyFcnInvoke the signal list destruction function for an S-function
ssCallSigListUnavailSigAlertFcnInvoke the unavailable signal alert function for a signal list in an S-function
ssCallGenericDestroyFcnInvoke the generic destruction function for an S-function
ssCallGetPortNameFcnGet the name for a given port
ssCallUnselectSigFcnInvoke the signal deselection function for an S-function
gsl_FirstRegGet the first region of an element in a signal list
gsl_nSigRegionsGet the number of regions in an element of a signal list
gsl_nSigsGet the number of signals in a signal list
gsl_NumElementsGet the number of elements in an element of a signal list
gsl_PortObjGet the port associated with an element of a signal list
gsl_TieWrapDetermine whether an element in a signal list is contiguous
gsr_ComplexDetermine whether the data in a signal region is complex
gsr_currDimsAccess the current dimensions for a variable-sized signal in a signal region
gsr_dataAccess the data in a signal region
gsr_DataTypeGet the Simulink data type identifier for a region
gsr_DataTypeSizeGet the size of a single real value in a signal region
gsr_DimsAccess the values in the dimensions vector for a signal region
gsr_nElsGet the number of elements in a region
gsr_NextRegGet next region in the corresponding signal list
gsr_NumDimsGet the number of dimensions of the data in a signal region
gsr_portObjGet the port associated with a signal region
gsr_startIdxGet the index for the element in a signal list at the start of a region
gsr_statusDetermine whether signal in a signal region is available
gsr_UnitGet the Simulink unit identifier for a signal region
gsr_MDetermine number of rows in matrix signal
gsr_NGet the number of rows in or width of a signal
ssGetDTypeIdFromMxArrayGet the data type of an S-function parameter
ssGetNumSFcnParamsGet the number of parameters that an S-Function block expects
ssGetSFcnParamGet a parameter of an S-Function block
ssGetSFcnParamsCountGet the number of block dialog parameters that an S-Function block has
ssSetNumSFcnParamsSpecify the number of parameters that an S-Function block has
ssSetSFcnParamTunableMake a block parameter tunable

采样时间

ssSetSampleTimeSet the period of a sample time
ssSetInputPortSampleTimeSpecify the sample time of an input port
ssSetModelReferenceSampleTimeDefaultInheritanceSpecify that a referenced model containing this S-function can inherit its sample time from its parent model
ssSetModelReferenceSampleTimeDisallowInheritanceSpecify that the use of this S-function in a referenced model prevents the referenced model from inheriting its sample time from its parent model
ssSetModelReferenceSampleTimeInheritanceRuleSpecify whether use of this S-function in a referenced model prevents the referenced model from inheriting its sample time from its parent model
ssSetNumSampleTimesSpecify the number of sample times that an S-Function block has
ssSetOffsetTimeSet the offset time of a block
ssSetTNextSet the time of the next sample hit
ssSetVariableDiscreteSampleTimeRegister controllable sample time in a block
ssSetNumTickstoNextHitForVariableDiscreteSchedule number of steps to next event
ssSetNeedAbsoluteTimeSpecify if a block should use absolute time
ssSetTimeSourceSet source of time for asynchronous task
ssGetInputPortSampleTimeGet the sample time of an input port
ssGetInputPortSampleTimeIndexGet the sample time index of an input port
ssGetNumSampleTimesGet the number of sample times that a block has
ssGetOffsetTimeGet one of an S-function's sample time offsets.
ssGetOutputPortSampleTimeGet the sample time of an output port
ssGetOutputPortSampleTimeIndexGet sample time index of output port
ssGetPortBasedSampleTimeBlockIsTriggeredDetermine whether a block that uses port-based sample times resides in a triggered subsystem
ssGetSampleTimeGet one of an S-function's sample times.
ssGetTNextGet the time of the next sample hit
ssSetParameterTuningComplianceSpecify sample time behavior and tunability for S-function blocks with port-based sample times
ssGetParameterTuningComplianceGet the sample time behavior and tunability for S-function blocks with port-based sample times
ssIsContinuousTaskDetermine whether a task is continuous
ssIsSampleHitDetermine whether the sample time is hit
ssIsSpecialSampleHitDetermine whether the sample time is hit
ssSampleAndOffsetAreTriggeredDetermine whether a sample time and offset value pair indicate a triggered sample time
ssSampleAndOffsetAreTriggeredOrAsyncDetermine whether a sample time and offset value pair indicate a triggered or asynchronous sample time

数据类型

ssRegisterDataTypeRegister a custom data type
ssRegisterTypeFromNamedObjectRegister a custom data type from a Simulink.AliasType, Simulink.NumericType, or Simulink.Bus object.
ssSetDataTypeSizeSet the size of a custom data type
ssSetDataTypeZeroSet the zero representation of a data type
ssSetInputPortDataTypeSet the data type of an input port
ssSetOutputPortDataTypeSet the data type of an output port
ssGetDataTypeIdGet the ID of a data type
ssGetDataTypeIdAliasedThruToGet the base data type associated with a data type alias
ssGetDataTypeNameGet the name of a data type
ssGetDataTypeSizeGet the size of a custom data type
ssGetDataTypeZeroGet the zero representation of a data type
ssGetInputPortDataTypeGet the data type of an input port
ssGetNumDataTypesGet number of data types registered for this simulation, including built-in types
ssGetOutputPortDataTypeGet the data type of an output port
ssGetOutputPortSignalGet the vector of signal elements emitted by an output port
ssGetSFcnParamDataTypeGet the data type of a parameter for an S-Function block

总线

ssGetBusElementComplexSignalGet the signal complexity for a bus element
ssGetBusElementDataTypeGet the data type identifier for a bus element
ssGetBusElementDimensionsGet the dimensions of a bus element
ssGetBusElementNameGet the name of a bus element
ssGetBusElementNumDimensionsGet the number of dimensions for a bus element
ssGetBusElementOffsetGet the offset from the start of the bus data type to a bus element
ssGetNumBusElementsGet the number of elements in a bus signal
ssGetSFcnParamNameGet the value of a block parameter for an S-function block
ssIsDataTypeABusDetermine whether a data type identifier represents a bus signal
ssRegisterTypeFromParameterRegister a data type that a parameter in the Simulink data type table specifies
ssRegisterTypeFromNamedObjectRegister a custom data type from a Simulink.AliasType, Simulink.NumericType, or Simulink.Bus object.
ssSetBusInputAsStructSpecify whether to convert the input bus signal for an S-function from virtual to nonvirtual
ssSetBusOutputAsStructSpecify whether the output bus signal from an S-function must be virtual or nonvirtual
ssSetBusOutputObjectNameSpecify the name of the bus object that defines the structure and type of the output bus signal
ssGetNumRunTimeParamsGet the number of run-time parameters created by this S-function
ssGetRunTimeParamInfoGet the attributes of a run-time parameter
ssRegAllTunableParamsAsRunTimeParamsRegister all tunable parameters as run-time parameters
ssRegDlgParamAsRunTimeParamRegister a dialog parameter as a run-time parameter
ssSetNumRunTimeParamsSpecify the number of run-time parameters created by this S-function
ssSetRunTimeParamInfoSpecify the attributes of a run-time parameter
ssUpdateAllTunableParamsAsRunTimeParamsUpdate the values of run-time parameters to be the same as those of the corresponding tunable dialog parameters
ssUpdateDlgParamAsRunTimeParamUpdate a run-time parameter that corresponds to a dialog parameter
ssUpdateRunTimeParamDataUpdate the value of a run-time parameter
ssUpdateRunTimeParamInfoUpdate the attributes of a run-time parameter

函数调用子系统

ssCallSystemWithTidCall the update and outputs methods of a function-call subsystem
ssDisableSystemWithTidDisable a function-call subsystem connected to this S-function block
ssEnableSystemWithTidEnable a function-call subsystem connected to this S-function
ssGetCallSystemNumFcnCallDestinations Get the number of function-call destinations.
ssGetExplicitFCSSCtrlDetermine whether this S-function explicitly enables and disables the function-call subsystems that it invokes
ssSetCallSystemOutputSpecify that an output port is issuing a function call
ssSetExplicitFCSSCtrlSpecify whether this S-function explicitly enables and disables the function-call subsystem that it calls

Simulink 函数

ssDeclareSimulinkFunctionDeclare Simulink Function with a given function prototype and scope.
ssDeclareFunctionCallerDeclare Simulink Function call with a given function prototype.
ssCallSimulinkFunctionCall a declared Simulink Function of a given function prototype at run time.
ssQuerySimulinkFunctionDetermine if function name is declared as a Simulink Function.
ssGetSimulinkFunctionInputGet a pointer to an input argument passed to a Simulink Function.
ssGetSimulinkFunctionOutputGet a pointer to an output argument passed to a Simulink Function.
ssSetSimulinkFunctionArgComplexityDeclare complexity of a Simulink Function argument.
ssSetSimulinkFunctionArgDataTypeDeclare data type of Simulink Function argument.
ssSetSimulinkFunctionArgDimensionsDeclare dimension of Simulink Function argument.

模型引用

ssRTWGenIsModelReferenceRTWTargetDetermine if the model reference Simulink Coder target is generating
ssRTWGenIsModelReferenceSimTargetDetermine if the model reference simulation target is generating
ssSetModelReferenceNormalModeSupportSpecify if S-function can be used in referenced model simulating in normal mode
ssSetModelReferenceSampleTimeDefaultInheritanceSpecify that a referenced model containing this S-function can inherit its sample time from its parent model
ssSetModelReferenceSampleTimeDisallowInheritanceSpecify that the use of this S-function in a referenced model prevents the referenced model from inheriting its sample time from its parent model
ssSetModelReferenceSampleTimeInheritanceRuleSpecify whether use of this S-function in a referenced model prevents the referenced model from inheriting its sample time from its parent model

仿真信息

ssSetStateAbsTolSet the absolute tolerance used by a variable-step solver for a specific S-function continuous state.
ssSetBlockReductionRequest that the Simulink engine attempt to reduce a block
ssSetOperatingPointComplianceSpecify the behavior of a Simulink S-function when saving and restoring the operating point of a model containing the S-function
ssSetOperatingPointVisibilitySpecify whether to make the S-function simulation operating point visible in model simulation operating point
ssSetSolverNeedsResetAsk Simulink engine to reset solver
ssSetSkipContStatesConsistencyCheckAsk Simulink engine to skip continuous state consistency check
ssSetStopRequestedSet the simulation stop requested flag
ssGetBlockReductionDetermine whether a block has requested block reduction before the simulation has begun and whether it has actually been reduced after the simulation loop has begun
ssGetErrorStatusGet a character vector that identifies the last error
ssGetFixedStepSizeGet the fixed step size of the model containing the S-function.
ssGetMaxStepSizeGet the maximum step size used by the model containing the S-function.
ssGetMinStepSizeGet the minimum step size used by the model containing the S-function.
ssGetSimModeGet the simulation mode of an S-Function block
ssGetSimStatusGet the current simulation status of an S-Function block
ssGetSolverModeGet the solver mode being used to solve the S-function
ssGetSolverNameGet the name of the solver being used to solve the S-function
ssGetStateAbsTolGet the absolute tolerance used by the variable-step solver for a specified state
ssGetStopRequestedGet the value of the simulation stop requested flag
ssGetTGet the current simulation time
ssGetTaskTimeGet the current time for the current task
ssGetTFinalGet the simulation stop time
ssGetTNextGet the time of the next sample hit
ssGetTStartGet the simulation start time
ssIsExternalSimDetermine if the model is running in external mode.
ssIsFirstInitCondDetermine whether the simulation time is equal to the start time.
ssIsMajorTimeStepDetermine whether the simulation is in a major step
ssIsMinorTimeStepDetermine whether the simulation is in a minor step
ssIsVariableStepSolverDetermine if a variable-step solver is being used to solve the S-function
ssRTWGenIsAccelerator Determine if the model is running in Accelerator mode.
ssIsRapidAcceleratorActiveDetermine whether the model is running in Rapid Accelerator mode

错误处理

ssGetErrorStatusGet a character vector that identifies the last error
ssGetLocalErrorStatusGet a character vector that identifies the last error
ssPrintfPrint a variable-content message
ssSetErrorStatusReport an error
ssSetLocalErrorStatusReport an error in a thread-safe manner
ssWarningDisplay a warning message

信息和选项

ssSetOptionsSpecify S-function options
ssCallExternalModeFcnInvoke the external mode function for an S-function
ssGetModelNameGet the model name
ssGetParentSSGet the parent of a SimStruct
ssGetPathGet the path of a block
ssGetRootSSGet the root of a SimStruct hierarchy
ssGetUserDataAccess user data
ssSetExternalModeFcnSpecify the external mode function for an S-function
ssSetPlacementGroupSpecify the name of the placement group of a block
ssSetUserDataSpecify user data
ssSupportsMultipleExecInstancesSpecify that a For Each Subsystem block supports an S-function operating inside the subsystem.
ssSetNumDWorkSpecify the number of data type work vectors used by a block
ssSetDWorkComplexSignalSpecify whether the elements of a data type work vector are real or complex
ssSetDWorkDataTypeSpecify the data type of a data type work vector
ssSetDWorkNameSpecify the name of a data type work vector
ssSetDWorkUsageTypeSpecify how DWork vector is used in S-function
ssSetDWorkUsedAsDStateSpecify that a data type work vector is used as a discrete state vector
ssSetDWorkWidthSpecify the width of a data type work vector
ssGetNumDWorkGet the number of data type work vectors used by a block
ssGetDWorkGet a DWork vector
ssGetDWorkComplexSignalDetermine whether the elements of a data type work vector are real or complex numbers
ssGetDWorkDataTypeGet the data type of a data type work vector
ssGetDWorkNameGet the name of a data type work vector
ssGetDWorkUsageTypeDetermine how DWork vector is used in S-function
ssGetDWorkUsedAsDStateDetermine whether a data type work vector is used as a discrete state vector
ssGetDWorkWidthGet the size of a data type work vector
ssGetdXGet the derivatives of a block's continuous states
ssSetNumContStatesSpecify the number of continuous states that a block has
ssSetNumDiscStatesSpecify the number of discrete states that a block has
ssSetNumNonsampledZCsSpecify the number of states for which a block detects zero crossings that occur between sample points
ssGetContStatesGet a block's continuous states
ssGetDiscStatesGet a block's discrete states
ssGetRealDiscStatesGet a block's discrete state vector
ssGetNonsampledZCsGet the zero-crossing signal values
ssGetNumContStatesGet the number of continuous states that a block has
ssGetNumDiscStatesGet the number of discrete states that a block has
ssGetNumNonsampledZCsGet the size of the zero-crossing vector
ssSetNumRWorkSpecify the size of a block's floating-point work vector
ssGetNumRWorkGet the size of a block's floating-point work vector
ssGetRWorkGet a block's floating-point work vector
ssGetRWorkValueGet an element of a block's floating-point work vector
ssSetRWorkValueSet an element of a block's floating-point work vector
ssSetNumIWorkSpecify the size of a block's integer work vector
ssGetNumIWorkGet the size of a block's integer work vector
ssGetIWorkGet a block's integer work vector
ssGetIWorkValueGet an element of a block's integer work vector
ssSetIWorkValueSet an element of a block's integer work vector
ssSetNumPWorkSpecify the size of a block's pointer work vector
ssGetNumPWorkGet the size of a block's pointer work vector
ssGetPWorkGet a block's pointer work vector
ssGetPWorkValueGet a pointer from a block's pointer work vector
ssSetPWorkValueSet an element of a block's pointer work vector
ssSetNumModesSpecify the size of the block's mode vector
ssGetNumModesGet the size of the mode vector
ssGetModeVectorGet the mode vector
ssGetModeVectorValueGet an element of a block's mode vector
ssSetModeVectorValueSet an element of a block's mode vector
ssGetDWorkRTWIdentifierGet the identifier used to declare a DWork vector in code generated from the associated S-function
ssGetDWorkRTWIdentifierMustResolveToSignalObjectGet a flag indicating if a DWork vector resolves to a Simulink.Signal object
ssGetDWorkRTWStorageClassGet the storage class of a DWork vector in code generated from the associated S-function
ssGetDWorkRTWTypeQualifierGet the C type qualifier (e.g., const) used to declare a DWork vector in code generated from the associated S-function
ssGetPlacementGroupGet the name of the placement group of a block
ssRTWGenIsCodeGenIdentify any code generation that is not used by the Accelerator.
ssSetArrayLayoutForCodeGenSpecify array layout of the S-function
ssSetDWorkRTWIdentifierSpecify the identifier used to declare a DWork vector in code generated from the associated S-function
ssSetDWorkRTWIdentifierMustResolveToSignalObjectSpecify if a DWork vector resolves to a Simulink.Signal object
ssSetDWorkRTWStorageClassSpecify the storage class of a DWork vector in code generated from the associated S-function
ssSetDWorkRTWTypeQualifierSpecify the C type qualifier (e.g., const) used to declare a DWork vector in code generated from the associated S-function
ssSetPlacementGroupSpecify the name of the placement group of a block
ssWriteRTW2dMatParamWrite a matrix parameter to the model.rtw file
ssWriteRTWMx2dMatParamWrite a matrix parameter in MATLAB format to the model.rtw file
ssWriteRTWMxVectParamWrite a vector parameter in MATLAB format to the model.rtw file
ssWriteRTWParametersWrite tunable parameter information to the model.rtw file
ssWriteRTWParamSettingsWrite values of nontunable parameters to the model.rtw file
ssWriteRTWScalarParamWrite a scalar parameter to the model.rtw file
ssWriteRTWStrWrite a character vector to the model.rtw file
ssWriteRTWStrParamWrite a character vector parameter to the model.rtw file
ssWriteRTWStrVectParamWrite a vector of character vector parameters to the model.rtw file
ssWriteRTWVectParamWrite a vector parameter to the model.rtw file
ssWriteRTWWorkVectWrite work vectors to the model.rtw file

主题

Input and Output Ports

Create input and output ports on a C/C++ S-function block.

Pass Dialog Parameters to S-Functions

Process parameters via the C/C++ S-function block dialog box.

Specify S-Function Sample Times

Specify the rate at which a block operates in C/C++ S-functions.

DWork Vector Basics

Learn the key concepts of DWork vectors.

Configure Custom Data Types

Configure custom data types for the values of a block's signals and parameters in C/C++ S-functions.

Implement Function-Call Subsystems with S-Functions

Create function-call subsystems with S-functions.

使用函数调用子系统

创建通过函数调用执行的子系统。

S-Function Compliance with the ModelOperatingPoint

Use ModelOperatingPoint object in C-MEX S-functions to save and restore simulation data.

Create and Update S-Function Run-Time Parameters

Create and update run-time parameters in C/C++ S-functions.

Use C/C++ S-Functions as Sim Viewing Devices in External Mode

Specify C/C++ S-function as a sim viewing device for use in external mode.

Handle Errors in S-Functions

Handle unexpected events in S-functions.