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.
 
 
 
 
 
 

316 lines
14 KiB

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