anchor.diff:  !----------------------------------------------------------------------------------------------------------------------------------
   subroutine BEMT_CalcOutput( t, u, p, x, xd, z, OtherState, AFInfo, y, m, errStat, errMsg )
   ! Routine for computing outputs, used in both loose and tight coupling.
  -! This SUBROUTINE is used to compute the output channels (motions and loads) and place them in the WriteOutput() array.
  -! NOTE: the descriptions of the output channels are not given here. Please see the included OutListParameters.xlsx sheet for
  -! for a complete description of each output parameter.
  -! NOTE: no matter how many channels are selected for output, all of the outputs are calculated
  -! All of the calculated output channels are placed into the OtherState%AllOuts(:), while the channels selected for outputs are
  -! placed in the y%WriteOutput(:) array.
   !..................................................................................................................................
   
      
  
positive.code: 
        end if
     end if
     
     ! Array OtherState%AllOuts() is initialized to 0.0 in initialization, so we are not going to reinitialize it here.
     
        
     !...............................................................................................................................
     ! Calculate all of the total forces and moments using all of the partial forces and moments calculated in RtHS().  Also,
     !   calculate all of the total angular and linear accelerations using all of the partial accelerations calculated in RtHS().
     !   To do this, first initialize the variables using the portions not associated with the accelerations.  Then add the portions
     !   associated with the accelerations one by one:
     !...............................................................................................................................  
     
     do j = 1,p%numBlades ! Loop through all blades
        
  
negative.code:    integer(IntKi)                 :: k
  #endif
  
     logical                        :: IsValidSolution !< this is set to false if k<=1 in propeller brake region or k<-1 in momentum region, indicating an invalid solution
           ! Initialize some output values
     errStat = ErrID_None
  