|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834 |
- subroutine TD_StringConnectionModes
-
- use CHoistingVariables
- use SimulationVariables
- use CDrillingConsoleVariables
- use SimulationVariables
- use SimulationVariables
- use UnitySignalVariables
- use UnitySignalsModule
- ! use OperationScenariosModule
- ! use OperationScenariosModule !!CElevator...
- ! Use CSlipsEnumVariables
- ! use UnitySignalsModuleVariables
- use SoftwareInputsVariables
- ! Use CZeroStringSpeed
- ! use UnitySignalsModule
- ! Use CTdsElevatorModesEnumVariables
- use OperationScenariosModule
- Use TD_DrillStemComponents
- use SimulationVariables !@
- use SimulationVariables !@
- use SimulationVariables !@
- Use TD_StringConnectionData
- use SimulationVariables !@!, only: Drawworks
-
-
-
- implicit none
- integer :: i , kk
- Real(8) :: LengthSum
-
-
-
-
-
-
-
- !!=====> Read Data
- !kk = 0
- !LengthSum = 0.d0
- !
- !Do i = data%State%TD_String%DrillStemComponentsNumbs , 1 , -1
- ! if (data%State%TD_DrillStems(i)%ComponentType==3) then
- ! kk = i
- ! exit
- ! else if (data%State%TD_DrillStems(i)%ComponentType==5 .or. data%State%TD_DrillStems(i)%ComponentType==7) then
- ! LengthSum = LengthSum+data%State%TD_DrillStems(i)%LengthIni
- ! end if
- !End Do
-
-
-
-
-
-
-
- !####C_Program -----> data%Configuration%Hoisting%DriveType =
- ! = 0 TopDrive_DriveType
- ! = 1 Kelly_DriveType
-
- !####C_Program -----> data%State%TD_StConn%KellyDriveTypeMode =
- ! = 0 Drill Mode (Kelly)
- ! = 1 Trip Mode (Elevator)
- ! = 2 TopDrive Mode
-
- if ( data%Configuration%Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL ) then
- data%State%TD_StConn%KellyDriveTypeMode = 0
- else if ( data%Configuration%Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_TRIP ) then
- data%State%TD_StConn%KellyDriveTypeMode = 1
- else if ( data%Configuration%Hoisting%DriveType==0 ) then
- data%State%TD_StConn%KellyDriveTypeMode = 2
- end if
-
- data%State%TD_StConn%HookHeight = data%State%Drawworks%TDHookHeight ! unit: [ft]
- data%State%TD_StConn%ElevatorConst = 17.985d0 ! [ft] Elevator Length(14.84) ????????????????? adad ha daghigh shavand
- data%State%TD_StConn%ElevatorECG = data%State%OperationScenario%ECG ! [ft]
- data%State%TD_StConn%KellyConst = 63.280d0 ! [ft] Kelly Length(61.74) + Safety Valve Length(1.54)
- data%State%TD_StConn%KellyElementConst = 41.840d0 ! [ft] Kelly Element Length(40.3) + Safety Valve Length(1.54)
- data%State%TD_StConn%TDSLength = 24.08d0 !??????????????????? ! [ft]
- data%State%TD_StConn%TDSToolJointLength = 0.77d0 !??????????????????? ! [ft]
- data%State%TD_StConn%TDSElevatorLength = 26.837d0 !?????? ! TDS with Elevator Length [ft]
- data%State%TD_StConn%TDSElevatorToolLength= 0.859d0 !??????????????????? ! [ft]
- data%State%TD_StConn%TDSElevatorECG = 2.454d0 ! [ft]
- data%State%TD_Load%NumOfCables = data%Configuration%Hoisting%NumberOfLine
- data%State%TD_Load%WeightTB = data%Configuration%Hoisting%TravelingBlockWeight ! [lb]
- data%State%TD_Load%WeightTD = data%Configuration%Hoisting%TopDriveWeight ! [lb]
- data%State%TD_Load%KellyWeight = data%Configuration%Hoisting%KellyWeight ! [lb]
-
-
-
-
-
-
-
-
- !=====> Velocity Calculation
- data%State%TD_StConn%HookVelocity = (data%State%TD_StConn%HookHeight-data%State%TD_StConn%HookHeightOld)/data%State%TD_General%TimeStep ! [ft/s]
-
-
-
-
-
-
-
-
-
- !====================================================
- ! Add or Remove DrillStem Components
- !====================================================
- Call TD_AddComponents
-
- Call TD_RemoveComponents
-
-
- !=====> Read Data
- kk = 0
- LengthSum = 0.d0
-
- Do i = data%State%TD_String%DrillStemComponentsNumbs , 1 , -1
- if (data%State%TD_DrillStems(i)%ComponentType==3) then
- kk = i
- exit
- else if (data%State%TD_DrillStems(i)%ComponentType==5 .or. data%State%TD_DrillStems(i)%ComponentType==7) then
- LengthSum = LengthSum+data%State%TD_DrillStems(i)%LengthIni
- end if
- End Do
- !if(print_log) print*, 'kk' , kk
- !if(print_log) print*, 'data%State%TD_DrillStems(kk)%LengthIni0=' , data%State%TD_DrillStems(kk)%LengthIni
-
-
-
-
- !====================================================
- ! String Connection Mode Determination
- !====================================================
-
- !####data%State%TD_StConn%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 (data%State%TD_String%DlTouch<=0.) then ![ft]
- ! if(data%State%TD_StConn%HookVelocity<=0.) then
- ! data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- ! data%State%TD_StConn%StringVelocity = 0.0d0
- ! return
- ! end if
- !end if
-
-
-
- !=====> Connection Height Determination
-
- if ( data%State%TD_StConn%KellyDriveTypeMode==0 ) then
-
- if(Get_KellyConnection() == KELLY_CONNECTION_STRING) then
- data%State%TD_Count%KellyNewStatus(1) = 1
- else
- data%State%TD_Count%KellyNewStatus(1) = 0
- !data%State%TD_Count%KellyOldStatus(1) = 0
- end if
-
- if(Get_KellyConnection()==KELLY_CONNECTION_NOTHING) then
- data%State%TD_Count%KellyNewStatus(2) = 1
- else
- data%State%TD_Count%KellyNewStatus(2) = 0
- !data%State%TD_Count%KellyOldStatus(2) = 0
- end if
-
- if(Get_KellyConnection()==KELLY_CONNECTION_SINGLE) then
- data%State%TD_Count%KellyNewStatus(3) = 1
- else
- data%State%TD_Count%KellyNewStatus(3) = 0
- !data%State%TD_Count%KellyOldStatus(3) = 0
- end if
-
-
- if ( Get_KellyConnection() == KELLY_CONNECTION_STRING ) then
- data%State%TD_StConn%StringConnectionMode = 1
- !if(print_log) print*, 'data%State%TD_StConn%ConnectionHeight10=' , data%State%TD_StConn%ConnectionHeight
- !if(print_log) print*, 'data%State%TD_StConn%KellyElementConst1=' , data%State%TD_StConn%KellyElementConst
- !if(print_log) print*, 'data%State%TD_DrillStems(kk)%LengthIni1=' , data%State%TD_DrillStems(kk)%LengthIni
- if (data%State%TD_Count%KellyOldStatus(2)==1 .and. data%State%TD_Count%KellyNewStatus(1)/=data%State%TD_Count%KellyOldStatus(1)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight+data%State%TD_StConn%KellyElementConst
- data%State%TD_Count%KellyOldStatus(1) = data%State%TD_Count%KellyNewStatus(1)
- data%State%TD_Count%KellyOldStatus(2) = 0
- else if (data%State%TD_Count%KellyOldStatus(3)==1 .and. data%State%TD_Count%KellyNewStatus(1)/=data%State%TD_Count%KellyOldStatus(1)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight+data%State%TD_StConn%KellyElementConst+30.d0 !data%State%TD_DrillStems(kk)%LengthIni
- data%State%TD_Count%KellyOldStatus(1) = data%State%TD_Count%KellyNewStatus(1)
- data%State%TD_Count%KellyOldStatus(3) = 0
- end if
- !if(print_log) print*, 'data%State%TD_StConn%ConnectionHeight1=' , data%State%TD_StConn%ConnectionHeight
- if ( Get_Slips() == SLIPS_SET_END ) then
- !!if ( data%State%TD_StConn%HookVelocity>0. ) then
- !! if(print_log) print*, '*** UnSet Slips ***' !?????????
- !!end if
- data%State%TD_StConn%KellyConnectionHeight = data%State%TD_StConn%HookHeight-(data%State%TD_StConn%KellyConst-data%State%TD_StConn%KellyElementConst) !?????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
- else
- !if (data%State%TD_String%DlTouch<=0. .and. data%State%TD_StConn%HookVelocity<=0.) then
- ! data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- ! data%State%TD_StConn%StringVelocity = 0.0d0
- !else
- data%State%TD_StConn%KellyConnectionHeight = data%State%TD_StConn%HookHeight-(data%State%TD_StConn%KellyConst-data%State%TD_StConn%KellyElementConst) !??????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%KellyConnectionHeight
- data%State%TD_StConn%StringVelocity = data%State%TD_StConn%HookVelocity
- !end if
- end if
-
- else if ( Get_KellyConnection() == KELLY_CONNECTION_NOTHING ) then
- data%State%TD_StConn%StringConnectionMode = 2
- !if(print_log) print*, 'data%State%TD_StConn%ConnectionHeight20=' , data%State%TD_StConn%ConnectionHeight
- !if(print_log) print*, 'data%State%TD_StConn%KellyElementConst2=' , data%State%TD_StConn%KellyElementConst
- if (data%State%TD_Count%KellyOldStatus(1)==1 .and. data%State%TD_Count%KellyNewStatus(2)/=data%State%TD_Count%KellyOldStatus(2)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight-data%State%TD_StConn%KellyElementConst
- data%State%TD_Count%KellyOldStatus(2) = data%State%TD_Count%KellyNewStatus(2)
- data%State%TD_Count%KellyOldStatus(1) = 0
- else if (data%State%TD_Count%KellyOldStatus(3)==1 .and. data%State%TD_Count%KellyNewStatus(2)/=data%State%TD_Count%KellyOldStatus(2)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(2) = data%State%TD_Count%KellyNewStatus(2)
- data%State%TD_Count%KellyOldStatus(3) = 0
- else if (data%State%TD_Count%KellyOldStatus(5)==1 .and. data%State%TD_Count%KellyNewStatus(2)/=data%State%TD_Count%KellyOldStatus(2)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(2) = data%State%TD_Count%KellyNewStatus(2)
- data%State%TD_Count%KellyOldStatus(5) = 0
- end if
- !if(print_log) print*, 'data%State%TD_StConn%ConnectionHeight2=' , data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%KellyConnectionHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%KellyConst
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
-
- else if ( Get_KellyConnection() == KELLY_CONNECTION_SINGLE ) then
- !if(print_log) print*, 'KELLY_CONNECTION_SINGLE' , data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringConnectionMode = 3
- !if(print_log) print*, 'data%State%TD_StConn%ConnectionHeight30=' , data%State%TD_StConn%ConnectionHeight
- !if(print_log) print*, 'data%State%TD_StConn%KellyElementConst3=' , data%State%TD_StConn%KellyElementConst
- !if(print_log) print*, 'data%State%TD_DrillStems(kk)%LengthIni3=' , data%State%TD_DrillStems(kk)%LengthIni
- if (data%State%TD_Count%KellyOldStatus(1)==1 .and. data%State%TD_Count%KellyNewStatus(3)/=data%State%TD_Count%KellyOldStatus(3)) then
- !if(print_log) print*, 'KELLY_CONNECTION_SINGLE1' , data%State%TD_StConn%ConnectionHeight
- !if(print_log) print*, 'data%State%TD_StConn%KellyElementConst=' , data%State%TD_StConn%KellyElementConst
- !if(print_log) print*, 'data%State%TD_DrillStems(kk)%LengthIni=' , data%State%TD_DrillStems(kk)%LengthIni
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight-data%State%TD_StConn%KellyElementConst-30.d0 !data%State%TD_DrillStems(kk)%LengthIni
- data%State%TD_Count%KellyOldStatus(3) = data%State%TD_Count%KellyNewStatus(3)
- data%State%TD_Count%KellyOldStatus(1) = 0
- else if (data%State%TD_Count%KellyOldStatus(2)==1 .and. data%State%TD_Count%KellyNewStatus(3)/=data%State%TD_Count%KellyOldStatus(3)) then
- !if(print_log) print*, 'KELLY_CONNECTION_SINGLE2' , data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(3) = data%State%TD_Count%KellyNewStatus(3)
- data%State%TD_Count%KellyOldStatus(2) = 0
- end if
- !if(print_log) print*, 'data%State%TD_StConn%ConnectionHeight3=' , data%State%TD_StConn%ConnectionHeight
- !if(print_log) print*, 'KELLY_CONNECTION_SINGLE3' , data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%KellyConnectionHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%KellyConst-data%State%TD_DrillStems(kk)%LengthIni
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
- !if(print_log) print*, 'KELLY_CONNECTION_SINGLE4' , data%State%TD_StConn%ConnectionHeight
- end if
- !if(print_log) print*, 'KELLY_CONNECTION_SINGLE5' , data%State%TD_StConn%ConnectionHeight
-
- else if ( data%State%TD_StConn%KellyDriveTypeMode==1 ) then
-
- if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING) then
- data%State%TD_Count%KellyNewStatus(4) = 1
- else
- data%State%TD_Count%KellyNewStatus(4) = 0
- !data%State%TD_Count%KellyOldStatus(4) = 0
- end if
-
- if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING) then
- data%State%TD_Count%KellyNewStatus(5) = 1
- else
- data%State%TD_Count%KellyNewStatus(5) = 0
- !data%State%TD_Count%KellyOldStatus(5) = 0
- end if
-
- if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND) then
- data%State%TD_Count%KellyNewStatus(6) = 1
- else
- data%State%TD_Count%KellyNewStatus(6) = 0
- !data%State%TD_Count%KellyOldStatus(6) = 0
- end if
-
- if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE) then
- data%State%TD_Count%KellyNewStatus(7) = 1
- else
- data%State%TD_Count%KellyNewStatus(7) = 0
- !data%State%TD_Count%KellyOldStatus(7) = 0
- end if
-
- if(Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) then
- data%State%TD_Count%KellyNewStatus(8) = 1
- else
- data%State%TD_Count%KellyNewStatus(8) = 0
- !data%State%TD_Count%KellyOldStatus(8) = 0
- end if
-
- if(Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE) then
- data%State%TD_Count%KellyNewStatus(18) = 1
- else
- data%State%TD_Count%KellyNewStatus(18) = 0
- !data%State%TD_Count%KellyOldStatus(18) = 0
- end if
-
- if(Get_ElevatorConnection() == ELEVATOR_LATCH_STAND) then
- data%State%TD_Count%KellyNewStatus(19) = 1
- else
- data%State%TD_Count%KellyNewStatus(19) = 0
- !data%State%TD_Count%KellyOldStatus(19) = 0
- end if
-
-
- if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING ) then
- data%State%TD_StConn%StringConnectionMode = 4
- if (data%State%TD_Count%KellyOldStatus(5)==1 .and. data%State%TD_Count%KellyNewStatus(4)/=data%State%TD_Count%KellyOldStatus(4)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(4) = data%State%TD_Count%KellyNewStatus(4)
- data%State%TD_Count%KellyOldStatus(5) = 0
- else if (data%State%TD_Count%KellyOldStatus(6)==1 .and. data%State%TD_Count%KellyNewStatus(4)/=data%State%TD_Count%KellyOldStatus(4)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight+(3.d0*data%State%TD_DrillStems(kk)%LengthIni)
- data%State%TD_Count%KellyOldStatus(4) = data%State%TD_Count%KellyNewStatus(4)
- data%State%TD_Count%KellyOldStatus(6) = 0
- else if (data%State%TD_Count%KellyOldStatus(7)==1 .and. data%State%TD_Count%KellyNewStatus(4)/=data%State%TD_Count%KellyOldStatus(4)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight+data%State%TD_DrillStems(kk)%LengthIni
- data%State%TD_Count%KellyOldStatus(4) = data%State%TD_Count%KellyNewStatus(4)
- data%State%TD_Count%KellyOldStatus(7) = 0
- else if (data%State%TD_Count%KellyOldStatus(8)==1 .and. data%State%TD_Count%KellyNewStatus(4)/=data%State%TD_Count%KellyOldStatus(4)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(4) = data%State%TD_Count%KellyNewStatus(4)
- data%State%TD_Count%KellyOldStatus(8) = 0
- end if
- if ( Get_Slips() == SLIPS_SET_END ) then
- !if ( data%State%TD_StConn%HookVelocity>0. ) then
- ! if(print_log) print*, '*** UnSet Slips ***' !???????????????????
- !end if
- data%State%TD_StConn%ElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%ElevatorConst !?????????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
- else
- data%State%TD_StConn%ElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%ElevatorConst
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%ElevatorConst+(LengthSum+data%State%TD_StConn%ElevatorECG) !(LengthSum+data%State%TD_DrillStems(kk)%ToolJointRange)
- data%State%TD_StConn%StringVelocity = data%State%TD_StConn%HookVelocity
- end if
-
- else if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING ) then
- data%State%TD_StConn%StringConnectionMode = 5
- if (data%State%TD_Count%KellyOldStatus(4)==1 .and. data%State%TD_Count%KellyNewStatus(5)/=data%State%TD_Count%KellyOldStatus(5)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(5) = data%State%TD_Count%KellyNewStatus(5)
- data%State%TD_Count%KellyOldStatus(4) = 0
- else if (data%State%TD_Count%KellyOldStatus(6)==1 .and. data%State%TD_Count%KellyNewStatus(5)/=data%State%TD_Count%KellyOldStatus(5)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(5) = data%State%TD_Count%KellyNewStatus(5)
- data%State%TD_Count%KellyOldStatus(6) = 0
- else if (data%State%TD_Count%KellyOldStatus(7)==1 .and. data%State%TD_Count%KellyNewStatus(5)/=data%State%TD_Count%KellyOldStatus(5)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(5) = data%State%TD_Count%KellyNewStatus(5)
- data%State%TD_Count%KellyOldStatus(7) = 0
- else if (data%State%TD_Count%KellyOldStatus(8)==1 .and. data%State%TD_Count%KellyNewStatus(5)/=data%State%TD_Count%KellyOldStatus(5)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(5) = data%State%TD_Count%KellyNewStatus(5)
- data%State%TD_Count%KellyOldStatus(8) = 0
- else if (data%State%TD_Count%KellyOldStatus(2)==1 .and. data%State%TD_Count%KellyNewStatus(5)/=data%State%TD_Count%KellyOldStatus(5)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(5) = data%State%TD_Count%KellyNewStatus(5)
- data%State%TD_Count%KellyOldStatus(2) = 0
- end if
- data%State%TD_StConn%ElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%ElevatorConst
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
-
- else if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND ) then
- data%State%TD_StConn%StringConnectionMode = 6
- if (data%State%TD_Count%KellyOldStatus(4)==1 .and. data%State%TD_Count%KellyNewStatus(6)/=data%State%TD_Count%KellyOldStatus(6)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight-(3.*data%State%TD_DrillStems(kk)%LengthIni)
- data%State%TD_Count%KellyOldStatus(6) = data%State%TD_Count%KellyNewStatus(6)
- data%State%TD_Count%KellyOldStatus(4) = 0
- else if (data%State%TD_Count%KellyOldStatus(5)==1 .and. data%State%TD_Count%KellyNewStatus(6)/=data%State%TD_Count%KellyOldStatus(6)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(6) = data%State%TD_Count%KellyNewStatus(6)
- data%State%TD_Count%KellyOldStatus(5) = 0
- else if (data%State%TD_Count%KellyOldStatus(7)==1 .and. data%State%TD_Count%KellyNewStatus(6)/=data%State%TD_Count%KellyOldStatus(6)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(6) = data%State%TD_Count%KellyNewStatus(6)
- data%State%TD_Count%KellyOldStatus(7) = 0
- else if (data%State%TD_Count%KellyOldStatus(8)==1 .and. data%State%TD_Count%KellyNewStatus(6)/=data%State%TD_Count%KellyOldStatus(6)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(6) = data%State%TD_Count%KellyNewStatus(6)
- data%State%TD_Count%KellyOldStatus(8) = 0
- end if
- data%State%TD_StConn%ElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%ElevatorConst-(3.*data%State%TD_DrillStems(kk)%LengthIni)
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
-
- else if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE ) then
- data%State%TD_StConn%StringConnectionMode = 7
- if (data%State%TD_Count%KellyOldStatus(4)==1 .and. data%State%TD_Count%KellyNewStatus(7)/=data%State%TD_Count%KellyOldStatus(7)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight-data%State%TD_DrillStems(kk)%LengthIni
- data%State%TD_Count%KellyOldStatus(7) = data%State%TD_Count%KellyNewStatus(7)
- data%State%TD_Count%KellyOldStatus(4) = 0
- else if (data%State%TD_Count%KellyOldStatus(5)==1 .and. data%State%TD_Count%KellyNewStatus(7)/=data%State%TD_Count%KellyOldStatus(7)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(7) = data%State%TD_Count%KellyNewStatus(7)
- data%State%TD_Count%KellyOldStatus(5) = 0
- else if (data%State%TD_Count%KellyOldStatus(6)==1 .and. data%State%TD_Count%KellyNewStatus(7)/=data%State%TD_Count%KellyOldStatus(7)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(7) = data%State%TD_Count%KellyNewStatus(7)
- data%State%TD_Count%KellyOldStatus(6) = 0
- else if (data%State%TD_Count%KellyOldStatus(8)==1 .and. data%State%TD_Count%KellyNewStatus(7)/=data%State%TD_Count%KellyOldStatus(7)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(7) = data%State%TD_Count%KellyNewStatus(7)
- data%State%TD_Count%KellyOldStatus(8) = 0
- end if
- data%State%TD_StConn%ElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%ElevatorConst-data%State%TD_DrillStems(kk)%LengthIni
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
-
- else if ( Get_ElevatorConnection() == ELEVATOR_LATCH_STRING ) then
- data%State%TD_StConn%StringConnectionMode = 8
- if (data%State%TD_Count%KellyOldStatus(4)==1 .and. data%State%TD_Count%KellyNewStatus(8)/=data%State%TD_Count%KellyOldStatus(8)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(8) = data%State%TD_Count%KellyNewStatus(8)
- data%State%TD_Count%KellyOldStatus(4) = 0
- else if (data%State%TD_Count%KellyOldStatus(5)==1 .and. data%State%TD_Count%KellyNewStatus(8)/=data%State%TD_Count%KellyOldStatus(8)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(8) = data%State%TD_Count%KellyNewStatus(8)
- data%State%TD_Count%KellyOldStatus(5) = 0
- else if (data%State%TD_Count%KellyOldStatus(6)==1 .and. data%State%TD_Count%KellyNewStatus(8)/=data%State%TD_Count%KellyOldStatus(8)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(8) = data%State%TD_Count%KellyNewStatus(8)
- data%State%TD_Count%KellyOldStatus(6) = 0
- else if (data%State%TD_Count%KellyOldStatus(7)==1 .and. data%State%TD_Count%KellyNewStatus(8)/=data%State%TD_Count%KellyOldStatus(8)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(8) = data%State%TD_Count%KellyNewStatus(8)
- data%State%TD_Count%KellyOldStatus(7) = 0
- end if
- data%State%TD_StConn%ElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%ElevatorConst
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
-
- else if ( Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE ) then
- data%State%TD_StConn%StringConnectionMode = 18
- if (data%State%TD_Count%KellyOldStatus(5)==1 .and. data%State%TD_Count%KellyNewStatus(18)/=data%State%TD_Count%KellyOldStatus(18)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(18) = data%State%TD_Count%KellyNewStatus(18)
- data%State%TD_Count%KellyOldStatus(5) = 0
- else if (data%State%TD_Count%KellyOldStatus(7)==1 .and. data%State%TD_Count%KellyNewStatus(18)/=data%State%TD_Count%KellyOldStatus(18)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(18) = data%State%TD_Count%KellyNewStatus(18)
- data%State%TD_Count%KellyOldStatus(7) = 0
- else if (data%State%TD_Count%KellyOldStatus(8)==1 .and. data%State%TD_Count%KellyNewStatus(18)/=data%State%TD_Count%KellyOldStatus(18)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(18) = data%State%TD_Count%KellyNewStatus(18)
- data%State%TD_Count%KellyOldStatus(8) = 0
- end if
- data%State%TD_StConn%ElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%ElevatorConst
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
-
- else if ( Get_ElevatorConnection() == ELEVATOR_LATCH_STAND ) then
- data%State%TD_StConn%StringConnectionMode = 19
- if (data%State%TD_Count%KellyOldStatus(5)==1 .and. data%State%TD_Count%KellyNewStatus(19)/=data%State%TD_Count%KellyOldStatus(19)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(19) = data%State%TD_Count%KellyNewStatus(19)
- data%State%TD_Count%KellyOldStatus(5) = 0
- else if (data%State%TD_Count%KellyOldStatus(6)==1 .and. data%State%TD_Count%KellyNewStatus(19)/=data%State%TD_Count%KellyOldStatus(19)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(19) = data%State%TD_Count%KellyNewStatus(19)
- data%State%TD_Count%KellyOldStatus(6) = 0
- else if (data%State%TD_Count%KellyOldStatus(8)==1 .and. data%State%TD_Count%KellyNewStatus(19)/=data%State%TD_Count%KellyOldStatus(19)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(19) = data%State%TD_Count%KellyNewStatus(19)
- data%State%TD_Count%KellyOldStatus(8) = 0
- end if
- data%State%TD_StConn%ElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%ElevatorConst
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
- end if
-
- else if ( data%State%TD_StConn%KellyDriveTypeMode==2 ) then
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
- data%State%TD_Count%KellyNewStatus(9) = 1
- else
- data%State%TD_Count%KellyNewStatus(9) = 0
- !data%State%TD_Count%KellyOldStatus(9) = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
- data%State%TD_Count%KellyNewStatus(10) = 1
- else
- data%State%TD_Count%KellyNewStatus(10) = 0
- !data%State%TD_Count%KellyOldStatus(10) = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STRING ) then
- data%State%TD_Count%KellyNewStatus(11) = 1
- else
- data%State%TD_Count%KellyNewStatus(11) = 0
- !data%State%TD_Count%KellyOldStatus(11) = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING ) then
- data%State%TD_Count%KellyNewStatus(12) = 1
- else
- data%State%TD_Count%KellyNewStatus(12) = 0
- !data%State%TD_Count%KellyOldStatus(12) = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
- data%State%TD_Count%KellyNewStatus(13) = 1
- else
- data%State%TD_Count%KellyNewStatus(13) = 0
- !data%State%TD_Count%KellyOldStatus(13) = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STAND ) then
- data%State%TD_Count%KellyNewStatus(14) = 1
- else
- data%State%TD_Count%KellyNewStatus(14) = 0
- !data%State%TD_Count%KellyOldStatus(14) = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_SINGLE ) then
- data%State%TD_Count%KellyNewStatus(15) = 1
- else
- data%State%TD_Count%KellyNewStatus(15) = 0
- !data%State%TD_Count%KellyOldStatus(15) = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_SINGLE ) then
- data%State%TD_Count%KellyNewStatus(16) = 1
- else
- data%State%TD_Count%KellyNewStatus(16) = 0
- !data%State%TD_Count%KellyOldStatus(16) = 0
- end if
-
- if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STAND ) then
- data%State%TD_Count%KellyNewStatus(17) = 1
- else
- data%State%TD_Count%KellyNewStatus(17) = 0
- !data%State%TD_Count%KellyOldStatus(17) = 0
- end if
-
- if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then
- data%State%TD_StConn%StringConnectionMode = 9
- if (data%State%TD_Count%KellyOldStatus(10)==1 .and. data%State%TD_Count%KellyNewStatus(9)/=data%State%TD_Count%KellyOldStatus(9)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(9) = data%State%TD_Count%KellyNewStatus(9)
- data%State%TD_Count%KellyOldStatus(10) = 0
- else if (data%State%TD_Count%KellyOldStatus(11)==1 .and. data%State%TD_Count%KellyNewStatus(9)/=data%State%TD_Count%KellyOldStatus(9)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(9) = data%State%TD_Count%KellyNewStatus(9)
- data%State%TD_Count%KellyOldStatus(11) = 0
- else if (data%State%TD_Count%KellyOldStatus(13)==1 .and. data%State%TD_Count%KellyNewStatus(9)/=data%State%TD_Count%KellyOldStatus(9)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(9) = data%State%TD_Count%KellyNewStatus(9)
- data%State%TD_Count%KellyOldStatus(13) = 0
- end if
- if ( Get_Slips() == SLIPS_SET_END ) then
- !if ( data%State%TD_StConn%HookVelocity>0. ) then
- ! if(print_log) print*, '*** UnSet Slips ***' !???????????????????
- !end if
- data%State%TD_StConn%TDSHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSLength-data%State%TD_StConn%TDSToolJointLength !?????????????
- data%State%TD_StConn%TDSElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSElevatorLength !?????????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
- else
- data%State%TD_StConn%TDSHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSLength-data%State%TD_StConn%TDSToolJointLength !?????????????
- data%State%TD_StConn%TDSElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSElevatorLength !?????????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%TDSHeight
- data%State%TD_StConn%StringVelocity = data%State%TD_StConn%HookVelocity
- end if
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then
- data%State%TD_StConn%StringConnectionMode = 10
- if (data%State%TD_Count%KellyOldStatus(9)==1 .and. data%State%TD_Count%KellyNewStatus(10)/=data%State%TD_Count%KellyOldStatus(10)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(10) = data%State%TD_Count%KellyNewStatus(10)
- data%State%TD_Count%KellyOldStatus(9) = 0
- end if
- if ( Get_Slips() == SLIPS_SET_END ) then
- !if ( data%State%TD_StConn%HookVelocity>0. ) then
- ! if(print_log) print*, '*** UnSet Slips ***' !???????????????????
- !end if
- data%State%TD_StConn%TDSHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSLength-data%State%TD_StConn%TDSToolJointLength !?????????????
- data%State%TD_StConn%TDSElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSElevatorLength !?????????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
- else
- data%State%TD_StConn%TDSHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSLength-data%State%TD_StConn%TDSToolJointLength !?????????????
- data%State%TD_StConn%TDSElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSElevatorLength !?????????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%TDSHeight
- data%State%TD_StConn%StringVelocity = data%State%TD_StConn%HookVelocity
- end if
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STRING ) then
- data%State%TD_StConn%StringConnectionMode = 11
- if (data%State%TD_Count%KellyOldStatus(9)==1 .and. data%State%TD_Count%KellyNewStatus(11)/=data%State%TD_Count%KellyOldStatus(11)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(11) = data%State%TD_Count%KellyNewStatus(11)
- data%State%TD_Count%KellyOldStatus(9) = 0
- else if (data%State%TD_Count%KellyOldStatus(12)==1 .and. data%State%TD_Count%KellyNewStatus(11)/=data%State%TD_Count%KellyOldStatus(11)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(11) = data%State%TD_Count%KellyNewStatus(11)
- data%State%TD_Count%KellyOldStatus(12) = 0
- else if (data%State%TD_Count%KellyOldStatus(13)==1 .and. data%State%TD_Count%KellyNewStatus(11)/=data%State%TD_Count%KellyOldStatus(11)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(11) = data%State%TD_Count%KellyNewStatus(11)
- data%State%TD_Count%KellyOldStatus(13) = 0
- else if (data%State%TD_Count%KellyOldStatus(16)==1 .and. data%State%TD_Count%KellyNewStatus(11)/=data%State%TD_Count%KellyOldStatus(11)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight+(data%State%TD_DrillStems(kk)%LengthIni)
- data%State%TD_Count%KellyOldStatus(11) = data%State%TD_Count%KellyNewStatus(11)
- data%State%TD_Count%KellyOldStatus(16) = 0
- else if (data%State%TD_Count%KellyOldStatus(17)==1 .and. data%State%TD_Count%KellyNewStatus(11)/=data%State%TD_Count%KellyOldStatus(11)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight+(3.d0*data%State%TD_DrillStems(kk)%LengthIni)
- data%State%TD_Count%KellyOldStatus(11) = data%State%TD_Count%KellyNewStatus(11)
- data%State%TD_Count%KellyOldStatus(17) = 0
- end if
- data%State%TD_StConn%TDSHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSLength !?????????????
- data%State%TD_StConn%TDSElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSElevatorLength !?????????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING ) then
- data%State%TD_StConn%StringConnectionMode = 12
- if (data%State%TD_Count%KellyOldStatus(11)==1 .and. data%State%TD_Count%KellyNewStatus(12)/=data%State%TD_Count%KellyOldStatus(12)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(12) = data%State%TD_Count%KellyNewStatus(12)
- data%State%TD_Count%KellyOldStatus(11) = 0
- else if (data%State%TD_Count%KellyOldStatus(14)==1 .and. data%State%TD_Count%KellyNewStatus(12)/=data%State%TD_Count%KellyOldStatus(12)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight+(3.d0*data%State%TD_DrillStems(kk)%LengthIni)
- data%State%TD_Count%KellyOldStatus(12) = data%State%TD_Count%KellyNewStatus(12)
- data%State%TD_Count%KellyOldStatus(14) = 0
- else if (data%State%TD_Count%KellyOldStatus(15)==1 .and. data%State%TD_Count%KellyNewStatus(12)/=data%State%TD_Count%KellyOldStatus(12)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight+(data%State%TD_DrillStems(kk)%LengthIni)
- data%State%TD_Count%KellyOldStatus(12) = data%State%TD_Count%KellyNewStatus(12)
- data%State%TD_Count%KellyOldStatus(15) = 0
- end if
- if ( Get_Slips() == SLIPS_SET_END ) then
- !if ( data%State%TD_StConn%HookVelocity>0. ) then
- ! if(print_log) print*, '*** UnSet Slips ***' !???????????????????
- !end if
- data%State%TD_StConn%TDSHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSLength !?????????????
- data%State%TD_StConn%TDSElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSElevatorLength !?????????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
- else
- data%State%TD_StConn%TDSHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSLength !?????????????
- data%State%TD_StConn%TDSElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSLength-data%State%TD_StConn%TDSElevatorLength !?????????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSElevatorLength+(LengthSum+data%State%TD_StConn%TDSElevatorECG) !?????????????
- data%State%TD_StConn%StringVelocity = data%State%TD_StConn%HookVelocity
- end if
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then
- data%State%TD_StConn%StringConnectionMode = 13
- if (data%State%TD_Count%KellyOldStatus(9)==1 .and. data%State%TD_Count%KellyNewStatus(13)/=data%State%TD_Count%KellyOldStatus(13)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(13) = data%State%TD_Count%KellyNewStatus(13)
- data%State%TD_Count%KellyOldStatus(9) = 0
- else if (data%State%TD_Count%KellyOldStatus(11)==1 .and. data%State%TD_Count%KellyNewStatus(13)/=data%State%TD_Count%KellyOldStatus(13)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(13) = data%State%TD_Count%KellyNewStatus(13)
- data%State%TD_Count%KellyOldStatus(11) = 0
- else if (data%State%TD_Count%KellyOldStatus(12)==1 .and. data%State%TD_Count%KellyNewStatus(13)/=data%State%TD_Count%KellyOldStatus(13)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(13) = data%State%TD_Count%KellyNewStatus(13)
- data%State%TD_Count%KellyOldStatus(12) = 0
- else if (data%State%TD_Count%KellyOldStatus(14)==1 .and. data%State%TD_Count%KellyNewStatus(13)/=data%State%TD_Count%KellyOldStatus(13)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(13) = data%State%TD_Count%KellyNewStatus(13)
- data%State%TD_Count%KellyOldStatus(14) = 0
- else if (data%State%TD_Count%KellyOldStatus(15)==1 .and. data%State%TD_Count%KellyNewStatus(13)/=data%State%TD_Count%KellyOldStatus(13)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(13) = data%State%TD_Count%KellyNewStatus(13)
- data%State%TD_Count%KellyOldStatus(15) = 0
- else if (data%State%TD_Count%KellyOldStatus(16)==1 .and. data%State%TD_Count%KellyNewStatus(13)/=data%State%TD_Count%KellyOldStatus(13)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(13) = data%State%TD_Count%KellyNewStatus(13)
- data%State%TD_Count%KellyOldStatus(16) = 0
- end if
- data%State%TD_StConn%TDSHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSLength !?????????????
- data%State%TD_StConn%TDSElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSElevatorLength !?????????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STAND ) then
- data%State%TD_StConn%StringConnectionMode = 14
- if (data%State%TD_Count%KellyOldStatus(12)==1 .and. data%State%TD_Count%KellyNewStatus(14)/=data%State%TD_Count%KellyOldStatus(14)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight-(3.d0*data%State%TD_DrillStems(kk)%LengthIni)
- data%State%TD_Count%KellyOldStatus(14) = data%State%TD_Count%KellyNewStatus(14)
- data%State%TD_Count%KellyOldStatus(12) = 0
- else if (data%State%TD_Count%KellyOldStatus(13)==1 .and. data%State%TD_Count%KellyNewStatus(14)/=data%State%TD_Count%KellyOldStatus(14)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(14) = data%State%TD_Count%KellyNewStatus(14)
- data%State%TD_Count%KellyOldStatus(13) = 0
- else if (data%State%TD_Count%KellyOldStatus(17)==1 .and. data%State%TD_Count%KellyNewStatus(14)/=data%State%TD_Count%KellyOldStatus(14)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(14) = data%State%TD_Count%KellyNewStatus(14)
- data%State%TD_Count%KellyOldStatus(17) = 0
- end if
- data%State%TD_StConn%TDSHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSLength !?????????????
- data%State%TD_StConn%TDSElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSElevatorLength !?????????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_SINGLE ) then
- data%State%TD_StConn%StringConnectionMode = 15
- if (data%State%TD_Count%KellyOldStatus(12)==1 .and. data%State%TD_Count%KellyNewStatus(15)/=data%State%TD_Count%KellyOldStatus(15)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight-(data%State%TD_DrillStems(kk)%LengthIni)
- data%State%TD_Count%KellyOldStatus(15) = data%State%TD_Count%KellyNewStatus(15)
- data%State%TD_Count%KellyOldStatus(12) = 0
- else if (data%State%TD_Count%KellyOldStatus(13)==1 .and. data%State%TD_Count%KellyNewStatus(15)/=data%State%TD_Count%KellyOldStatus(15)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(15) = data%State%TD_Count%KellyNewStatus(15)
- data%State%TD_Count%KellyOldStatus(13) = 0
- else if (data%State%TD_Count%KellyOldStatus(16)==1 .and. data%State%TD_Count%KellyNewStatus(15)/=data%State%TD_Count%KellyOldStatus(15)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(15) = data%State%TD_Count%KellyNewStatus(15)
- data%State%TD_Count%KellyOldStatus(16) = 0
- end if
- data%State%TD_StConn%TDSHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSLength !?????????????
- data%State%TD_StConn%TDSElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSElevatorLength !?????????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_SINGLE ) then
- data%State%TD_StConn%StringConnectionMode = 16
- if (data%State%TD_Count%KellyOldStatus(11)==1 .and. data%State%TD_Count%KellyNewStatus(16)/=data%State%TD_Count%KellyOldStatus(16)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight-(data%State%TD_DrillStems(kk)%LengthIni)
- data%State%TD_Count%KellyOldStatus(16) = data%State%TD_Count%KellyNewStatus(16)
- data%State%TD_Count%KellyOldStatus(11) = 0
- else if (data%State%TD_Count%KellyOldStatus(13)==1 .and. data%State%TD_Count%KellyNewStatus(16)/=data%State%TD_Count%KellyOldStatus(16)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(16) = data%State%TD_Count%KellyNewStatus(16)
- data%State%TD_Count%KellyOldStatus(13) = 0
- else if (data%State%TD_Count%KellyOldStatus(15)==1 .and. data%State%TD_Count%KellyNewStatus(16)/=data%State%TD_Count%KellyOldStatus(16)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_Count%KellyOldStatus(16) = data%State%TD_Count%KellyNewStatus(16)
- data%State%TD_Count%KellyOldStatus(15) = 0
- end if
- data%State%TD_StConn%TDSHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSLength !?????????????
- data%State%TD_StConn%TDSElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSElevatorLength !?????????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
-
- else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STAND ) then
- data%State%TD_StConn%StringConnectionMode = 17
- if (data%State%TD_Count%KellyOldStatus(11)==1 .and. data%State%TD_Count%KellyNewStatus(17)/=data%State%TD_Count%KellyOldStatus(17)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight-(3.d0*data%State%TD_DrillStems(kk)%LengthIni)
- data%State%TD_Count%KellyOldStatus(17) = data%State%TD_Count%KellyNewStatus(17)
- data%State%TD_Count%KellyOldStatus(11) = 0
- else if (data%State%TD_Count%KellyOldStatus(14)==1 .and. data%State%TD_Count%KellyNewStatus(17)/=data%State%TD_Count%KellyOldStatus(17)) then
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight+(3.d0*data%State%TD_DrillStems(kk)%LengthIni)
- data%State%TD_Count%KellyOldStatus(17) = data%State%TD_Count%KellyNewStatus(17)
- data%State%TD_Count%KellyOldStatus(14) = 0
- end if
- data%State%TD_StConn%TDSHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSLength !?????????????
- data%State%TD_StConn%TDSElevatorHeight = data%State%TD_StConn%HookHeight-data%State%TD_StConn%TDSElevatorLength !?????????????
- data%State%TD_StConn%ConnectionHeight = data%State%TD_StConn%ConnectionHeight
- data%State%TD_StConn%StringVelocity = 0.0d0
- end if
-
-
- end if
-
- !if(print_log) print*, 'data%State%TD_StConn%StringConnectionMode=' , data%State%TD_StConn%StringConnectionMode
- !if(print_log) print* , 'data%State%TD_StConn%ConnectionHeight=' , data%State%TD_StConn%ConnectionHeight
- !if(print_log) print*, 'data%State%TD_StConn%StringConnectionMode=' , data%State%TD_StConn%StringConnectionMode
- !if(print_log) print*, 'data%State%TD_String%DrillStemComponentsNumbs=' , data%State%TD_String%DrillStemComponentsNumbs
- !!if(print_log) print*, 'data%State%TD_Count%KellyNewStatus(1)=' , data%State%TD_Count%KellyNewStatus(1)
- !if(print_log) print*, 'data%State%TD_Count%KellyOldStatus(1)=' , data%State%TD_Count%KellyOldStatus(1)
- !if(print_log) print*, 'data%State%TD_Count%KellyNewStatus(2)=' , data%State%TD_Count%KellyNewStatus(2)
- !if(print_log) print*, 'data%State%TD_Count%KellyOldStatus(2)=' , data%State%TD_Count%KellyOldStatus(2)
- !if(print_log) print*, 'data%State%TD_Count%KellyNewStatus(3)=' , data%State%TD_Count%KellyNewStatus(3)
- !if(print_log) print*, 'data%State%TD_Count%KellyOldStatus(3)=' , data%State%TD_Count%KellyOldStatus(3)
-
-
-
-
-
-
- if ( (any(data%State%TD_StConn%StringConnectionMode==(/1,9,10/))) .or. data%Equipments%DrillingConsole%CloseSafetyValve==.true. ) then !for fluid module
- data%State%TD_StConn%FluidStringConnectionMode = 1 !string is connected
- !else if ( (any(data%State%TD_StConn%StringConnectionMode==(/1,9,10/))) .or. data%Equipments%DrillingConsole%CloseSafetyValve==.true. ) then
- !
- else
- data%State%TD_StConn%FluidStringConnectionMode = 0 !string is not connected
- end if
-
-
-
-
-
-
- !====================================================
- ! Zero String Speed
- !====================================================
- if ( abs(data%State%TD_StConn%StringVelocity)<=0.05d0 ) then ! [ft/s]
- data%State%TD_Load%ZeroStringSpeed = 1
- Call Set_ZeroStringSpeed(.true.)
- else
- data%State%TD_Load%ZeroStringSpeed = 0
- Call Set_ZeroStringSpeed(.false.)
- end if
-
-
-
-
-
-
-
- end subroutine
|