anchor.diff:  SUBROUTINE ModName_JacobianPDiscState( t, u, p, x, xd, z, OtherState, m, dYdxd, dXdxd, dXddxd, dZdxd, ErrStat, ErrMsg )
   !..................................................................................................................................
   
  -      REAL(DbKi),                                INTENT(IN   )           :: t          !< Current simulation time in seconds
  -      TYPE(ModName_InputType),                   INTENT(IN   )           :: u          !< Inputs at t
  -      TYPE(ModName_ParameterType),               INTENT(IN   )           :: p          !< Parameters
  -      TYPE(ModName_ContinuousStateType),         INTENT(IN   )           :: x          !< Continuous states at t
  -      TYPE(ModName_DiscreteStateType),           INTENT(IN   )           :: xd         !< Discrete states at t
  -      TYPE(ModName_ConstraintStateType),         INTENT(IN   )           :: z          !< Constraint states at t
  -      TYPE(ModName_OtherStateType),              INTENT(IN   )           :: OtherState !< Other states at t
  -      TYPE(ModName_MiscVarType),                 INTENT(INOUT)           :: m          !< Misc/optimization variables
  -      REAL(ReKi), ALLOCATABLE, OPTIONAL,         INTENT(  OUT)           :: dYdxd      !< Partial derivatives of output functions
  -                                                                                       !!  (Y) with respect to the discrete
  -                                                                                       !!  states (xd)
  -      REAL(ReKi), ALLOCATABLE, OPTIONAL,         INTENT(  OUT)           :: dXdxd      !< Partial derivatives of continuous state
  -                                                                                       !!   functions (X) with respect to the
  -                                                                                       !!   discrete states (xd)
  -      REAL(ReKi), ALLOCATABLE, OPTIONAL,         INTENT(  OUT)           :: dXddxd     !< Partial derivatives of discrete state
  -                                                                                       !!   functions (Xd) with respect to the
  -                                                                                       !!   discrete states (xd)
  -      REAL(ReKi), ALLOCATABLE, OPTIONAL,         INTENT(  OUT)           :: dZdxd      !< Partial derivatives of constraint state
  -                                                                                       !!   functions (Z) with respect to the
  -                                                                                       !!   discrete states (xd)
  -      INTEGER(IntKi),                            INTENT(  OUT)           :: ErrStat    !< Error status of the operation
  -      CHARACTER(*),                              INTENT(  OUT)           :: ErrMsg     !< Error message if ErrStat /= ErrID_None
  -
  -
  -         ! Initialize ErrStat
  -
  -      ErrStat = ErrID_None
  -      ErrMsg  = ""
  -
  -
  -      IF ( PRESENT( dYdxd ) ) THEN
  -
  -         ! Calculate the partial derivative of the output functions (Y) with respect to the discrete states (xd) here:
  -
  -         ! allocate and set dYdxd
  -
  -      END IF
  -
  -      IF ( PRESENT( dXdxd ) ) THEN
  -
  -         ! Calculate the partial derivative of the continuous state functions (X) with respect to the discrete states (xd) here:
  -
  -         ! allocate and set dXdxd
  -
  -      END IF
  -
  -      IF ( PRESENT( dXddxd ) ) THEN
  -
  -         ! Calculate the partial derivative of the discrete state functions (Xd) with respect to the discrete states (xd) here:
  -
  -         ! allocate and set dXddxd
  -
  -      END IF
  -
  -      IF ( PRESENT( dZdxd ) ) THEN
  -
  -         ! Calculate the partial derivative of the constraint state functions (Z) with respect to the discrete states (xd) here:
  -
  -         ! allocate and set dZdxd
  -
  -      END IF
  +   REAL(DbKi),                                INTENT(IN   )           :: t          !< Current simulation time in seconds
  +   TYPE(ModName_InputType),                   INTENT(IN   )           :: u          !< Inputs at t
  +   TYPE(ModName_ParameterType),               INTENT(IN   )           :: p          !< Parameters
  +   TYPE(ModName_ContinuousStateType),         INTENT(IN   )           :: x          !< Continuous states at t
  +   TYPE(ModName_DiscreteStateType),           INTENT(IN   )           :: xd         !< Discrete states at t
  +   TYPE(ModName_ConstraintStateType),         INTENT(IN   )           :: z          !< Constraint states at t
  +   TYPE(ModName_OtherStateType),              INTENT(IN   )           :: OtherState !< Other states at t
  +   TYPE(ModName_MiscVarType),                 INTENT(INOUT)           :: m          !< Misc/optimization variables
  +   REAL(ReKi), ALLOCATABLE, OPTIONAL,         INTENT(INOUT)           :: dYdxd      !< Partial derivatives of output functions
  +                                                                                    !!  (Y) with respect to the discrete
  +                                                                                    !!  states (xd)
  +   REAL(ReKi), ALLOCATABLE, OPTIONAL,         INTENT(INOUT)           :: dXdxd      !< Partial derivatives of continuous state
  +                                                                                    !!   functions (X) with respect to the
  +                                                                                    !!   discrete states (xd)
  +   REAL(ReKi), ALLOCATABLE, OPTIONAL,         INTENT(INOUT)           :: dXddxd     !< Partial derivatives of discrete state
  +                                                                                    !!   functions (Xd) with respect to the
  +                                                                                    !!   discrete states (xd)
  +   REAL(ReKi), ALLOCATABLE, OPTIONAL,         INTENT(INOUT)           :: dZdxd      !< Partial derivatives of constraint state
  +                                                                                    !!   functions (Z) with respect to the
  +                                                                                    !!   discrete states (xd)
  +   INTEGER(IntKi),                            INTENT(  OUT)           :: ErrStat    !< Error status of the operation
  +   CHARACTER(*),                              INTENT(  OUT)           :: ErrMsg     !< Error message if ErrStat /= ErrID_None
  +
  +
  +      ! Initialize ErrStat
  +
  +   ErrStat = ErrID_None
  +   ErrMsg  = ""
  +
  +
  +   IF ( PRESENT( dYdxd ) ) THEN
  +
  +      ! Calculate the partial derivative of the output functions (Y) with respect to the discrete states (xd) here:
  +
  +      ! allocate and set dYdxd
  +
  +   END IF
  +
  +   IF ( PRESENT( dXdxd ) ) THEN
  +
  +      ! Calculate the partial derivative of the continuous state functions (X) with respect to the discrete states (xd) here:
  +
  +      ! allocate and set dXdxd
  +
  +   END IF
  +
  +   IF ( PRESENT( dXddxd ) ) THEN
  +
  +      ! Calculate the partial derivative of the discrete state functions (Xd) with respect to the discrete states (xd) here:
  +
  +      ! allocate and set dXddxd
  +
  +   END IF
  +
  +   IF ( PRESENT( dZdxd ) ) THEN
  +
  +      ! Calculate the partial derivative of the constraint state functions (Z) with respect to the discrete states (xd) here:
  +
  +      ! allocate and set dZdxd
  +
  +   END IF
   
   
   END SUBROUTINE ModName_JacobianPDiscState
  
