Simulation Core
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

357 rindas
15 KiB

  1. subroutine TD_RemoveComponents
  2. Use CStringConfigurationVariables
  3. Use CStringUpdateVariables
  4. Use CSafetyValveEnumVariables
  5. Use CIbopEnumVariables
  6. Use COperationConditionEnumVariables
  7. Use CKellyConnectionEnumVariables
  8. Use CElevatorConnectionEnumVariables
  9. Use CTdsConnectionModesEnumVariables
  10. Use CTdsElevatorModesEnumVariables
  11. Use CHoistingVariables
  12. Use TD_DrillStemComponents
  13. Use TD_WellGeometry
  14. Use TD_GeneralData
  15. Use TD_StringConnectionData
  16. implicit none
  17. integer :: i , TD_NumOfRemovedComponents
  18. !====================================================
  19. ! Remove Safety Valve & Kelly (OPERATION_DRILL)
  20. !====================================================
  21. if ( DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING ) then
  22. TD_KellyNewRemove = 1
  23. else
  24. TD_KellyNewRemove = 0
  25. TD_KellyOldRemove = 0
  26. end if
  27. if ( DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. TD_KellyNewRemove/=TD_KellyOldRemove ) then
  28. !print* , 'Remove Safety Valve & Kelly='
  29. TD_NumOfRemovedComponents = 1
  30. Do i= TD_DrillStemComponentsNumbs , (TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1
  31. TD_DrillStems(i)%ComponentType = 0 !????????????
  32. TD_DrillStems(i)%Id = 0.
  33. TD_DrillStems(i)%Od = 0.
  34. TD_DrillStems(i)%Area = 0.
  35. TD_DrillStems(i)%RtoolJoint = 0.
  36. TD_DrillStems(i)%ToolJointRange = 0.
  37. TD_DrillStems(i)%Length = 0.
  38. TD_DrillStems(i)%LengthIni = 0.
  39. TD_DrillStems(i)%WeightperLength = 0.
  40. TD_DrillStems(i)%Weight = 0.
  41. End Do
  42. TD_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents
  43. i = TD_StringConfigurationCount
  44. if ( TD_DrillStem(i)%Numbs>1 ) then
  45. TD_DrillStem(i)%ComponentType = 6
  46. TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-1
  47. TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft]
  48. TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft]
  49. TD_DrillStem(i)%Length = TD_DrillStem(i)%Length ![ft]
  50. TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength
  51. TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
  52. TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
  53. TD_StringConfigurationCount = TD_StringConfigurationCount
  54. else if ( TD_DrillStem(i)%Numbs==1 ) then
  55. TD_DrillStem(i)%ComponentType = 6
  56. TD_DrillStem(i)%Numbs = 0
  57. TD_DrillStem(i)%Id = 0.
  58. TD_DrillStem(i)%Od = 0.
  59. TD_DrillStem(i)%Length = 0.
  60. TD_DrillStem(i)%WeightperLength = 0.
  61. TD_DrillStem(i)%TotalLength = 0.
  62. TD_DrillStem(i)%TotalWeight = 0.
  63. TD_StringConfigurationCount = TD_StringConfigurationCount-1
  64. end if
  65. TD_KellyOldRemove = TD_KellyNewRemove
  66. !print* , 'Remove Safety Valve & Kelly (OPERATION_DRILL)'
  67. end if
  68. !====================================================
  69. ! Remove Single
  70. !====================================================
  71. if ( Get_StringUpdate() == STRING_UPDATE_REMOVE_SINGLE ) then
  72. !print* , 'STRING_UPDATE_REMOVE_SINGLE='
  73. TD_NumOfRemovedComponents = 1
  74. Do i= TD_DrillStemComponentsNumbs , (TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1
  75. TD_DrillStems(i)%ComponentType = 0 !????????????
  76. TD_DrillStems(i)%Id = 0.
  77. TD_DrillStems(i)%Od = 0.
  78. TD_DrillStems(i)%Area = 0.
  79. TD_DrillStems(i)%RtoolJoint = 0.
  80. TD_DrillStems(i)%ToolJointRange = 0.
  81. TD_DrillStems(i)%Length = 0.
  82. TD_DrillStems(i)%LengthIni = 0.
  83. TD_DrillStems(i)%WeightperLength = 0.
  84. TD_DrillStems(i)%Weight = 0.
  85. End Do
  86. TD_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents
  87. i = TD_StringConfigurationCount
  88. if ( TD_DrillStem(i)%Numbs>1 ) then
  89. TD_DrillStem(i)%ComponentType = 3
  90. TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-1
  91. TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft]
  92. TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft]
  93. TD_DrillStem(i)%Length = TD_DrillStem(i)%Length
  94. TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%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
  98. else if ( TD_DrillStem(i)%Numbs==1 ) then
  99. TD_DrillStem(i)%ComponentType = 3
  100. TD_DrillStem(i)%Numbs = 0
  101. TD_DrillStem(i)%Id = 0.
  102. TD_DrillStem(i)%Od = 0.
  103. TD_DrillStem(i)%Length = 0.
  104. TD_DrillStem(i)%WeightperLength = 0.
  105. TD_DrillStem(i)%TotalLength = 0.
  106. TD_DrillStem(i)%TotalWeight = 0.
  107. TD_StringConfigurationCount = TD_StringConfigurationCount-1
  108. end if
  109. Call Set_StringUpdate(STRING_UPDATE_NEUTRAL)
  110. !print* , 'Remove Single'
  111. end if
  112. !====================================================
  113. ! Remove Stand
  114. !====================================================
  115. if ( Get_StringUpdate() == STRING_UPDATE_REMOVE_STAND ) then
  116. TD_NumOfRemovedComponents = 3
  117. Do i= TD_DrillStemComponentsNumbs , (TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1
  118. TD_DrillStems(i)%ComponentType = 0 !????????????
  119. TD_DrillStems(i)%Id = 0.
  120. TD_DrillStems(i)%Od = 0.
  121. TD_DrillStems(i)%Area = 0.
  122. TD_DrillStems(i)%RtoolJoint = 0.
  123. TD_DrillStems(i)%ToolJointRange = 0.
  124. TD_DrillStems(i)%Length = 0.
  125. TD_DrillStems(i)%LengthIni = 0.
  126. TD_DrillStems(i)%WeightperLength = 0.
  127. TD_DrillStems(i)%Weight = 0.
  128. End Do
  129. TD_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents
  130. i = TD_StringConfigurationCount
  131. if ( TD_DrillStem(i)%Numbs>3 ) then
  132. TD_DrillStem(i)%ComponentType = 3
  133. TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-3
  134. TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft]
  135. TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft]
  136. TD_DrillStem(i)%Length = TD_DrillStem(i)%Length
  137. TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength
  138. TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
  139. TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
  140. TD_StringConfigurationCount = TD_StringConfigurationCount
  141. else if ( TD_DrillStem(i)%Numbs==3 ) then
  142. TD_DrillStem(i)%ComponentType = 3
  143. TD_DrillStem(i)%Numbs = 0
  144. TD_DrillStem(i)%Id = 0.
  145. TD_DrillStem(i)%Od = 0.
  146. TD_DrillStem(i)%Length = 0.
  147. TD_DrillStem(i)%WeightperLength = 0.
  148. TD_DrillStem(i)%TotalLength = 0.
  149. TD_DrillStem(i)%TotalWeight = 0.
  150. TD_StringConfigurationCount = TD_StringConfigurationCount-1
  151. end if
  152. Call Set_StringUpdate(STRING_UPDATE_NEUTRAL)
  153. !print* , 'Remove Stand'
  154. end if
  155. !====================================================
  156. ! Remove IBOP
  157. !====================================================
  158. !if ( Get_Ibop() == IBOP_REMOVE ) then
  159. ! TD_IBOPNewRemove = 1
  160. !else
  161. ! TD_IBOPNewRemove = 0
  162. ! TD_IBOPOldRemove = 0
  163. !end if
  164. if ( Get_Ibop() == IBOP_REMOVE .and. TD_IBOPOldRemove==0 ) then
  165. TD_NumOfRemovedComponents = 1
  166. Do i= TD_DrillStemComponentsNumbs , (TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1
  167. TD_DrillStems(i)%ComponentType = 0 !????????????
  168. TD_DrillStems(i)%Id = 0.
  169. TD_DrillStems(i)%Od = 0.
  170. TD_DrillStems(i)%Area = 0.
  171. TD_DrillStems(i)%RtoolJoint = 0.
  172. TD_DrillStems(i)%ToolJointRange = 0.
  173. TD_DrillStems(i)%Length = 0.
  174. TD_DrillStems(i)%LengthIni = 0.
  175. TD_DrillStems(i)%WeightperLength = 0.
  176. TD_DrillStems(i)%Weight = 0.
  177. End Do
  178. TD_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents
  179. i = TD_StringConfigurationCount
  180. if ( TD_DrillStem(i)%Numbs>1 ) then
  181. TD_DrillStem(i)%ComponentType = 5
  182. TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-1
  183. TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft]
  184. TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft]
  185. TD_DrillStem(i)%Length = TD_DrillStem(i)%Length ![ft]
  186. TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength
  187. TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
  188. TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
  189. TD_StringConfigurationCount = TD_StringConfigurationCount
  190. else if ( TD_DrillStem(i)%Numbs==1 ) then
  191. TD_DrillStem(i)%ComponentType = 5
  192. TD_DrillStem(i)%Numbs = 0
  193. TD_DrillStem(i)%Id = 0.
  194. TD_DrillStem(i)%Od = 0.
  195. TD_DrillStem(i)%Length = 0.
  196. TD_DrillStem(i)%WeightperLength = 0.
  197. TD_DrillStem(i)%TotalLength = 0.
  198. TD_DrillStem(i)%TotalWeight = 0.
  199. TD_StringConfigurationCount = TD_StringConfigurationCount-1
  200. end if
  201. !TD_IBOPOldRemove = TD_IBOPNewRemove
  202. if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then
  203. TD_ConnectionHeight = TD_ConnectionHeight-TD_IBOPLength
  204. end if
  205. !print* , 'Remove IBOP'
  206. end if
  207. if ( Get_Ibop() == IBOP_REMOVE ) then
  208. TD_IBOPOldRemove = 1
  209. else
  210. TD_IBOPOldRemove = 0
  211. end if
  212. !====================================================
  213. ! Remove Safety Valve (OPERATION_TRIP)
  214. !====================================================
  215. !if ( TD_OldOperationCondition==1 .and. TD_KellyDriveTypeMode==1 .and. Get_SafetyValve() == SAFETY_VALVE_REMOVE ) then
  216. ! TD_SafetyValveNewRemove = 1
  217. !else
  218. ! TD_SafetyValveNewRemove = 0
  219. ! TD_SafetyValveOldRemove = 0
  220. !end if
  221. !print* , 'Get_SafetyValve()=' , Get_SafetyValve()
  222. if ( TD_KellyDriveTypeMode/=0 .and. TD_OldOperationCondition/=0 .and. Get_SafetyValve() == SAFETY_VALVE_REMOVE .and. TD_SafetyValveOldRemove==0 ) then
  223. TD_NumOfRemovedComponents = 1
  224. Do i= TD_DrillStemComponentsNumbs , (TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1
  225. TD_DrillStems(i)%ComponentType = 0 !????????????
  226. TD_DrillStems(i)%Id = 0.
  227. TD_DrillStems(i)%Od = 0.
  228. TD_DrillStems(i)%Area = 0.
  229. TD_DrillStems(i)%RtoolJoint = 0.
  230. TD_DrillStems(i)%ToolJointRange = 0.
  231. TD_DrillStems(i)%Length = 0.
  232. TD_DrillStems(i)%LengthIni = 0.
  233. TD_DrillStems(i)%WeightperLength = 0.
  234. TD_DrillStems(i)%Weight = 0.
  235. End Do
  236. TD_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents
  237. i = TD_StringConfigurationCount
  238. if ( TD_DrillStem(i)%Numbs>1 ) then
  239. TD_DrillStem(i)%ComponentType = 7
  240. TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-1
  241. TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft]
  242. TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft]
  243. TD_DrillStem(i)%Length = TD_DrillStem(i)%Length ![ft]
  244. TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength
  245. TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length
  246. TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength
  247. TD_StringConfigurationCount = TD_StringConfigurationCount
  248. else if ( TD_DrillStem(i)%Numbs==1 ) then
  249. TD_DrillStem(i)%ComponentType = 7
  250. TD_DrillStem(i)%Numbs = 0
  251. TD_DrillStem(i)%Id = 0.
  252. TD_DrillStem(i)%Od = 0.
  253. TD_DrillStem(i)%Length = 0.
  254. TD_DrillStem(i)%WeightperLength = 0.
  255. TD_DrillStem(i)%TotalLength = 0.
  256. TD_DrillStem(i)%TotalWeight = 0.
  257. TD_StringConfigurationCount = TD_StringConfigurationCount-1
  258. end if
  259. !print* , 'Get_OperationCondition()=' , Get_OperationCondition()
  260. !print* , 'TD_OldOperationCondition=' , TD_OldOperationCondition
  261. !print* , 'TD_SafetyValveNewRemove=' , TD_SafetyValveNewRemove
  262. !print* , 'TD_SafetyValveOldRemove=' , TD_SafetyValveOldRemove
  263. !TD_SafetyValveOldRemove = TD_SafetyValveNewRemove
  264. if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then
  265. TD_ConnectionHeight = TD_ConnectionHeight-TD_SafetyValveLength
  266. end if
  267. end if
  268. if ( Get_SafetyValve() == SAFETY_VALVE_REMOVE ) then
  269. TD_SafetyValveOldRemove = 1
  270. else
  271. TD_SafetyValveOldRemove = 0
  272. end if
  273. if ( TD_KellyDriveTypeMode==1 ) then
  274. TD_OldOperationCondition = 1
  275. else
  276. TD_OldOperationCondition = 0
  277. end if
  278. !print* , 'TD_KellyDriveTypeMode2=' , TD_KellyDriveTypeMode
  279. !print* , 'TD_OldOperationCondition2=' , TD_OldOperationCondition
  280. !print* , 'TD_SafetyValveNewRemove2=' , TD_SafetyValveNewRemove
  281. !print* , 'TD_SafetyValveOldRemove2=' , TD_SafetyValveOldRemove
  282. end subroutine