subroutine TD_StaticHookLoadCalculation
    
   Use TD_DrillStemComponents
   use SimulationVariables !@
   use SimulationVariables !@
   use SimulationVariables !@
   

   implicit none
   
   Integer :: i
   
   
   
   
   
   i = 1
    if(data%State%TD_DrillStems(i)%HoleType == 0) then
         data%State%TD_DrillStems(i)%StaticHookLoad = data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%Length * &
                                            data%State%TD_DrillStems(i)%BouyancyFactor * cos(data%State%TD_DrillStems(i)%StartAngle)
       
     else if (data%State%TD_DrillStems(i)%HoleType == 1) then
         data%State%TD_DrillStems(i)%StaticHookLoad = -(data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%RCurvature * &
                                            (sin(data%State%TD_DrillStems(i)%EndAngle) - sin(data%State%TD_DrillStems(i)%StartAngle)))
       
     else if (data%State%TD_DrillStems(i)%HoleType == 2) then
         data%State%TD_DrillStems(i)%StaticHookLoad = (data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%RCurvature * &
                                            (sin(data%State%TD_DrillStems(i)%EndAngle) - sin(data%State%TD_DrillStems(i)%StartAngle)))  
     end if
     
     
   
     do i = 2, data%State%TD_String%DrillStemComponentsNumbs
         
         if(data%State%TD_DrillStems(i)%HoleType == 0) then
             data%State%TD_DrillStems(i)%StaticHookLoad = data%State%TD_DrillStems(i-1)%StaticHookLoad + data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%Length * &
                                                data%State%TD_DrillStems(i)%BouyancyFactor * cos(data%State%TD_DrillStems(i)%StartAngle)
       
         else if (data%State%TD_DrillStems(i)%HoleType == 1) then
             data%State%TD_DrillStems(i)%StaticHookLoad = data%State%TD_DrillStems(i-1)%StaticHookLoad -(data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%RCurvature * &
                                                (sin(data%State%TD_DrillStems(i)%EndAngle) - sin(data%State%TD_DrillStems(i)%StartAngle)))
       
         else if (data%State%TD_DrillStems(i)%HoleType == 2) then
             data%State%TD_DrillStems(i)%StaticHookLoad = data%State%TD_DrillStems(i-1)%StaticHookLoad +(data%State%TD_DrillStems(i)%WeightperLength * data%State%TD_DrillStems(i)%RCurvature * &
                                                (sin(data%State%TD_DrillStems(i)%EndAngle) - sin(data%State%TD_DrillStems(i)%StartAngle)))  
         end if
     
     end do
!     
!---------------------------------------------------------------------------------------------------
!        
        i = 1
        !data%State%TD_DrillStems(i)%TotalSHookLoad = data%State%TD_DrillStems(i)%StaticHookLoad   ????????????????????????????
        data%State%TD_DrillStems(i)%Dl      = data%State%TD_DrillStems(i)%StaticHookLoad * data%State%TD_DrillStems(i)%Length / data%State%TD_DrillStems(i)%Area / data%State%TD_DrillStems(i)%ElasticModule
        data%State%TD_DrillStems(i)%DlTotal = data%State%TD_DrillStems(i)%Dl
        do i = 2 , data%State%TD_String%DrillStemComponentsNumbs 
         !data%State%TD_DrillStems(i)%TotalSHookLoad = data%State%TD_DrillStems(i-1)%TotalSHookLoad + data%State%TD_DrillStems(i)%StaticHookLoad   ?????????????????????????
         data%State%TD_DrillStems(i)%Dl      = data%State%TD_DrillStems(i)%StaticHookLoad * data%State%TD_DrillStems(i)%Length / data%State%TD_DrillStems(i)%Area / data%State%TD_DrillStems(i)%ElasticModule
         data%State%TD_DrillStems(i)%DlTotal = data%State%TD_DrillStems(i-1)%DlTotal + data%State%TD_DrillStems(i)%Dl
        end do
        
    data%State%TD_String%StaticHookLoad = data%State%TD_DrillStems(data%State%TD_String%DrillStemComponentsNumbs)%StaticHookLoad
    data%State%TD_String%DlMax          = data%State%TD_DrillStems(data%State%TD_String%DrillStemComponentsNumbs)%DlTotal
    
    
    
    
    
    
   
end subroutine