subroutine Drawworks_Inputs use CDrillingConsoleVariables use SimulationVariables use SimulationVariables ! Use CSimulationVariables use OperationScenariosModule use CWarnings use SimulationVariables use SimulationVariables !@ Use TD_StringConnectionData Use TD_DrillStemComponents use SimulationVariables !@ use SimulationVariables !@ IMPLICIT NONE data%State%Drawworks%AssignmentSwitch = data%EquipmentControl%DrillingConsole%AssignmentSwitch data%State%Drawworks%Switch = data%EquipmentControl%DrillingConsole%DWSwitch data%State%Drawworks%Throttle = data%EquipmentControl%DrillingConsole%DWThrottle ![RPM] data%State%Drawworks%DriveType = data%Configuration%Hoisting%DriveType data%State%Drawworks%ShearBopSituation = data%State%RamLine%ShearBop_Situation_forTD !data%State%Drawworks%MotorFaileMalf = ?????? motaghayere voroudi !dar CHoistingProblemsVariables meghdardehi mishavad !>>> RAM & ToolJoint Collision data%State%Drawworks%TDBOPElementNo = data%State%TD_BOP%BOPElementNo data%State%Drawworks%TDBOPHeight = data%State%TD_BOP%BOPHeight data%State%Drawworks%TDBOPRamDiam = data%State%TD_BOP%BOPRamDiam data%State%Drawworks%TDBOPThickness = data%State%TD_BOP%BOPThickness data%State%Drawworks%TDDrillStemBottom = data%State%TD_String%DrillStemBottom data%State%Drawworks%TDWellTotalLength = data%State%TD_WellGeneral%WellTotalLength data%State%Drawworks%TDDlMax = data%State%TD_String%DlMax data%State%Drawworks%TDDrillStemComponentsNumbs = data%State%TD_String%DrillStemComponentsNumbs if (Allocated(data%State%Drawworks%TDDrillStemsDownDepth)) deAllocate (data%State%Drawworks%TDDrillStemsDownDepth) ! inja gozashtameshun cho momkene tuye startup tedade elemanha dir berese va error bede Allocate (data%State%Drawworks%TDDrillStemsDownDepth(data%State%Drawworks%TDDrillStemComponentsNumbs+400)) ! +400: because of: Add or Remove DrillStem Components data%State%Drawworks%TDDrillStemsDownDepth = data%State%TD_DrillStems%DownDepth if (Allocated(data%State%Drawworks%TDDrillStemsToolJointRange)) deAllocate (data%State%Drawworks%TDDrillStemsToolJointRange) Allocate (data%State%Drawworks%TDDrillStemsToolJointRange(data%State%Drawworks%TDDrillStemComponentsNumbs+400)) ! +400: because of: Add or Remove DrillStem Components data%State%Drawworks%TDDrillStemsToolJointRange = data%State%TD_DrillStems%ToolJointRange if (Allocated(data%State%Drawworks%TDDrillStemsTopDepth)) deAllocate (data%State%Drawworks%TDDrillStemsTopDepth) Allocate (data%State%Drawworks%TDDrillStemsTopDepth(data%State%Drawworks%TDDrillStemComponentsNumbs+400)) ! +400: because of: Add or Remove DrillStem Components data%State%Drawworks%TDDrillStemsTopDepth = data%State%TD_DrillStems%TopDepth if (Allocated(data%State%Drawworks%TDDrillStemsRtoolJoint)) deAllocate (data%State%Drawworks%TDDrillStemsRtoolJoint) Allocate (data%State%Drawworks%TDDrillStemsRtoolJoint(data%State%Drawworks%TDDrillStemComponentsNumbs+400)) ! +400: because of: Add or Remove DrillStem Components data%State%Drawworks%TDDrillStemsRtoolJoint = data%State%TD_DrillStems%RtoolJoint !>>> Warnings data%State%Drawworks%CrownCollision = data%Warnings%CrownCollision data%State%Drawworks%FloorCollision = data%Warnings%FloorCollision 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) data%EquipmentControl%DrillingConsole%ParkingBrakeLed = 0 !===> min&max Hook Height if ( data%State%Drawworks%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL ) then if ( Get_Swing()==SWING_WELL_END .and. Get_KellyConnection()==KELLY_CONNECTION_NOTHING ) then data%State%Drawworks%DrillModeCond = 1 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 data%State%Drawworks%max_Hook_Height = 120.d0 ![ft] else if ( Get_Swing()==SWING_WELL_END .and. Get_KellyConnection()==KELLY_CONNECTION_SINGLE ) then data%State%Drawworks%DrillModeCond = 2 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 data%State%Drawworks%max_Hook_Height = 120.d0 ![ft] else if ( Get_Swing()==SWING_WELL_END .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then data%State%Drawworks%DrillModeCond = 3 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) data%State%Drawworks%max_Hook_Height = 120.d0 ![ft] else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_KellyConnection()==KELLY_CONNECTION_NOTHING ) then data%State%Drawworks%DrillModeCond = 4 data%State%Drawworks%min_Hook_Height = 66.d0-data%State%OperationScenario%RE ![ft] data%State%Drawworks%max_Hook_Height = 120.d0 ![ft] else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_KellyConnection()==KELLY_CONNECTION_SINGLE ) then data%State%Drawworks%DrillModeCond = 5 data%State%Drawworks%min_Hook_Height = 65.1d0-data%State%OperationScenario%RE ![ft] data%State%Drawworks%max_Hook_Height = 120.d0 ![ft] else if ( Get_Swing()==SWING_RAT_HOLE_END ) then data%State%Drawworks%DrillModeCond = 6 data%State%Drawworks%min_Hook_Height = 66.d0-data%State%OperationScenario%RE ![ft] data%State%Drawworks%max_Hook_Height = 120.d0 ![ft] end if else if ( data%State%Drawworks%DriveType==1 .and. Get_OperationCondition()==OPERATION_TRIP ) then if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING ) then data%State%Drawworks%DrillModeCond = 7 data%State%Drawworks%min_Hook_Height = 18.38d0 ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND ) then data%State%Drawworks%DrillModeCond = 8 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 data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE ) then data%State%Drawworks%DrillModeCond = 9 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 data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING ) then data%State%Drawworks%DrillModeCond = 10 data%State%Drawworks%min_Hook_Height = 18.5d0-data%State%OperationScenario%RE ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING ) then data%State%Drawworks%DrillModeCond = 11 data%State%Drawworks%min_Hook_Height = 19.38d0-data%State%OperationScenario%RE ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE ) then data%State%Drawworks%DrillModeCond = 12 data%State%Drawworks%min_Hook_Height = 17.73d0-data%State%OperationScenario%RE ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_Swing()==SWING_RAT_HOLE_END ) then data%State%Drawworks%DrillModeCond = 13 data%State%Drawworks%min_Hook_Height = 27.41d0-data%State%OperationScenario%RE ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING ) then data%State%Drawworks%DrillModeCond = 14 data%State%Drawworks%min_Hook_Height = 18.38d0 ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE ) then data%State%Drawworks%DrillModeCond = 25 !warning & collision data%State%Drawworks%min_Hook_Height = 18.38d0 !????????????????? ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE ) then data%State%Drawworks%DrillModeCond = 26 data%State%Drawworks%min_Hook_Height = 10.38d0 !????????????????? ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_STAND ) then data%State%Drawworks%DrillModeCond = 27 data%State%Drawworks%min_Hook_Height = 18.38d0 !????????????????? ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] end if else if ( data%State%Drawworks%DriveType==0 ) then if ( Get_TdsSwing()==TDS_SWING_TILT_END ) then if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_SINGLE ) then data%State%Drawworks%DrillModeCond = 15 data%State%Drawworks%min_Hook_Height = 15.0d0 ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_SINGLE ) then data%State%Drawworks%DrillModeCond = 16 data%State%Drawworks%min_Hook_Height = 15.0d0 ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then data%State%Drawworks%DrillModeCond = 17 data%State%Drawworks%min_Hook_Height = 15.0d0 ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] end if else if ( Get_TdsSwing()==TDS_SWING_OFF_END ) then if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STRING ) then data%State%Drawworks%DrillModeCond = 18 data%State%Drawworks%min_Hook_Height = max(16.0d0,data%State%TD_String%TopJointHeight) ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING ) then data%State%Drawworks%DrillModeCond = 19 data%State%Drawworks%min_Hook_Height = data%State%TD_String%TopJointHeight ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then data%State%Drawworks%DrillModeCond = 20 data%State%Drawworks%min_Hook_Height = data%State%TD_String%TopJointHeight ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then data%State%Drawworks%DrillModeCond = 21 data%State%Drawworks%min_Hook_Height = max(16.0d0,data%State%TD_String%TopJointHeight) ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STAND ) then data%State%Drawworks%DrillModeCond = 22 data%State%Drawworks%min_Hook_Height = max(16.0d0,data%State%TD_String%TopJointHeight) ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STAND ) then data%State%Drawworks%DrillModeCond = 23 data%State%Drawworks%min_Hook_Height = max(16.0d0,data%State%TD_String%TopJointHeight) ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then data%State%Drawworks%DrillModeCond = 24 data%State%Drawworks%min_Hook_Height = data%State%TD_String%TopJointHeight ![ft] data%State%Drawworks%max_Hook_Height = 140.d0 ![ft] end if end if end if !===> SLIPS SET , No Motion if ( data%State%Drawworks%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then data%State%Drawworks%Speed = 0.d0 end if 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 data%State%Drawworks%Speed = 0.d0 end if !===> Closed BOP Rams , No Motion if ( data%State%Drawworks%ShearBopSituation==1 .and. (any(data%State%Drawworks%DrillModeCond==(/3,10,19,20,24/))) ) then data%State%Drawworks%Speed = 0.d0 end if end subroutine Drawworks_Inputs