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.
 
 
 
 
 
 

241 lines
14 KiB

  1. subroutine Drawworks_INPUTS
  2. Use CDrillingConsoleVariables
  3. Use CDataDisplayConsoleVariables
  4. Use CHoistingVariables
  5. ! use CSimulationVariables
  6. ! Use CSlipsEnumVariables
  7. Use CKellyConnectionEnumVariables
  8. Use CElevatorConnectionEnumVariables
  9. ! Use COperationConditionEnumVariables
  10. Use COperationScenariosVariables
  11. ! Use CSwingEnumVariables
  12. Use CUnityInputs
  13. Use CTdsConnectionModesEnumVariables
  14. Use CTdsElevatorModesEnumVariables
  15. ! Use CTdsSwingEnumVariables
  16. use UnitySignalVariables
  17. Use VARIABLES
  18. Use Drawworks_VARIABLES
  19. Use TD_StringConnectionData
  20. Use TD_DrillStemComponents
  21. IMPLICIT NONE
  22. Call DWMalfunction_ClutchEngage
  23. Drawworks%TransMode = DrillingConsole%DWTransmisionLever
  24. Drawworks%Direction_Var = DrillingConsole%DWSwitch
  25. ! if (IsPortable) then
  26. ! if (Drawworks%Direction_Var==-1 .and. DataDisplayConsole%Clutch==1) then !in FWD mode
  27. ! Drawworks%Conv_Ratio = Drawworks%FWD_Conv_Ratio(Drawworks%ClutchMode,Drawworks%TransMode)
  28. ! else
  29. ! Drawworks%Conv_Ratio = 1.d0
  30. ! end if
  31. ! else
  32. if (Drawworks%Direction_Var==-1) then !in FWD mode
  33. Drawworks%Conv_Ratio = Drawworks%FWD_Conv_Ratio(Drawworks%ClutchMode,Drawworks%TransMode)
  34. else if (Drawworks%Direction_Var==+1) then !in REV mode
  35. Drawworks%Conv_Ratio = 1.d0
  36. else if (Drawworks%Direction_Var==0) then !in OFF mode
  37. Drawworks%Conv_Ratio = 1.d0
  38. end if
  39. ! end if
  40. !===> Main Brake and Eddy Brake
  41. Drawworks%EddyBreak = DrillingConsole%EddyBreakLever*0.5 !0<EddyBreakLever<100 *0.5= 50% of EddyBreakLever
  42. Drawworks%BrakeLeverCoefficient = DrillingConsole%BrakeLeverCoefficient !0<BrakeLeverCoefficient<100
  43. if ( Drawworks%BrakeLeverCoefficient<10.d0 ) then
  44. Drawworks%BrakeLeverCoefficient = 10.d0
  45. end if
  46. Drawworks%ManualBreak = 100.d0-((100.d0-DrillingConsole%DWBreak)*(100.d0/Drawworks%BrakeLeverCoefficient)) !0<DWBrake<100 20
  47. if ( Drawworks%ManualBreak<0.d0 ) then
  48. Drawworks%ManualBreak = 0.d0
  49. end if
  50. ! if ( IsPortable .and. DrillingConsole%ParkingBrakeBtn==1 ) then
  51. ! Drawworks%ManualBreak = 100.d0
  52. ! DrillingConsole%ParkingBrakeLed = 1
  53. ! else
  54. DrillingConsole%ParkingBrakeLed = 0
  55. ! end if
  56. !===> Brake Load (Main Brake)
  57. Drawworks%BreakLoad = Hoisting%DrillingLineBreakingLoad ![Lbf]
  58. Drawworks%BreakLoad = 4.448221619*Drawworks%BreakLoad ![N]
  59. !===> F_fastline
  60. Drawworks%F_fastline = real(TD_DrawworksLoadInput) ![Lbf]
  61. Drawworks%F_fastline = 4.448221619*Drawworks%F_fastline ![N]
  62. !===> min&max Hook Height
  63. if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL ) then
  64. if ( Get_Swing()==SWING_WELL_END .and. Get_KellyConnection()==KELLY_CONNECTION_NOTHING ) then
  65. DW_DrillModeCond = 1
  66. Drawworks%min_Hook_Height = TD_TopJointHeight+OperationScenario%HKL-OperationScenario%RE ![ft] HKL=63.76=Kelly Ass. Height , RE=Release
  67. Drawworks%max_Hook_Height = 120.d0 ![ft]
  68. else if ( Get_Swing()==SWING_WELL_END .and. Get_KellyConnection()==KELLY_CONNECTION_SINGLE ) then
  69. DW_DrillModeCond = 2
  70. Drawworks%min_Hook_Height = TD_TopJointHeight+OperationScenario%HKL+OperationScenario%PL-OperationScenario%RE ![ft] PL=30=Pipe Lenght
  71. Drawworks%max_Hook_Height = 120.d0 ![ft]
  72. else if ( Get_Swing()==SWING_WELL_END .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then
  73. DW_DrillModeCond = 3
  74. Drawworks%min_Hook_Height = 21.44d0-OperationScenario%RE ![ft] ?????????? check 21.44=(TD_KellyConst-TD_KellyElementConst)
  75. Drawworks%max_Hook_Height = 120.d0 ![ft]
  76. else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_KellyConnection()==KELLY_CONNECTION_NOTHING ) then
  77. DW_DrillModeCond = 4
  78. Drawworks%min_Hook_Height = 66.d0-OperationScenario%RE ![ft]
  79. Drawworks%max_Hook_Height = 120.d0 ![ft]
  80. else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_KellyConnection()==KELLY_CONNECTION_SINGLE ) then
  81. DW_DrillModeCond = 5
  82. Drawworks%min_Hook_Height = 65.1d0-OperationScenario%RE ![ft]
  83. Drawworks%max_Hook_Height = 120.d0 ![ft]
  84. else if ( Get_Swing()==SWING_RAT_HOLE_END ) then
  85. DW_DrillModeCond = 6
  86. Drawworks%min_Hook_Height = 66.d0-OperationScenario%RE ![ft]
  87. Drawworks%max_Hook_Height = 120.d0 ![ft]
  88. end if
  89. else if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_TRIP ) then
  90. if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING ) then
  91. DW_DrillModeCond = 7
  92. Drawworks%min_Hook_Height = 18.38d0 ![ft]
  93. Drawworks%max_Hook_Height = 140.d0 ![ft]
  94. else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND ) then
  95. DW_DrillModeCond = 8
  96. Drawworks%min_Hook_Height = TD_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
  97. Drawworks%max_Hook_Height = 140.d0 ![ft]
  98. else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE ) then
  99. DW_DrillModeCond = 9
  100. Drawworks%min_Hook_Height = TD_TopJointHeight+OperationScenario%HL+OperationScenario%PL-(3.d0*OperationScenario%RE) ![ft] 3: chon meghdari az toole loole(tool joint) balaye elevator mimanad
  101. Drawworks%max_Hook_Height = 140.d0 ![ft]
  102. else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING ) then
  103. DW_DrillModeCond = 10
  104. Drawworks%min_Hook_Height = 18.5d0-OperationScenario%RE ![ft]
  105. Drawworks%max_Hook_Height = 140.d0 ![ft]
  106. else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING ) then
  107. DW_DrillModeCond = 11
  108. Drawworks%min_Hook_Height = 19.38d0-OperationScenario%RE ![ft]
  109. Drawworks%max_Hook_Height = 140.d0 ![ft]
  110. else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE ) then
  111. DW_DrillModeCond = 12
  112. Drawworks%min_Hook_Height = 17.73d0-OperationScenario%RE ![ft]
  113. Drawworks%max_Hook_Height = 140.d0 ![ft]
  114. else if ( Get_Swing()==SWING_RAT_HOLE_END ) then
  115. DW_DrillModeCond = 13
  116. Drawworks%min_Hook_Height = 27.41d0-OperationScenario%RE ![ft]
  117. Drawworks%max_Hook_Height = 140.d0 ![ft]
  118. else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING ) then
  119. DW_DrillModeCond = 14
  120. Drawworks%min_Hook_Height = 18.38d0 ![ft]
  121. Drawworks%max_Hook_Height = 140.d0 ![ft]
  122. else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE ) then
  123. DW_DrillModeCond = 25 !warning & collision
  124. Drawworks%min_Hook_Height = 18.38d0 !????????????????? ![ft]
  125. Drawworks%max_Hook_Height = 140.d0 ![ft]
  126. else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE ) then
  127. DW_DrillModeCond = 26
  128. Drawworks%min_Hook_Height = 10.38d0 !????????????????? ![ft]
  129. Drawworks%max_Hook_Height = 140.d0 ![ft]
  130. else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_STAND ) then
  131. DW_DrillModeCond = 27
  132. Drawworks%min_Hook_Height = 18.38d0 !????????????????? ![ft]
  133. Drawworks%max_Hook_Height = 140.d0 ![ft]
  134. end if
  135. else if ( Hoisting%DriveType==0 ) then
  136. if ( Get_TdsSwing()==TDS_SWING_TILT_END ) then
  137. if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_SINGLE ) then
  138. DW_DrillModeCond = 15
  139. Drawworks%min_Hook_Height = 15.0d0 ![ft]
  140. Drawworks%max_Hook_Height = 140.d0 ![ft]
  141. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_SINGLE ) then
  142. DW_DrillModeCond = 16
  143. Drawworks%min_Hook_Height = 15.0d0 ![ft]
  144. Drawworks%max_Hook_Height = 140.d0 ![ft]
  145. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
  146. DW_DrillModeCond = 17
  147. Drawworks%min_Hook_Height = 15.0d0 ![ft]
  148. Drawworks%max_Hook_Height = 140.d0 ![ft]
  149. end if
  150. else if ( Get_TdsSwing()==TDS_SWING_OFF_END ) then
  151. if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STRING ) then
  152. DW_DrillModeCond = 18
  153. Drawworks%min_Hook_Height = max(16.0d0,TD_TopJointHeight) ![ft]
  154. Drawworks%max_Hook_Height = 140.d0 ![ft]
  155. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING ) then
  156. DW_DrillModeCond = 19
  157. Drawworks%min_Hook_Height = TD_TopJointHeight ![ft]
  158. Drawworks%max_Hook_Height = 140.d0 ![ft]
  159. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
  160. DW_DrillModeCond = 20
  161. Drawworks%min_Hook_Height = TD_TopJointHeight ![ft]
  162. Drawworks%max_Hook_Height = 140.d0 ![ft]
  163. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
  164. DW_DrillModeCond = 21
  165. Drawworks%min_Hook_Height = max(16.0d0,TD_TopJointHeight) ![ft]
  166. Drawworks%max_Hook_Height = 140.d0 ![ft]
  167. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STAND ) then
  168. DW_DrillModeCond = 22
  169. Drawworks%min_Hook_Height = max(16.0d0,TD_TopJointHeight) ![ft]
  170. Drawworks%max_Hook_Height = 140.d0 ![ft]
  171. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STAND ) then
  172. DW_DrillModeCond = 23
  173. Drawworks%min_Hook_Height = max(16.0d0,TD_TopJointHeight) ![ft]
  174. Drawworks%max_Hook_Height = 140.d0 ![ft]
  175. else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
  176. DW_DrillModeCond = 24
  177. Drawworks%min_Hook_Height = TD_TopJointHeight ![ft]
  178. Drawworks%max_Hook_Height = 140.d0 ![ft]
  179. end if
  180. end if
  181. end if
  182. !print* , 'DW_DrillModeCond=' , DW_DrillModeCond
  183. !!print* , 'Drawworks%min_Hook_Height=' , Drawworks%min_Hook_Height
  184. !!print* , 'Drawworks%max_Hook_Height=' , Drawworks%max_Hook_Height
  185. !print* , 'Drawworks%Hook_Height_final=' , Drawworks%Hook_Height_final
  186. !print*, 'TD_DrillStemComponentsNumbs2=' , TD_DrillStemComponentsNumbs
  187. !print*, 'TD_TopJointHeight2=' , TD_TopJointHeight
  188. !print*, 'TD_DrillStemTotalLength2=', TD_DrillStemTotalLength
  189. !===> SLIPS SET , No Motion
  190. if ( Hoisting%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then
  191. Drawworks%ManualBreak = 100.d0
  192. Drawworks%N_ref = 0.d0
  193. end if
  194. if ( Hoisting%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_SPINE .or. Get_TdsConnectionModes()==TDS_CONNECTION_STRING) ) then
  195. Drawworks%ManualBreak = 100.d0
  196. Drawworks%N_ref = 0.d0
  197. end if
  198. !===> Closed BOP Rams , No Motion
  199. !if ( PipeRam1_Situation_forTD==1 .or. PipeRam2_Situation_forTD==1 .or. ShearBop_Situation_forTD==1 ) then
  200. if ( RamLine%ShearBop_Situation_forTD==1 .and. (any(DW_DrillModeCond==(/3,10,19,20,24/))) ) then
  201. Drawworks%ManualBreak = 100.d0
  202. Drawworks%N_ref = 0.d0
  203. end if
  204. end subroutine Drawworks_INPUTS