Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

145 lines
7.1 KiB

  1. subroutine TD_DrillStemReadData
  2. use SimulationVariables
  3. Use CStringConfigurationVariables
  4. Use TD_DrillStemComponents
  5. use SimulationVariables !@
  6. use SimulationVariables !@
  7. Use TD_StringConnectionData
  8. ! use ConfigurationVariables !@, only: Drawworks
  9. implicit none
  10. Integer :: i
  11. Integer :: TD_FirstIndex , TD_LastIndex
  12. !====================================================
  13. ! Set Drill Stem Components Data
  14. !====================================================
  15. data%State%TD_String%StringConfigurationCount = data%Configuration%StringConfiguration%StringConfigurationCount
  16. data%State%TD_String%DrillStemComponentsNumbs = 0
  17. !########## data%State%TD_DrillStem%ComponentType ::
  18. !#Bit_ComponentType = 0
  19. !#Stabilizer_ComponentType = 1
  20. !#Collar_ComponentType = 2
  21. !#DrillPipe_ComponentType = 3
  22. !#Heavyweight_ComponentType = 4
  23. !#IBOP = 5
  24. !#Kelly & SafetyValve (DrillMode) = 6
  25. !#SafetyValve (TripMode) = 7
  26. if (Allocated(data%State%TD_DrillStem)) deAllocate (data%State%TD_DrillStem)
  27. Allocate (data%State%TD_DrillStem(data%State%TD_String%StringConfigurationCount+100))
  28. Do i=1, data%State%TD_String%StringConfigurationCount
  29. data%State%TD_DrillStem(i)%ComponentType = data%Configuration%StringConfiguration%StringConfigurations(i)%ComponentType
  30. data%State%TD_DrillStem(i)%Numbs = data%Configuration%StringConfiguration%StringConfigurations(i)%NumberOfJoint
  31. data%State%TD_DrillStem(i)%Id = data%Configuration%StringConfiguration%StringConfigurations(i)%NominalId/12.d0 ![ft]
  32. data%State%TD_DrillStem(i)%Od = data%Configuration%StringConfiguration%StringConfigurations(i)%NominalOd/12.d0 ![ft]
  33. data%State%TD_DrillStem(i)%Length = data%Configuration%StringConfiguration%StringConfigurations(i)%LengthPerJoint ![ft]
  34. data%State%TD_DrillStem(i)%WeightperLength = data%Configuration%StringConfiguration%StringConfigurations(i)%WeightPerLength ![lb/ft]
  35. data%State%TD_DrillStem(i)%TotalLength = data%Configuration%StringConfiguration%StringConfigurations(i)%ComponentLength
  36. data%State%TD_DrillStem(i)%TotalWeight = data%State%TD_DrillStem(i)%TotalLength*data%State%TD_DrillStem(i)%WeightperLength
  37. data%State%TD_String%DrillStemComponentsNumbs = data%State%TD_String%DrillStemComponentsNumbs+data%Configuration%StringConfiguration%StringConfigurations(i)%NumberOfJoint
  38. !!=========> Set Separated Drill Stem Components Data
  39. ! TD_LastIndex = TD_LastIndex+StringConfigurations(i)%NumberOfJoint
  40. !
  41. ! data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ComponentType = data%State%TD_DrillStem(i)%ComponentType
  42. ! data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Id = data%State%TD_DrillStem(i)%Id
  43. ! data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Od = data%State%TD_DrillStem(i)%Od
  44. ! data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Length = data%State%TD_DrillStem(i)%Length
  45. ! data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Weight = data%State%TD_DrillStem(i)%Weight
  46. !
  47. ! TD_FirstIndex = TD_LastIndex+1
  48. End Do
  49. !===> Initial Values of Removed-Volume Variables
  50. if (data%State%TD_DrillStem(1)%ComponentType==0) then
  51. data%State%TD_Vol%PreCount = data%State%TD_String%StringConfigurationCount-1
  52. else
  53. data%State%TD_Vol%PreCount = data%State%TD_String%StringConfigurationCount
  54. end if
  55. data%State%TD_Vol%PreElementVolume = data%State%TD_DrillStem(data%State%TD_String%StringConfigurationCount)%TotalLength*(((pi*((data%State%TD_DrillStem(data%State%TD_String%StringConfigurationCount)%Id)**2))/4.d0)) ![ft^3]
  56. data%State%TD_Vol%PreElementLength = data%State%TD_DrillStem(data%State%TD_String%StringConfigurationCount)%TotalLength
  57. !====================================================
  58. ! Set Separated Drill Stem Components Data
  59. !====================================================
  60. TD_FirstIndex = 1
  61. TD_LastIndex = 0
  62. if (Allocated(data%State%TD_DrillStems)) deAllocate (data%State%TD_DrillStems)
  63. Allocate (data%State%TD_DrillStems(data%State%TD_String%DrillStemComponentsNumbs+300)) ! +300: because of: Add or Remove DrillStem Components
  64. Call TD_DrillStemStartUp
  65. Do i=1, data%State%TD_String%StringConfigurationCount
  66. TD_LastIndex = TD_LastIndex+data%Configuration%StringConfiguration%StringConfigurations(i)%NumberOfJoint
  67. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ComponentType = data%State%TD_DrillStem(i)%ComponentType
  68. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Id = data%State%TD_DrillStem(i)%Id
  69. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Od = data%State%TD_DrillStem(i)%Od
  70. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Area = (pi*((data%State%TD_DrillStem(i)%Od**2)-(data%State%TD_DrillStem(i)%Id**2)))/4.0d0
  71. if (data%State%TD_DrillStem(i)%ComponentType == 3 .or. data%State%TD_DrillStem(i)%ComponentType == 4) then
  72. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%RtoolJoint = data%State%TD_DrillStem(i)%Od*1.30d0/2.0d0
  73. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ToolJointRange = data%State%TD_String%ToolJointRange
  74. else if (data%State%TD_DrillStem(i)%ComponentType == 1 .or. data%State%TD_DrillStem(i)%ComponentType == 2) then
  75. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%RtoolJoint = data%State%TD_DrillStem(i)%Od/2.0d0
  76. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ToolJointRange = data%State%TD_String%ToolJointRange
  77. else if (data%State%TD_DrillStem(i)%ComponentType == 0) then
  78. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%RtoolJoint = data%State%TD_DrillStem(i)%Od
  79. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%ToolJointRange = 0.0d0
  80. end if
  81. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Length = data%State%TD_DrillStem(i)%Length
  82. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%LengthIni = data%State%TD_DrillStem(i)%Length
  83. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%WeightperLength= data%State%TD_DrillStem(i)%WeightperLength
  84. data%State%TD_DrillStems(TD_FirstIndex:TD_LastIndex)%Weight = data%State%TD_DrillStem(i)%WeightperLength*data%State%TD_DrillStem(i)%Length
  85. TD_FirstIndex = TD_LastIndex+1
  86. End Do
  87. !====================================================
  88. ! Set Hook Height Data
  89. !====================================================
  90. data%State%TD_StConn%HookHeightOld = data%State%Drawworks%Hook_Height_ini
  91. data%State%TD_StConn%HookHeight = data%State%TD_StConn%HookHeightOld
  92. end subroutine