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.
 
 
 
 
 
 

211 lines
16 KiB

  1. # 1 "/home/admin/SimulationCore2/Equipments/Drawworks/Drawworks_INPUTS.f90"
  2. subroutine Drawworks_Inputs
  3. use CDrillingConsoleVariables
  4. use SimulationVariables
  5. use SimulationVariables
  6. ! Use CSimulationVariables
  7. use OperationScenariosModule
  8. use CWarnings
  9. use SimulationVariables
  10. use SimulationVariables !@
  11. Use TD_StringConnectionData
  12. Use TD_DrillStemComponents
  13. use SimulationVariables !@
  14. use SimulationVariables !@
  15. IMPLICIT NONE
  16. data%State%Drawworks%AssignmentSwitch = data%Equipments%DrillingConsole%AssignmentSwitch
  17. data%State%Drawworks%Switch = data%Equipments%DrillingConsole%DWSwitch
  18. data%State%Drawworks%Throttle = data%Equipments%DrillingConsole%DWThrottle ![RPM]
  19. data%State%Drawworks%DriveType = data%Configuration%Hoisting%DriveType
  20. data%State%Drawworks%ShearBopSituation = data%State%RamLine%ShearBop_Situation_forTD
  21. !data%State%Drawworks%MotorFaileMalf = ?????? motaghayere voroudi !dar CHoistingProblemsVariables meghdardehi mishavad
  22. !>>> RAM & ToolJoint Collision
  23. data%State%Drawworks%TDBOPElementNo = data%State%TD_BOP%BOPElementNo
  24. data%State%Drawworks%TDBOPHeight = data%State%TD_BOP%BOPHeight
  25. data%State%Drawworks%TDBOPRamDiam = data%State%TD_BOP%BOPRamDiam
  26. data%State%Drawworks%TDBOPThickness = data%State%TD_BOP%BOPThickness
  27. data%State%Drawworks%TDDrillStemBottom = data%State%TD_String%DrillStemBottom
  28. data%State%Drawworks%TDWellTotalLength = data%State%TD_WellGeneral%WellTotalLength
  29. data%State%Drawworks%TDDlMax = data%State%TD_String%DlMax
  30. data%State%Drawworks%TDDrillStemComponentsNumbs = data%State%TD_String%DrillStemComponentsNumbs
  31. if (Allocated(data%State%Drawworks%TDDrillStemsDownDepth)) deAllocate (data%State%Drawworks%TDDrillStemsDownDepth) ! inja gozashtameshun cho momkene tuye startup tedade elemanha dir berese va error bede
  32. Allocate (data%State%Drawworks%TDDrillStemsDownDepth(data%State%Drawworks%TDDrillStemComponentsNumbs+400)) ! +400: because of: Add or Remove DrillStem Components
  33. data%State%Drawworks%TDDrillStemsDownDepth = data%State%TD_DrillStems%DownDepth
  34. if (Allocated(data%State%Drawworks%TDDrillStemsToolJointRange)) deAllocate (data%State%Drawworks%TDDrillStemsToolJointRange)
  35. Allocate (data%State%Drawworks%TDDrillStemsToolJointRange(data%State%Drawworks%TDDrillStemComponentsNumbs+400)) ! +400: because of: Add or Remove DrillStem Components
  36. data%State%Drawworks%TDDrillStemsToolJointRange = data%State%TD_DrillStems%ToolJointRange
  37. if (Allocated(data%State%Drawworks%TDDrillStemsTopDepth)) deAllocate (data%State%Drawworks%TDDrillStemsTopDepth)
  38. Allocate (data%State%Drawworks%TDDrillStemsTopDepth(data%State%Drawworks%TDDrillStemComponentsNumbs+400)) ! +400: because of: Add or Remove DrillStem Components
  39. data%State%Drawworks%TDDrillStemsTopDepth = data%State%TD_DrillStems%TopDepth
  40. if (Allocated(data%State%Drawworks%TDDrillStemsRtoolJoint)) deAllocate (data%State%Drawworks%TDDrillStemsRtoolJoint)
  41. Allocate (data%State%Drawworks%TDDrillStemsRtoolJoint(data%State%Drawworks%TDDrillStemComponentsNumbs+400)) ! +400: because of: Add or Remove DrillStem Components
  42. data%State%Drawworks%TDDrillStemsRtoolJoint = data%State%TD_DrillStems%RtoolJoint
  43. !>>> Warnings
  44. data%State%Drawworks%CrownCollision = data%Warnings%CrownCollision
  45. data%State%Drawworks%FloorCollision = data%Warnings%FloorCollision
  46. data%State%Drawworks%Conv_Ratio = 1.0d0/.380d0 !che meghdari bashad?????????????????? !data%State%Drawworks%FWD_Conv_Ratio(data%State%Drawworks%ClutchMode,data%State%Drawworks%TransMode)
  47. data%Equipments%DrillingConsole%ParkingBrakeLed = 0
  48. !===> min&max Hook Height
  49. if ( data%State%Drawworks%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL ) then
  50. if ( Get_Swing()==SWING_WELL_END .and. Get_KellyConnection()==KELLY_CONNECTION_NOTHING ) then
  51. data%State%Drawworks%DrillModeCond = 1
  52. data%State%Drawworks%min_Hook_Height = data%State%TD_String%TopJointHeight+data%State%OperationScenario%HKL-data%State%OperationScenario%RE ![ft] HKL=63.76=Kelly Ass. Height , RE=Release
  53. data%State%Drawworks%max_Hook_Height = 120.d0 ![ft]
  54. else if ( Get_Swing()==SWING_WELL_END .and. Get_KellyConnection()==KELLY_CONNECTION_SINGLE ) then
  55. data%State%Drawworks%DrillModeCond = 2
  56. data%State%Drawworks%min_Hook_Height = data%State%TD_String%TopJointHeight+data%State%OperationScenario%HKL+data%State%OperationScenario%PL-data%State%OperationScenario%RE ![ft] PL=30=Pipe Lenght
  57. data%State%Drawworks%max_Hook_Height = 120.d0 ![ft]
  58. else if ( Get_Swing()==SWING_WELL_END .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then
  59. data%State%Drawworks%DrillModeCond = 3
  60. data%State%Drawworks%min_Hook_Height = 21.44d0-data%State%OperationScenario%RE ![ft] ?????????? check 21.44=(data%State%TD_StConn%KellyConst-data%State%TD_StConn%KellyElementConst)
  61. data%State%Drawworks%max_Hook_Height = 120.d0 ![ft]
  62. else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_KellyConnection()==KELLY_CONNECTION_NOTHING ) then
  63. data%State%Drawworks%DrillModeCond = 4
  64. data%State%Drawworks%min_Hook_Height = 66.d0-data%State%OperationScenario%RE ![ft]
  65. data%State%Drawworks%max_Hook_Height = 120.d0 ![ft]
  66. else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_KellyConnection()==KELLY_CONNECTION_SINGLE ) then
  67. data%State%Drawworks%DrillModeCond = 5
  68. data%State%Drawworks%min_Hook_Height = 65.1d0-data%State%OperationScenario%RE ![ft]
  69. data%State%Drawworks%max_Hook_Height = 120.d0 ![ft]
  70. else if ( Get_Swing()==SWING_RAT_HOLE_END ) then
  71. data%State%Drawworks%DrillModeCond = 6
  72. data%State%Drawworks%min_Hook_Height = 66.d0-data%State%OperationScenario%RE ![ft]
  73. data%State%Drawworks%max_Hook_Height = 120.d0 ![ft]
  74. end if
  75. else if ( data%State%Drawworks%DriveType==1 .and. Get_OperationCondition()==OPERATION_TRIP ) then
  76. if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING ) then
  77. data%State%Drawworks%DrillModeCond = 7
  78. data%State%Drawworks%min_Hook_Height = 18.38d0 ![ft]
  79. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  80. else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND ) then
  81. data%State%Drawworks%DrillModeCond = 8
  82. data%State%Drawworks%min_Hook_Height = data%State%TD_String%TopJointHeight+data%State%OperationScenario%HL+data%State%OperationScenario%SL-(3.d0*data%State%OperationScenario%RE) ![ft] HL=17.81=Hook Assy , SL=90=Stand Length , 3: chon meghdari az toole loole(tool joint) dakhele elevator gharar migirad
  83. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  84. else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE ) then
  85. data%State%Drawworks%DrillModeCond = 9
  86. data%State%Drawworks%min_Hook_Height = data%State%TD_String%TopJointHeight+data%State%OperationScenario%HL+data%State%OperationScenario%PL-(3.d0*data%State%OperationScenario%RE) ![ft] 3: chon meghdari az toole loole(tool joint) balaye elevator mimanad
  87. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  88. else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING ) then
  89. data%State%Drawworks%DrillModeCond = 10
  90. data%State%Drawworks%min_Hook_Height = 18.5d0-data%State%OperationScenario%RE ![ft]
  91. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  92. else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING ) then
  93. data%State%Drawworks%DrillModeCond = 11
  94. data%State%Drawworks%min_Hook_Height = 19.38d0-data%State%OperationScenario%RE ![ft]
  95. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  96. else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE ) then
  97. data%State%Drawworks%DrillModeCond = 12
  98. data%State%Drawworks%min_Hook_Height = 17.73d0-data%State%OperationScenario%RE ![ft]
  99. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  100. else if ( Get_Swing()==SWING_RAT_HOLE_END ) then
  101. data%State%Drawworks%DrillModeCond = 13
  102. data%State%Drawworks%min_Hook_Height = 27.41d0-data%State%OperationScenario%RE ![ft]
  103. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  104. else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING ) then
  105. data%State%Drawworks%DrillModeCond = 14
  106. data%State%Drawworks%min_Hook_Height = 18.38d0 ![ft]
  107. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  108. else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE ) then
  109. data%State%Drawworks%DrillModeCond = 25 !warning & collision
  110. data%State%Drawworks%min_Hook_Height = 18.38d0 !????????????????? ![ft]
  111. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  112. else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE ) then
  113. data%State%Drawworks%DrillModeCond = 26
  114. data%State%Drawworks%min_Hook_Height = 10.38d0 !????????????????? ![ft]
  115. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  116. else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_STAND ) then
  117. data%State%Drawworks%DrillModeCond = 27
  118. data%State%Drawworks%min_Hook_Height = 18.38d0 !????????????????? ![ft]
  119. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  120. end if
  121. else if ( data%State%Drawworks%DriveType==0 ) then
  122. if ( Get_TdsSwing()==TDS_SWING_TILT_END ) then
  123. if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_SINGLE ) then
  124. data%State%Drawworks%DrillModeCond = 15
  125. data%State%Drawworks%min_Hook_Height = 15.0d0 ![ft]
  126. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  127. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_SINGLE ) then
  128. data%State%Drawworks%DrillModeCond = 16
  129. data%State%Drawworks%min_Hook_Height = 15.0d0 ![ft]
  130. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  131. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
  132. data%State%Drawworks%DrillModeCond = 17
  133. data%State%Drawworks%min_Hook_Height = 15.0d0 ![ft]
  134. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  135. end if
  136. else if ( Get_TdsSwing()==TDS_SWING_OFF_END ) then
  137. if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STRING ) then
  138. data%State%Drawworks%DrillModeCond = 18
  139. data%State%Drawworks%min_Hook_Height = max(16.0d0,data%State%TD_String%TopJointHeight) ![ft]
  140. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  141. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING ) then
  142. data%State%Drawworks%DrillModeCond = 19
  143. data%State%Drawworks%min_Hook_Height = data%State%TD_String%TopJointHeight ![ft]
  144. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  145. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
  146. data%State%Drawworks%DrillModeCond = 20
  147. data%State%Drawworks%min_Hook_Height = data%State%TD_String%TopJointHeight ![ft]
  148. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  149. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
  150. data%State%Drawworks%DrillModeCond = 21
  151. data%State%Drawworks%min_Hook_Height = max(16.0d0,data%State%TD_String%TopJointHeight) ![ft]
  152. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  153. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STAND ) then
  154. data%State%Drawworks%DrillModeCond = 22
  155. data%State%Drawworks%min_Hook_Height = max(16.0d0,data%State%TD_String%TopJointHeight) ![ft]
  156. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  157. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STAND ) then
  158. data%State%Drawworks%DrillModeCond = 23
  159. data%State%Drawworks%min_Hook_Height = max(16.0d0,data%State%TD_String%TopJointHeight) ![ft]
  160. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  161. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
  162. data%State%Drawworks%DrillModeCond = 24
  163. data%State%Drawworks%min_Hook_Height = data%State%TD_String%TopJointHeight ![ft]
  164. data%State%Drawworks%max_Hook_Height = 140.d0 ![ft]
  165. end if
  166. end if
  167. end if
  168. !===> SLIPS SET , No Motion
  169. if ( data%State%Drawworks%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then
  170. data%State%Drawworks%Speed = 0.d0
  171. end if
  172. if ( data%State%Drawworks%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_SPINE .or. Get_TdsConnectionModes()==TDS_CONNECTION_STRING) ) then
  173. data%State%Drawworks%Speed = 0.d0
  174. end if
  175. !===> Closed BOP Rams , No Motion
  176. if ( data%State%Drawworks%ShearBopSituation==1 .and. (any(data%State%Drawworks%DrillModeCond==(/3,10,19,20,24/))) ) then
  177. data%State%Drawworks%Speed = 0.d0
  178. end if
  179. end subroutine Drawworks_Inputs