| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
void ssSetRunTimeParamInfo(SimStruct *S, int_T param, ssParamRec *info)
SimStruct representing an S-Function block.
Index of a run-time parameter.
ssParamRec structure containing the attributes of the run-time parameter.
Use this function in mdlSetWorkWidths to specify information about a run-time parameter. Use an ssParamRec structure to pass the parameter attributes to the function. See Run-Time Parameters for more information.
The simstruc.h macro defines this structure as follows:
typedef struct ssParamRec_tag {
const char *name;
int_T nDimensions;
int_T *dimensions;
DTypeId dataTypeId;
boolean_T complexSignal;
void *data;
const void *dataAttributes;
int_T nDlgParamIndices;
int_T *dlgParamIndices;
TransformedFlag transformed; /* Transformed status */
boolean_T outputAsMatrix; /* Write out parameter
* as a vector (false)
* [default] or a matrix (true)
*/
} ssParamRec;
The record contains the following fields.
Name of the parameter. This must point to persistent memory. Do not set to a local variable (static char name[32] or strings name are okay).
Number of dimensions that this parameter has.
Array giving the size of each dimension of the parameter.
Data type of the parameter. For a list of built-in data types, see BuiltInDTypeId in simstruc_types.h.
Specifies whether this parameter has complex numbers (true) or real numbers (false) as values.
Pointer to the value of this run-time parameter. If the parameter is a vector or matrix or a complex number, this field points to an array of values representing the parameter elements. Complex Simulink signals are stored interleaved. Likewise complex run-time parameters must be stored interleaved. Note that mxArrays stores the real and complex parts of complex matrices as two separate contiguous pieces of data instead of interleaving the real and complex parts.
Note ssSetRunTimeParamInfo must set this field to the parameter's actual value. This is necessary for Real–Time Workshop to perform the parameter pooling optimization correctly. If you fail to set the data field at the time of registration and then fill it in at a later juncture, you might see an error indicating that some parameters were incorrectly pooled with each other. |
The data attributes pointer is a persistent storage location where the S-function can store additional information describing the data and then recover this information later (potentially in a different function).
Number of dialog parameters used to compute this run-time parameter.
Indices of dialog parameters used to compute this run-time parameter.
Specifies the relationship between this run-time parameter and the dialog parameters specified by dlgParamIndices. This field can have any of the following values defined by TransformFlag in simstruc.h.
RTPARAM_NOT_TRANSFORMED
Specifies that this run-time parameter corresponds to a single dialog parameter (nDialogParamIndices is one) and has the same value as the dialog parameter.
RTPARAM_TRANSFORMED
Specifies that the value of this run-time parameter depends on the values of multiple dialog parameters (nDialogParamIndices > 1) or that this run-time parameter corresponds to one dialog parameter but has a different value or data type.
RTPARAM_MAKE_TRANSFORMED_TUNABLE
Specifies that this run-time parameter corresponds to a single tunable dialog parameter (nDialogParamIndices is one) and that the run-time parameter's value or data type differs from the dialog parameter's. During code generation, the Real-Time Workshop product writes the data type and value of the run-time parameter (rather than the dialog parameter) out to the Real-Time Workshop file. For example, suppose that the dialog parameter contains a workspace variable k of type double and value 1. Further, suppose the S-function sets the data type of the corresponding run-time variable to int8 and the run-time parameter's value to 2. In this case, during code generation, the Real-Time Workshop product writes k out to the Real-Time Workshop file as an int8 variable with an initial value of 2.
Specifies whether to write the values of this parameter out to the model.rtw file as a matrix (true) or as a vector (false).
C, C++
See the S-function matlabroot/toolbox/simulink/simdemos/simfeatures/src/sfun_runtime4.c used in sfcndemo_runtime.mdl.
mdlSetWorkWidths, mdlProcessParameters, ssGetNumRunTimeParams, ssGetRunTimeParamInfo
![]() | ssSetRWorkValue | ssSetSampleTime | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |