This subroutine is used to specify the simulation time at which the sampling of the discrete states is to start.
See the definition of the SAMPLE_OFFSET attribute in the documentation for the GSE statement.
When the GSE is initialized Adams Solver (C++) will look for a GSE_SET_SAMPLE_OFFSET entry point in the GSE (if it was not explicitly specified using the INTERFACE= attribute). If GSE_SET_SAMPLE_OFFSET is present, then during initialization of the GSE this subroutine will be called.
Notes: | ■The value returned by GSE_SET_SAMPLE_OFFSET will override any SAMPLE_OFFSET attribute setting that is specified in the GSE statement. ■Use mixed case names for the Adams subroutine names when using the C style interface. For the default subroutine name capitalize the first letter and have the remaining letters lower case. Doing this ensures that Adams Solver correctly distinguishes a C style subroutine from Fortran and calls with the appropriate interface. |
This user-defined subroutine is new for Adams Solver (C++) v2006r1 and gives the GSE the ability to set the SAMPLE_OFFSET attribute itself. That is, the formulation of a GSE can be changed without changing the corresponding Adams model (.amd).
Calling Sequence and Structure
SUBROUTINE GSE_SET_SAMPLE_OFFSET (ID, SAMPLE_OFFSET)
Input Arguments
ID | An integer variable that gives the identifier of the GSE statement requesting information from the GSE subroutine. |
Output Arguments
SAMPLE_OFFSET | A double-precision variable specifying time simulation time at which the sampling of the discrete states is to start. |
Example
C
C+=================================================================*
C
SUBROUTINE GSE_SET_SAMPLE_OFFSET (ID, SAMPLE_OFFSET)
C
C Inputs:
C
INTEGER ID
C
C Outputs:
C
DOUBLE_PRECISION STATIC_HOLD
C
C Discrete states are to be sampled at time at time = 1.23.
C
SAMPLE_OFFSET = 1.23
RETURN
END
C
C+=================================================================*
C