Simulation Core
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

316 wiersze
18 KiB

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