function Tension = WinchLimits(T,ElongationRate)

Tmax = 600*4.45;
Tension = T;

%Limit Tension to max motor can produce.
if(abs(ElongationRate) <= 0.4)
  if(T>Tmax)
     Tension = Tmax; 
  end
end


%if(ElongationRate > 0.4)
%    Tension = T;
%end

%Limit tension if payin is faster than 0.4 m/s
if(ElongationRate < -0.4)  
    Tension = Tmax+(ElongationRate+.4)*Tmax/.2;
end
if(ElongationRate < -0.6)  
    Tension = 0;
end


    
    
