Simulink Reference Previous page   Next Page
Simulink.MSFcnRunTimeBlock

Get runtime information about a Level-2 M-file S-function block.

Description

This class allows a Level-2 M-file S-function or other M program to obtain information from Simulink and provide information to Simulink about a Level-2 M-file S-function block. Simulink creates an instance of this class for each Level-2 M-file S-function block in a model. Simulink passes the object to the callback methods of Level-2 M-file S-functions when it updates or simulates a model, allowing the callback methods to get and provide block-related information to Simulink. See Writing Level-2 M-file S-functions for more information.

You can also use instances of this class in M-file programs to obtain information about Level-2 M-file S-function blocks during a a simulation. See Accessing Block Data During Simulation for more information.

Parent Class

Simulink.RunTimeBlock

Derived Classes

none

Property Summary

Name
Description
DialogPrmsTunable
Specifies which of the S-function's dialog parameters are tunable.
NextTimeHit
Time of the next sample hit for variable sample time S-functions.

Method Summary

Name
Description
AutoRegRuntimePrms
Register this block's dialog parameters as runtime parameters.
AutoUpdateRuntimePrms
Update this block's runtime parameters.
IsDoingConstantOutput
Determine whether the current simulation stage is the constant sample time stage.
IsMajorTimeStep
Determine whether the current simulation time step is a major time step.
IsSampleHit
Determine whether the current simulation time is one at which a task handled by this block is active.
IsSpecialSampleHit
Determine whether the current simulation time is one at which multiple tasks handled by this block are active.
IsSampleHit
Register a callback method for this block.
RegisterDataTypeFxpBinaryPoint
Register fixed-point data type with binary point-only scaling.
RegisterDataTypeFxpFSlopeFixExpBias
Register fixed-point data type with [Slope Bias] scaling specified in terms of fractional slope, fixed exponent, and bias.
RegisterDataTypeFxpSlopeBias
Register data type with [Slope Bias] scaling.
RegisterDataTypeFxpBinaryPoint
Specify whether to use this block's TLC file to generate the simulation target for the model that uses it.
SetPreCompPortInfoToDefaults
Set compiled attributes of this block's ports to default values.
SetPreCompPortInfoToDynamic
Set precompiled attributes of this block's ports to be inherited.
SetSimViewingDevice
Specify whether block is a viewer.
WriteRTWParam
Write custom parameter info to RTW file.

Properties


DialogPrmsTunable

Description:   Specifies whether a dialog parameter of the S-function is tunable. Tunable parameters are registered as run-time parameters when you call the AutoRegRuntimePrms method. Note that SimOnlyTunable parameters are not registered as run-time parameters.

Data Type:   array

Access:   RW



NextTimeHit

Description:   Time of the next sample hit for variable sample-time S-functions.

Data Type:   double

Access:   RW

Methods


AutoRegRuntimePrms

Purpose.:   Register a block's tunable dialog parameters as runtime parameters.

Syntax:   AutoRegRuntimePrms;

Description:   Register this block's tunable dialog parameters as runtime parameters.



AutoUpdateRuntimePrms

Purpose.:   Update a block's runtime parameters.

Syntax:   AutoRegRuntimePrms;

Description:   Automatically update the values of the run-time parameters during a call to mdlProcessParameters.



IsDoingConstantOutput

Purpose.:   Determine whether this is in the constant sample time stage of a simulation.

Syntax:   bVal = IsDoingConstantOutput;

Description:   Returns true if this is the ~constant sample time stage of a simulation, i.e., the stage at the beginning of a simulation where Simulink computes the values of block outputs that cannot change during the simulation (see Constant Sample Time). Use this method in the mdlOutputs method of an S-function with port-based sample times to avoid unnecessarily computing the outputs of ports that have constant sample time, i.e., ['inf', 0], i.e.,

See Specifying Port-Based Sample Times for more information.



IsMajorTimeStep

Purpose.:   Determine whether current time step is a major or a minor time step.

Syntax:   bVal = IsMajorTimeStep;

Description:   Returns true if the current time step is a major time step; false, if it is a minor time step. This method can be called only from mdlOutputs and mdlUpdate.



IsSampleHit

Purpose.:   Determine whether the current simulation time is one at which a task handled by this block is active.

Syntax:   bVal = IsSampleHit(stIdx);

Arguments:   
  

Description:   Use in Outputs or Update block methods when the M-file S-function has multiple sample times to determine whether a sample hit has occurred at stIdx. (Similar to ssIsSampleHit for C-Mex S-functions).



IsSpecialSampleHit

Purpose.:   Determine whether the current simulation time is one at which multiple tasks implemented by this block are active.

Syntax:   bVal = IsSpecialSampleHit(stIdx1,stIdx1);

