Simulation Core
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

TD_AddComponents.i90 17 KiB

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