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.
 
 
 
 
 
 

207 lines
14 KiB

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