anchor.diff:     TYPE(BD_ContinuousStateType)                       :: x_tmp      ! Holds temporary modification to x
      TYPE(BD_OtherStateType     )                       :: OS_tmp     ! Holds temporary modification to x
      TYPE(BD_InputType)                                 :: u_interp   ! interpolated value of inputs
  -   TYPE(BD_InputType)                                 :: u_tmp2
      INTEGER(IntKi)                                     :: ErrStat2   ! Temporary Error status
      CHARACTER(ErrMsgLen)                               :: ErrMsg2    ! Temporary Error message
      CHARACTER(*), PARAMETER                            :: RoutineName = 'BD_GA2'
  
positive.code:       CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )   
     CALL BD_CopyInput(u, u_tmp, MESH_NEWCOPY, ErrStat2, ErrMsg2)
        CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
     CALL BD_CopyInput(u, u_tmp2, MESH_NEWCOPY, ErrStat2, ErrMsg2)
        CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
     ! Actuator
     IF( p%torq ) THEN
         temp_R(:,:) = MATMUL(u%RootMotion%Orientation(:,:,1),TRANSPOSE(u%HubMotion%Orientation(:,:,1)))
         temp_cc(:) = EulerExtract(temp_R)
         temp_thetaP = xd%thetaP
         temp_omegaP = xd%thetaPD
         temp_alphaP = -(p%pitchK/p%pitchJ) * xd%thetaP - (p%pitchC/p%pitchJ) * xd%thetaPD + &
            (p%pitchK/p%pitchJ) * (-temp_cc(3))
         temp_cc(3) = -temp_thetaP
         temp_R(:,:) = EulerConstruct(temp_cc)
         u_tmp%RootMotion%Orientation(:,:,1) = MATMUL(temp_R,u%HubMotion%Orientation(:,:,1))
         u_tmp%RootMotion%RotationVel(:,1) = u%RootMotion%RotationVel(:,1) - &
           temp_omegaP * u%RootMotion%Orientation(3,1:3,1)
         u_tmp%RootMotion%RotationAcc(:,1) = u%RootMotion%RotationAcc(:,1) - &
           temp_alphaP * u%RootMotion%Orientation(3,1:3,1)
         CALL BD_CopyInput(u_tmp, u_tmp2, MESH_NEWCOPY, ErrStat2, ErrMsg2)
            CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
     ENDIF
     ! END Actuator
     CALL BD_CrvExtractCrv(p%GlbRot,temp_glb,ErrStat2,ErrMsg2)
        CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
        if (ErrStat >= AbortErrLev) then
  
negative.code:    call BD_Input_extrapinterp( u, utimes, u_interp, t+p%dt, ErrStat2, ErrMsg2 )
        call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
  
     CALL BD_UpdateDiscState( t, n, u_interp, p, x, xd, z, OtherState, ErrStat2, ErrMsg2 )
        call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
              
  ! Actuator
     IF( p%torq ) THEN
        CALL PitchActuator_SetBC(p, u_interp, xd)      
     ENDIF
  ! END Actuator
  
  