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.

Drawworks_INPUTS.f90 16 KiB

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