|
- subroutine TD_StringConnectionModes
-
- Use CHoistingVariables
- Use CDrillingConsoleVariables
- use UnitySignalVariables
- ! Use CKellyConnectionEnumVariables
- ! Use CElevatorConnectionEnumVariables
- ! Use CSlipsEnumVariables
- ! Use COperationConditionEnumVariables
- use SoftwareInputsVariables
- ! Use CZeroStringSpeed
- ! Use CTdsConnectionModesEnumVariables
- ! Use CTdsElevatorModesEnumVariables
- Use COperationScenariosVariables
- Use TD_DrillStemComponents
- Use TD_WellElements
- Use TD_WellGeometry
- Use TD_GeneralData
- Use TD_StringConnectionData
- Use Drawworks_VARIABLES!, only: Drawworks
-
-
-
- implicit none
- integer :: i , kk
- Real(8) :: LengthSum
-
-
-
-
-
-
-
- !!=====> Read Data
- !kk = 0
- !LengthSum = 0.d0
- !
- !Do i = TD_DrillStemComponentsNumbs , 1 , -1
- ! if (TD_DrillStems(i)%ComponentType==3) then
- ! kk = i
- ! exit
- ! else if (TD_DrillStems(i)%ComponentType==5 .or. TD_DrillStems(i)%ComponentType==7) then
- ! LengthSum = LengthSum+TD_DrillStems(i)%LengthIni
- ! end if
- !End Do
-
-
-
-
-
-
-
- !####C_Program -----> DriveType =
- ! = 0 TopDrive_DriveType
- ! = 1 Kelly_DriveType
-
- !####C_Program -----> TD_KellyDriveTypeMode =
- ! = 0 Drill Mode (Kelly)
- ! = 1 Trip Mode (Elevator)
- ! = 2 TopDrive Mode
-
- if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL ) then
- TD_KellyDriveTypeMode = 0
- else if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_TRIP ) then
- TD_KellyDriveTypeMode = 1
- else if ( Hoisting%DriveType==0 ) then
- TD_KellyDriveTypeMode = 2
- end if
-
- TD_HookHeight = DW_TDHookHeight ! unit: [ft]
- TD_ElevatorConst = 17.985 ! [ft] Elevator Length(14.84) ????????????????? adad ha daghigh shavand
- TD_ElevatorECG = OperationScenario%ECG ! [ft]
- TD_KellyConst = 63.280d0 ! [ft] Kelly Length(61.74) + Safety Valve Length(1.54)
- TD_KellyElementConst = 41.840d0 ! [ft] Kelly Element Length(40.3) + Safety Valve Length(1.54)
- TD_TDSLength = 24.08d0 !??????????????????? ! [ft]
- TD_TDSToolJointLength = 0.77d0 !??????????????????? ! [ft]
- TD_TDSElevatorLength = 26.837d0 !?????? ! TDS with Elevator Length [ft]
- TD_TDSElevatorToolLength= 0.859d0 !??????????????????? ! [ft]
- TD_TDSElevatorECG = 2.454 ! [ft]
- TD_NumOfCables = Hoisting%NumberOfLine
- TD_WeightTB = Hoisting%TravelingBlockWeight ! [lb]
- TD_WeightTD = Hoisting%TopDriveWeight ! [lb]
- TD_KellyWeight = Hoisting%KellyWeight ! [lb]
-
-
-
-
-
-
-
-
- !=====> Velocity Calculation
- TD_HookVelocity = (TD_HookHeight-TD_HookHeightOld)/TD_TimeStep ! [ft/s]
-
-
-
-
-
-
-
-
-
- !====================================================
- ! Add or Remove DrillStem Components
- !====================================================
- Call TD_AddComponents
-
- Call TD_RemoveComponents
-
-
- !=====> Read Data
- kk = 0
- LengthSum = 0.d0
-
- Do i = TD_DrillStemComponentsNumbs , 1 , -1
- if (TD_DrillStems(i)%ComponentType==3) then
- kk = i
- exit
- else if (TD_DrillStems(i)%ComponentType==5 .or. TD_DrillStems(i)%ComponentType==7) then
- LengthSum = LengthSum+TD_DrillStems(i)%LengthIni
- end if
- End Do
- !print*, 'kk' , kk
- !print*, 'TD_DrillStems(kk)%LengthIni0=' , TD_DrillStems(kk)%LengthIni
-
-
-
-
- !====================================================
- ! String Connection Mode Determination
- !====================================================
-
- !####TD_StringConnectionMode =
- ! = 0 Slips Set ???????
- ! = 1 Kelly Connected to String
- ! = 2 Kelly Nothing Connected
- ! = 3 Kelly Connected to Single
- ! = 4 Elevator Connected to String
- ! = 5 Elevator Nothing Connected
- ! = 6 Elevator Connected to Stand
- ! = 7 Elevator Connected to Single
- ! = 8 Elevator Latch String
- ! = 18 Elevator Latch Single
- ! = 19 Elevator Latch Stand
- ! = 9 TDS CONNECTION SPINE
- ! = 10 TDS CONNECTION STRING
- ! = 11 TDS CONNECTION NOTHING .and. TDS ELEVATOR LATCH STRING
- ! = 12 TDS CONNECTION NOTHING .and. TDS ELEVATOR CONNECTION STRING
- ! = 13 TDS CONNECTION NOTHING .and. TDS ELEVATOR CONNECTION NOTHING
- ! = 14 TDS CONNECTION NOTHING .and. TDS ELEVATOR CONNECTION STAND
- ! = 15 TDS CONNECTION NOTHING .and. TDS ELEVATOR CONNECTION SINGLE
- ! = 16 TDS CONNECTION NOTHING .and. TDS ELEVATOR LATCH SINGLE
- ! = 17 TDS CONNECTION NOTHING .and. TDS ELEVATOR LATCH STAND
-
-
-
-
-
- !if (TD_DlTouch<=0.) then ![ft]
- ! if(TD_HookVelocity<=0.) then
- ! TD_ConnectionHeight = TD_ConnectionHeight
- ! TD_StringVelocity = 0.0d0
- ! return
- ! end if
- !end if
-
-
-
- !=====> Connection Height Determination
-
- if ( TD_KellyDriveTypeMode==0 ) then
-
- if(Get_KellyConnection() == KELLY_CONNECTION_STRING) then
- TD_KellyNewStatus1 = 1
- else
- TD_KellyNewStatus1 = 0
- !TD_KellyOldStatus1 = 0
- end if
-
- if(Get_KellyConnection()==KELLY_CONNECTION_NOTHING) then
- TD_KellyNewStatus2 = 1
- else
- TD_KellyNewStatus2 = 0
- !TD_KellyOldStatus2 = 0
- end if
-
- if(Get_KellyConnection()==KELLY_CONNECTION_SINGLE) then
- TD_KellyNewStatus3 = 1
- else
- TD_KellyNewStatus3 = 0
- !TD_KellyOldStatus3 = 0
- end if
-
-
- if ( Get_KellyConnection() == KELLY_CONNECTION_STRING ) then
- TD_StringConnectionMode = 1
- !print*, 'TD_ConnectionHeight10=' , TD_ConnectionHeight
- !print*, 'TD_KellyElementConst1=' , TD_KellyElementConst
- !print*, 'TD_DrillStems(kk)%LengthIni1=' , TD_DrillStems(kk)%LengthIni
- if (TD_KellyOldStatus2==1 .and. TD_KellyNewStatus1/=TD_KellyOldStatus1) then
- TD_ConnectionHeight = TD_ConnectionHeight+TD_KellyElementConst
- TD_KellyOldStatus1 = TD_KellyNewStatus1
- TD_KellyOldStatus2 = 0
- else if (TD_KellyOldStatus3==1 .and. TD_KellyNewStatus1/=TD_KellyOldStatus1) then
- TD_ConnectionHeight = TD_ConnectionHeight+TD_KellyElementConst+30.d0 !TD_DrillStems(kk)%LengthIni
- TD_KellyOldStatus1 = TD_KellyNewStatus1
- TD_KellyOldStatus3 = 0
- end if
- !print*, 'TD_ConnectionHeight1=' , TD_ConnectionHeight
- if ( Get_Slips() == SLIPS_SET_END ) then
- !!if ( TD_HookVelocity>0. ) then
- !! Print*, '*** UnSet Slips ***' !?????????
- !!end if
- TD_KellyConnectionHeight = TD_HookHeight-(TD_KellyConst-TD_KellyElementConst) !?????????
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
- else
- !if (TD_DlTouch<=0. .and. TD_HookVelocity<=0.) then
- ! TD_ConnectionHeight = TD_ConnectionHeight
- ! TD_StringVelocity = 0.0d0
- !else
- TD_KellyConnectionHeight = TD_HookHeight-(TD_KellyConst-TD_KellyElementConst) !??????????
- TD_ConnectionHeight = TD_KellyConnectionHeight
- TD_StringVelocity = TD_HookVelocity
- !end if
- end if
-
- else if ( Get_KellyConnection() == KELLY_CONNECTION_NOTHING ) then
- TD_StringConnectionMode = 2
- !print*, 'TD_ConnectionHeight20=' , TD_ConnectionHeight
- !print*, 'TD_KellyElementConst2=' , TD_KellyElementConst
- if (TD_KellyOldStatus1==1 .and. TD_KellyNewStatus2/=TD_KellyOldStatus2) then
- TD_ConnectionHeight = TD_ConnectionHeight-TD_KellyElementConst
- TD_KellyOldStatus2 = TD_KellyNewStatus2
- TD_KellyOldStatus1 = 0
- else if (TD_KellyOldStatus3==1 .and. TD_KellyNewStatus2/=TD_KellyOldStatus2) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus2 = TD_KellyNewStatus2
- TD_KellyOldStatus3 = 0
- else if (TD_KellyOldStatus5==1 .and. TD_KellyNewStatus2/=TD_KellyOldStatus2) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus2 = TD_KellyNewStatus2
- TD_KellyOldStatus5 = 0
- end if
- !print*, 'TD_ConnectionHeight2=' , TD_ConnectionHeight
- TD_KellyConnectionHeight = TD_HookHeight-TD_KellyConst
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
-
- else if ( Get_KellyConnection() == KELLY_CONNECTION_SINGLE ) then
- !print*, 'KELLY_CONNECTION_SINGLE' , TD_ConnectionHeight
- TD_StringConnectionMode = 3
- !print*, 'TD_ConnectionHeight30=' , TD_ConnectionHeight
- !print*, 'TD_KellyElementConst3=' , TD_KellyElementConst
- !print*, 'TD_DrillStems(kk)%LengthIni3=' , TD_DrillStems(kk)%LengthIni
- if (TD_KellyOldStatus1==1 .and. TD_KellyNewStatus3/=TD_KellyOldStatus3) then
- !print*, 'KELLY_CONNECTION_SINGLE1' , TD_ConnectionHeight
- !print*, 'TD_KellyElementConst=' , TD_KellyElementConst
- !print*, 'TD_DrillStems(kk)%LengthIni=' , TD_DrillStems(kk)%LengthIni
- TD_ConnectionHeight = TD_ConnectionHeight-TD_KellyElementConst-30.d0 !TD_DrillStems(kk)%LengthIni
- TD_KellyOldStatus3 = TD_KellyNewStatus3
- TD_KellyOldStatus1 = 0
- else if (TD_KellyOldStatus2==1 .and. TD_KellyNewStatus3/=TD_KellyOldStatus3) then
- !print*, 'KELLY_CONNECTION_SINGLE2' , TD_ConnectionHeight
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus3 = TD_KellyNewStatus3
- TD_KellyOldStatus2 = 0
- end if
- !print*, 'TD_ConnectionHeight3=' , TD_ConnectionHeight
- !print*, 'KELLY_CONNECTION_SINGLE3' , TD_ConnectionHeight
- TD_KellyConnectionHeight = TD_HookHeight-TD_KellyConst-TD_DrillStems(kk)%LengthIni
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
- !print*, 'KELLY_CONNECTION_SINGLE4' , TD_ConnectionHeight
- end if
- !print*, 'KELLY_CONNECTION_SINGLE5' , TD_ConnectionHeight
-
- else if ( TD_KellyDriveTypeMode==1 ) then
-
- if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING) then
- TD_KellyNewStatus4 = 1
- else
- TD_KellyNewStatus4 = 0
- !TD_KellyOldStatus4 = 0
- end if
-
- if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING) then
- TD_KellyNewStatus5 = 1
- else
- TD_KellyNewStatus5 = 0
- !TD_KellyOldStatus5 = 0
- end if
-
- if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND) then
- TD_KellyNewStatus6 = 1
- else
- TD_KellyNewStatus6 = 0
- !TD_KellyOldStatus6 = 0
- end if
-
- if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE) then
- TD_KellyNewStatus7 = 1
- else
- TD_KellyNewStatus7 = 0
- !TD_KellyOldStatus7 = 0
- end if
-
- if(Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) then
- TD_KellyNewStatus8 = 1
- else
- TD_KellyNewStatus8 = 0
- !TD_KellyOldStatus8 = 0
- end if
-
- if(Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE) then
- TD_KellyNewStatus18 = 1
- else
- TD_KellyNewStatus18 = 0
- !TD_KellyOldStatus18 = 0
- end if
-
- if(Get_ElevatorConnection() == ELEVATOR_LATCH_STAND) then
- TD_KellyNewStatus19 = 1
- else
- TD_KellyNewStatus19 = 0
- !TD_KellyOldStatus19 = 0
- end if
-
-
- if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING ) then
- TD_StringConnectionMode = 4
- if (TD_KellyOldStatus5==1 .and. TD_KellyNewStatus4/=TD_KellyOldStatus4) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus4 = TD_KellyNewStatus4
- TD_KellyOldStatus5 = 0
- else if (TD_KellyOldStatus6==1 .and. TD_KellyNewStatus4/=TD_KellyOldStatus4) then
- TD_ConnectionHeight = TD_ConnectionHeight+(3.d0*TD_DrillStems(kk)%LengthIni)
- TD_KellyOldStatus4 = TD_KellyNewStatus4
- TD_KellyOldStatus6 = 0
- else if (TD_KellyOldStatus7==1 .and. TD_KellyNewStatus4/=TD_KellyOldStatus4) then
- TD_ConnectionHeight = TD_ConnectionHeight+TD_DrillStems(kk)%LengthIni
- TD_KellyOldStatus4 = TD_KellyNewStatus4
- TD_KellyOldStatus7 = 0
- else if (TD_KellyOldStatus8==1 .and. TD_KellyNewStatus4/=TD_KellyOldStatus4) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus4 = TD_KellyNewStatus4
- TD_KellyOldStatus8 = 0
- end if
- if ( Get_Slips() == SLIPS_SET_END ) then
- !if ( TD_HookVelocity>0. ) then
- ! Print*, '*** UnSet Slips ***' !???????????????????
- !end if
- TD_ElevatorHeight = TD_HookHeight-TD_ElevatorConst !?????????????
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
- else
- TD_ElevatorHeight = TD_HookHeight-TD_ElevatorConst
- TD_ConnectionHeight = TD_HookHeight-TD_ElevatorConst+(LengthSum+TD_ElevatorECG) !(LengthSum+TD_DrillStems(kk)%ToolJointRange)
- TD_StringVelocity = TD_HookVelocity
- end if
-
- else if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING ) then
- TD_StringConnectionMode = 5
- if (TD_KellyOldStatus4==1 .and. TD_KellyNewStatus5/=TD_KellyOldStatus5) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus5 = TD_KellyNewStatus5
- TD_KellyOldStatus4 = 0
- else if (TD_KellyOldStatus6==1 .and. TD_KellyNewStatus5/=TD_KellyOldStatus5) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus5 = TD_KellyNewStatus5
- TD_KellyOldStatus6 = 0
- else if (TD_KellyOldStatus7==1 .and. TD_KellyNewStatus5/=TD_KellyOldStatus5) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus5 = TD_KellyNewStatus5
- TD_KellyOldStatus7 = 0
- else if (TD_KellyOldStatus8==1 .and. TD_KellyNewStatus5/=TD_KellyOldStatus5) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus5 = TD_KellyNewStatus5
- TD_KellyOldStatus8 = 0
- else if (TD_KellyOldStatus2==1 .and. TD_KellyNewStatus5/=TD_KellyOldStatus5) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus5 = TD_KellyNewStatus5
- TD_KellyOldStatus2 = 0
- end if
- TD_ElevatorHeight = TD_HookHeight-TD_ElevatorConst
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
-
- else if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND ) then
- TD_StringConnectionMode = 6
- if (TD_KellyOldStatus4==1 .and. TD_KellyNewStatus6/=TD_KellyOldStatus6) then
- TD_ConnectionHeight = TD_ConnectionHeight-(3.*TD_DrillStems(kk)%LengthIni)
- TD_KellyOldStatus6 = TD_KellyNewStatus6
- TD_KellyOldStatus4 = 0
- else if (TD_KellyOldStatus5==1 .and. TD_KellyNewStatus6/=TD_KellyOldStatus6) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus6 = TD_KellyNewStatus6
- TD_KellyOldStatus5 = 0
- else if (TD_KellyOldStatus7==1 .and. TD_KellyNewStatus6/=TD_KellyOldStatus6) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus6 = TD_KellyNewStatus6
- TD_KellyOldStatus7 = 0
- else if (TD_KellyOldStatus8==1 .and. TD_KellyNewStatus6/=TD_KellyOldStatus6) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus6 = TD_KellyNewStatus6
- TD_KellyOldStatus8 = 0
- end if
- TD_ElevatorHeight = TD_HookHeight-TD_ElevatorConst-(3.*TD_DrillStems(kk)%LengthIni)
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
-
- else if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE ) then
- TD_StringConnectionMode = 7
- if (TD_KellyOldStatus4==1 .and. TD_KellyNewStatus7/=TD_KellyOldStatus7) then
- TD_ConnectionHeight = TD_ConnectionHeight-TD_DrillStems(kk)%LengthIni
- TD_KellyOldStatus7 = TD_KellyNewStatus7
- TD_KellyOldStatus4 = 0
- else if (TD_KellyOldStatus5==1 .and. TD_KellyNewStatus7/=TD_KellyOldStatus7) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus7 = TD_KellyNewStatus7
- TD_KellyOldStatus5 = 0
- else if (TD_KellyOldStatus6==1 .and. TD_KellyNewStatus7/=TD_KellyOldStatus7) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus7 = TD_KellyNewStatus7
- TD_KellyOldStatus6 = 0
- else if (TD_KellyOldStatus8==1 .and. TD_KellyNewStatus7/=TD_KellyOldStatus7) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus7 = TD_KellyNewStatus7
- TD_KellyOldStatus8 = 0
- end if
- TD_ElevatorHeight = TD_HookHeight-TD_ElevatorConst-TD_DrillStems(kk)%LengthIni
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
-
- else if ( Get_ElevatorConnection() == ELEVATOR_LATCH_STRING ) then
- TD_StringConnectionMode = 8
- if (TD_KellyOldStatus4==1 .and. TD_KellyNewStatus8/=TD_KellyOldStatus8) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus8 = TD_KellyNewStatus8
- TD_KellyOldStatus4 = 0
- else if (TD_KellyOldStatus5==1 .and. TD_KellyNewStatus8/=TD_KellyOldStatus8) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus8 = TD_KellyNewStatus8
- TD_KellyOldStatus5 = 0
- else if (TD_KellyOldStatus6==1 .and. TD_KellyNewStatus8/=TD_KellyOldStatus8) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus8 = TD_KellyNewStatus8
- TD_KellyOldStatus6 = 0
- else if (TD_KellyOldStatus7==1 .and. TD_KellyNewStatus8/=TD_KellyOldStatus8) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus8 = TD_KellyNewStatus8
- TD_KellyOldStatus7 = 0
- end if
- TD_ElevatorHeight = TD_HookHeight-TD_ElevatorConst
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
-
- else if ( Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE ) then
- TD_StringConnectionMode = 18
- if (TD_KellyOldStatus5==1 .and. TD_KellyNewStatus18/=TD_KellyOldStatus18) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus18 = TD_KellyNewStatus18
- TD_KellyOldStatus5 = 0
- else if (TD_KellyOldStatus7==1 .and. TD_KellyNewStatus18/=TD_KellyOldStatus18) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus18 = TD_KellyNewStatus18
- TD_KellyOldStatus7 = 0
- else if (TD_KellyOldStatus8==1 .and. TD_KellyNewStatus18/=TD_KellyOldStatus18) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus18 = TD_KellyNewStatus18
- TD_KellyOldStatus8 = 0
- end if
- TD_ElevatorHeight = TD_HookHeight-TD_ElevatorConst
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
-
- else if ( Get_ElevatorConnection() == ELEVATOR_LATCH_STAND ) then
- TD_StringConnectionMode = 19
- if (TD_KellyOldStatus5==1 .and. TD_KellyNewStatus19/=TD_KellyOldStatus19) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus19 = TD_KellyNewStatus19
- TD_KellyOldStatus5 = 0
- else if (TD_KellyOldStatus6==1 .and. TD_KellyNewStatus19/=TD_KellyOldStatus19) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus19 = TD_KellyNewStatus19
- TD_KellyOldStatus6 = 0
- else if (TD_KellyOldStatus8==1 .and. TD_KellyNewStatus19/=TD_KellyOldStatus19) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus19 = TD_KellyNewStatus19
- TD_KellyOldStatus8 = 0
- end if
- TD_ElevatorHeight = TD_HookHeight-TD_ElevatorConst
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
- end if
-
- else if ( TD_KellyDriveTypeMode==2 ) then
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
- TD_KellyNewStatus9 = 1
- else
- TD_KellyNewStatus9 = 0
- !TD_KellyOldStatus9 = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
- TD_KellyNewStatus10 = 1
- else
- TD_KellyNewStatus10 = 0
- !TD_KellyOldStatus10 = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STRING ) then
- TD_KellyNewStatus11 = 1
- else
- TD_KellyNewStatus11 = 0
- !TD_KellyOldStatus11 = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING ) then
- TD_KellyNewStatus12 = 1
- else
- TD_KellyNewStatus12 = 0
- !TD_KellyOldStatus12 = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
- TD_KellyNewStatus13 = 1
- else
- TD_KellyNewStatus13 = 0
- !TD_KellyOldStatus13 = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STAND ) then
- TD_KellyNewStatus14 = 1
- else
- TD_KellyNewStatus14 = 0
- !TD_KellyOldStatus14 = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_SINGLE ) then
- TD_KellyNewStatus15 = 1
- else
- TD_KellyNewStatus15 = 0
- !TD_KellyOldStatus15 = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_SINGLE ) then
- TD_KellyNewStatus16 = 1
- else
- TD_KellyNewStatus16 = 0
- !TD_KellyOldStatus16 = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STAND ) then
- TD_KellyNewStatus17 = 1
- else
- TD_KellyNewStatus17 = 0
- !TD_KellyOldStatus17 = 0
- end if
-
- if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
- TD_StringConnectionMode = 9
- if (TD_KellyOldStatus10==1 .and. TD_KellyNewStatus9/=TD_KellyOldStatus9) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus9 = TD_KellyNewStatus9
- TD_KellyOldStatus10 = 0
- else if (TD_KellyOldStatus11==1 .and. TD_KellyNewStatus9/=TD_KellyOldStatus9) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus9 = TD_KellyNewStatus9
- TD_KellyOldStatus11 = 0
- else if (TD_KellyOldStatus13==1 .and. TD_KellyNewStatus9/=TD_KellyOldStatus9) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus9 = TD_KellyNewStatus9
- TD_KellyOldStatus13 = 0
- end if
- if ( Get_Slips() == SLIPS_SET_END ) then
- !if ( TD_HookVelocity>0. ) then
- ! Print*, '*** UnSet Slips ***' !???????????????????
- !end if
- TD_TDSHeight = TD_HookHeight-TD_TDSLength-TD_TDSToolJointLength !?????????????
- TD_TDSElevatorHeight = TD_HookHeight-TD_TDSElevatorLength !?????????????
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
- else
- TD_TDSHeight = TD_HookHeight-TD_TDSLength-TD_TDSToolJointLength !?????????????
- TD_TDSElevatorHeight = TD_HookHeight-TD_TDSElevatorLength !?????????????
- TD_ConnectionHeight = TD_TDSHeight
- TD_StringVelocity = TD_HookVelocity
- end if
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
- TD_StringConnectionMode = 10
- if (TD_KellyOldStatus9==1 .and. TD_KellyNewStatus10/=TD_KellyOldStatus10) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus10 = TD_KellyNewStatus10
- TD_KellyOldStatus9 = 0
- end if
- if ( Get_Slips() == SLIPS_SET_END ) then
- !if ( TD_HookVelocity>0. ) then
- ! Print*, '*** UnSet Slips ***' !???????????????????
- !end if
- TD_TDSHeight = TD_HookHeight-TD_TDSLength-TD_TDSToolJointLength !?????????????
- TD_TDSElevatorHeight = TD_HookHeight-TD_TDSElevatorLength !?????????????
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
- else
- TD_TDSHeight = TD_HookHeight-TD_TDSLength-TD_TDSToolJointLength !?????????????
- TD_TDSElevatorHeight = TD_HookHeight-TD_TDSElevatorLength !?????????????
- TD_ConnectionHeight = TD_TDSHeight
- TD_StringVelocity = TD_HookVelocity
- end if
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STRING ) then
- TD_StringConnectionMode = 11
- if (TD_KellyOldStatus9==1 .and. TD_KellyNewStatus11/=TD_KellyOldStatus11) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus11 = TD_KellyNewStatus11
- TD_KellyOldStatus9 = 0
- else if (TD_KellyOldStatus12==1 .and. TD_KellyNewStatus11/=TD_KellyOldStatus11) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus11 = TD_KellyNewStatus11
- TD_KellyOldStatus12 = 0
- else if (TD_KellyOldStatus13==1 .and. TD_KellyNewStatus11/=TD_KellyOldStatus11) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus11 = TD_KellyNewStatus11
- TD_KellyOldStatus13 = 0
- else if (TD_KellyOldStatus16==1 .and. TD_KellyNewStatus11/=TD_KellyOldStatus11) then
- TD_ConnectionHeight = TD_ConnectionHeight+(TD_DrillStems(kk)%LengthIni)
- TD_KellyOldStatus11 = TD_KellyNewStatus11
- TD_KellyOldStatus16 = 0
- else if (TD_KellyOldStatus17==1 .and. TD_KellyNewStatus11/=TD_KellyOldStatus11) then
- TD_ConnectionHeight = TD_ConnectionHeight+(3.d0*TD_DrillStems(kk)%LengthIni)
- TD_KellyOldStatus11 = TD_KellyNewStatus11
- TD_KellyOldStatus17 = 0
- end if
- TD_TDSHeight = TD_HookHeight-TD_TDSLength !?????????????
- TD_TDSElevatorHeight = TD_HookHeight-TD_TDSElevatorLength !?????????????
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING ) then
- TD_StringConnectionMode = 12
- if (TD_KellyOldStatus11==1 .and. TD_KellyNewStatus12/=TD_KellyOldStatus12) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus12 = TD_KellyNewStatus12
- TD_KellyOldStatus11 = 0
- else if (TD_KellyOldStatus14==1 .and. TD_KellyNewStatus12/=TD_KellyOldStatus12) then
- TD_ConnectionHeight = TD_ConnectionHeight+(3.d0*TD_DrillStems(kk)%LengthIni)
- TD_KellyOldStatus12 = TD_KellyNewStatus12
- TD_KellyOldStatus14 = 0
- else if (TD_KellyOldStatus15==1 .and. TD_KellyNewStatus12/=TD_KellyOldStatus12) then
- TD_ConnectionHeight = TD_ConnectionHeight+(TD_DrillStems(kk)%LengthIni)
- TD_KellyOldStatus12 = TD_KellyNewStatus12
- TD_KellyOldStatus15 = 0
- end if
- if ( Get_Slips() == SLIPS_SET_END ) then
- !if ( TD_HookVelocity>0. ) then
- ! Print*, '*** UnSet Slips ***' !???????????????????
- !end if
- TD_TDSHeight = TD_HookHeight-TD_TDSLength !?????????????
- TD_TDSElevatorHeight = TD_HookHeight-TD_TDSElevatorLength !?????????????
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
- else
- TD_TDSHeight = TD_HookHeight-TD_TDSLength !?????????????
- TD_TDSElevatorHeight = TD_HookHeight-TD_TDSLength-TD_TDSElevatorLength !?????????????
- TD_ConnectionHeight = TD_HookHeight-TD_TDSElevatorLength+(LengthSum+TD_TDSElevatorECG) !?????????????
- TD_StringVelocity = TD_HookVelocity
- end if
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
- TD_StringConnectionMode = 13
- if (TD_KellyOldStatus9==1 .and. TD_KellyNewStatus13/=TD_KellyOldStatus13) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus13 = TD_KellyNewStatus13
- TD_KellyOldStatus9 = 0
- else if (TD_KellyOldStatus11==1 .and. TD_KellyNewStatus13/=TD_KellyOldStatus13) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus13 = TD_KellyNewStatus13
- TD_KellyOldStatus11 = 0
- else if (TD_KellyOldStatus12==1 .and. TD_KellyNewStatus13/=TD_KellyOldStatus13) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus13 = TD_KellyNewStatus13
- TD_KellyOldStatus12 = 0
- else if (TD_KellyOldStatus14==1 .and. TD_KellyNewStatus13/=TD_KellyOldStatus13) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus13 = TD_KellyNewStatus13
- TD_KellyOldStatus14 = 0
- else if (TD_KellyOldStatus15==1 .and. TD_KellyNewStatus13/=TD_KellyOldStatus13) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus13 = TD_KellyNewStatus13
- TD_KellyOldStatus15 = 0
- else if (TD_KellyOldStatus16==1 .and. TD_KellyNewStatus13/=TD_KellyOldStatus13) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus13 = TD_KellyNewStatus13
- TD_KellyOldStatus16 = 0
- end if
- TD_TDSHeight = TD_HookHeight-TD_TDSLength !?????????????
- TD_TDSElevatorHeight = TD_HookHeight-TD_TDSElevatorLength !?????????????
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STAND ) then
- TD_StringConnectionMode = 14
- if (TD_KellyOldStatus12==1 .and. TD_KellyNewStatus14/=TD_KellyOldStatus14) then
- TD_ConnectionHeight = TD_ConnectionHeight-(3.d0*TD_DrillStems(kk)%LengthIni)
- TD_KellyOldStatus14 = TD_KellyNewStatus14
- TD_KellyOldStatus12 = 0
- else if (TD_KellyOldStatus13==1 .and. TD_KellyNewStatus14/=TD_KellyOldStatus14) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus14 = TD_KellyNewStatus14
- TD_KellyOldStatus13 = 0
- else if (TD_KellyOldStatus17==1 .and. TD_KellyNewStatus14/=TD_KellyOldStatus14) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus14 = TD_KellyNewStatus14
- TD_KellyOldStatus17 = 0
- end if
- TD_TDSHeight = TD_HookHeight-TD_TDSLength !?????????????
- TD_TDSElevatorHeight = TD_HookHeight-TD_TDSElevatorLength !?????????????
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_SINGLE ) then
- TD_StringConnectionMode = 15
- if (TD_KellyOldStatus12==1 .and. TD_KellyNewStatus15/=TD_KellyOldStatus15) then
- TD_ConnectionHeight = TD_ConnectionHeight-(TD_DrillStems(kk)%LengthIni)
- TD_KellyOldStatus15 = TD_KellyNewStatus15
- TD_KellyOldStatus12 = 0
- else if (TD_KellyOldStatus13==1 .and. TD_KellyNewStatus15/=TD_KellyOldStatus15) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus15 = TD_KellyNewStatus15
- TD_KellyOldStatus13 = 0
- else if (TD_KellyOldStatus16==1 .and. TD_KellyNewStatus15/=TD_KellyOldStatus15) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus15 = TD_KellyNewStatus15
- TD_KellyOldStatus16 = 0
- end if
- TD_TDSHeight = TD_HookHeight-TD_TDSLength !?????????????
- TD_TDSElevatorHeight = TD_HookHeight-TD_TDSElevatorLength !?????????????
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_SINGLE ) then
- TD_StringConnectionMode = 16
- if (TD_KellyOldStatus11==1 .and. TD_KellyNewStatus16/=TD_KellyOldStatus16) then
- TD_ConnectionHeight = TD_ConnectionHeight-(TD_DrillStems(kk)%LengthIni)
- TD_KellyOldStatus16 = TD_KellyNewStatus16
- TD_KellyOldStatus11 = 0
- else if (TD_KellyOldStatus13==1 .and. TD_KellyNewStatus16/=TD_KellyOldStatus16) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus16 = TD_KellyNewStatus16
- TD_KellyOldStatus13 = 0
- else if (TD_KellyOldStatus15==1 .and. TD_KellyNewStatus16/=TD_KellyOldStatus16) then
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_KellyOldStatus16 = TD_KellyNewStatus16
- TD_KellyOldStatus15 = 0
- end if
- TD_TDSHeight = TD_HookHeight-TD_TDSLength !?????????????
- TD_TDSElevatorHeight = TD_HookHeight-TD_TDSElevatorLength !?????????????
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STAND ) then
- TD_StringConnectionMode = 17
- if (TD_KellyOldStatus11==1 .and. TD_KellyNewStatus17/=TD_KellyOldStatus17) then
- TD_ConnectionHeight = TD_ConnectionHeight-(3.d0*TD_DrillStems(kk)%LengthIni)
- TD_KellyOldStatus17 = TD_KellyNewStatus17
- TD_KellyOldStatus11 = 0
- else if (TD_KellyOldStatus14==1 .and. TD_KellyNewStatus17/=TD_KellyOldStatus17) then
- TD_ConnectionHeight = TD_ConnectionHeight+(3.d0*TD_DrillStems(kk)%LengthIni)
- TD_KellyOldStatus17 = TD_KellyNewStatus17
- TD_KellyOldStatus14 = 0
- end if
- TD_TDSHeight = TD_HookHeight-TD_TDSLength !?????????????
- TD_TDSElevatorHeight = TD_HookHeight-TD_TDSElevatorLength !?????????????
- TD_ConnectionHeight = TD_ConnectionHeight
- TD_StringVelocity = 0.0d0
- end if
-
-
- end if
-
- !Print*, 'TD_StringConnectionMode=' , TD_StringConnectionMode
- !print* , 'TD_ConnectionHeight=' , TD_ConnectionHeight
- !Print*, 'TD_StringConnectionMode=' , TD_StringConnectionMode
- !print*, 'TD_DrillStemComponentsNumbs=' , TD_DrillStemComponentsNumbs
- !!Print*, 'TD_KellyNewStatus1=' , TD_KellyNewStatus1
- !Print*, 'TD_KellyOldStatus1=' , TD_KellyOldStatus1
- !Print*, 'TD_KellyNewStatus2=' , TD_KellyNewStatus2
- !Print*, 'TD_KellyOldStatus2=' , TD_KellyOldStatus2
- !Print*, 'TD_KellyNewStatus3=' , TD_KellyNewStatus3
- !Print*, 'TD_KellyOldStatus3=' , TD_KellyOldStatus3
-
-
-
-
-
-
- if ( (any(TD_StringConnectionMode==(/1,9,10/))) .or. DrillingConsole%CloseSafetyValve==.true. ) then !for fluid module
- TD_FluidStringConnectionMode = 1 !string is connected
- !else if ( (any(TD_StringConnectionMode==(/1,9,10/))) .or. CloseSafetyValve==.true. ) then
- !
- else
- TD_FluidStringConnectionMode = 0 !string is not connected
- end if
-
-
-
-
-
-
- !====================================================
- ! Zero String Speed
- !====================================================
- if ( abs(TD_StringVelocity)<=0.05d0 ) then ! [ft/s]
- TD_ZeroStringSpeed = 1
- Call Set_ZeroStringSpeed(.true.)
- else
- TD_ZeroStringSpeed = 0
- Call Set_ZeroStringSpeed(.false.)
- end if
-
-
-
-
-
-
-
- end subroutine
|