positive.code: SUBROUTINE ModName_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg )
  !..................................................................................................................................
  
        TYPE(ModName_InputType),           INTENT(INOUT)  :: u           !< System inputs
        TYPE(ModName_ParameterType),       INTENT(INOUT)  :: p           !< Parameters
        TYPE(ModName_ContinuousStateType), INTENT(INOUT)  :: x           !< Continuous states
        TYPE(ModName_DiscreteStateType),   INTENT(INOUT)  :: xd          !< Discrete states
        TYPE(ModName_ConstraintStateType), INTENT(INOUT)  :: z           !< Constraint states
        TYPE(ModName_OtherStateType),      INTENT(INOUT)  :: OtherState  !< Other states
        TYPE(ModName_OutputType),          INTENT(INOUT)  :: y           !< System outputs
        TYPE(ModName_MiscVarType),         INTENT(INOUT)  :: m           !< Misc variables for optimization (not copied in glue code)
        INTEGER(IntKi),                    INTENT(  OUT)  :: ErrStat     !< Error status of the operation
        CHARACTER(*),                      INTENT(  OUT)  :: ErrMsg      !< Error message if ErrStat /= ErrID_None
  
           ! local variables
        INTEGER(IntKi)                                    :: ErrStat2    ! local error status
        CHARACTER(ErrMsgLen)                              :: ErrMsg2     ! local error message
        CHARACTER(*), PARAMETER                           :: RoutineName = 'ModName_End'
  
           ! Initialize ErrStat
  
        ErrStat = ErrID_None
        ErrMsg  = ""
  
  
           !! Place any last minute operations or calculations here:
  
  
           !! Close files here (but because of checkpoint-restart capability, it is not recommended to have files open during the simulation):
  
  
           !! Destroy the input data:
  
        call ModName_DestroyInput( u, ErrStat2, ErrMsg2 )
           call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
  
  
           !! Destroy the parameter data:
  
        call ModName_DestroyParam( p, ErrStat2, ErrMsg2 )
           call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
  
           !! Destroy the state data:
  
        call ModName_DestroyContState(   x,          ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
        call ModName_DestroyDiscState(   xd,         ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
        call ModName_DestroyConstrState( z,          ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
        call ModName_DestroyOtherState(  OtherState, ErrStat2,ErrMsg2); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
  
  
           !! Destroy the output data:
  
        call ModName_DestroyOutput( y, ErrStat2, ErrMsg2 ); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
  
  
           !! Destroy the misc data:
  
        call ModName_DestroyMisc( m, ErrStat2, ErrMsg2 ); call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
  
  
  END SUBROUTINE ModName_End
  
negative.code: SUBROUTINE ModName_CalcContStateDeriv( t, u, p, x, xd, z, OtherState, m, dxdt, ErrStat, ErrMsg )
  !..................................................................................................................................
  
     REAL(DbKi),                        INTENT(IN   )  :: t           !< Current simulation time in seconds
     TYPE(ModName_InputType),           INTENT(IN   )  :: u           !< Inputs at t
     TYPE(ModName_ParameterType),       INTENT(IN   )  :: p           !< Parameters
     TYPE(ModName_ContinuousStateType), INTENT(IN   )  :: x           !< Continuous states at t
     TYPE(ModName_DiscreteStateType),   INTENT(IN   )  :: xd          !< Discrete states at t
     TYPE(ModName_ConstraintStateType), INTENT(IN   )  :: z           !< Constraint states at t
     TYPE(ModName_OtherStateType),      INTENT(IN   )  :: OtherState  !< Other states at t
     TYPE(ModName_MiscVarType),         INTENT(INOUT)  :: m           !< Misc variables for optimization (not copied in glue code)
     TYPE(ModName_ContinuousStateType), INTENT(  OUT)  :: dxdt        !< Continuous state derivatives at t
     INTEGER(IntKi),                    INTENT(  OUT)  :: ErrStat     !< Error status of the operation
     CHARACTER(*),                      INTENT(  OUT)  :: ErrMsg      !< Error message if ErrStat /= ErrID_None
  
  
        ! Initialize ErrStat
  
     ErrStat = ErrID_None
     ErrMsg  = ""
  
  
        ! Compute the first time derivatives of the continuous states here:
  
     dxdt%DummyContState = 0.0_ReKi
  
  END SUBROUTINE ModName_CalcContStateDeriv
  !----------------------------------------------------------------------------------------------------------------------------------
  