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.
 
 
 
 
 
 

314 lines
14 KiB

  1. subroutine TD_AddComponents
  2. Use CStringConfigurationVariables
  3. Use CStringUpdateVariables
  4. Use CSafetyValveEnumVariables
  5. Use CIbopEnumVariables
  6. Use COperationConditionEnumVariables
  7. Use CKellyConnectionEnumVariables
  8. Use CElevatorConnectionEnumVariables
  9. Use CHoistingVariables
  10. Use CTdsConnectionModesEnumVariables
  11. Use CTdsElevatorModesEnumVariables
  12. Use TD_DrillStemComponents
  13. Use TD_WellGeometry
  14. Use TD_GeneralData
  15. Use TD_StringConnectionData
  16. implicit none
  17. integer :: i , kk , TD_NumOfAddedComponents
  18. !====================================================
  19. ! Add Single
  20. !====================================================
  21. if ( Get_StringUpdate() == STRING_UPDATE_ADD_SINGLE ) then
  22. kk = 0
  23. Do i= TD_DrillStemComponentsNumbs , 1 , -1
  24. if (TD_DrillStems(i)%ComponentType==3) then
  25. kk = i
  26. exit
  27. end if
  28. End Do
  29. ! DrillStems Array:
  30. TD_NumOfAddedComponents = 1
  31. Do i= (TD_DrillStemComponentsNumbs+1) , (TD_DrillStemComponentsNumbs+TD_NumOfAddedComponents)
  32. TD_DrillStems(i)%ComponentType = 3
  33. TD_DrillStems(i)%Id = TD_DrillStems(kk)%Id
  34. TD_DrillStems(i)%Od = TD_DrillStems(kk)%Od
  35. TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.d0
  36. TD_DrillStems(i)%RtoolJoint = TD_DrillStems(i)%Od*1.3d0/2.d0
  37. TD_DrillStems(i)%ToolJointRange = TD_ToolJointRange
  38. TD_DrillStems(i)%Length = TD_DrillStems(kk)%LengthIni
  39. TD_DrillStems(i)%LengthIni = TD_DrillStems(kk)%LengthIni
  40. TD_DrillStems(i)%WeightperLength = TD_DrillStems(kk)%WeightperLength
  41. TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length
  42. TD_DrillStems(i)%Density = TD_DrillStems(kk)%Density
  43. TD_DrillStems(i)%ElasticModule = TD_DrillStems(kk)%ElasticModule
  44. End Do
  45. TD_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs+TD_NumOfAddedComponents
  46. ! DrillStem Array:
  47. i = TD_StringConfigurationCount+1
  48. TD_DrillStem(i)%ComponentType = 3
  49. TD_DrillStem(i)%Numbs = 1
  50. TD_DrillStem(i)%Id = TD_DrillStems(kk)%Id ! [ft]
  51. TD_DrillStem(i)%Od = TD_DrillStems(kk)%Od ! [ft]
  52. TD_DrillStem(i)%Length = TD_DrillStems(kk)%LengthIni
  53. TD_DrillStem(i)%WeightperLength = TD_DrillStems(kk)%WeightperLength
  54. TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
  55. TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
  56. TD_StringConfigurationCount = TD_StringConfigurationCount+1
  57. Call Set_StringUpdate(STRING_UPDATE_NEUTRAL)
  58. end if
  59. !====================================================
  60. ! Add Stand
  61. !====================================================
  62. if ( Get_StringUpdate() == STRING_UPDATE_ADD_STAND ) then
  63. kk = 0
  64. Do i= TD_DrillStemComponentsNumbs , 1 , -1
  65. if (TD_DrillStems(i)%ComponentType==3) then
  66. kk = i
  67. exit
  68. end if
  69. End Do
  70. ! DrillStems Array:
  71. TD_NumOfAddedComponents = 3
  72. Do i= (TD_DrillStemComponentsNumbs+1) , (TD_DrillStemComponentsNumbs+TD_NumOfAddedComponents)
  73. TD_DrillStems(i)%ComponentType = 3
  74. TD_DrillStems(i)%Id = TD_DrillStems(kk)%Id
  75. TD_DrillStems(i)%Od = TD_DrillStems(kk)%Od
  76. TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.0d0
  77. TD_DrillStems(i)%RtoolJoint = TD_DrillStems(i)%Od*1.30d0/2.0d0
  78. TD_DrillStems(i)%ToolJointRange = TD_ToolJointRange
  79. TD_DrillStems(i)%Length = TD_DrillStems(kk)%LengthIni
  80. TD_DrillStems(i)%LengthIni = TD_DrillStems(kk)%LengthIni
  81. TD_DrillStems(i)%WeightperLength = TD_DrillStems(kk)%WeightperLength
  82. TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length
  83. TD_DrillStems(i)%Density = TD_DrillStems(kk)%Density
  84. TD_DrillStems(i)%ElasticModule = TD_DrillStems(kk)%ElasticModule
  85. End Do
  86. TD_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs+TD_NumOfAddedComponents
  87. ! DrillStem Array:
  88. i = TD_StringConfigurationCount+1
  89. TD_DrillStem(i)%ComponentType = 3
  90. TD_DrillStem(i)%Numbs = 3
  91. TD_DrillStem(i)%Id = TD_DrillStems(kk)%Id ! [ft]
  92. TD_DrillStem(i)%Od = TD_DrillStems(kk)%Od ! [ft]
  93. TD_DrillStem(i)%Length = TD_DrillStems(kk)%LengthIni
  94. TD_DrillStem(i)%WeightperLength = TD_DrillStems(kk)%WeightperLength
  95. TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
  96. TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
  97. TD_StringConfigurationCount = TD_StringConfigurationCount+1
  98. Call Set_StringUpdate(STRING_UPDATE_NEUTRAL)
  99. end if
  100. !====================================================
  101. ! Add IBOP
  102. !====================================================
  103. !if ( Get_Ibop()==IBOP_INSTALL ) then
  104. ! TD_IBOPNewAdd = 1
  105. !else
  106. ! TD_IBOPNewAdd = 0
  107. ! TD_IBOPOldAdd = 0
  108. ! end if
  109. if ( Get_Ibop()==IBOP_INSTALL .and. TD_IBOPOldAdd==0 ) then
  110. kk = 0
  111. Do i= TD_DrillStemComponentsNumbs , 1 , -1
  112. if (TD_DrillStems(i)%ComponentType==3) then
  113. kk = i
  114. exit
  115. end if
  116. End Do
  117. ! DrillStems Array:
  118. TD_NumOfAddedComponents = 1
  119. Do i= (TD_DrillStemComponentsNumbs+1) , (TD_DrillStemComponentsNumbs+TD_NumOfAddedComponents)
  120. TD_DrillStems(i)%ComponentType = 5
  121. TD_DrillStems(i)%Id = TD_DrillStems(kk)%Id
  122. TD_DrillStems(i)%Od = TD_DrillStems(kk)%RtoolJoint
  123. TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.0d0
  124. TD_DrillStems(i)%RtoolJoint = TD_DrillStems(kk)%RtoolJoint
  125. TD_DrillStems(i)%ToolJointRange = 0.0d0
  126. TD_DrillStems(i)%Length = TD_IBOPLength ! [ft]
  127. TD_DrillStems(i)%LengthIni = TD_IBOPLength ! [ft]
  128. TD_DrillStems(i)%WeightperLength = 55.0d0 ! [lb/ft]
  129. TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length
  130. TD_DrillStems(i)%Density = TD_DrillStems(kk)%Density !????????????
  131. TD_DrillStems(i)%ElasticModule = TD_DrillStems(kk)%ElasticModule !????????????
  132. End Do
  133. TD_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs+TD_NumOfAddedComponents
  134. ! DrillStem Array:
  135. i = TD_StringConfigurationCount+1
  136. TD_DrillStem(i)%ComponentType = 5
  137. TD_DrillStem(i)%Numbs = 1
  138. TD_DrillStem(i)%Id = TD_DrillStems(kk)%Id ! [ft]
  139. TD_DrillStem(i)%Od = TD_DrillStems(kk)%RtoolJoint ! [ft]
  140. TD_DrillStem(i)%Length = 1.540d0 ! [ft]
  141. TD_DrillStem(i)%WeightperLength = 55.0d0 ! [lb/ft]
  142. TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
  143. TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
  144. TD_StringConfigurationCount = TD_StringConfigurationCount+1
  145. !TD_IBOPOldAdd = TD_IBOPNewAdd
  146. if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then
  147. TD_ConnectionHeight = TD_ConnectionHeight+TD_DrillStem(i)%Length
  148. end if
  149. end if
  150. if ( Get_Ibop()==IBOP_INSTALL ) then
  151. TD_IBOPOldAdd = 1
  152. else
  153. TD_IBOPOldAdd = 0
  154. end if
  155. !====================================================
  156. ! Add Safety Valve & Kelly (OPERATION_DRILL)
  157. !====================================================
  158. if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then
  159. TD_KellyNewAdd = 1
  160. else
  161. TD_KellyNewAdd = 0
  162. TD_KellyOldAdd = 0
  163. end if
  164. if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() == KELLY_CONNECTION_STRING .and. TD_KellyNewAdd/=TD_KellyOldAdd ) then
  165. ! DrillStems Array:
  166. TD_NumOfAddedComponents = 1
  167. Do i= (TD_DrillStemComponentsNumbs+1) , (TD_DrillStemComponentsNumbs+TD_NumOfAddedComponents)
  168. TD_DrillStems(i)%ComponentType = 6
  169. TD_DrillStems(i)%Id = TD_KellyElementID ! [ft]
  170. TD_DrillStems(i)%Od = TD_KellyElementOD ! [ft]
  171. TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.0d0
  172. TD_DrillStems(i)%RtoolJoint = TD_DrillStems(i)%Od*1.30d0/2.0d0
  173. TD_DrillStems(i)%ToolJointRange = 0.0d0
  174. TD_DrillStems(i)%Length = TD_KellyElementConst ! [ft]
  175. TD_DrillStems(i)%LengthIni = TD_KellyElementConst ! [ft]
  176. TD_DrillStems(i)%WeightperLength = 55.0d0 ! [lb/ft]
  177. TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length
  178. TD_DrillStems(i)%Density = 7850.d0*0.06242796d0 ! [kg/m3]*0.06242796=[lb/ft3]
  179. TD_DrillStems(i)%ElasticModule = 200.0d9*0.02088543d0 ! [lb/ft2] !200GPa=29Mpsi (steel)
  180. End Do
  181. TD_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs+TD_NumOfAddedComponents
  182. ! DrillStem Array:
  183. i = TD_StringConfigurationCount+1
  184. TD_DrillStem(i)%ComponentType = 6
  185. TD_DrillStem(i)%Numbs = 1
  186. TD_DrillStem(i)%Id = 3.0d0/12.d0 ! [ft]
  187. TD_DrillStem(i)%Od = 5.90d0/12.d0 ! [ft]
  188. TD_DrillStem(i)%Length = TD_KellyElementConst ! [ft]
  189. TD_DrillStem(i)%WeightperLength = 55.0d0 ! [lb/ft]
  190. TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
  191. TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
  192. TD_StringConfigurationCount = TD_StringConfigurationCount+1
  193. TD_KellyOldAdd = TD_KellyNewAdd
  194. end if
  195. !====================================================
  196. ! Add Safety Valve (OPERATION_TRIP)
  197. !====================================================
  198. !if ( Get_OperationCondition()==OPERATION_TRIP .and. Get_SafetyValve()==SAFETY_VALVE_INSTALL ) then
  199. ! TD_SafetyValveNewAdd = 1
  200. !else
  201. ! TD_SafetyValveNewAdd = 0
  202. ! TD_SafetyValveOldAdd = 0
  203. !end if
  204. if ( TD_KellyDriveTypeMode/=0 .and. TD_OldOperationCondition/=0 .and. Get_SafetyValve()==SAFETY_VALVE_INSTALL .and. TD_SafetyValveOldAdd==0 ) then
  205. kk = 0
  206. Do i= TD_DrillStemComponentsNumbs , 1 , -1
  207. if (TD_DrillStems(i)%ComponentType==3) then
  208. kk = i
  209. exit
  210. end if
  211. End Do
  212. ! DrillStems Array:
  213. TD_NumOfAddedComponents = 1
  214. Do i= (TD_DrillStemComponentsNumbs+1) , (TD_DrillStemComponentsNumbs+TD_NumOfAddedComponents)
  215. TD_DrillStems(i)%ComponentType = 7
  216. TD_DrillStems(i)%Id = TD_DrillStems(kk)%Id
  217. TD_DrillStems(i)%Od = TD_DrillStems(kk)%RtoolJoint
  218. TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.0d0
  219. TD_DrillStems(i)%RtoolJoint = TD_DrillStems(kk)%RtoolJoint
  220. TD_DrillStems(i)%ToolJointRange = 0.0d0
  221. TD_DrillStems(i)%Length = TD_SafetyValveLength ! [ft]
  222. TD_DrillStems(i)%LengthIni = TD_SafetyValveLength ! [ft]
  223. TD_DrillStems(i)%WeightperLength = 55.0d0 ! [lb/ft]
  224. TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length
  225. TD_DrillStems(i)%Density = TD_DrillStems(kk)%Density !????????????
  226. TD_DrillStems(i)%ElasticModule = TD_DrillStems(kk)%ElasticModule !????????????
  227. End Do
  228. TD_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs+TD_NumOfAddedComponents
  229. ! DrillStem Array:
  230. i = TD_StringConfigurationCount+1
  231. TD_DrillStem(i)%ComponentType = 7
  232. TD_DrillStem(i)%Numbs = 1
  233. TD_DrillStem(i)%Id = TD_DrillStems(kk)%Id ! [ft]
  234. TD_DrillStem(i)%Od = TD_DrillStems(kk)%RtoolJoint ! [ft]
  235. TD_DrillStem(i)%Length = 1.540d0 ! [ft]
  236. TD_DrillStem(i)%WeightperLength = 55.0d0 ! [lb/ft]
  237. TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
  238. TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
  239. TD_StringConfigurationCount = TD_StringConfigurationCount+1
  240. !TD_SafetyValveOldAdd = TD_SafetyValveNewAdd
  241. if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then
  242. TD_ConnectionHeight = TD_ConnectionHeight+TD_DrillStem(i)%Length
  243. end if
  244. end if
  245. if ( Get_SafetyValve()==SAFETY_VALVE_INSTALL ) then
  246. TD_SafetyValveOldAdd = 1
  247. else
  248. TD_SafetyValveOldAdd = 0
  249. end if
  250. end subroutine