This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Simulation Information

Handle unexpected events in S-Function blocks

S-Function Callback Methods

mdlGetSimState Return the C MEX S-function simulation state as a valid MATLAB data structure, such as a matrix structure or a cell array.
mdlSetSimState Set the simulation state of the C MEX S-function by restoring the SimState.

SimStruct Functions

ssSetStateAbsTol Set the absolute tolerance used by a variable-step solver for a specific S-function continuous state.
ssSetBlockReduction Request that the Simulink engine attempt to reduce a block
ssSetSimStateCompliance Specify the behavior of a Simulink S-function when saving and restoring the SimState of a model containing the S-function.
ssSetSimStateVisibility Specify whether to make the S-function's simulation state visible in the simulation state of the model.
ssSetSolverNeedsReset Ask Simulink engine to reset solver
ssSetSkipContStatesConsistencyCheck Ask Simulink engine to skip continuous state consistency check
ssSetStopRequested Set the simulation stop requested flag
ssGetBlockReduction Determine 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
ssGetErrorStatus Get a character vector that identifies the last error
ssGetFixedStepSize Get the fixed step size of the model containing the S-function.
ssGetSimMode Get the simulation mode of an S-Function block
ssGetSimStatus Get the current simulation status of an S-Function block
ssGetSolverMode Get the solver mode being used to solve the S-function
ssGetSolverName Get the name of the solver being used to solve the S-function
ssGetStateAbsTol Get the absolute tolerance used by the variable-step solver for a specified state
ssGetStopRequested Get the value of the simulation stop requested flag
ssGetT Get the current simulation time
ssGetTaskTime Get the current time for the current task
ssGetTFinal Get the simulation stop time
ssGetTNext Get the time of the next sample hit
ssGetTStart Get the simulation start time
ssIsExternalSim Determine if the model is running in external mode.
ssIsFirstInitCond Determine whether the simulation time is equal to the start time.
ssIsMajorTimeStep Determine whether the simulation is in a major step
ssIsMinorTimeStep Determine whether the simulation is in a minor step
ssIsVariableStepSolver Determine if a variable-step solver is being used to solve the S-function
ssRTWGenIsAccelerator Determine if the model is running in Accelerator mode.
ssIsRapidAcceleratorActive Determine whether the model is running in Rapid Accelerator mode

Examples and How To

S-Function Compliance with the SimState

How to save and restore SimState for further simulation.


S-Function Callback Methods

Description of S-function callback methods

S-Function SimStruct Functions

Overview of SimStruct macros and functions.

Was this topic helpful?