|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828 |
- subroutine TD_StringConnectionModes
-
- Use CHoistingVariables
- Use CDrillingConsoleVariables
- Use CKellyConnectionEnumVariables
- Use CElevatorConnectionEnumVariables
- Use CSlipsEnumVariables
- Use COperationConditionEnumVariables
- 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 ( DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL ) then
- TD_KellyDriveTypeMode = 0
- else if ( DriveType==1 .and. Get_OperationCondition()==OPERATION_TRIP ) then
- TD_KellyDriveTypeMode = 1
- else if ( 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 = 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 = NumberOfLine
- TD_WeightTB = TravelingBlockWeight ! [lb]
- TD_WeightTD = TopDriveWeight ! [lb]
- TD_KellyWeight = 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. 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
|