Arguments:   
  

Description:   Use in Outputs or Update block methods to ensure the validity of data shared by multiple tasks running at different rates. Returns true if a sample hit has occurred at stIdx1 and a sample hit has also occurred at stIdx2 in the same time step. (Similar to ssIsSpecialSampleHit for C-Mex S-functions)



RegBlockMethod

Purpose:   Register a block callback method.

Syntax:   RegBlockMethod(methName, methHandle);

Arguments:   
  

Description:   Registers the block callback method specified by methName and methHandle. Use this method in a Level-2 M-file S-function to specify the block callback methods that the S-function implements.



RegisterDataTypeFxpBinaryPoint

Purpose:   Register fixed-point data type with binary point-only scaling.

Syntax:   dtID = RegisterDataTypeFxpBinaryPoint(isSigned, wordLength, fractionalSlope, fixedExponent, bias, obeyDataTypeOverride);

Arguments:   
  

Description:   This method registers a fixed-point data type with Simulink and returns a data type ID. The data type ID can be used to specify the data types of input and output ports, run-time parameters, and DWork states. It can also be used with all the standard data type access methods defined for instances of this class, such as DatatypeSize.

Use this function if you want to register a fixed-point data type with binary point-only scaling. Alternatively, you can use one of the other fixed-point registration functions:

If the registered data type is not one of the Simulink built-in data types, a Simulink Fixed Point license is checked out.



RegisterDataTypeFxpFSlopeFixExpBias

Purpose:   Register fixed-point data type with [Slope Bias] scaling specified in terms of fractional slope, fixed exponent, and bias

Syntax:   dtID = RegisterDataTypeFxpFSlopeFixExpBias(isSigned, wordLength, fractionalSlope, fixedExponent, bias, obeyDataTypeOverride);

Arguments:   
  

Description:   This method registers a fixed-point data type with Simulink and returns a data type ID. The data type ID can be used to specify the data types of input and output ports, run-time parameters, and DWork states.It can also be used with all the standard data type access methods defined for instances of this class, such as DatatypeSize.

Use this function if you want to register a fixed-point data type by specifying the word length, fractional slope, fixed exponent, and bias. Alternatively, you can use one of the other fixed-point registration functions:

If the registered data type is not one of the Simulink built-in data types, a Simulink Fixed Point license is checked out.



RegisterDataTypeFxpSlopeBias

Purpose:   Register data type with [Slope Bias] scaling.

Syntax:   dtID = RegisterDataTypeFxpSlopeBias(isSigned, wordLength, totalSlope, bias, obeyDataTypeOverride);

Arguments:   
  

Description:   This method registers a fixed-point data type with Simulink and returns a data type ID. The data type ID can be used to specify the data types of input and output ports, run-time parameters, and DWork states. It can also be used with all the standard data type access methods defined for instances of this class, such as DatatypeSize.

Use this function if you want to register a fixed-point data type with [Slope Bias] scaling. Alternatively, you can use one of the other fixed-point registration functions:

If the registered data type is not one of the Simulink built-in data types, a Simulink Fixed Point license is checked out.



SetAccelRunOnTLC

Purpose:   Specify whether to use block's TLC file to generate code for the Simulink accelerator.

Syntax:   SetAccelRunOnTLC(bVal);

Arguments:   
  

Description:   Specify if the block should use its TLC file to generate code that runs with the accelerator. If this option is 'false', the block runs in interpreted mode



SetPreCompPortInfoToDefaults

Purpose:   Set compiled attributes of this block to default values.

Syntax:   SetPreCompPortInfoToDefaults;

Description:   Initialize the compiled information (dimensions, datatype, complexity, and sampling mode) of this block's ports to have default attributes (double, real, sample-based scalars)



SetPreCompPortInfoToDynamic

Purpose:   Set compiled attributes of this block to be inherited.

Syntax:   SetPreCompPortInfoToDefaults;

Description:   Initialize the compiled information (dimensions, datatype, complexity, and sampling mode) of the block's ports to be inherited.



SetSimViewingDevice

Purpose:   Specify whether this block is a viewer.

Syntax:   SetSimViewingDevice(bVal);

Arguments:   
  

Description:   Specify if the block is a viewer/scope. If this flag is specified, the block will be used only during simulation and automatically stubbed out in generated code.



WriteRTWParam

Purpose:   Write a custom parameter to the RTW information file used for code generation.

Syntax:   WriteRTWParam(pType, pName, pVal)

Arguments:   

Description:   Use in the mdlRTW method of the M-file S-function to write out custom parameters. These parameters are generally settings used to determine how code should be generated in the TLC file for the S-function.


Previous page  Simulink.ModelWorkspace Simulink.NumericType Next page

© 1994-2005 The MathWorks, Inc.