Make a block parameter tunable
void ssSetSFcnParamTunable(SimStruct *S, int_T param, int_T isTunable)
S
SimStruct representing an S-Function block.
param
Index of the parameter.
isTunable
Valid values are SS_PRM_TUNABLE
(true
/ tunable),
SS_PRM_NOT_TUNABLE
(false
/
not tunable), or SS_PRM_SIM_ONLY_TUNABLE
(tunable
only during simulation).
Use this macro in mdlInitializeSizes
to specify whether a user
can change a dialog parameter during the simulation. The parameter index starts at 0
and is less than ssGetSFcnParamsCount(S)
. This improves
efficiency and provides error handling in the event that an attempt is made to
change the parameter.
If you specify the SS_PRM_TUNABLE
option, you must create a
corresponding run-time parameter (see Creating Run-Time Parameters). You do not
have to create a corresponding run-time parameter if you specify the
SS_PRM_SIM_ONLY_TUNABLE
option.
Note
Dialog parameters are tunable by default. However, an S-function should
declare the tunability of all parameters, whether tunable or not, to avoid
programming errors. If the user enables the simulation diagnostic
S-function upgrade needed
, the Simulink® engine issues the diagnostic whenever it encounters an S-function
that fails to specify the tunability of all its parameters.
C, C++
See the following S-functions for examples that use this function:
sfun_atol.c
used in sfcndemo_sfun_atol
stvctf.c
used in sfcndemo_stvctf
stvdtf.c
used in sfcndemo_stvdtf