|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 |
- # 1 "/home/admin/SimulationCore2/Equipments/Drawworks/Drawworks_Solver.f90"
- subroutine Drawworks_Solver
-
- Use CUnityInputs
- use UnitySignalVariables
- use UnitySignalsModule
- use SimulationVariables !@
- use OperationScenariosModule
- use OperationScenariosModule !!CElevator...
- use UnitySignalsModule
- ! Use CTdsElevatorModesEnumVariables
- use OperationScenariosModule
-
- IMPLICIT NONE
-
-
- Integer :: j
- Integer :: CrownCollision_Status , FloorCollision_Status , CrownWarning_Status , FloorWarning_Status
-
-
-
-
-
- !>>>>>>>>>>>>>>>>>>>> Speed <<<<<<<<<<<<<<<<<<<<<<<<
-
- data%State%Drawworks%N_Throtle = abs(data%State%Drawworks%Throttle) ![rpm]
- !data%State%Drawworks%N_Accelarator = (data%State%Drawworks%Acceleretor/100.d0)*965.d0 ![rpm]
-
- !IF (data%State%Drawworks%N_Throtle>data%State%Drawworks%N_Accelarator) THEN
- data%State%Drawworks%N_new = data%State%Drawworks%N_Throtle
- !ELSE
- ! data%State%Drawworks%N_new = data%State%Drawworks%N_Accelarator
- !END IF
-
- !========================== Drawworks Rate limit ==========================
- if (((data%State%Drawworks%N_new-data%State%Drawworks%N_old)/data%State%Drawworks%time_step)>data%State%Drawworks%RateChange) then
- data%State%Drawworks%Speed =(data%State%Drawworks%RateChange*data%State%Drawworks%time_step)+data%State%Drawworks%N_old ![rpm]
- else if (((data%State%Drawworks%N_old-data%State%Drawworks%N_new)/data%State%Drawworks%time_step)>data%State%Drawworks%RateChange) then
- data%State%Drawworks%Speed = (-data%State%Drawworks%RateChange*data%State%Drawworks%time_step)+data%State%Drawworks%N_old
- else
- data%State%Drawworks%Speed = data%State%Drawworks%N_new
- end if
- !=======================================================================
-
- !========================== Speed Correction ==========================
- !===> SLIPS SET , No Motion
- if ( data%State%Drawworks%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then
- data%State%Drawworks%Speed = 0.d0
- end if
- if ( data%State%Drawworks%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_SPINE .or. Get_TdsConnectionModes()==TDS_CONNECTION_STRING) ) then
- data%State%Drawworks%Speed = 0.d0
- end if
-
-
- !===> Closed BOP Rams , No Motion
- if ( data%State%Drawworks%ShearBopSituation==1 .and. (any(data%State%Drawworks%DrillModeCond==(/3,10,19,20,24/))) ) then
- data%State%Drawworks%Speed = 0.d0
- end if
- !=======================================================================
-
-
- Call Drawworks_Direction
-
-
-
- !====================================================
- ! Collision & Warning
- !====================================================
- if ( data%State%Drawworks%CrownCollision == .false. ) then
- CrownCollision_Status = 0
- end if
- if ( data%State%Drawworks%FloorCollision == .false. ) then
- FloorCollision_Status = 0
- end if
-
-
-
-
-
-
- ! !====================================================
- ! ! Crown Collision (Max_Hook_Height)
- ! !====================================================
- ! ?if ( ((3.280839895d0*data%State%Drawworks%Hook_Height)>=data%State%Drawworks%max_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/3,4,7,10,11,12,14/))) ) then
- ! if ( CrownCollision_Status==0 .and. data%State%Drawworks%motion==1 ) then
- ! CrownCollision_Status = 1
- ! data%State%Drawworks%CrownCollision = .true.
- ! data%State%Drawworks%SoundCrownCollision = .true.
- ! else
- ! data%State%Drawworks%SoundCrownCollision = .false.
- ! end if
- ! if ( data%State%Drawworks%motion==-1 .and. data%State%Drawworks%CrownCollision==.false. ) then
- ! !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft]
- ! data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s]
- ! else
- ! Call DWFixModeMotion
- ! end if
- ! return
- ! end if
-
-
-
-
-
-
-
- ! !====================================================
- ! ! Floor Collision (Min_Hook_Height)
- ! !====================================================
- ! ?if ( ((3.280839895*data%State%Drawworks%Hook_Height)<=data%State%Drawworks%min_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/3,4,7,10,11,12,14/))) ) then
- ! if ( FloorCollision_Status==0 .and. data%State%Drawworks%motion==-1 ) then
- ! FloorCollision_Status = 1
- ! data%State%Drawworks%FloorCollision = .true.
- ! data%State%Drawworks%SoundFloorCollision = .true.
- ! else
- ! data%State%Drawworks%SoundFloorCollision = .false.
- ! end if
- ! if ( data%State%Drawworks%motion==1 .and. data%State%Drawworks%FloorCollision==.false. ) then
- ! !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft]
- ! data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s]
- ! else
- ! Call DWFixModeMotion
- ! end if
- ! return
- ! end if
-
-
-
-
-
-
-
-
- ! !====================================================
- ! ! Crown Warning
- ! !====================================================
- ! ?if ( ((3.280839895*data%State%Drawworks%Hook_Height)>=data%State%Drawworks%max_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/1,2,5,6,8,9,13/))) ) then
- ! if ( data%State%Drawworks%motion==-1 ) then
- ! !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft]
- ! data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s]
- ! else
- ! Call DWFixModeMotion
- ! end if
- ! return
- ! end if
-
-
-
-
-
-
-
- ! !====================================================
- ! ! Floor Warning
- ! !====================================================
- ! ?if ( ((3.280839895*data%State%Drawworks%Hook_Height)<=data%State%Drawworks%min_Hook_Height) .and. (any(data%State%Drawworks%DrillModeCond==(/1,2,5,6,8,9,13/))) ) then
- ! if ( data%State%Drawworks%motion==1 ) then
- ! !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft]
- ! data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s]
- ! else
- ! Call DWFixModeMotion
- ! end if
- ! return
- ! end if
-
-
-
-
-
-
-
-
-
-
- !====================================================
- ! ELEVATOR CONNECTION STRING (SLIPS SET , No Motion)
- !====================================================
- if ( data%State%Drawworks%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and. data%State%Drawworks%motion/=-1 ) then
- Call DWFixModeMotion
- return
- end if
-
- if ( data%State%Drawworks%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING) .and. data%State%Drawworks%motion/=-1 ) then
- Call DWFixModeMotion
- return
- end if
-
-
-
-
-
-
-
-
-
-
-
- !====================================================
- ! RAM & ToolJoint Collision (Top of RAM)
- !====================================================
- Do j = 2,4 !startup problem ???????
- if ( data%State%Drawworks%TDBOPElementNo(j)/=0 ) then
- if ( ((data%State%Drawworks%TDBOPHeight(j)-data%State%Drawworks%TDBOPThickness)<=(data%State%Drawworks%TDDrillStemsTopDepth(data%State%Drawworks%TDBOPElementNo(j))+data%State%Drawworks%TDDrillStemsToolJointRange(data%State%Drawworks%TDBOPElementNo(j)))) .and. ((data%State%Drawworks%TDBOPHeight(j)-data%State%Drawworks%TDBOPThickness)>data%State%Drawworks%TDDrillStemsTopDepth(data%State%Drawworks%TDBOPElementNo(j))) .and. (data%State%Drawworks%TDBOPRamDiam(j)<(2.d0*12.d0*data%State%Drawworks%TDDrillStemsRtoolJoint(data%State%Drawworks%TDBOPElementNo(j)))) ) then
- if ( data%State%Drawworks%motion==1 ) then
- !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft]
- data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s]
- else
- Call DWFixModeMotion
- end if
- return
- end if
- end if
- End Do
-
-
-
-
-
-
-
-
-
- !====================================================
- ! RAM & ToolJoint Collision (Bottom of RAM)
- !====================================================
- Do j = 2,4
- if ( data%State%Drawworks%TDBOPElementNo(j)/=0 ) then
- if ( ((data%State%Drawworks%TDBOPHeight(j)+data%State%Drawworks%TDBOPThickness)>=(data%State%Drawworks%TDDrillStemsDownDepth(data%State%Drawworks%TDBOPElementNo(j))-data%State%Drawworks%TDDrillStemsToolJointRange(data%State%Drawworks%TDBOPElementNo(j)))) .and. ((data%State%Drawworks%TDBOPHeight(j)+data%State%Drawworks%TDBOPThickness)<data%State%Drawworks%TDDrillStemsDownDepth(data%State%Drawworks%TDBOPElementNo(j))) .and. (data%State%Drawworks%TDBOPRamDiam(j)<(2.d0*12.d0*data%State%Drawworks%TDDrillStemsRtoolJoint(data%State%Drawworks%TDBOPElementNo(j)))) ) then
- if ( data%State%Drawworks%motion==-1 ) then
- !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft]
- data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s]
- else
- Call DWFixModeMotion
- end if
- return
- end if
- end if
- End Do
-
-
-
-
-
-
-
- !====================================================
- ! TopDrive (TdsStemIn)
- !====================================================
- if ( (data%State%Drawworks%DriveType==0) .and. (Get_TdsStemIn()) .and. Get_Slips() == SLIPS_SET_END ) then
- if ( data%State%Drawworks%motion==1 ) then
- !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft]
- data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s]
- else
- Call DWFixModeMotion
- end if
- return
- end if
-
- !=====> BottomHole ROP Condition
- if ( (int(data%State%Drawworks%TDDrillStemBottom*10000.d0)>=(int((data%State%Drawworks%TDWellTotalLength+data%State%Drawworks%TDDlMax)*10000.d0))) .and. (data%State%Drawworks%motion==-1 .or. data%State%Drawworks%motion==0) ) then
- if ( data%State%Drawworks%StringIsBottomOfWell==0 ) then
- !?data%State%Drawworks%Hook_Height_final = data%State%Drawworks%Hook_Height_final+(data%State%Drawworks%TDDrillStemBottom-(data%State%Drawworks%TDWellTotalLength+data%State%Drawworks%TDDlMax))
- data%State%Drawworks%HookLinearVelocity_final = (data%State%Drawworks%TDDrillStemBottom-(data%State%Drawworks%TDWellTotalLength+data%State%Drawworks%TDDlMax))/data%State%Drawworks%time_step ![ft/s]
- data%State%Drawworks%StringIsBottomOfWell = 1
- end if
- Call DWFixModeMotion
- return
- else
- data%State%Drawworks%StringIsBottomOfWell = 0
- end if
-
-
-
-
-
-
-
-
- !data%State%Drawworks%Hook_Height_final = 3.280839895d0*data%State%Drawworks%Hook_Height ![ft]
- data%State%Drawworks%HookLinearVelocity_final = 3.280839895d0*data%State%Drawworks%HookLinearVelocity ![ft/s]
- data%State%Drawworks%HookHeight_graph_output = 0.1189d0*((3.280839895d0*data%State%Drawworks%Hook_Height)-28.d0)-2.6d0 ![ft]
-
-
-
-
- end subroutine Drawworks_Solver
|