@@ -141,7 +141,7 @@ module COperationScenariosVariables | |||
real(8) function TJH() | |||
use TD_DrillStemComponents | |||
implicit none | |||
TJH = TD_TopJointHeight | |||
TJH = TD_String%TopJointHeight | |||
end function | |||
real function TL() | |||
@@ -45,7 +45,7 @@ module CInstallFillupHeadPermission | |||
!OPERATION-CODE=70 | |||
if (Get_OperationCondition() == OPERATION_TRIP .and.& | |||
TD_TopJointHeight >= 3.0 .and. TD_TopJointHeight <= 9.0 .and.& | |||
TD_String%TopJointHeight >= 3.0 .and. TD_String%TopJointHeight <= 9.0 .and.& | |||
Get_JointConnectionPossible() == .false. .and.& | |||
!Get_ElevatorConnectionPossible() == .false. .and.& | |||
!Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .and.& | |||
@@ -48,7 +48,7 @@ module CIrIbopPermission | |||
if (GetRotaryRpm() == 0.0d0 .and.& | |||
Get_OperationCondition() == OPERATION_TRIP .and.& | |||
!(Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .or. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) .and.& | |||
TD_TopJointHeight >= 3.0 .and. TD_TopJointHeight <= 10.0 .and.& | |||
TD_String%TopJointHeight >= 3.0 .and. TD_String%TopJointHeight <= 10.0 .and.& | |||
!Get_IbopHeight() >= 22.0 .and. Get_IbopHeight() <= 35.0 .and.& | |||
Get_JointConnectionPossible() == .false. .and.& | |||
Get_Swing() == SWING_WELL_END .and.& | |||
@@ -51,7 +51,7 @@ module CIrSafetyValvePermission | |||
GetRotaryRpm() == 0.0d0 .and.& | |||
!(Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .or. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) .and.& | |||
!Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 10.0 .and.& | |||
TD_TopJointHeight >= 3.0 .and. TD_TopJointHeight <= 10.0 .and.& | |||
TD_String%TopJointHeight >= 3.0 .and. TD_String%TopJointHeight <= 10.0 .and.& | |||
!Get_SafetyValveHeight() >= 22.0 .and. Get_SafetyValveHeight() <= 35.0 .and.& | |||
Get_JointConnectionPossible() == .false. .and.& | |||
Get_FillupHead() == FILLUP_HEAD_REMOVE .and.& | |||
@@ -183,8 +183,8 @@ module CGaugesProblemsVariables | |||
implicit none | |||
integer, intent (in) :: status | |||
! if(associated(WeightIndicatorPtr)) call WeightIndicatorPtr(status) | |||
if(status == Clear_StatusType) TD_WeightIndicatorMalf = 0 | |||
if(status == Executed_StatusType) TD_WeightIndicatorMalf = 1 | |||
if(status == Clear_StatusType) TD_general%WeightIndicatorMalf = 0 | |||
if(status == Executed_StatusType) TD_general%WeightIndicatorMalf = 1 | |||
endsubroutine | |||
subroutine ChangeRotaryRpm(status) | |||
@@ -36,10 +36,10 @@ module BOP | |||
!=== Instantaneous Pipe Diameters in Each Ram (Input from TD Module):== | |||
Annular%ODDrillpipe_inAnnular= TD_AnnularPreventerDiam * 12.0 ! ft to inch | |||
PipeRam1%ODDrillpipe_in= TD_UpperRamDiam * 12.0 | |||
ShearRam%ODDrillpipe_inShearRam= TD_BlindRamDiam * 12.0 | |||
PipeRam2%ODDrillpipe_in= TD_LowerRamDiam * 12.0 | |||
Annular%ODDrillpipe_inAnnular= TD_BOP%AnnularPreventerDiam * 12.0 ! ft to inch | |||
PipeRam1%ODDrillpipe_in= TD_BOP%UpperRamDiam * 12.0 | |||
ShearRam%ODDrillpipe_inShearRam= TD_BOP%BlindRamDiam * 12.0 | |||
PipeRam2%ODDrillpipe_in= TD_BOP%LowerRamDiam * 12.0 | |||
@@ -123,14 +123,14 @@ module BOP | |||
!=================================================================== | |||
! Annular Preventer Pressure Rise On Tooljoint | |||
!=================================================================== | |||
if ( Annular%Annular_Situation_forTD == 1 .and. TD_AnnularFillingFinal==0.0 ) then ! Annular_Situation_forTD= 1 ! closed - for TD code | |||
if ( Annular%Annular_Situation_forTD == 1 .and. TD_BOP%AnnularFillingFinal==0.0 ) then ! Annular_Situation_forTD= 1 ! closed - for TD code | |||
AnnularComputational%AnnPressureRise= .true. | |||
elseif ( Annular%Annular_Situation_forTD == 0 ) then | |||
AnnularComputational%AnnPressureRise= .false. | |||
endif | |||
if (AnnularComputational%AnnPressureRise == .true.) then | |||
Annular%Pannular_reg= Annular%Pannular_reg + 200. * TD_AnnularFillingFinal ! 200 psi pressure rise when 100% of AnnPreventer is filled by tool joint | |||
Annular%Pannular_reg= Annular%Pannular_reg + 200. * TD_BOP%AnnularFillingFinal ! 200 psi pressure rise when 100% of AnnPreventer is filled by tool joint | |||
!TD_AnnularFillingFinal ! (0.0 to 1.0) percentage filled by tool joint | |||
endif | |||
!=================================================================== | |||
@@ -788,7 +788,7 @@ if (ramtype==1) then !for shear ram | |||
BopStackInput%MiddleRamsCloseLEDMine = LedOn | |||
BopControlPanel%MiddleRamsOpenLED = LedOff | |||
BopStackInput%MiddleRamsOpenLEDMine = LedOff | |||
if (TD_BOPConnectionPossibility(3) == 1 .and. ShearRam%ShearIsNotAllowed==0) then | |||
if (TD_BOP%BOPConnectionPossibility(3) == 1 .and. ShearRam%ShearIsNotAllowed==0) then | |||
CALL CloseMiddleRams | |||
RamLine%ShearBop_Situation_forTD= 1 ! closed - for TD code | |||
endif | |||
@@ -832,7 +832,7 @@ if (ramtype==2) then !for pipe ram1 | |||
BopStackInput%UpperRamsCloseLEDMine = LedOn | |||
BopControlPanel%UpperRamsOpenLED = LedOff | |||
BopStackInput%UpperRamsOpenLEDMine = LedOff | |||
if (TD_BOPConnectionPossibility(2) == 1) then | |||
if (TD_BOP%BOPConnectionPossibility(2) == 1) then | |||
CALL CloseUpperRams ! for C code | |||
call Set_BlowoutFromAnnular(.true.) | |||
@@ -880,7 +880,7 @@ if (ramtype==3) then !for pipe ram2 | |||
BopStackInput%LowerRamsCloseLEDMine = LedOn | |||
BopControlPanel%LowerRamsOpenLED = LedOff | |||
BopStackInput%LowerRamsOpenLEDMine = LedOff | |||
if (TD_BOPConnectionPossibility(4) == 1) then | |||
if (TD_BOP%BOPConnectionPossibility(4) == 1) then | |||
CALL CloseLowerRams | |||
PipeRam2%Situation_forTD= 1 ! closed - for TD code | |||
endif | |||
@@ -1234,7 +1234,7 @@ RamLine%P_ACC=RamLine%B1*exp(RamLine%B2*RamLine%FVR/BopStackAcc%NOBOTTLES)+RamLi | |||
BopControlPanel%AnnularOpenLED = LedOff | |||
BopStackInput%AnnularOpenLedMine = LedOff | |||
if (TD_BOPConnectionPossibility(1) == 1) then | |||
if (TD_BOP%BOPConnectionPossibility(1) == 1) then | |||
CALL CloseAnnular | |||
Annular%Annular_Situation_forTD= 1 ! closed - for TD code | |||
endif | |||
@@ -1,91 +0,0 @@ | |||
subroutine DWBrakeSound | |||
! Use Drawworks_VARIABLES | |||
! Use CSounds | |||
! | |||
!IMPLICIT NONE | |||
! | |||
! Real :: DW_MainBrakeTorque , DW_DrumRPM | |||
! | |||
! | |||
! | |||
! DW_MainBrakeTorque = ((Drawworks%Diameter/2.0d0)*Drawworks%BreakLoad)*(Drawworks%ManualBreak/100.0d0) ![N.m] | |||
! DW_MainBrakeTorque = DW_MainBrakeTorque/800.d0 ! Scaling: 0<=DW_MainBrakeTorque=<100 | |||
! !print*, 'DW_MainBrakeTorque0=' , DW_MainBrakeTorque | |||
! if ( DW_MainBrakeTorque>100. ) then | |||
! DW_MainBrakeTorque = 100.d0 | |||
! end if | |||
! | |||
! | |||
! | |||
! DW_DrumRPM = Drawworks%w_drum | |||
! DW_DrumRPM = DW_DrumRPM*10.d0+(Drawworks%ManualBreak/100.0d0) ! Scaling: 0<=DW_DrumRPM=<1000 | |||
! !print*, 'DW_DrumRPM0=' , DW_DrumRPM | |||
! !if ( DW_DrumRPM>=0. .and. DW_DrumRPM<=1. ) then | |||
! ! DW_DrumRPM = 1.0 | |||
! !end if | |||
! if ( DW_DrumRPM>1000.d0 ) then | |||
! DW_DrumRPM = 1000.d0 | |||
! end if | |||
! | |||
! | |||
! Drawworks%SoundDwBrake = INT((DW_MainBrakeTorque*DW_DrumRPM)) ! 0<=SoundDWBrake=<100000 | |||
! Call SetSoundDwBrake( Drawworks%SoundDwBrake ) | |||
! | |||
! | |||
! !print*, 'Drawworks%SoundDwBrake=' , Drawworks%SoundDwBrake | |||
! !print*, 'DW_DrumRPM=' , DW_DrumRPM | |||
! !print*, 'DW_MainBrakeTorque=' , DW_MainBrakeTorque | |||
! !print*, 'Drawworks%ManualBreak=' , Drawworks%ManualBreak | |||
Use Drawworks_VARIABLES | |||
Use CSounds | |||
Use TD_StringConnectionData | |||
IMPLICIT NONE | |||
Real :: DW_MainBrakeTorque , DW_DrumRPM | |||
!DW_MainBrakeTorque = ((Drawworks%Diameter/2.0d0)*Drawworks%BreakLoad)*(Drawworks%ManualBreak/100.0d0) ![N.m] | |||
!DW_MainBrakeTorque = DW_MainBrakeTorque/800.d0 ! Scaling: 0<=DW_MainBrakeTorque=<100 | |||
!print*, 'DW_MainBrakeTorque0=' , DW_MainBrakeTorque | |||
!if ( DW_MainBrakeTorque>100. ) then | |||
! DW_MainBrakeTorque = 100.d0 | |||
!end if | |||
DW_DrumRPM = Drawworks%w_drum | |||
!DW_DrumRPM = DW_DrumRPM*10.d0+(Drawworks%ManualBreak/100.0d0) ! Scaling: 0<=DW_DrumRPM=<1000 | |||
!print*, 'DW_DrumRPM0=' , DW_DrumRPM | |||
!!if ( DW_DrumRPM>=0. .and. DW_DrumRPM<=1. ) then | |||
!! DW_DrumRPM = 1.0 | |||
!!end if | |||
!if ( DW_DrumRPM>1000.d0 ) then | |||
! DW_DrumRPM = 1000.d0 | |||
!end if | |||
!Drawworks%SoundDwBrake = INT((DW_MainBrakeTorque*DW_DrumRPM)) ! 0<=SoundDWBrake=<100000 | |||
Drawworks%SoundDwBrake = INT((TD_DrawworksLoadInput/20000.)*DW_DrumRPM) | |||
if ( Drawworks%ManualBreak==0. ) then | |||
Drawworks%SoundDwBrake = 0 | |||
end if | |||
Drawworks%SoundDwBrake = Drawworks%SoundDwBrake*10 | |||
Call SetSoundDwBrake( Drawworks%SoundDwBrake ) | |||
!print*, 'Drawworks%SoundDwBrake=' , Drawworks%SoundDwBrake | |||
!print*, 'DW_DrumRPM=' , DW_DrumRPM | |||
!print*, 'TD_DrawworksLoadInput=' , TD_DrawworksLoadInput | |||
!print*, 'Drawworks%ManualBreak=' , Drawworks%ManualBreak | |||
END subroutine |
@@ -1,28 +1,18 @@ | |||
subroutine DWFixModeMotion | |||
Use Drawworks_VARIABLES | |||
Use CHookVariables | |||
IMPLICIT NONE | |||
Drawworks%Hook_Height_final = Drawworks%Hook_Height_final ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
Drawworks%Hook_Height= Drawworks%Hook_Height_final/3.280839895 ![m] | |||
Drawworks%w_drum = 0. | |||
Drawworks%w_old_drum = 0. | |||
Drawworks%w = 0. | |||
Drawworks%w_old = 0. | |||
!Drawworks%ia = 0. ?????????? | |||
!Drawworks%ia_old = 0. ?????????? | |||
!Drawworks%x = 0. ?????????? | |||
!Drawworks%x_old = 0. ?????????? | |||
!Drawworks%y = 0. ?????????? | |||
!Drawworks%y_old = 0. ?????????? | |||
Drawworks%motion = 0 | |||
Drawworks%Hook_Height_final = Drawworks%Hook_Height_final ![ft] | |||
Drawworks%Hook_Height = Drawworks%Hook_Height_final/3.280839895d0 ![m] | |||
Drawworks%w_drum = 0.d0 | |||
Drawworks%w_old_drum = 0.d0 | |||
Drawworks%motion = 0 | |||
END subroutine | |||
End subroutine |
@@ -1,19 +0,0 @@ | |||
subroutine DWMalfunction_ClutchDisengage | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
use CHoistingVariables | |||
use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
!! Drawworks Malfunction ----> Clutch Disengage | |||
!if ( Drawworks%ClutchDisengageMalf==1 ) then | |||
! Drawworks%ClutchMode=0 | |||
! return | |||
!end if | |||
END subroutine |
@@ -1,55 +0,0 @@ | |||
subroutine DWMalfunction_ClutchEngage | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
use CHoistingVariables | |||
use Drawworks_VARIABLES | |||
use CSounds | |||
use CLog4 | |||
IMPLICIT NONE | |||
! Sound Generation | |||
if ( Drawworks%SoundClutch) then | |||
Drawworks%SoundClutch = .false. | |||
Call SetSoundDwClutch(Drawworks%SoundClutch) | |||
end if | |||
if ( DW_OldClutchMode/=0 .and. DrillingConsole%DWClutchLever==0 ) then | |||
Drawworks%SoundClutch = .true. | |||
Call SetSoundDwClutch(Drawworks%SoundClutch) | |||
end if | |||
DW_OldClutchMode = DrillingConsole%DWClutchLever | |||
! Drawworks Malfunction ----> Clutch Engage | |||
if ( Drawworks%ClutchEngageMalf==1 ) then | |||
if ( Drawworks%ClutchMode==1 .or. Drawworks%ClutchMode==-1 ) then | |||
Drawworks%ClutchMode = Drawworks%ClutchMode | |||
else if ( Drawworks%ClutchMode==0 ) then | |||
Drawworks%ClutchMode = -1 | |||
end if | |||
return | |||
end if | |||
! Drawworks Malfunction ----> Clutch Disengage | |||
if ( Drawworks%ClutchDisengageMalf==1 ) then | |||
Drawworks%ClutchMode = 0 | |||
return | |||
end if | |||
Drawworks%ClutchMode = DrillingConsole%DWClutchLever | |||
end subroutine |
@@ -3,169 +3,45 @@ module DrawworksMain | |||
public | |||
contains | |||
! subroutine Drawworks_Setup() | |||
! ! use CSimulationVariables | |||
! implicit none | |||
! call OnSimulationInitialization%Add(Drawworks_Init) | |||
! call OnSimulationStop%Add(Drawworks_Init) | |||
! call OnDrawworksStep%Add(Drawworks_Step) | |||
! call OnDrawworksOutput%Add(Drawworks_Output) | |||
! call OnDrawworksMain%Add(DrawworksMainBody) | |||
! end subroutine | |||
subroutine Drawworks_Setup() | |||
use CSimulationVariables | |||
implicit none | |||
call OnSimulationInitialization%Add(Drawworks_Init) | |||
call OnSimulationStop%Add(Drawworks_Init) | |||
call OnDrawworksStep%Add(Drawworks_Step) | |||
call OnDrawworksOutput%Add(Drawworks_Output) | |||
call OnDrawworksMain%Add(DrawworksMainBody) | |||
end subroutine | |||
! subroutine Drawworks_Init | |||
! implicit none | |||
! end subroutine Drawworks_Init | |||
subroutine Drawworks_Init | |||
implicit none | |||
end subroutine Drawworks_Init | |||
subroutine Drawworks_Step | |||
implicit none | |||
end subroutine Drawworks_Step | |||
! subroutine Drawworks_Output | |||
! implicit none | |||
! end subroutine Drawworks_Output | |||
subroutine Drawworks_Output | |||
implicit none | |||
end subroutine Drawworks_Output | |||
! subroutine DrawworksMainBody | |||
subroutine DrawworksMainBody | |||
Use Drawworks_VARIABLES | |||
! use CDrillingConsoleVariables | |||
! use CDataDisplayConsoleVariables | |||
! use CHoistingVariables | |||
! ! use CSimulationVariables | |||
! use Drawworks_VARIABLES | |||
! use CHookVariables | |||
! use CWarningsVariables | |||
! use CSounds | |||
! implicit none | |||
! integer,dimension(8) :: DW_START_TIME, DW_END_TIME | |||
! INTEGER :: DW_SolDuration | |||
implicit none | |||
Call Drawworks_StartUp | |||
loopdrawsim : do | |||
! Call Drawworks_StartUp | |||
! loopdrawsim : do | |||
Call Drawworks_MainSolver | |||
! CALL DATE_AND_TIME(values=DW_START_TIME) | |||
! if (IsPortable) then | |||
! Drawworks%AssignmentSwitch = 1 | |||
! else | |||
! Drawworks%AssignmentSwitch = DrillingConsole%AssignmentSwitch | |||
! end if | |||
! if((any(Drawworks%AssignmentSwitch==(/1,2,3,4,5,7,8,9,10,11/))) .and. (DrillingConsole%DWSwitch==-1) .and. (DrillingConsole%DWThrottle==0.)) then | |||
! Drawworks%SoundBlower = .true. | |||
! Call SetSoundBlowerDW(Drawworks%SoundBlower) | |||
! DrillingConsole%DWBLWR = 1 | |||
! loopDrawworks1 : do | |||
! CALL DATE_AND_TIME(values=DW_START_TIME) | |||
! if (IsPortable) then | |||
! Drawworks%AssignmentSwitch = 1 | |||
! else | |||
! Drawworks%AssignmentSwitch = DrillingConsole%AssignmentSwitch | |||
! end if | |||
! if(any(Drawworks%AssignmentSwitch==(/1,2,5,7,8,9,10,11/))) then | |||
! Drawworks%NumberOfTracMotor = 2.0d0 | |||
! else if (any(Drawworks%AssignmentSwitch==(/3,4/))) then | |||
! Drawworks%NumberOfTracMotor = 1.0d0 | |||
! end if | |||
! Call Drawworks_Solver | |||
! DW_TDHookHeight = Drawworks%Hook_Height_final | |||
! if ( Drawworks%motion==+1 ) then | |||
! Drawworks%SoundRev = 0 ![rpm] , Integer | |||
! Call SetSoundDwRev( Drawworks%SoundRev ) | |||
! Drawworks%SoundFw = INT(Drawworks%w_drum) ![rpm] , Integer | |||
! Call SetSoundDwFw(Drawworks%SoundFw) | |||
! Call DWBrakeSound | |||
! else | |||
! Drawworks%SoundFw = 0 ![rpm] , Integer | |||
! Call SetSoundDwFw(Drawworks%SoundFw) | |||
! Drawworks%SoundRev = INT(Drawworks%w_drum) ![rpm] , Integer | |||
! Call SetSoundDwRev( Drawworks%SoundRev ) | |||
! Call DWBrakeSound | |||
! end if | |||
! DW_OldTransMode = DrillingConsole%DWTransmisionLever | |||
! if (IsPortable) then | |||
! Drawworks%AssignmentSwitch = 1 | |||
! else | |||
! Drawworks%AssignmentSwitch = DrillingConsole%AssignmentSwitch | |||
! end if | |||
! if ((any(Drawworks%AssignmentSwitch==(/6,12/))) .or. (any(DrillingConsole%DWSwitch==(/0,1/))) .or. (IsStopped == .true.)) then | |||
! Drawworks%SoundBlower = .false. | |||
! Call SetSoundBlowerDW(Drawworks%SoundBlower) | |||
! DrillingConsole%DWBLWR = 0 | |||
! !Call Drawworks_Solver_FreeTractionMotor | |||
! exit loopDrawworks1 | |||
! end if | |||
! CALL DATE_AND_TIME(values=DW_END_TIME) | |||
! DW_SolDuration = 100-(DW_END_TIME(5)*3600000+DW_END_TIME(6)*60000+DW_END_TIME(7)*1000+DW_END_TIME(8)-DW_START_TIME(5)*3600000-DW_START_TIME(6)*60000-DW_START_TIME(7)*1000-DW_START_TIME(8)) | |||
! if(DW_SolDuration > 0.0d0) then | |||
! CALL sleepqq(DW_SolDuration) | |||
! end if | |||
! end do loopDrawworks1 | |||
! else | |||
! if (IsPortable) then | |||
! Drawworks%AssignmentSwitch = 1 | |||
! else | |||
! Drawworks%AssignmentSwitch = DrillingConsole%AssignmentSwitch | |||
! end if | |||
! if((any(Drawworks%AssignmentSwitch==(/1,2,3,4,5,7,8,9,10,11/))) .and. (DrillingConsole%DWSwitch==-1)) then | |||
! Drawworks%SoundBlower = .true. | |||
! Call SetSoundBlowerDW(Drawworks%SoundBlower) | |||
! DrillingConsole%DWBLWR = 1 | |||
! else | |||
! Drawworks%SoundBlower = .false. | |||
! Call SetSoundBlowerDW(Drawworks%SoundBlower) | |||
! DrillingConsole%DWBLWR = 0 | |||
! end if | |||
! Call Drawworks_Solver_FreeTractionMotor | |||
! DW_TDHookHeight = Drawworks%Hook_Height_final | |||
! if ( Drawworks%motion==+1 ) then | |||
! Drawworks%SoundRev = 0 ![rpm] , Integer | |||
! Call SetSoundDwRev( Drawworks%SoundRev ) | |||
! Drawworks%SoundFw = INT(Drawworks%w_drum) ![rpm] , Integer | |||
! Call SetSoundDwFw(Drawworks%SoundFw) | |||
! Call DWBrakeSound | |||
! else | |||
! Drawworks%SoundFw = 0 ![rpm] , Integer | |||
! Call SetSoundDwFw(Drawworks%SoundFw) | |||
! Drawworks%SoundRev = INT(Drawworks%w_drum) ![rpm] , Integer | |||
! Call SetSoundDwRev( Drawworks%SoundRev ) | |||
! Call DWBrakeSound | |||
! end if | |||
! DW_OldTransMode = DrillingConsole%DWTransmisionLever | |||
! end if | |||
! if (IsStopped == .true.) then | |||
! exit loopdrawsim | |||
! end if | |||
! CALL DATE_AND_TIME(values=DW_END_TIME) | |||
! DW_SolDuration = 100-(DW_END_TIME(5)*3600000+DW_END_TIME(6)*60000+DW_END_TIME(7)*1000+DW_END_TIME(8)-DW_START_TIME(5)*3600000-DW_START_TIME(6)*60000-DW_START_TIME(7)*1000-DW_START_TIME(8)) | |||
! !print*, 'time=', DW_SolDuration | |||
! if(DW_SolDuration > 0.0d0) then | |||
! CALL sleepqq(DW_SolDuration) | |||
! end if | |||
! end do loopdrawsim | |||
end do loopdrawsim | |||
! end subroutine DrawworksMainBody | |||
end subroutine DrawworksMainBody | |||
end module DrawworksMain |
@@ -1,218 +0,0 @@ | |||
!---------------------------------------------- | |||
! subroutine dia | |||
!---------------------------------------------- | |||
subroutine dia(x1,x2,x3,x5,x6,x7) !dia(t ia w fii x y) | |||
Use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1,x2,x3,x5,x6,x7 | |||
!Drawworks%Vt = x6+Kpi*(Kpn*((30.*Drawworks%w_ref/pi)-(30.*x3/pi))-x2) | |||
Drawworks%ia_ref = x7+Kpn*((30.0d0*Drawworks%w_ref/pi)-(30.0d0*x3/pi)) | |||
if ( Drawworks%ia_ref>1400. ) then | |||
Drawworks%ia_ref = 1400. | |||
end if | |||
Drawworks%Vt = x6+(Kpi*(Drawworks%ia_ref-x2)) | |||
IF (Drawworks%Vt>810.0d0) THEN | |||
Drawworks%Vt = 810.0d0 | |||
ELSE IF (Drawworks%Vt<0.0d0) THEN | |||
Drawworks%Vt = 0.0d0 | |||
END IF | |||
IF (x2<=1150.0d0) THEN | |||
x5 = 6.3304d-3*x2 | |||
ELSE IF (x2>1150.0d0) THEN | |||
x5 = (2.8571d-7)*(x2-1150.0d0)+7.280d0 | |||
END IF | |||
Drawworks%Ea = x5*x3 | |||
Drawworks%dia = (Drawworks%Vt-(Ra+Rf)*x2-Drawworks%Ea)/(La+Lf) | |||
end subroutine | |||
!---------------------------------------------- | |||
! subroutine dw | |||
!---------------------------------------------- | |||
subroutine dw(x1,x2,x3,x4,x5) !x1=t, x2=ia, x3=w, x4=fii, x5=TL | |||
Use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1,x2,x3,x4,x5 | |||
IF (x2<=1150.) THEN | |||
x4 = 6.3304d-3*x2 | |||
ELSE IF (x2>1150.0d0) THEN | |||
x4 = 2.8571d-7*(x2-1150.0d0)+7.280d0 | |||
END IF | |||
Drawworks%Te = x4*x2 | |||
IF (Drawworks%Conv_Ratio==1.) THEN | |||
Drawworks%Te = 0.0d0 | |||
END IF | |||
Drawworks%EddyTorque = (1.039d5*exp(4.343d-4*(30.0d0*(x3/Drawworks%Conv_Ratio)/pi)))+(-1.036d5*exp(-.047920d0*(30.0d0*(x3/Drawworks%Conv_Ratio)/pi))) ![Lbf.ft] | |||
!IF (Drawworks%EddyTorque>115000.0d0) THEN | |||
! Drawworks%EddyTorque = 115000.0d0 | |||
!END IF | |||
Drawworks%EddyTorque = 1.3558179480d0*Drawworks%EddyTorque ![N.m] | |||
Drawworks%TL = ((Drawworks%F_fastline*(Drawworks%Diameter/2.0d0))+(Drawworks%EddyTorque*(Drawworks%EddyBreak/100.0d0))+(((Drawworks%Diameter/2.0d0)*Drawworks%BreakLoad)*(Drawworks%ManualBreak/100.0d0)))/Drawworks%Conv_Ratio | |||
Drawworks%TL = Drawworks%TL/Drawworks%NumberOfTracMotor | |||
Drawworks%dw = (Drawworks%Te-Drawworks%TL)/Drawworks%J_coef | |||
end subroutine | |||
!---------------------------------------------- | |||
! subroutine dx | |||
!---------------------------------------------- | |||
subroutine dx(x1,x2,x3,x4,x5) | |||
Use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1,x2,x3,x4,x5 | |||
Drawworks%ia_ref = x5+Kpn*((30.0d0*Drawworks%w_ref/pi)-(30.0d0*x3/pi)) | |||
if ( Drawworks%ia_ref>1400. ) then | |||
Drawworks%ia_ref = 1400. | |||
end if | |||
Drawworks%dx = Kii*(Drawworks%ia_ref-x2) | |||
end subroutine | |||
!---------------------------------------------- | |||
! subroutine dy | |||
!---------------------------------------------- | |||
subroutine dy(x1,x2,x3,x4,x5) | |||
Use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1,x2,x3,x4,x5 | |||
Drawworks%dy = Kin*((30.0d0*Drawworks%w_ref/pi)-(30.0d0*x3/pi)) | |||
end subroutine | |||
!---------------------------------------------- | |||
! subroutine dw_freeTrac_Dmotion | |||
!---------------------------------------------- | |||
subroutine dw_freeTrac_Dmotion(x1,x2) !x1=t , x2=w | |||
Use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1, x2 | |||
Drawworks%EddyTorque = (1.039d5*exp(4.343d-4*(30.0d0*(x2)/pi)))+(-1.036d5*exp(-.047920d0*(30.0d0*(x2)/pi))) ![Lbf.ft] | |||
IF (Drawworks%EddyTorque>115000.0d0) THEN | |||
Drawworks%EddyTorque = 115000.0d0 | |||
END IF | |||
Drawworks%EddyTorque = 1.3558179480d0*Drawworks%EddyTorque ![N.m] | |||
Drawworks%dw_freeTrac_Dmotion = ((Drawworks%F_fastline*(Drawworks%Diameter/2.0d0))-(Drawworks%EddyTorque*(Drawworks%EddyBreak/100.0d0))-(((Drawworks%Diameter/2.0d0)*Drawworks%BreakLoad)*(Drawworks%ManualBreak/100.0d0)))/Drawworks%J_coef | |||
end subroutine | |||
!---------------------------------------------- | |||
! subroutine dw_freeTrac | |||
!---------------------------------------------- | |||
subroutine dw_freeTrac(x1,x2) !x1=t, x2=w | |||
Use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1, x2 | |||
Drawworks%EddyTorque = (1.039d5*exp(4.343d-4*(30.0d0*(x2)/pi)))+(-1.036d5*exp(-.047920d0*(30.0d0*(x2)/pi))) ![Lbf.ft] | |||
IF (Drawworks%EddyTorque>115000.0d0) THEN | |||
Drawworks%EddyTorque = 115000.0d0 | |||
END IF | |||
Drawworks%EddyTorque = 1.3558179480d0*Drawworks%EddyTorque ![N.m] | |||
Drawworks%dw_freeTrac = (-(Drawworks%F_fastline*(Drawworks%Diameter/2.0d0))-(Drawworks%EddyTorque*(Drawworks%EddyBreak/100.0d0))-(((Drawworks%Diameter/2.0d0)*Drawworks%BreakLoad)*(Drawworks%ManualBreak/100.0d0)))/Drawworks%J_coef | |||
end subroutine | |||
!---------------------------------------------- | |||
! subroutine dw_DawnMotion | |||
!---------------------------------------------- | |||
subroutine dw_DawnMotion(x1,x2,x3,x4,x5) !x1=t, x2=ia, x3=w, x4=fii, x5=TL | |||
Use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1,x2,x3,x4,x5 | |||
IF (x2<=1150.0d0) THEN | |||
x4 = 6.3304d-3*x2 | |||
ELSE IF (x2>1150.0d0) THEN | |||
x4 = 2.8571d-7*(x2-1150.0d0)+7.280d0 | |||
END IF | |||
Drawworks%Te = x4*x2 | |||
Drawworks%EddyTorque = (1.039d5*exp(4.343d-4*(30.0d0*(x3/Drawworks%Conv_Ratio)/pi)))+(-1.036d5*exp(-.047920d0*(30.0d0*(x3/Drawworks%Conv_Ratio)/pi))) ![Lbf.ft] | |||
IF (Drawworks%EddyTorque>115000.0d0) THEN | |||
Drawworks%EddyTorque = 115000.0d0 | |||
END IF | |||
Drawworks%EddyTorque = 1.3558179480d0*Drawworks%EddyTorque ![N.m] | |||
Drawworks%TL = ((Drawworks%F_fastline*(Drawworks%Diameter/2.0d0))-(Drawworks%EddyTorque*(Drawworks%EddyBreak/100.0d0))-(((Drawworks%Diameter/2.0d0)*Drawworks%BreakLoad)*(Drawworks%ManualBreak/100.0d0)))/Drawworks%Conv_Ratio | |||
Drawworks%TL = Drawworks%TL/Drawworks%NumberOfTracMotor | |||
Drawworks%dw_DawnMotion = (Drawworks%TL-Drawworks%Te)/Drawworks%J_coef | |||
end subroutine |
@@ -10,110 +10,140 @@ subroutine Drawworks_Direction | |||
if (Drawworks%Conv_Ratio==1.d0) then | |||
IF (Drawworks%motion==+1) THEN | |||
Call Drawworks_Free_Traction_motor_Dir | |||
if (Drawworks%w_drum_Dir<=0.) then | |||
Drawworks%motion = 0 | |||
else | |||
Drawworks%motion = +1 | |||
Call Drawworks_Free_Traction_motor | |||
Drawworks%w = Drawworks%w_drum*Drawworks%Conv_Ratio | |||
Drawworks%w_old = Drawworks%w_old_drum*Drawworks%Conv_Ratio | |||
end if | |||
ELSE | |||
if (((Drawworks%F_fastline*(Drawworks%Diameter/2.0d0))-(((Drawworks%Diameter/2.0d0)*Drawworks%BreakLoad)*(Drawworks%ManualBreak/100.0d0)))<=0.) then | |||
Drawworks%motion = 0 | |||
Drawworks%w_drum = 0.0d0 | |||
Drawworks%w_old_drum = 0.0d0 | |||
Drawworks%w = Drawworks%w_drum*Drawworks%Conv_Ratio | |||
Drawworks%w_old = Drawworks%w_old_drum*Drawworks%Conv_Ratio | |||
Drawworks%Hook_Height = Drawworks%Hook_Height | |||
Drawworks%ia = 0. | |||
Drawworks%ia_old = 0. | |||
Drawworks%x = 0. | |||
Drawworks%x_old = 0. | |||
Drawworks%y = 0. | |||
Drawworks%y_old = 0. | |||
else | |||
Drawworks%motion = -1 | |||
Call Drawworks_Free_Traction_motor_dawn_motion | |||
Drawworks%w = Drawworks%w_drum*Drawworks%Conv_Ratio | |||
Drawworks%w_old = Drawworks%w_old_drum*Drawworks%Conv_Ratio | |||
end if | |||
END IF | |||
else | |||
IF (Drawworks%motion==-1) THEN | |||
Drawworks%w = -Drawworks%w | |||
Drawworks%w_old = -Drawworks%w_old | |||
Drawworks%w_drum = -Drawworks%w_drum | |||
Drawworks%w_old_drum = -Drawworks%w_old_drum | |||
END IF | |||
Call Drawworks_Traction_motor_ClutchMode_Dir | |||
IF (Drawworks%w_Dir>0.) then | |||
Drawworks%motion = +1 | |||
Call Drawworks_Traction_motor_ClutchMode | |||
Drawworks%w_drum = Drawworks%w/Drawworks%Conv_Ratio | |||
Drawworks%w_old_drum = Drawworks%w_old/Drawworks%Conv_Ratio | |||
ELSE | |||
Drawworks%EddyTorque = (1.039d5*exp(4.343d-4*(30.0d0*(Drawworks%w/Drawworks%Conv_Ratio)/pi)))+(-1.036d5*exp(-.047920d0*(30.0d0*(Drawworks%w/Drawworks%Conv_Ratio)/pi))) !Lbf.ft | |||
if (Drawworks%EddyTorque>115000.) then | |||
Drawworks%EddyTorque = 115000.0d0 | |||
end if | |||
Drawworks%EddyTorque = 1.355817948*Drawworks%EddyTorque ![N.m] | |||
if ((Drawworks%F_fastline*(Drawworks%Diameter/2.0d0))>((((Drawworks%Diameter/2.0d0)*Drawworks%BreakLoad)*(Drawworks%ManualBreak/100.0d0))+(Drawworks%EddyTorque*(Drawworks%EddyBreak/100.0d0)))) then | |||
Drawworks%motion = -1 | |||
IF (Drawworks%w_drum<0.) THEN | |||
Drawworks%w = -Drawworks%w | |||
Drawworks%w_old = -Drawworks%w_old | |||
!Drawworks%w = 0. !??????????????? | |||
!Drawworks%w_old = 0. !??????????????? | |||
Drawworks%w_drum = -Drawworks%w_drum | |||
Drawworks%w_old_drum = -Drawworks%w_old_drum | |||
END IF | |||
Drawworks%Conv_Ratio = 1. | |||
Call Drawworks_Free_Traction_motor_dawn_motion | |||
Drawworks%w = Drawworks%w_drum*Drawworks%Conv_Ratio | |||
Drawworks%w_old = Drawworks%w_old_drum*Drawworks%Conv_Ratio | |||
!Drawworks%w_drum = Drawworks%w/Drawworks%Conv_Ratio | |||
!Drawworks%w_old_drum = Drawworks%w_old/Drawworks%Conv_Ratio | |||
else | |||
Drawworks%motion = 0 | |||
Drawworks%w_drum = 0.0d0 | |||
Drawworks%w_old_drum = 0.0d0 | |||
Drawworks%w = Drawworks%w_drum*Drawworks%Conv_Ratio | |||
Drawworks%w_old = Drawworks%w_old_drum*Drawworks%Conv_Ratio | |||
Drawworks%Hook_Height = Drawworks%Hook_Height | |||
Drawworks%ia = 0. | |||
Drawworks%ia_old = 0. | |||
Drawworks%x = 0. | |||
Drawworks%x_old = 0. | |||
Drawworks%y = 0. | |||
Drawworks%y_old = 0. | |||
end if | |||
END IF | |||
if (Drawworks%Switch==1) then !Up | |||
Drawworks%motion = +1 | |||
Drawworks%w_old_drum = Drawworks%w_drum !(pi*(Drawworks%N_old/Drawworks%Conv_Ratio)/30.d0) ? | |||
Drawworks%w_drum = (pi*(Drawworks%Speed/Drawworks%Conv_Ratio)/30.d0) ![rad/s] | |||
Drawworks%Hook_Height = Drawworks%Hook_Height+(((Drawworks%Diameter/2.0)*(Drawworks%time_step*0.5d0*(Drawworks%w_drum+Drawworks%w_old_drum)))/Drawworks%NumberOfLine) ![m] | |||
else if (Drawworks%Switch==-1) then !Down | |||
Drawworks%motion = -1 | |||
Drawworks%w_old_drum = Drawworks%w_drum !(pi*(Drawworks%N_old/Drawworks%Conv_Ratio)/30.d0) ? | |||
Drawworks%w_drum = (pi*(Drawworks%Speed/Drawworks%Conv_Ratio)/30.d0) ![rad/s] | |||
Drawworks%Hook_Height = Drawworks%Hook_Height-(((Drawworks%Diameter/2.0)*(Drawworks%time_step*0.5d0*(Drawworks%w_drum+Drawworks%w_old_drum)))/Drawworks%NumberOfLine) ![m] | |||
!else if (Drawworks%Switch==0) then !Off | |||
! Drawworks%motion = 0 | |||
! Drawworks%w_old_drum = 0.d0 | |||
! Drawworks%w_drum = 0.d0 | |||
! Drawworks%Hook_Height = Drawworks%Hook_Height | |||
end if | |||
Call DWBrakeSound | |||
!print* , 'Drawworks%ia_new=' , Drawworks%ia_new | |||
!print* , 'Drawworks%ia_ref=' , Drawworks%ia_ref | |||
!print* , 'Drawworks%Vt=' , Drawworks%Vt | |||
!print* , 'Drawworks%w_new=' , Drawworks%w_new | |||
!if (Drawworks%Conv_Ratio==1.d0) then | |||
! | |||
! | |||
! IF (Drawworks%motion==+1) THEN | |||
! Call Drawworks_Free_Traction_motor_Dir | |||
! if (Drawworks%w_drum_Dir<=0.) then | |||
! Drawworks%motion = 0 | |||
! else | |||
! Drawworks%motion = +1 | |||
! Call Drawworks_Free_Traction_motor | |||
! Drawworks%w = Drawworks%w_drum*Drawworks%Conv_Ratio | |||
! Drawworks%w_old = Drawworks%w_old_drum*Drawworks%Conv_Ratio | |||
! end if | |||
! ELSE | |||
! if (((Drawworks%F_fastline*(Drawworks%Diameter/2.0d0))-(((Drawworks%Diameter/2.0d0)*Drawworks%BreakLoad)*(Drawworks%ManualBreak/100.0d0)))<=0.) then | |||
! Drawworks%motion = 0 | |||
! Drawworks%w_drum = 0.0d0 | |||
! Drawworks%w_old_drum = 0.0d0 | |||
! Drawworks%w = Drawworks%w_drum*Drawworks%Conv_Ratio | |||
! Drawworks%w_old = Drawworks%w_old_drum*Drawworks%Conv_Ratio | |||
! Drawworks%Hook_Height = Drawworks%Hook_Height | |||
! | |||
! Drawworks%ia = 0. | |||
! Drawworks%ia_old = 0. | |||
! Drawworks%x = 0. | |||
! Drawworks%x_old = 0. | |||
! Drawworks%y = 0. | |||
! Drawworks%y_old = 0. | |||
! else | |||
! Drawworks%motion = -1 | |||
! Call Drawworks_Free_Traction_motor_dawn_motion | |||
! Drawworks%w = Drawworks%w_drum*Drawworks%Conv_Ratio | |||
! Drawworks%w_old = Drawworks%w_old_drum*Drawworks%Conv_Ratio | |||
! end if | |||
! | |||
! END IF | |||
! | |||
! | |||
!else | |||
! | |||
! IF (Drawworks%motion==-1) THEN | |||
! Drawworks%w = -Drawworks%w | |||
! Drawworks%w_old = -Drawworks%w_old | |||
! Drawworks%w_drum = -Drawworks%w_drum | |||
! Drawworks%w_old_drum = -Drawworks%w_old_drum | |||
! END IF | |||
! Call Drawworks_Traction_motor_ClutchMode_Dir | |||
! IF (Drawworks%w_Dir>0.d0) then | |||
! | |||
! Drawworks%motion = +1 | |||
! Call Drawworks_Traction_motor_ClutchMode | |||
! Drawworks%w_drum = Drawworks%w/Drawworks%Conv_Ratio | |||
! Drawworks%w_old_drum = Drawworks%w_old/Drawworks%Conv_Ratio | |||
! ELSE | |||
! Drawworks%EddyTorque = (1.039d5*exp(4.343d-4*(30.0d0*(Drawworks%w/Drawworks%Conv_Ratio)/pi)))+(-1.036d5*exp(-.047920d0*(30.0d0*(Drawworks%w/Drawworks%Conv_Ratio)/pi))) !Lbf.ft | |||
! if (Drawworks%EddyTorque>115000.) then | |||
! Drawworks%EddyTorque = 115000.0d0 | |||
! end if | |||
! Drawworks%EddyTorque = 1.355817948*Drawworks%EddyTorque ![N.m] | |||
! if ((Drawworks%F_fastline*(Drawworks%Diameter/2.0d0))>((((Drawworks%Diameter/2.0d0)*Drawworks%BreakLoad)*(Drawworks%ManualBreak/100.0d0))+(Drawworks%EddyTorque*(Drawworks%EddyBreak/100.0d0)))) then | |||
! Drawworks%motion = -1 | |||
! | |||
! IF (Drawworks%w_drum<0.) THEN | |||
! Drawworks%w = -Drawworks%w | |||
! Drawworks%w_old = -Drawworks%w_old | |||
! !Drawworks%w = 0. !??????????????? | |||
! !Drawworks%w_old = 0. !??????????????? | |||
! Drawworks%w_drum = -Drawworks%w_drum | |||
! Drawworks%w_old_drum = -Drawworks%w_old_drum | |||
! END IF | |||
! | |||
! Drawworks%Conv_Ratio = 1. | |||
! Call Drawworks_Free_Traction_motor_dawn_motion | |||
! Drawworks%w = Drawworks%w_drum*Drawworks%Conv_Ratio | |||
! Drawworks%w_old = Drawworks%w_old_drum*Drawworks%Conv_Ratio | |||
! !Drawworks%w_drum = Drawworks%w/Drawworks%Conv_Ratio | |||
! !Drawworks%w_old_drum = Drawworks%w_old/Drawworks%Conv_Ratio | |||
! else | |||
! Drawworks%motion = 0 | |||
! Drawworks%w_drum = 0.0d0 | |||
! Drawworks%w_old_drum = 0.0d0 | |||
! Drawworks%w = Drawworks%w_drum*Drawworks%Conv_Ratio | |||
! Drawworks%w_old = Drawworks%w_old_drum*Drawworks%Conv_Ratio | |||
! Drawworks%Hook_Height = Drawworks%Hook_Height | |||
! | |||
! Drawworks%ia = 0. | |||
! Drawworks%ia_old = 0. | |||
! Drawworks%x = 0. | |||
! Drawworks%x_old = 0. | |||
! Drawworks%y = 0. | |||
! Drawworks%y_old = 0. | |||
! end if | |||
! | |||
! END IF | |||
! | |||
!end if | |||
!Call DWBrakeSound | |||
end subroutine Drawworks_Direction |
@@ -1,86 +0,0 @@ | |||
subroutine Drawworks_Free_Traction_motor | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
REAL, allocatable, dimension(:) :: w_array | |||
Integer :: jj, kk | |||
REAL :: sigma_w | |||
!Drawworks%w_drum = Drawworks%w/Drawworks%Conv_Ratio | |||
Drawworks%time = Drawworks%time_step | |||
Drawworks%dt = 1.d-5 | |||
Drawworks%error = .001 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
Drawworks%n = Drawworks%time/Drawworks%dt | |||
if (allocated(w_array)) deallocate(w_array) | |||
allocate(w_array(0:Drawworks%n)) | |||
w_array(0) = Drawworks%w_drum | |||
Drawworks%i = 1 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
DO WHILE (Drawworks%i<=Drawworks%n) | |||
!>>>>>>>>>>>> Runge-Kutta Method (2nd order) <<<<<<<<<<<<<< | |||
call dw_freeTrac((Drawworks%i*Drawworks%dt),Drawworks%w_drum) | |||
Drawworks%K1w = Drawworks%dt*Drawworks%dw_freeTrac | |||
call dw_freeTrac((Drawworks%i*Drawworks%dt)+(Drawworks%dt),Drawworks%w_drum+(Drawworks%K1w)) | |||
Drawworks%K2w = Drawworks%dt*Drawworks%dw_freeTrac | |||
Drawworks%w_new_drum = Drawworks%w_old_drum+((Drawworks%K1w+Drawworks%K2w)/2.) | |||
Drawworks%w_old_drum = Drawworks%w_new_drum | |||
Drawworks%w_drum = Drawworks%w_new_drum | |||
w_array(Drawworks%i) = Drawworks%w_new_drum | |||
Drawworks%i = Drawworks%i+1 | |||
END DO | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
!>>>>>>>>> Hook Height Calculation <<<<<<<<<<< | |||
!>>>>>>>>>>>> Simpson1/3 Method <<<<<<<<<<<<<< | |||
sigma_w = w_array(0)+w_array(Drawworks%n) | |||
do jj = 1,Drawworks%n-1,2 | |||
sigma_w = sigma_w+(4.0d0*w_array(jj)) | |||
end do | |||
do kk = 2,Drawworks%n-2,2 | |||
sigma_w = sigma_w+(2.0d0*w_array(kk)) | |||
end do | |||
Drawworks%Hook_Height = Drawworks%Hook_Height+(((Drawworks%Diameter/2.0d0)*(Drawworks%dt*sigma_w/3.0d0))/Drawworks%NumberOfLine) | |||
END subroutine Drawworks_Free_Traction_motor |
@@ -1,61 +0,0 @@ | |||
subroutine Drawworks_Free_Traction_motor_Dir | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
Integer :: jj, kk | |||
REAL, allocatable, dimension(:) :: w_array | |||
REAL :: sigma_w | |||
!Drawworks%w_drum = Drawworks%w/Drawworks%Conv_Ratio | |||
Drawworks%time = Drawworks%time_step | |||
Drawworks%dt = 1.d-5 | |||
Drawworks%error = .001 | |||
Drawworks%w_drum_Dir = Drawworks%w_drum | |||
Drawworks%w_old_drum_Dir = Drawworks%w_old_drum | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
Drawworks%n = Drawworks%time/Drawworks%dt | |||
Drawworks%i = 1 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
DO WHILE (Drawworks%i<=Drawworks%n) | |||
!>>>>>>>>>>>> Runge-Kutta Method (2nd order) <<<<<<<<<<<<<< | |||
call dw_freeTrac((Drawworks%i*Drawworks%dt),Drawworks%w_drum_Dir) | |||
Drawworks%K1w = Drawworks%dt*Drawworks%dw_freeTrac | |||
call dw_freeTrac((Drawworks%i*Drawworks%dt)+(Drawworks%dt),Drawworks%w_drum_Dir+(Drawworks%K1w)) | |||
Drawworks%K2w = Drawworks%dt*Drawworks%dw_freeTrac | |||
Drawworks%w_new_drum_Dir = Drawworks%w_old_drum_Dir+((Drawworks%K1w+Drawworks%K2w)/2.0d0) | |||
Drawworks%w_old_drum_Dir = Drawworks%w_new_drum_Dir | |||
Drawworks%w_drum_Dir = Drawworks%w_new_drum_Dir | |||
Drawworks%i = Drawworks%i+1 | |||
END DO | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
END subroutine Drawworks_Free_Traction_motor_Dir |
@@ -1,86 +0,0 @@ | |||
subroutine Drawworks_Free_Traction_motor_dawn_motion | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
REAL, allocatable, dimension(:) :: w_array | |||
Integer :: jj, kk | |||
REAL :: sigma_w | |||
!Drawworks%w_drum = Drawworks%w/Drawworks%Conv_Ratio | |||
Drawworks%time = Drawworks%time_step | |||
Drawworks%dt = 1.d-5 | |||
Drawworks%error = .001 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
Drawworks%n = Drawworks%time/Drawworks%dt | |||
if (allocated(w_array)) deallocate(w_array) | |||
allocate(w_array(0:Drawworks%n)) | |||
w_array(0) = Drawworks%w_drum | |||
Drawworks%i = 1 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
DO WHILE (Drawworks%i<=Drawworks%n) | |||
!>>>>>>>>>>>> Runge-Kutta Method (2nd order) <<<<<<<<<<<<<< | |||
call dw_freeTrac_Dmotion((Drawworks%i*Drawworks%dt),Drawworks%w_drum) | |||
Drawworks%K1w = Drawworks%dt*Drawworks%dw_freeTrac_Dmotion | |||
call dw_freeTrac_Dmotion((Drawworks%i*Drawworks%dt)+(Drawworks%dt),Drawworks%w_drum+(Drawworks%K1w)) | |||
Drawworks%K2w = Drawworks%dt*Drawworks%dw_freeTrac_Dmotion | |||
Drawworks%w_new_drum = Drawworks%w_old_drum+((Drawworks%K1w+Drawworks%K2w)/2.) | |||
Drawworks%w_old_drum = Drawworks%w_new_drum | |||
Drawworks%w_drum = Drawworks%w_new_drum | |||
w_array(Drawworks%i) = Drawworks%w_new_drum | |||
Drawworks%i = Drawworks%i+1 | |||
END DO | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
!print* , 'Drawworksdir555=',Drawworks%F_fastline , (Drawworks%F_fastline*(Drawworks%Diameter/2.0d0)) , (Drawworks%EddyTorque*(Drawworks%EddyBreak/100.0d0)) , (((Drawworks%Diameter/2.0d0)*Drawworks%BreakLoad)*(Drawworks%ManualBreak/100.0d0)) , Drawworks%ManualBreak | |||
!>>>>>>>>> Hook Height Calculation <<<<<<<<<<< | |||
!>>>>>>>>>>>> Simpson1/3 Method <<<<<<<<<<<<<< | |||
sigma_w = w_array(0)+w_array(Drawworks%n) | |||
do jj=1,Drawworks%n-1,2 | |||
sigma_w = sigma_w+(4.0d0*w_array(jj)) | |||
end do | |||
do kk=2,Drawworks%n-2,2 | |||
sigma_w = sigma_w+(2.0d0*w_array(kk)) | |||
end do | |||
Drawworks%Hook_Height = Drawworks%Hook_Height-(((Drawworks%Diameter/2.0d0)*(Drawworks%dt*sigma_w/3.0d0))/Drawworks%NumberOfLine) | |||
!deallocate(w_array) | |||
END subroutine Drawworks_Free_Traction_motor_dawn_motion |
@@ -1,202 +1,183 @@ | |||
subroutine Drawworks_INPUTS | |||
subroutine Drawworks_Inputs | |||
Use CDrillingConsoleVariables | |||
Use CDataDisplayConsoleVariables | |||
Use CHoistingVariables | |||
! use CSimulationVariables | |||
! Use CSlipsEnumVariables | |||
Use CKellyConnectionEnumVariables | |||
Use CElevatorConnectionEnumVariables | |||
! Use COperationConditionEnumVariables | |||
Use CSimulationVariables | |||
Use COperationScenariosVariables | |||
! Use CSwingEnumVariables | |||
Use CUnityInputs | |||
Use CTdsConnectionModesEnumVariables | |||
Use CTdsElevatorModesEnumVariables | |||
! Use CTdsSwingEnumVariables | |||
use UnitySignalVariables | |||
Use CWarningsVariables | |||
Use VARIABLES | |||
Use Drawworks_VARIABLES | |||
Use TD_StringConnectionData | |||
Use TD_DrillStemComponents | |||
Use TD_GeneralData | |||
Use TD_WellGeometry | |||
IMPLICIT NONE | |||
Call DWMalfunction_ClutchEngage | |||
Drawworks%AssignmentSwitch = DrillingConsole%AssignmentSwitch | |||
Drawworks%Switch = DrillingConsole%DWSwitch | |||
Drawworks%Throttle = DrillingConsole%DWThrottle ![RPM] | |||
Drawworks%DriveType = Hoisting%DriveType | |||
Drawworks%ShearBopSituation = RamLine%ShearBop_Situation_forTD | |||
!Drawworks%MotorFaileMalf = ?????? motaghayere voroudi !dar CHoistingProblemsVariables meghdardehi mishavad | |||
Drawworks%TransMode = DrillingConsole%DWTransmisionLever | |||
Drawworks%Direction_Var = DrillingConsole%DWSwitch | |||
!>>> RAM & ToolJoint Collision | |||
Drawworks%TDBOPElementNo = TD_BOP%BOPElementNo | |||
Drawworks%TDBOPHeight = TD_BOP%BOPHeight | |||
Drawworks%TDBOPRamDiam = TD_BOP%BOPRamDiam | |||
Drawworks%TDBOPThickness = TD_BOP%BOPThickness | |||
Drawworks%TDDrillStemBottom = TD_String%DrillStemBottom | |||
Drawworks%TDWellTotalLength = TD_WellGeneral%WellTotalLength | |||
Drawworks%TDDlMax = TD_String%DlMax | |||
Drawworks%TDDrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs | |||
if (Allocated(Drawworks%TDDrillStemsDownDepth)) deAllocate (Drawworks%TDDrillStemsDownDepth) ! inja gozashtameshun cho momkene tuye startup tedade elemanha dir berese va error bede | |||
Allocate (Drawworks%TDDrillStemsDownDepth(Drawworks%TDDrillStemComponentsNumbs+400)) ! +400: because of: Add or Remove DrillStem Components | |||
Drawworks%TDDrillStemsDownDepth = TD_DrillStems%DownDepth | |||
if (Allocated(Drawworks%TDDrillStemsToolJointRange)) deAllocate (Drawworks%TDDrillStemsToolJointRange) | |||
Allocate (Drawworks%TDDrillStemsToolJointRange(Drawworks%TDDrillStemComponentsNumbs+400)) ! +400: because of: Add or Remove DrillStem Components | |||
Drawworks%TDDrillStemsToolJointRange = TD_DrillStems%ToolJointRange | |||
if (Allocated(Drawworks%TDDrillStemsTopDepth)) deAllocate (Drawworks%TDDrillStemsTopDepth) | |||
Allocate (Drawworks%TDDrillStemsTopDepth(Drawworks%TDDrillStemComponentsNumbs+400)) ! +400: because of: Add or Remove DrillStem Components | |||
Drawworks%TDDrillStemsTopDepth = TD_DrillStems%TopDepth | |||
if (Allocated(Drawworks%TDDrillStemsRtoolJoint)) deAllocate (Drawworks%TDDrillStemsRtoolJoint) | |||
Allocate (Drawworks%TDDrillStemsRtoolJoint(Drawworks%TDDrillStemComponentsNumbs+400)) ! +400: because of: Add or Remove DrillStem Components | |||
Drawworks%TDDrillStemsRtoolJoint = TD_DrillStems%RtoolJoint | |||
! if (IsPortable) then | |||
! if (Drawworks%Direction_Var==-1 .and. DataDisplayConsole%Clutch==1) then !in FWD mode | |||
! Drawworks%Conv_Ratio = Drawworks%FWD_Conv_Ratio(Drawworks%ClutchMode,Drawworks%TransMode) | |||
! else | |||
! Drawworks%Conv_Ratio = 1.d0 | |||
! end if | |||
! else | |||
if (Drawworks%Direction_Var==-1) then !in FWD mode | |||
Drawworks%Conv_Ratio = Drawworks%FWD_Conv_Ratio(Drawworks%ClutchMode,Drawworks%TransMode) | |||
else if (Drawworks%Direction_Var==+1) then !in REV mode | |||
Drawworks%Conv_Ratio = 1.d0 | |||
else if (Drawworks%Direction_Var==0) then !in OFF mode | |||
Drawworks%Conv_Ratio = 1.d0 | |||
end if | |||
! end if | |||
!===> Main Brake and Eddy Brake | |||
Drawworks%EddyBreak = DrillingConsole%EddyBreakLever*0.5 !0<EddyBreakLever<100 *0.5= 50% of EddyBreakLever | |||
Drawworks%BrakeLeverCoefficient = DrillingConsole%BrakeLeverCoefficient !0<BrakeLeverCoefficient<100 | |||
if ( Drawworks%BrakeLeverCoefficient<10.d0 ) then | |||
Drawworks%BrakeLeverCoefficient = 10.d0 | |||
end if | |||
Drawworks%ManualBreak = 100.d0-((100.d0-DrillingConsole%DWBreak)*(100.d0/Drawworks%BrakeLeverCoefficient)) !0<DWBrake<100 20 | |||
if ( Drawworks%ManualBreak<0.d0 ) then | |||
Drawworks%ManualBreak = 0.d0 | |||
end if | |||
! if ( IsPortable .and. DrillingConsole%ParkingBrakeBtn==1 ) then | |||
! Drawworks%ManualBreak = 100.d0 | |||
! DrillingConsole%ParkingBrakeLed = 1 | |||
! else | |||
DrillingConsole%ParkingBrakeLed = 0 | |||
! end if | |||
!>>> Warnings | |||
Drawworks%CrownCollision = CrownCollision | |||
Drawworks%FloorCollision = FloorCollision | |||
!===> Brake Load (Main Brake) | |||
Drawworks%BreakLoad = Hoisting%DrillingLineBreakingLoad ![Lbf] | |||
Drawworks%BreakLoad = 4.448221619*Drawworks%BreakLoad ![N] | |||
Drawworks%Conv_Ratio = 1.0d0/.380d0 !che meghdari bashad?????????????????? !Drawworks%FWD_Conv_Ratio(Drawworks%ClutchMode,Drawworks%TransMode) | |||
!===> F_fastline | |||
Drawworks%F_fastline = real(TD_DrawworksLoadInput) ![Lbf] | |||
Drawworks%F_fastline = 4.448221619*Drawworks%F_fastline ![N] | |||
DrillingConsole%ParkingBrakeLed = 0 | |||
!===> min&max Hook Height | |||
if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL ) then | |||
if ( Drawworks%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL ) then | |||
if ( Get_Swing()==SWING_WELL_END .and. Get_KellyConnection()==KELLY_CONNECTION_NOTHING ) then | |||
DW_DrillModeCond = 1 | |||
Drawworks%min_Hook_Height = TD_TopJointHeight+OperationScenario%HKL-OperationScenario%RE ![ft] HKL=63.76=Kelly Ass. Height , RE=Release | |||
Drawworks%DrillModeCond = 1 | |||
Drawworks%min_Hook_Height = TD_String%TopJointHeight+OperationScenario%HKL-OperationScenario%RE ![ft] HKL=63.76=Kelly Ass. Height , RE=Release | |||
Drawworks%max_Hook_Height = 120.d0 ![ft] | |||
else if ( Get_Swing()==SWING_WELL_END .and. Get_KellyConnection()==KELLY_CONNECTION_SINGLE ) then | |||
DW_DrillModeCond = 2 | |||
Drawworks%min_Hook_Height = TD_TopJointHeight+OperationScenario%HKL+OperationScenario%PL-OperationScenario%RE ![ft] PL=30=Pipe Lenght | |||
Drawworks%DrillModeCond = 2 | |||
Drawworks%min_Hook_Height = TD_String%TopJointHeight+OperationScenario%HKL+OperationScenario%PL-OperationScenario%RE ![ft] PL=30=Pipe Lenght | |||
Drawworks%max_Hook_Height = 120.d0 ![ft] | |||
else if ( Get_Swing()==SWING_WELL_END .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then | |||
DW_DrillModeCond = 3 | |||
Drawworks%min_Hook_Height = 21.44d0-OperationScenario%RE ![ft] ?????????? check 21.44=(TD_KellyConst-TD_KellyElementConst) | |||
Drawworks%DrillModeCond = 3 | |||
Drawworks%min_Hook_Height = 21.44d0-OperationScenario%RE ![ft] ?????????? check 21.44=(TD_StConn%KellyConst-TD_StConn%KellyElementConst) | |||
Drawworks%max_Hook_Height = 120.d0 ![ft] | |||
else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_KellyConnection()==KELLY_CONNECTION_NOTHING ) then | |||
DW_DrillModeCond = 4 | |||
Drawworks%min_Hook_Height = 66.d0-OperationScenario%RE ![ft] | |||
Drawworks%DrillModeCond = 4 | |||
Drawworks%min_Hook_Height = 66.d0-OperationScenario%RE ![ft] | |||
Drawworks%max_Hook_Height = 120.d0 ![ft] | |||
else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_KellyConnection()==KELLY_CONNECTION_SINGLE ) then | |||
DW_DrillModeCond = 5 | |||
Drawworks%min_Hook_Height = 65.1d0-OperationScenario%RE ![ft] | |||
Drawworks%DrillModeCond = 5 | |||
Drawworks%min_Hook_Height = 65.1d0-OperationScenario%RE ![ft] | |||
Drawworks%max_Hook_Height = 120.d0 ![ft] | |||
else if ( Get_Swing()==SWING_RAT_HOLE_END ) then | |||
DW_DrillModeCond = 6 | |||
Drawworks%min_Hook_Height = 66.d0-OperationScenario%RE ![ft] | |||
Drawworks%DrillModeCond = 6 | |||
Drawworks%min_Hook_Height = 66.d0-OperationScenario%RE ![ft] | |||
Drawworks%max_Hook_Height = 120.d0 ![ft] | |||
end if | |||
else if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_TRIP ) then | |||
else if ( Drawworks%DriveType==1 .and. Get_OperationCondition()==OPERATION_TRIP ) then | |||
if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING ) then | |||
DW_DrillModeCond = 7 | |||
Drawworks%DrillModeCond = 7 | |||
Drawworks%min_Hook_Height = 18.38d0 ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND ) then | |||
DW_DrillModeCond = 8 | |||
Drawworks%min_Hook_Height = TD_TopJointHeight+OperationScenario%HL+OperationScenario%SL-(3.d0*OperationScenario%RE) ![ft] HL=17.81=Hook Assy , SL=90=Stand Length , 3: chon meghdari az toole loole(tool joint) dakhele elevator gharar migirad | |||
Drawworks%DrillModeCond = 8 | |||
Drawworks%min_Hook_Height = TD_String%TopJointHeight+OperationScenario%HL+OperationScenario%SL-(3.d0*OperationScenario%RE) ![ft] HL=17.81=Hook Assy , SL=90=Stand Length , 3: chon meghdari az toole loole(tool joint) dakhele elevator gharar migirad | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE ) then | |||
DW_DrillModeCond = 9 | |||
Drawworks%min_Hook_Height = TD_TopJointHeight+OperationScenario%HL+OperationScenario%PL-(3.d0*OperationScenario%RE) ![ft] 3: chon meghdari az toole loole(tool joint) balaye elevator mimanad | |||
Drawworks%DrillModeCond = 9 | |||
Drawworks%min_Hook_Height = TD_String%TopJointHeight+OperationScenario%HL+OperationScenario%PL-(3.d0*OperationScenario%RE) ![ft] 3: chon meghdari az toole loole(tool joint) balaye elevator mimanad | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING ) then | |||
DW_DrillModeCond = 10 | |||
Drawworks%min_Hook_Height = 18.5d0-OperationScenario%RE ![ft] | |||
Drawworks%DrillModeCond = 10 | |||
Drawworks%min_Hook_Height = 18.5d0-OperationScenario%RE ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING ) then | |||
DW_DrillModeCond = 11 | |||
Drawworks%min_Hook_Height = 19.38d0-OperationScenario%RE ![ft] | |||
Drawworks%DrillModeCond = 11 | |||
Drawworks%min_Hook_Height = 19.38d0-OperationScenario%RE ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE ) then | |||
DW_DrillModeCond = 12 | |||
Drawworks%min_Hook_Height = 17.73d0-OperationScenario%RE ![ft] | |||
Drawworks%DrillModeCond = 12 | |||
Drawworks%min_Hook_Height = 17.73d0-OperationScenario%RE ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_Swing()==SWING_RAT_HOLE_END ) then | |||
DW_DrillModeCond = 13 | |||
Drawworks%min_Hook_Height = 27.41d0-OperationScenario%RE ![ft] | |||
Drawworks%DrillModeCond = 13 | |||
Drawworks%min_Hook_Height = 27.41d0-OperationScenario%RE ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING ) then | |||
DW_DrillModeCond = 14 | |||
Drawworks%DrillModeCond = 14 | |||
Drawworks%min_Hook_Height = 18.38d0 ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE ) then | |||
DW_DrillModeCond = 25 !warning & collision | |||
Drawworks%min_Hook_Height = 18.38d0 !????????????????? ![ft] | |||
Drawworks%DrillModeCond = 25 !warning & collision | |||
Drawworks%min_Hook_Height = 18.38d0 !????????????????? ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_Swing()==SWING_MOUSE_HOLE_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE ) then | |||
DW_DrillModeCond = 26 | |||
Drawworks%min_Hook_Height = 10.38d0 !????????????????? ![ft] | |||
Drawworks%DrillModeCond = 26 | |||
Drawworks%min_Hook_Height = 10.38d0 !????????????????? ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_Swing()==SWING_WELL_END .and. Get_ElevatorConnection() == ELEVATOR_LATCH_STAND ) then | |||
DW_DrillModeCond = 27 | |||
Drawworks%min_Hook_Height = 18.38d0 !????????????????? ![ft] | |||
Drawworks%DrillModeCond = 27 | |||
Drawworks%min_Hook_Height = 18.38d0 !????????????????? ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
end if | |||
else if ( Hoisting%DriveType==0 ) then | |||
else if ( Drawworks%DriveType==0 ) then | |||
if ( Get_TdsSwing()==TDS_SWING_TILT_END ) then | |||
if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_SINGLE ) then | |||
DW_DrillModeCond = 15 | |||
Drawworks%DrillModeCond = 15 | |||
Drawworks%min_Hook_Height = 15.0d0 ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_SINGLE ) then | |||
DW_DrillModeCond = 16 | |||
Drawworks%DrillModeCond = 16 | |||
Drawworks%min_Hook_Height = 15.0d0 ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then | |||
DW_DrillModeCond = 17 | |||
Drawworks%DrillModeCond = 17 | |||
Drawworks%min_Hook_Height = 15.0d0 ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
end if | |||
else if ( Get_TdsSwing()==TDS_SWING_OFF_END ) then | |||
if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STRING ) then | |||
DW_DrillModeCond = 18 | |||
Drawworks%min_Hook_Height = max(16.0d0,TD_TopJointHeight) ![ft] | |||
Drawworks%DrillModeCond = 18 | |||
Drawworks%min_Hook_Height = max(16.0d0,TD_String%TopJointHeight) ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING ) then | |||
DW_DrillModeCond = 19 | |||
Drawworks%min_Hook_Height = TD_TopJointHeight ![ft] | |||
Drawworks%DrillModeCond = 19 | |||
Drawworks%min_Hook_Height = TD_String%TopJointHeight ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then | |||
DW_DrillModeCond = 20 | |||
Drawworks%min_Hook_Height = TD_TopJointHeight ![ft] | |||
Drawworks%DrillModeCond = 20 | |||
Drawworks%min_Hook_Height = TD_String%TopJointHeight ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then | |||
DW_DrillModeCond = 21 | |||
Drawworks%min_Hook_Height = max(16.0d0,TD_TopJointHeight) ![ft] | |||
Drawworks%DrillModeCond = 21 | |||
Drawworks%min_Hook_Height = max(16.0d0,TD_String%TopJointHeight) ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STAND ) then | |||
DW_DrillModeCond = 22 | |||
Drawworks%min_Hook_Height = max(16.0d0,TD_TopJointHeight) ![ft] | |||
Drawworks%DrillModeCond = 22 | |||
Drawworks%min_Hook_Height = max(16.0d0,TD_String%TopJointHeight) ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STAND ) then | |||
DW_DrillModeCond = 23 | |||
Drawworks%min_Hook_Height = max(16.0d0,TD_TopJointHeight) ![ft] | |||
Drawworks%DrillModeCond = 23 | |||
Drawworks%min_Hook_Height = max(16.0d0,TD_String%TopJointHeight) ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then | |||
DW_DrillModeCond = 24 | |||
Drawworks%min_Hook_Height = TD_TopJointHeight ![ft] | |||
Drawworks%DrillModeCond = 24 | |||
Drawworks%min_Hook_Height = TD_String%TopJointHeight ![ft] | |||
Drawworks%max_Hook_Height = 140.d0 ![ft] | |||
end if | |||
end if | |||
@@ -204,38 +185,23 @@ subroutine Drawworks_INPUTS | |||
!print* , 'DW_DrillModeCond=' , DW_DrillModeCond | |||
!!print* , 'Drawworks%min_Hook_Height=' , Drawworks%min_Hook_Height | |||
!!print* , 'Drawworks%max_Hook_Height=' , Drawworks%max_Hook_Height | |||
!print* , 'Drawworks%Hook_Height_final=' , Drawworks%Hook_Height_final | |||
!print*, 'TD_DrillStemComponentsNumbs2=' , TD_DrillStemComponentsNumbs | |||
!print*, 'TD_TopJointHeight2=' , TD_TopJointHeight | |||
!print*, 'TD_DrillStemTotalLength2=', TD_DrillStemTotalLength | |||
!===> SLIPS SET , No Motion | |||
if ( Hoisting%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then | |||
Drawworks%ManualBreak = 100.d0 | |||
Drawworks%N_ref = 0.d0 | |||
if ( Drawworks%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then | |||
Drawworks%Speed = 0.d0 | |||
end if | |||
if ( Drawworks%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_SPINE .or. Get_TdsConnectionModes()==TDS_CONNECTION_STRING) ) then | |||
Drawworks%Speed = 0.d0 | |||
end if | |||
if ( Hoisting%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_SPINE .or. Get_TdsConnectionModes()==TDS_CONNECTION_STRING) ) then | |||
Drawworks%ManualBreak = 100.d0 | |||
Drawworks%N_ref = 0.d0 | |||
end if | |||
!===> Closed BOP Rams , No Motion | |||
!if ( PipeRam1_Situation_forTD==1 .or. PipeRam2_Situation_forTD==1 .or. ShearBop_Situation_forTD==1 ) then | |||
if ( RamLine%ShearBop_Situation_forTD==1 .and. (any(DW_DrillModeCond==(/3,10,19,20,24/))) ) then | |||
Drawworks%ManualBreak = 100.d0 | |||
Drawworks%N_ref = 0.d0 | |||
if ( Drawworks%ShearBopSituation==1 .and. (any(Drawworks%DrillModeCond==(/3,10,19,20,24/))) ) then | |||
Drawworks%Speed = 0.d0 | |||
end if | |||
end subroutine Drawworks_INPUTS | |||
end subroutine Drawworks_Inputs |
@@ -0,0 +1,62 @@ | |||
subroutine Drawworks_MainSolver | |||
Use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
Call Drawworks_Inputs | |||
if (Drawworks%Throttle<=0.d0) then | |||
Drawworks%K_Throttle = 1 | |||
end if | |||
if((any(Drawworks%AssignmentSwitch==(/1,2,3,4,5,7,8,9,10,11/))) .and. (Drawworks%Switch==-1 .or. Drawworks%Switch==1) .and. (Drawworks%CrownCollision==.false. .and. Drawworks%FloorCollision==.false.) .and. (Drawworks%K_Throttle==1)) then | |||
Drawworks%SoundBlower = .true. | |||
Drawworks%BLWR = 1 | |||
Call Drawworks_Solver | |||
if ( Drawworks%motion==+1 ) then | |||
Drawworks%SoundRev = 0 ![rpm or rad/s????????????????] , Integer | |||
Drawworks%SoundFw = INT(Drawworks%w_drum) ![rpm] , Integer | |||
else | |||
Drawworks%SoundFw = 0 ![rpm] , Integer | |||
Drawworks%SoundRev = INT(Drawworks%w_drum) ![rpm] , Integer | |||
end if | |||
else | |||
if((any(Drawworks%AssignmentSwitch==(/1,2,3,4,5,7,8,9,10,11/))) .and. (Drawworks%Switch==-1 .or. Drawworks%Switch==1)) then | |||
Drawworks%SoundBlower = .true. | |||
Drawworks%BLWR = 1 | |||
else | |||
Drawworks%SoundBlower = .false. | |||
Drawworks%BLWR = 0 | |||
end if | |||
Call Drawworks_Solver_OffMode | |||
if ( Drawworks%motion==+1 ) then | |||
Drawworks%SoundRev = 0 ![rpm] , Integer | |||
Drawworks%SoundFw = INT(Drawworks%w_drum) ![rpm] , Integer | |||
else | |||
Drawworks%SoundFw = 0 ![rpm] , Integer | |||
Drawworks%SoundRev = INT(Drawworks%w_drum) ![rpm] , Integer | |||
end if | |||
Drawworks%K_Throttle = 0 | |||
end if | |||
Call Drawworks_Outputs | |||
Drawworks%N_old = Drawworks%Speed | |||
end subroutine Drawworks_MainSolver |
@@ -0,0 +1,37 @@ | |||
subroutine Drawworks_Outputs | |||
Use CSounds | |||
Use CHookVariables | |||
Use CWarningsVariables | |||
Use Drawworks_VARIABLES | |||
Use CDrillingConsoleVariables | |||
IMPLICIT NONE | |||
DrillingConsole%DWBLWR = Drawworks%BLWR | |||
Call SetSoundBlowerDW( Drawworks%SoundBlower ) !.true. or .false. | |||
Call SetSoundDwRev( Drawworks%SoundRev ) ![rpm] ??? or rad/s, Integer | |||
Call SetSoundDwFw( Drawworks%SoundFw ) ![rpm] , Integer | |||
Call SetSoundCrownCollision( Drawworks%SoundCrownCollision ) !.true. or .false. | |||
Call SetSoundFloorCollision( Drawworks%SoundFloorCollision ) !.true. or .false. | |||
if (Drawworks%CrownCollision==1) then | |||
Call Activate_CrownCollision() | |||
end if | |||
if (Drawworks%FloorCollision==1) then | |||
Call Activate_FloorCollision() | |||
end if | |||
Call Set_HookHeight( real(Drawworks%Hook_Height_final) ) ![ft] | |||
Drawworks%TDHookHeight = Drawworks%Hook_Height_final ![ft] | |||
!!Drawworks%HookHeight_graph_output | |||
!DrillingConsole%ParkingBrakeLed = 0 ! in Drawworks_Inputs | |||
end subroutine Drawworks_Outputs |
@@ -1,148 +1,99 @@ | |||
subroutine Drawworks_Solver | |||
Use CDrillingConsoleVariables | |||
Use CDataDisplayConsoleVariables | |||
Use CHoistingVariables | |||
Use CUnityInputs | |||
Use UnitySignalVariables | |||
Use Drawworks_VARIABLES | |||
Use CHookVariables | |||
Use CWarningsVariables | |||
use UnitySignalVariables | |||
! Use COperationConditionEnumVariables | |||
! Use CSlipsEnumVariables | |||
Use COperationScenariosVariables, only: Get_ElevatorConnection | |||
Use CKellyConnectionEnumVariables | |||
Use CElevatorConnectionEnumVariables | |||
Use CTdsConnectionModesEnumVariables | |||
Use CTdsElevatorModesEnumVariables | |||
Use TD_DrillStemComponents | |||
Use TD_WellGeometry | |||
Use CWarningsVariables | |||
Use TD_GeneralData | |||
Use CSounds | |||
Use COperationScenariosVariables | |||
IMPLICIT NONE | |||
Integer :: j | |||
Integer :: CrownCollision_Status , FloorCollision_Status , CrownWarning_Status , FloorWarning_Status | |||
real :: time | |||
!>>>>>>>>>>>>>>>>>>>> N_Ref <<<<<<<<<<<<<<<<<<<<<<<< | |||
!>>>>>>>>>>>>>>>>>>>> Speed <<<<<<<<<<<<<<<<<<<<<<<< | |||
Drawworks%N_Throtle = DrillingConsole%DWThrottle ![rpm] | |||
Drawworks%N_Accelarator = (DrillingConsole%DWAcceleretor/100.0)*965.0 ![rpm] | |||
!print* , 'Drawworks%N_Throtle=' , Drawworks%N_Throtle | |||
!print* , 'DWAcceleretor=' , DWAcceleretor | |||
!print* , 'Drawworks%N_Accelarator=' , Drawworks%N_Accelarator | |||
IF (Drawworks%N_Throtle>Drawworks%N_Accelarator) THEN | |||
Drawworks%N_Throtle = Drawworks%Throttle ![rpm] | |||
!Drawworks%N_Accelarator = (Drawworks%Acceleretor/100.d0)*965.d0 ![rpm] | |||
!IF (Drawworks%N_Throtle>Drawworks%N_Accelarator) THEN | |||
Drawworks%N_new = Drawworks%N_Throtle | |||
!print* , 'Drawworks%N_Throtle' | |||
ELSE | |||
Drawworks%N_new = Drawworks%N_Accelarator | |||
!print* , 'Drawworks%N_Accelarator' | |||
END IF | |||
if (((Drawworks%N_new-Drawworks%N_old)/Drawworks%time_step)>193.) then | |||
Drawworks%N_ref = (193.*Drawworks%time_step)+Drawworks%N_old | |||
else if (((Drawworks%N_old-Drawworks%N_new)/Drawworks%time_step)>193.) then | |||
Drawworks%N_ref = (-193.*Drawworks%time_step)+Drawworks%N_old | |||
!ELSE | |||
! Drawworks%N_new = Drawworks%N_Accelarator | |||
!END IF | |||
!========================== Drawworks Rate limit ========================== | |||
if (((Drawworks%N_new-Drawworks%N_old)/Drawworks%time_step)>Drawworks%RateChange) then | |||
Drawworks%Speed =(Drawworks%RateChange*Drawworks%time_step)+Drawworks%N_old ![rpm] | |||
else if (((Drawworks%N_old-Drawworks%N_new)/Drawworks%time_step)>Drawworks%RateChange) then | |||
Drawworks%Speed = (-Drawworks%RateChange*Drawworks%time_step)+Drawworks%N_old | |||
else | |||
Drawworks%N_ref = Drawworks%N_new | |||
Drawworks%Speed = Drawworks%N_new | |||
end if | |||
Drawworks%N_old = Drawworks%N_ref | |||
!print* , 'Drawworks%N_ref=' , Drawworks%N_ref | |||
Call Drawworks_INPUTS | |||
! Drawworks Malfunction ----> Drive Motor Failure | |||
Call DWMalfunction_MotorFailure | |||
!======================================================================= | |||
!=====> Drawworks Gears Abuse | |||
if ( DW_OldTransMode==0 .and. Drawworks%TransMode/=0 .and. Drawworks%w_drum/=0. .and. Drawworks%ClutchMode/=0 ) then | |||
Call Activate_DrawworksGearsAbuse() | |||
Drawworks%SoundGearCrash = .true. | |||
Call SetSoundDwGearCrash(Drawworks%SoundGearCrash) | |||
Drawworks%ManualBreak = 100. | |||
!Drawworks%N_ref = 0. | |||
Call DWFixModeMotion | |||
Drawworks%SoundRev = INT(Drawworks%w_drum) ![rpm] , Integer | |||
Call SetSoundDwRev( Drawworks%SoundRev ) | |||
return | |||
else | |||
Drawworks%SoundGearCrash = .false. | |||
Call SetSoundDwGearCrash(Drawworks%SoundGearCrash) | |||
!========================== Speed Correction ========================== | |||
!===> SLIPS SET , No Motion | |||
if ( Drawworks%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then | |||
Drawworks%Speed = 0.d0 | |||
end if | |||
if ( DrawworksGearsAbuse==1 ) then | |||
return | |||
if ( Drawworks%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_SPINE .or. Get_TdsConnectionModes()==TDS_CONNECTION_STRING) ) then | |||
Drawworks%Speed = 0.d0 | |||
end if | |||
!===> Closed BOP Rams , No Motion | |||
if ( Drawworks%ShearBopSituation==1 .and. (any(Drawworks%DrillModeCond==(/3,10,19,20,24/))) ) then | |||
Drawworks%Speed = 0.d0 | |||
end if | |||
!======================================================================= | |||
Call Drawworks_Direction | |||
!==================================================== | |||
! Collision & Warning | |||
!==================================================== | |||
if ( CrownCollision == .false. ) then | |||
CrownCollision_Status = 0 | |||
end if | |||
if ( FloorCollision == .false. ) then | |||
FloorCollision_Status = 0 | |||
end if | |||
!if ( CrownWarning == .false. ) then | |||
! CrownWarning_Status = 0 | |||
!end if | |||
!if ( FloorWarning == .false. ) then | |||
! FloorWarning_Status = 0 | |||
!end if | |||
if ( Drawworks%CrownCollision == .false. ) then | |||
CrownCollision_Status = 0 | |||
end if | |||
if ( Drawworks%FloorCollision == .false. ) then | |||
FloorCollision_Status = 0 | |||
end if | |||
!==================================================== | |||
! Crown Collision (Max_Hook_Height) | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)>=Drawworks%max_Hook_Height) .and. (any(DW_DrillModeCond==(/3,4,7,10,11,12,14/))) ) then | |||
if ( CrownCollision_Status==0 .and. Drawworks%motion==1 ) then | |||
Call Activate_CrownCollision() | |||
CrownCollision_Status = 1 | |||
Drawworks%SoundCrownCollision = .true. | |||
Call SetSoundCrownCollision(Drawworks%SoundCrownCollision) | |||
else | |||
Drawworks%SoundCrownCollision = .false. | |||
Call SetSoundCrownCollision(Drawworks%SoundCrownCollision) | |||
end if | |||
do While ( CrownCollision==1 ) | |||
Call DWFixModeMotion | |||
end do | |||
if ( Drawworks%motion==-1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!==================================================== | |||
! Crown Collision (Max_Hook_Height) | |||
!==================================================== | |||
if ( ((3.280839895d0*Drawworks%Hook_Height)>=Drawworks%max_Hook_Height) .and. (any(Drawworks%DrillModeCond==(/3,4,7,10,11,12,14/))) ) then | |||
if ( CrownCollision_Status==0 .and. Drawworks%motion==1 ) then | |||
CrownCollision_Status = 1 | |||
Drawworks%CrownCollision = .true. | |||
Drawworks%SoundCrownCollision = .true. | |||
else | |||
Drawworks%SoundCrownCollision = .false. | |||
end if | |||
if ( Drawworks%motion==-1 .and. Drawworks%CrownCollision==.false. ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
@@ -150,30 +101,24 @@ subroutine Drawworks_Solver | |||
!==================================================== | |||
! Floor Collision (Min_Hook_Height) | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)<=Drawworks%min_Hook_Height) .and. (any(DW_DrillModeCond==(/3,4,7,10,11,12,14/))) ) then | |||
if ( FloorCollision_Status==0 .and. Drawworks%motion==-1 ) then | |||
Call Activate_FloorCollision() | |||
Drawworks%SoundFloorCollision = .true. | |||
Call SetSoundFloorCollision(Drawworks%SoundFloorCollision) | |||
FloorCollision_Status = 1 | |||
else | |||
Drawworks%SoundFloorCollision = .false. | |||
Call SetSoundFloorCollision(Drawworks%SoundFloorCollision) | |||
end if | |||
Do While ( FloorCollision ==1 ) | |||
Call DWFixModeMotion | |||
End Do | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!==================================================== | |||
! Floor Collision (Min_Hook_Height) | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)<=Drawworks%min_Hook_Height) .and. (any(Drawworks%DrillModeCond==(/3,4,7,10,11,12,14/))) ) then | |||
if ( FloorCollision_Status==0 .and. Drawworks%motion==-1 ) then | |||
FloorCollision_Status = 1 | |||
Drawworks%FloorCollision = .true. | |||
Drawworks%SoundFloorCollision = .true. | |||
else | |||
Drawworks%SoundFloorCollision = .false. | |||
end if | |||
if ( Drawworks%motion==1 .and. Drawworks%FloorCollision==.false. ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
@@ -182,27 +127,17 @@ subroutine Drawworks_Solver | |||
!==================================================== | |||
! Crown Warning | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)>=Drawworks%max_Hook_Height) .and. (any(DW_DrillModeCond==(/1,2,5,6,8,9,13/))) ) then | |||
!if ( crownwarning_Status==0 .and. Drawworks%motion==1 ) then ?????????? | |||
! Call Activate_crownwarning() ?????????? | |||
!Drawworks%SoundCrownCollision = .true. | |||
!Call SetSoundCrownCollision(Drawworks%SoundCrownCollision) | |||
! CrownWarning_Status = 1 ?????????? | |||
!else | |||
! Drawworks%SoundCrownCollision = .false. | |||
!Call SetSoundCrownCollision(Drawworks%SoundCrownCollision) | |||
!end if ?????????? | |||
if ( Drawworks%motion==-1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!==================================================== | |||
! Crown Warning | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)>=Drawworks%max_Hook_Height) .and. (any(Drawworks%DrillModeCond==(/1,2,5,6,8,9,13/))) ) then | |||
if ( Drawworks%motion==-1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
@@ -210,27 +145,17 @@ subroutine Drawworks_Solver | |||
!==================================================== | |||
! Floor Warning | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)<=Drawworks%min_Hook_Height) .and. (any(DW_DrillModeCond==(/1,2,5,6,8,9,13/))) ) then | |||
!if ( floorwarning_Status==0 .and. Drawworks%motion==-1 ) then ?????????? | |||
! Call Activate_floorwarning() ?????????? | |||
!Drawworks%SoundCrownCollision = .true. | |||
!Call SetSoundCrownCollision(Drawworks%SoundCrownCollision) | |||
! floorwarning_Status = 1 ?????????? | |||
!else | |||
!Drawworks%SoundCrownCollision = .false. | |||
!Call SetSoundCrownCollision(Drawworks%SoundCrownCollision) | |||
!end if ?????????? | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!==================================================== | |||
! Floor Warning | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)<=Drawworks%min_Hook_Height) .and. (any(Drawworks%DrillModeCond==(/1,2,5,6,8,9,13/))) ) then | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
@@ -241,22 +166,18 @@ subroutine Drawworks_Solver | |||
!==================================================== | |||
! ELEVATOR CONNECTION STRING (SLIPS SET , No Motion) | |||
!==================================================== | |||
if ( Hoisting%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and. Drawworks%motion/=-1 ) then | |||
!if ( Drawworks%motion/=-1 ) then | |||
Call DWFixModeMotion | |||
return | |||
!end if | |||
end if | |||
!==================================================== | |||
! ELEVATOR CONNECTION STRING (SLIPS SET , No Motion) | |||
!==================================================== | |||
if ( Drawworks%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and. Drawworks%motion/=-1 ) then | |||
Call DWFixModeMotion | |||
return | |||
end if | |||
if ( Hoisting%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING) .and. Drawworks%motion/=-1 ) then | |||
!if ( Drawworks%motion/=-1 ) then | |||
Call DWFixModeMotion | |||
return | |||
!end if | |||
end if | |||
if ( Drawworks%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING) .and. Drawworks%motion/=-1 ) then | |||
Call DWFixModeMotion | |||
return | |||
end if | |||
@@ -268,22 +189,21 @@ subroutine Drawworks_Solver | |||
!==================================================== | |||
! RAM & ToolJoint Collision (Top of RAM) | |||
!==================================================== | |||
Do j = 2,4 !startup problem ??????? | |||
if ( TD_BOPElementNo(j)/=0 ) then | |||
if ( ((TD_BOPHeight(j)-TD_BOPThickness)<=(TD_DrillStems(TD_BOPElementNo(j))%TopDepth+TD_DrillStems(TD_BOPElementNo(j))%ToolJointRange)) .and. ((TD_BOPHeight(j)-TD_BOPThickness)>TD_DrillStems(TD_BOPElementNo(j))%TopDepth) .and. (TD_BOPRamDiam(j)<(2.d0*12.d0*TD_DrillStems(TD_BOPElementNo(j))%RtoolJoint)) ) then | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
!==================================================== | |||
! RAM & ToolJoint Collision (Top of RAM) | |||
!==================================================== | |||
Do j = 2,4 !startup problem ??????? | |||
if ( Drawworks%TDBOPElementNo(j)/=0 ) then | |||
if ( ((Drawworks%TDBOPHeight(j)-Drawworks%TDBOPThickness)<=(Drawworks%TDDrillStemsTopDepth(Drawworks%TDBOPElementNo(j))+Drawworks%TDDrillStemsToolJointRange(Drawworks%TDBOPElementNo(j)))) .and. ((Drawworks%TDBOPHeight(j)-Drawworks%TDBOPThickness)>Drawworks%TDDrillStemsTopDepth(Drawworks%TDBOPElementNo(j))) .and. (Drawworks%TDBOPRamDiam(j)<(2.d0*12.d0*Drawworks%TDDrillStemsRtoolJoint(Drawworks%TDBOPElementNo(j)))) ) then | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
end if | |||
End Do | |||
end if | |||
return | |||
end if | |||
end if | |||
End Do | |||
@@ -293,22 +213,21 @@ subroutine Drawworks_Solver | |||
!==================================================== | |||
! RAM & ToolJoint Collision (Bottom of RAM) | |||
!==================================================== | |||
Do j = 2,4 | |||
if ( TD_BOPElementNo(j)/=0 ) then | |||
if ( ((TD_BOPHeight(j)+TD_BOPThickness)>=(TD_DrillStems(TD_BOPElementNo(j))%DownDepth-TD_DrillStems(TD_BOPElementNo(j))%ToolJointRange)) .and. ((TD_BOPHeight(j)+TD_BOPThickness)<TD_DrillStems(TD_BOPElementNo(j))%DownDepth) .and. (TD_BOPRamDiam(j)<(2.d0*12.d0*TD_DrillStems(TD_BOPElementNo(j))%RtoolJoint)) ) then | |||
if ( Drawworks%motion==-1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
!==================================================== | |||
! RAM & ToolJoint Collision (Bottom of RAM) | |||
!==================================================== | |||
Do j = 2,4 | |||
if ( Drawworks%TDBOPElementNo(j)/=0 ) then | |||
if ( ((Drawworks%TDBOPHeight(j)+Drawworks%TDBOPThickness)>=(Drawworks%TDDrillStemsDownDepth(Drawworks%TDBOPElementNo(j))-Drawworks%TDDrillStemsToolJointRange(Drawworks%TDBOPElementNo(j)))) .and. ((Drawworks%TDBOPHeight(j)+Drawworks%TDBOPThickness)<Drawworks%TDDrillStemsDownDepth(Drawworks%TDBOPElementNo(j))) .and. (Drawworks%TDBOPRamDiam(j)<(2.d0*12.d0*Drawworks%TDDrillStemsRtoolJoint(Drawworks%TDBOPElementNo(j)))) ) then | |||
if ( Drawworks%motion==-1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
end if | |||
End Do | |||
end if | |||
return | |||
end if | |||
end if | |||
End Do | |||
@@ -316,20 +235,17 @@ subroutine Drawworks_Solver | |||
!==================================================== | |||
! TopDrive (TdsStemIn) | |||
!==================================================== | |||
if ( (Hoisting%DriveType==0) .and. (Get_TdsStemIn()) .and. Get_Slips() == SLIPS_SET_END ) then | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!==================================================== | |||
! TopDrive (TdsStemIn) | |||
!==================================================== | |||
if ( (Drawworks%DriveType==0) .and. (Get_TdsStemIn()) .and. Get_Slips() == SLIPS_SET_END ) then | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
@@ -339,23 +255,17 @@ subroutine Drawworks_Solver | |||
!print* , 'Drawworks%Hook_Height_final15=' , Drawworks%Hook_Height_final , TD_DrillStemBottom , int(TD_DrillStemBottom*1000.d0) , int((TD_WellTotalLength+TD_DlMax)*1000.d0) , (TD_WellTotalLength+TD_DlMax) , Drawworks%motion , StringIsBottomOfWell | |||
!=====> BottomHole ROP Condition | |||
if ( (int(TD_DrillStemBottom*10000.d0)>=(int((TD_WellTotalLength+TD_DlMax)*10000.d0))) .and. (Drawworks%motion==-1 .or. Drawworks%motion==0) ) then | |||
!print* , 'Drawworks%Hook_Height_final10=' , Drawworks%Hook_Height_final , TD_DrillStemBottom , (TD_WellTotalLength+TD_DlMax) | |||
if ( StringIsBottomOfWell==0 ) then | |||
Drawworks%Hook_Height_final = Drawworks%Hook_Height_final+(TD_DrillStemBottom-(TD_WellTotalLength+TD_DlMax)) | |||
StringIsBottomOfWell = 1 | |||
!print* , 'Drawworks%Hook_Height_final11=' , Drawworks%Hook_Height_final , TD_DrillStemBottom , (TD_WellTotalLength+TD_DlMax) | |||
!=====> BottomHole ROP Condition | |||
if ( (int(Drawworks%TDDrillStemBottom*10000.d0)>=(int((Drawworks%TDWellTotalLength+Drawworks%TDDlMax)*10000.d0))) .and. (Drawworks%motion==-1 .or. Drawworks%motion==0) ) then | |||
if ( Drawworks%StringIsBottomOfWell==0 ) then | |||
Drawworks%Hook_Height_final = Drawworks%Hook_Height_final+(Drawworks%TDDrillStemBottom-(Drawworks%TDWellTotalLength+Drawworks%TDDlMax)) | |||
Drawworks%StringIsBottomOfWell = 1 | |||
end if | |||
Call DWFixModeMotion | |||
!print* , 'Drawworks%Hook_Height_final12=' , Drawworks%Hook_Height_final | |||
!print* , 'bef return1' | |||
return | |||
!print* , 'aft return1' | |||
else | |||
StringIsBottomOfWell = 0 | |||
end if | |||
else | |||
Drawworks%StringIsBottomOfWell = 0 | |||
end if | |||
@@ -364,18 +274,10 @@ subroutine Drawworks_Solver | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
Drawworks%HookHeight_graph_output = 0.1189*((3.280839895*Drawworks%Hook_Height)-28.0)-2.6 ![ft] | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
Drawworks%HookHeight_graph_output = 0.1189d0*((3.280839895d0*Drawworks%Hook_Height)-28.d0)-2.6d0 ![ft] | |||
!print*, 'Drawworks%motion=' , Drawworks%motion | |||
!print*, 'Drawworks%Hook_Height_final=' , Drawworks%Hook_Height_final | |||
!print*, 'Drawworks%ia_new=' , Drawworks%ia_new | |||
!print*, 'Drawworks%ia_ref=' , Drawworks%ia_ref | |||
!print*, 'Drawworks%dia=' , Drawworks%dia | |||
!print*, 'Drawworks%dw=' , Drawworks%dw | |||
!print*, 'Drawworks%w_new=' , Drawworks%w_new | |||
end subroutine Drawworks_Solver |
@@ -1,338 +0,0 @@ | |||
subroutine Drawworks_Solver_FreeTractionMotor | |||
Use CDrillingConsoleVariables | |||
Use CDataDisplayConsoleVariables | |||
Use CHoistingVariables | |||
Use CUnityInputs | |||
Use CHookVariables | |||
use UnitySignalVariables | |||
! Use COperationConditionEnumVariables | |||
! Use CSlipsEnumVariables | |||
Use CElevatorConnectionEnumVariables | |||
use COperationScenariosVariables, only: Get_ElevatorConnection | |||
Use CTdsConnectionModesEnumVariables | |||
Use CTdsElevatorModesEnumVariables | |||
Use Drawworks_VARIABLES | |||
Use CWarningsVariables | |||
Use TD_DrillStemComponents | |||
Use TD_WellGeometry | |||
Use CWarningsVariables | |||
Use TD_GeneralData | |||
Use CSounds | |||
IMPLICIT NONE | |||
Integer :: j | |||
Integer :: CrownCollision_Status , FloorCollision_Status , CrownWarning_Status , FloorWarning_Status | |||
Call Drawworks_INPUTS | |||
Drawworks%Conv_Ratio = 1.d0 | |||
!=====> Drawworks Gears Abuse | |||
if ( DW_OldTransMode==0 .and. Drawworks%TransMode/=0 .and. Drawworks%w_drum/=0. .and. Drawworks%ClutchMode/=0 ) then | |||
Call Activate_DrawworksGearsAbuse() | |||
Drawworks%SoundGearCrash = .true. | |||
Call SetSoundDwGearCrash(Drawworks%SoundGearCrash) | |||
Drawworks%ManualBreak = 100. | |||
!Drawworks%N_ref = 0. | |||
Call DWFixModeMotion | |||
Drawworks%SoundRev = INT(Drawworks%w_drum) ![rpm] , Integer | |||
Call SetSoundDwRev( Drawworks%SoundRev ) | |||
return | |||
else | |||
Drawworks%SoundGearCrash = .false. | |||
Call SetSoundDwGearCrash(Drawworks%SoundGearCrash) | |||
end if | |||
if ( DrawworksGearsAbuse==1 ) then | |||
return | |||
end if | |||
Call Drawworks_Direction | |||
!==================================================== | |||
! Collision & Warning | |||
!==================================================== | |||
if ( CrownCollision == .false. ) then | |||
CrownCollision_Status = 0 | |||
end if | |||
if ( FloorCollision == .false. ) then | |||
FloorCollision_Status = 0 | |||
end if | |||
!if ( CrownWarning == .false. ) then | |||
! CrownWarning_Status = 0 | |||
!end if | |||
!if ( FloorWarning == .false. ) then | |||
! FloorWarning_Status = 0 | |||
!end if | |||
!==================================================== | |||
! Crown Collision (Max_Hook_Height) | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)>=Drawworks%max_Hook_Height) .and. (any(DW_DrillModeCond==(/3,4,7,10,11,12,14/))) ) then | |||
if ( CrownCollision_Status==0 .and. Drawworks%motion==1 ) then | |||
Call Activate_CrownCollision() | |||
CrownCollision_Status = 1 | |||
Drawworks%SoundCrownCollision = .true. | |||
Call SetSoundCrownCollision(Drawworks%SoundCrownCollision) | |||
else | |||
Drawworks%SoundCrownCollision = .false. | |||
Call SetSoundCrownCollision(Drawworks%SoundCrownCollision) | |||
end if | |||
do While ( CrownCollision==1 ) | |||
Call DWFixModeMotion | |||
end do | |||
if ( Drawworks%motion==-1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!==================================================== | |||
! Floor Collision (Min_Hook_Height) | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)<=Drawworks%min_Hook_Height) .and. (any(DW_DrillModeCond==(/3,4,7,10,11,12,14/))) ) then | |||
if ( FloorCollision_Status==0 .and. Drawworks%motion==-1 ) then | |||
Call Activate_FloorCollision() | |||
Drawworks%SoundFloorCollision = .true. | |||
Call SetSoundFloorCollision(Drawworks%SoundFloorCollision) | |||
FloorCollision_Status = 1 | |||
else | |||
Drawworks%SoundFloorCollision = .false. | |||
Call SetSoundFloorCollision(Drawworks%SoundFloorCollision) | |||
end if | |||
Do While ( FloorCollision ==1 ) | |||
Call DWFixModeMotion | |||
End Do | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!==================================================== | |||
! Warning (Max_Hook_Height) | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)>=Drawworks%max_Hook_Height) .and. (any(DW_DrillModeCond==(/1,2,5,6,8,9,13/))) ) then | |||
!if ( CrownWarning_Status==0 .and. Drawworks%motion==1 ) then ?????????? | |||
! Call Activate_crownwarning() ?????????? | |||
!Drawworks%SoundCrownCollision = .true. | |||
!Call SetSoundCrownCollision(Drawworks%SoundCrownCollision) | |||
! CrownWarning_Status = 1 ?????????? | |||
!else | |||
! Drawworks%SoundCrownCollision = .false. | |||
!Call SetSoundCrownCollision(Drawworks%SoundCrownCollision) | |||
!end if ?????????? | |||
if ( Drawworks%motion==-1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!==================================================== | |||
! Warning (Min_Hook_Height) | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)<=Drawworks%min_Hook_Height) .and. (any(DW_DrillModeCond==(/1,2,5,6,8,9,13/))) ) then | |||
!if ( floorwarning_Status==0 .and. Drawworks%motion==-1 ) then ?????????? | |||
! Call Activate_floorwarning() ?????????? | |||
!Drawworks%SoundCrownCollision = .true. | |||
!Call SetSoundCrownCollision(Drawworks%SoundCrownCollision) | |||
! floorwarning_Status = 1 ?????????? | |||
!else | |||
!Drawworks%SoundCrownCollision = .false. | |||
!Call SetSoundCrownCollision(Drawworks%SoundCrownCollision) | |||
!end if ?????????? | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!==================================================== | |||
! ELEVATOR CONNECTION STRING (SLIPS SET , No Motion) | |||
!==================================================== | |||
if ( Hoisting%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and. Drawworks%motion/=-1 ) then | |||
!if ( Drawworks%motion/=-1 ) then | |||
Call DWFixModeMotion | |||
return | |||
!end if | |||
end if | |||
if ( Hoisting%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING) .and. Drawworks%motion/=-1 ) then | |||
!if ( Drawworks%motion/=-1 ) then | |||
Call DWFixModeMotion | |||
return | |||
!end if | |||
end if | |||
!==================================================== | |||
! RAM & ToolJoint Collision (Top of RAM) | |||
!==================================================== | |||
Do j = 2,4 !startup problem ??????? | |||
if ( TD_BOPElementNo(j)/=0 ) then | |||
if ( ((TD_BOPHeight(j)-TD_BOPThickness)<=(TD_DrillStems(TD_BOPElementNo(j))%TopDepth+TD_DrillStems(TD_BOPElementNo(j))%ToolJointRange)) .and. ((TD_BOPHeight(j)-TD_BOPThickness)>TD_DrillStems(TD_BOPElementNo(j))%TopDepth) .and. (TD_BOPRamDiam(j)<(2.d0*12.d0*TD_DrillStems(TD_BOPElementNo(j))%RtoolJoint)) ) then | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
end if | |||
End Do | |||
!==================================================== | |||
! RAM & ToolJoint Collision (Bottom of RAM) | |||
!==================================================== | |||
Do j = 2,4 | |||
if ( TD_BOPElementNo(j)/=0 ) then | |||
if ( ((TD_BOPHeight(j)+TD_BOPThickness)>=(TD_DrillStems(TD_BOPElementNo(j))%DownDepth-TD_DrillStems(TD_BOPElementNo(j))%ToolJointRange)) .and. ((TD_BOPHeight(j)+TD_BOPThickness)<TD_DrillStems(TD_BOPElementNo(j))%DownDepth) .and. (TD_BOPRamDiam(j)<(2.d0*12.d0*TD_DrillStems(TD_BOPElementNo(j))%RtoolJoint)) ) then | |||
if ( Drawworks%motion==-1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
end if | |||
End Do | |||
!==================================================== | |||
! TopDrive (TdsStemIn) | |||
!==================================================== | |||
if ( (Hoisting%DriveType==0) .and. (Get_TdsStemIn()) .and. Get_Slips() == SLIPS_SET_END ) then | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895*Drawworks%Hook_Height ![ft] | |||
Call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!print* , 'Drawworks%Hook_Height_final05=' , Drawworks%Hook_Height_final , TD_DrillStemBottom , int(TD_DrillStemBottom*1000.d0) , int((TD_WellTotalLength+TD_DlMax)*1000.d0) , (TD_WellTotalLength+TD_DlMax) , Drawworks%motion , StringIsBottomOfWell | |||
!=====> BottomHole ROP Condition | |||
if ( (int(TD_DrillStemBottom*10000.d0)>=(int((TD_WellTotalLength+TD_DlMax)*10000.d0))) .and. (Drawworks%motion==-1 .or. Drawworks%motion==0) ) then | |||
!print* , 'Drawworks%Hook_Height_final00=' , Drawworks%Hook_Height_final , TD_DrillStemBottom , (TD_WellTotalLength+TD_DlMax) | |||
if ( StringIsBottomOfWell==0 ) then | |||
Drawworks%Hook_Height_final = Drawworks%Hook_Height_final+(TD_DrillStemBottom-(TD_WellTotalLength+TD_DlMax)) | |||
StringIsBottomOfWell = 1 | |||
!print* , 'Drawworks%Hook_Height_final01=' , Drawworks%Hook_Height_final , TD_DrillStemBottom , (TD_WellTotalLength+TD_DlMax) | |||
end if | |||
Call DWFixModeMotion | |||
!print* , 'Drawworks%Hook_Height_final02=' , Drawworks%Hook_Height_final | |||
!print* , 'bef return0' | |||
return | |||
!print* , 'aft return0' | |||
else | |||
StringIsBottomOfWell = 0 | |||
end if | |||
!print* , 'Drawworks%beffree2=' , DW_OldTransMode , Drawworks%TransMode , Drawworks%w_drum , Drawworks%ClutchMode , Drawworks%N_ref , DWThrottle , DWAcceleretor | |||
Drawworks%Hook_Height_final=3.280839895*Drawworks%Hook_Height ![ft] | |||
call Set_HookHeight(real(Drawworks%Hook_Height_final)) | |||
Drawworks%HookHeight_graph_output=0.1189*((3.280839895*Drawworks%Hook_Height)-28.0d0)-2.6 ![ft] | |||
!print*, 'Drawworks%motion0=' , Drawworks%motion | |||
!print*, 'Drawworks%Hook_Height_final0=' , Drawworks%Hook_Height_final | |||
!print*, 'Drawworks%ia_new0=' , Drawworks%ia_new | |||
!print*, 'Drawworks%ia_ref0=' , Drawworks%ia_ref | |||
!print*, 'Drawworks%dia0=' , Drawworks%dia | |||
!print*, 'Drawworks%dw0=' , Drawworks%dw | |||
!print*, 'Drawworks%w_new0=' , Drawworks%w_new | |||
end subroutine Drawworks_Solver_FreeTractionMotor |
@@ -0,0 +1,247 @@ | |||
subroutine Drawworks_Solver_OffMode | |||
Use CUnityInputs | |||
Use UnitySignalVariables | |||
Use Drawworks_VARIABLES | |||
Use CKellyConnectionEnumVariables | |||
Use CElevatorConnectionEnumVariables | |||
Use CTdsConnectionModesEnumVariables | |||
Use CTdsElevatorModesEnumVariables | |||
Use COperationScenariosVariables | |||
IMPLICIT NONE | |||
Integer :: j | |||
Integer :: CrownCollision_Status , FloorCollision_Status , CrownWarning_Status , FloorWarning_Status | |||
Drawworks%motion = 0 | |||
Drawworks%w_old_drum = 0.d0 | |||
Drawworks%w_drum = 0.d0 | |||
Drawworks%Hook_Height = Drawworks%Hook_Height | |||
!==================================================== | |||
! Collision & Warning | |||
!==================================================== | |||
if ( Drawworks%CrownCollision == .false. ) then | |||
CrownCollision_Status = 0 | |||
end if | |||
if ( Drawworks%FloorCollision == .false. ) then | |||
FloorCollision_Status = 0 | |||
end if | |||
!==================================================== | |||
! Crown Collision (Max_Hook_Height) | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)>=Drawworks%max_Hook_Height) .and. (any(Drawworks%DrillModeCond==(/3,4,7,10,11,12,14/))) ) then | |||
if ( CrownCollision_Status==0 .and. Drawworks%motion==1 ) then | |||
CrownCollision_Status = 1 | |||
Drawworks%CrownCollision = .true. | |||
Drawworks%SoundCrownCollision = .true. | |||
else | |||
Drawworks%SoundCrownCollision = .false. | |||
end if | |||
if ( Drawworks%motion==-1 .and. Drawworks%CrownCollision==.false. ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!==================================================== | |||
! Floor Collision (Min_Hook_Height) | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)<=Drawworks%min_Hook_Height) .and. (any(Drawworks%DrillModeCond==(/3,4,7,10,11,12,14/))) ) then | |||
if ( FloorCollision_Status==0 .and. Drawworks%motion==-1 ) then | |||
FloorCollision_Status = 1 | |||
Drawworks%FloorCollision = .true. | |||
Drawworks%SoundFloorCollision = .true. | |||
else | |||
Drawworks%SoundFloorCollision = .false. | |||
end if | |||
if ( Drawworks%motion==1 .and. Drawworks%FloorCollision==.false. ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!==================================================== | |||
! Warning (Max_Hook_Height) | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)>=Drawworks%max_Hook_Height) .and. (any(Drawworks%DrillModeCond==(/1,2,5,6,8,9,13/))) ) then | |||
if ( Drawworks%motion==-1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!==================================================== | |||
! Warning (Min_Hook_Height) | |||
!==================================================== | |||
if ( ((3.280839895*Drawworks%Hook_Height)<=Drawworks%min_Hook_Height) .and. (any(Drawworks%DrillModeCond==(/1,2,5,6,8,9,13/))) ) then | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!==================================================== | |||
! ELEVATOR CONNECTION STRING (SLIPS SET , No Motion) | |||
!==================================================== | |||
if ( Drawworks%DriveType==1 .and. Get_Slips() == SLIPS_SET_END .and. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and. Drawworks%motion/=-1 ) then | |||
Call DWFixModeMotion | |||
return | |||
end if | |||
if ( Drawworks%DriveType==0 .and. Get_Slips() == SLIPS_SET_END .and. (Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING) .and. Drawworks%motion/=-1 ) then | |||
Call DWFixModeMotion | |||
return | |||
end if | |||
!==================================================== | |||
! RAM & ToolJoint Collision (Top of RAM) | |||
!==================================================== | |||
Do j = 2,4 !startup problem ??????? | |||
if ( Drawworks%TDBOPElementNo(j)/=0 ) then | |||
if ( ((Drawworks%TDBOPHeight(j)-Drawworks%TDBOPThickness)<=(Drawworks%TDDrillStemsTopDepth(Drawworks%TDBOPElementNo(j))+Drawworks%TDDrillStemsToolJointRange(Drawworks%TDBOPElementNo(j)))) .and. ((Drawworks%TDBOPHeight(j)-Drawworks%TDBOPThickness)>Drawworks%TDDrillStemsTopDepth(Drawworks%TDBOPElementNo(j))) .and. (Drawworks%TDBOPRamDiam(j)<(2.d0*12.d0*Drawworks%TDDrillStemsRtoolJoint(Drawworks%TDBOPElementNo(j)))) ) then | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
end if | |||
End Do | |||
!==================================================== | |||
! RAM & ToolJoint Collision (Bottom of RAM) | |||
!==================================================== | |||
Do j = 2,4 | |||
if ( Drawworks%TDBOPElementNo(j)/=0 ) then | |||
if ( ((Drawworks%TDBOPHeight(j)+Drawworks%TDBOPThickness)>=(Drawworks%TDDrillStemsDownDepth(Drawworks%TDBOPElementNo(j))-Drawworks%TDDrillStemsToolJointRange(Drawworks%TDBOPElementNo(j)))) .and. ((Drawworks%TDBOPHeight(j)+Drawworks%TDBOPThickness)<Drawworks%TDDrillStemsDownDepth(Drawworks%TDBOPElementNo(j))) .and. (Drawworks%TDBOPRamDiam(j)<(2.d0*12.d0*Drawworks%TDDrillStemsRtoolJoint(Drawworks%TDBOPElementNo(j)))) ) then | |||
if ( Drawworks%motion==-1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
end if | |||
End Do | |||
!==================================================== | |||
! TopDrive (TdsStemIn) | |||
!==================================================== | |||
if ( (Drawworks%DriveType==0) .and. (Get_TdsStemIn()) .and. Get_Slips() == SLIPS_SET_END ) then | |||
if ( Drawworks%motion==1 ) then | |||
Drawworks%Hook_Height_final = 3.280839895d0*Drawworks%Hook_Height ![ft] | |||
else | |||
Call DWFixModeMotion | |||
end if | |||
return | |||
end if | |||
!=====> BottomHole ROP Condition | |||
if ( (int(Drawworks%TDDrillStemBottom*10000.d0)>=(int((Drawworks%TDWellTotalLength+Drawworks%TDDlMax)*10000.d0))) .and. (Drawworks%motion==-1 .or. Drawworks%motion==0) ) then | |||
if ( Drawworks%StringIsBottomOfWell==0 ) then | |||
Drawworks%Hook_Height_final = Drawworks%Hook_Height_final+(Drawworks%TDDrillStemBottom-(Drawworks%TDWellTotalLength+Drawworks%TDDlMax)) | |||
Drawworks%StringIsBottomOfWell = 1 | |||
end if | |||
Call DWFixModeMotion | |||
return | |||
else | |||
Drawworks%StringIsBottomOfWell = 0 | |||
end if | |||
Drawworks%Hook_Height_final=3.280839895d0*Drawworks%Hook_Height ![ft] | |||
Drawworks%HookHeight_graph_output=0.1189d0*((3.280839895d0*Drawworks%Hook_Height)-28.0d0)-2.6d0 ![ft] | |||
end subroutine Drawworks_Solver_OffMode |
@@ -8,28 +8,24 @@ subroutine Drawworks_StartUp | |||
IMPLICIT NONE | |||
Integer :: jj, ii | |||
StringIsBottomOfWell = 0 ! 1=string is at the bottom of the well | |||
Drawworks%RateChange = 193.d0 ! [rpm/s?] !??????? motaghayere voroudi | |||
!===> Hook Height | |||
Drawworks%Hook_Height_ini = 75.0d0 ![ft] | |||
Drawworks%Hook_Height_ini_graph_output = -1.54090d0 ![ft] | |||
Drawworks%Hook_Height_inim = 0.3048*Drawworks%Hook_Height_ini ![m] | |||
Drawworks%Hook_Height = Drawworks%Hook_Height_inim ![m] | |||
Drawworks%Hook_Height_final = 75.0 ![ft] | |||
Drawworks%Hook_Height_ini = 75.0d0 ![ft] | |||
Drawworks%Hook_Height_ini_graph_output = -1.54090d0 ![ft] | |||
Drawworks%Hook_Height_inim = 0.3048d0*Drawworks%Hook_Height_ini ![m] | |||
Drawworks%Hook_Height = Drawworks%Hook_Height_inim ![m] | |||
Drawworks%Hook_Height_final = 75.d0 ![ft] | |||
Drawworks%TDHookHeight = 75.d0 ![ft] | |||
!===> Drum (Drawworks) Diameter | |||
Drawworks%Diameter = 2.50d0 ![ft] | |||
Drawworks%Diameter = 0.3048*Drawworks%Diameter ![m] | |||
Drawworks%Diameter = 2.50d0 ![ft] | |||
Drawworks%Diameter = 0.3048d0*Drawworks%Diameter ![m] | |||
@@ -38,63 +34,19 @@ subroutine Drawworks_StartUp | |||
!===> Inertia Moment (Drawworks) | |||
Drawworks%Inertia_Moment = 23.261341 ! 23.261341 [kg.m^2] = 552 [Ib.ft^2] | |||
!Drawworks%J_coef = Drawworks%Inertia_Moment+(9.*(Drawworks%Inertia_Moment)) | |||
Drawworks%J_coef = 1200.0d0 ![kg.m^2] | |||
!===> Simulation time step | |||
Drawworks%time_step = 0.10d0 | |||
!CrownCollision = 0 | |||
!FloorCollision = 0 | |||
!>>>>>>>>>>>>>>>>>>> Transmission Ratio <<<<<<<<<<<<<<<<<<< | |||
DO ii=-1,1 !ii=clutch mode | |||
DO jj=-1,1 !jj=transmission mode | |||
if (ii==0 .or. jj==0) then | |||
Drawworks%FWD_Conv_Ratio(ii,jj) = 1. | |||
end if | |||
End DO | |||
End DO | |||
Drawworks%FWD_Conv_Ratio(1,1) = 1.0d0/.380 | |||
Drawworks%FWD_Conv_Ratio(1,-1) = 1.0d0/.2170 | |||
Drawworks%FWD_Conv_Ratio(-1,1) = 1.0d0/.110 | |||
Drawworks%FWD_Conv_Ratio(-1,-1) = 1.0d0/.0630 | |||
DW_OldTransMode = DrillingConsole%DWTransmisionLever | |||
DW_OldClutchMode = DrillingConsole%DWClutchLever | |||
Drawworks%time_step = 0.10d0 ![s] | |||
!===> motor variables | |||
Drawworks%w_drum = 0. | |||
Drawworks%w_old_drum = 0. | |||
Drawworks%w = 0. | |||
Drawworks%w_old = 0. | |||
Drawworks%ia = 0. | |||
Drawworks%ia_old = 0. | |||
Drawworks%x = 0. | |||
Drawworks%x_old = 0. | |||
Drawworks%y = 0. | |||
Drawworks%y_old = 0. | |||
Drawworks%motion = 0 | |||
!===> Initial Values | |||
Drawworks%w_drum = 0.d0 | |||
Drawworks%w_old_drum = 0.d0 | |||
Drawworks%motion = 0 | |||
Drawworks%K_Throttle = 0 | |||
Drawworks%StringIsBottomOfWell = 0 ! 1= string is at the bottom of the well | |||
!Drawworks%CrownCollision = 0 | |||
!Drawworks%FloorCollision = 0 | |||
@@ -1,161 +0,0 @@ | |||
subroutine Drawworks_Traction_motor_ClutchMode | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
Integer :: jj, kk , i | |||
REAL :: numerator, Denominator | |||
REAL :: sigma_w | |||
REAL, allocatable, dimension(:) :: w_array | |||
!>>>>>>>>>>>>>>>>>>>>>>> DATA <<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
La = 1700.*1d-6 | |||
Lf = 260.*1d-6 | |||
Ra = 9.5*1d-3 | |||
Rf = 5.4*1d-3 | |||
!******** controller ******* | |||
Kpn = 50.0 | |||
Kin = 3.0 | |||
Kpi = 100.0 | |||
Kii = 900.0 | |||
!*************************** | |||
Drawworks%time = Drawworks%time_step | |||
Drawworks%dt = 1.d-5 | |||
Drawworks%error = .001 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
Drawworks%n = Drawworks%time/Drawworks%dt | |||
Drawworks%w_ref = (pi*(Drawworks%N_ref)/30.0) | |||
!if (Drawworks%N_ref==0.) then | |||
! Drawworks%w_ref = 0.0 | |||
!end if | |||
allocate(w_array(0:Drawworks%n)) | |||
w_array(0) = Drawworks%w/Drawworks%Conv_Ratio | |||
Drawworks%ia_er = 1. | |||
Drawworks%w_er = 1. | |||
Drawworks%x_er = 1. | |||
Drawworks%y_er = 1. | |||
Drawworks%i = 1 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
DO WHILE (Drawworks%i<=Drawworks%n) | |||
!>>>>>>>>>>>> Runge-Kutta Method (4th order) <<<<<<<<<<<<<< | |||
call dx((Drawworks%i*Drawworks%dt),Drawworks%ia,Drawworks%w,Drawworks%x,Drawworks%y) | |||
call dy((Drawworks%i*Drawworks%dt),Drawworks%ia,Drawworks%w,Drawworks%x,Drawworks%y) | |||
call dia((Drawworks%i*Drawworks%dt),Drawworks%ia,Drawworks%w,Drawworks%fii,Drawworks%x,Drawworks%y) | |||
call dw((Drawworks%i*Drawworks%dt),Drawworks%ia,Drawworks%w,Drawworks%fii,Drawworks%TL) | |||
Drawworks%K1x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K1y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K1ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K1w = Drawworks%dt*Drawworks%dw | |||
call dx((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K1ia/2.),Drawworks%w+(Drawworks%K1w/2.),Drawworks%x+(Drawworks%K1x/2.),Drawworks%y+(Drawworks%K1y/2.)) | |||
call dy((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K1ia/2.),Drawworks%w+(Drawworks%K1w/2.),Drawworks%x+(Drawworks%K1x/2.),Drawworks%y+(Drawworks%K1y/2.)) | |||
call dia((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K1ia/2.),Drawworks%w+(Drawworks%K1w/2.),Drawworks%fii,Drawworks%x+(Drawworks%K1x/2.),Drawworks%y+(Drawworks%K1y/2.)) | |||
call dw((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K1ia/2.),Drawworks%w+(Drawworks%K1w/2.),Drawworks%fii,Drawworks%TL) | |||
Drawworks%K2x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K2y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K2ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K2w = Drawworks%dt*Drawworks%dw | |||
call dx((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K2ia/2.),Drawworks%w+(Drawworks%K2w/2.),Drawworks%x+(Drawworks%K2x/2.),Drawworks%y+(Drawworks%K2y/2.)) | |||
call dy((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K2ia/2.),Drawworks%w+(Drawworks%K2w/2.),Drawworks%x+(Drawworks%K2x/2.),Drawworks%y+(Drawworks%K2y/2.)) | |||
call dia((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K2ia/2.),Drawworks%w+(Drawworks%K2w/2.),Drawworks%fii,Drawworks%x+(Drawworks%K2x/2.),Drawworks%y+(Drawworks%K2y/2.)) | |||
call dw((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K2ia/2.),Drawworks%w+(Drawworks%K2w/2.),Drawworks%fii,Drawworks%TL) | |||
Drawworks%K3x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K3y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K3ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K3w = Drawworks%dt*Drawworks%dw | |||
call dx((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia+Drawworks%K3ia,Drawworks%w+Drawworks%K3w,Drawworks%x+Drawworks%K3x,Drawworks%y+Drawworks%K3y) | |||
call dy((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia+Drawworks%K3ia,Drawworks%w+Drawworks%K3w,Drawworks%x+Drawworks%K3x,Drawworks%y+Drawworks%K3y) | |||
call dia((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia+Drawworks%K3ia,Drawworks%w+Drawworks%K3w,Drawworks%fii,Drawworks%x+Drawworks%K3x,Drawworks%y+Drawworks%K3y) | |||
call dw((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia+Drawworks%K3ia,Drawworks%w+Drawworks%K3w,Drawworks%fii,Drawworks%TL) | |||
Drawworks%K4x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K4y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K4ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K4w = Drawworks%dt*Drawworks%dw | |||
Drawworks%x_new = Drawworks%x_old+((Drawworks%K1x+(2.0*Drawworks%K2x)+(2.0*Drawworks%K3x)+Drawworks%K4x)/6.0) | |||
Drawworks%y_new = Drawworks%y_old+((Drawworks%K1y+(2.0*Drawworks%K2y)+(2.0*Drawworks%K3y)+Drawworks%K4y)/6.0) | |||
Drawworks%ia_new = Drawworks%ia_old+((Drawworks%K1ia+(2.0*Drawworks%K2ia)+(2.0*Drawworks%K3ia)+Drawworks%K4ia)/6.0) | |||
Drawworks%w_new = Drawworks%w_old+((Drawworks%K1w+(2.0*Drawworks%K2w)+(2.0*Drawworks%K3w)+Drawworks%K4w)/6.0) | |||
Drawworks%x_old = Drawworks%x_new | |||
Drawworks%y_old = Drawworks%y_new | |||
Drawworks%ia_old = Drawworks%ia_new | |||
Drawworks%w_old = Drawworks%w_new | |||
Drawworks%x = Drawworks%x_new | |||
Drawworks%y = Drawworks%y_new | |||
Drawworks%ia = Drawworks%ia_new | |||
Drawworks%w = Drawworks%w_new | |||
Drawworks%Te = Drawworks%fii*Drawworks%ia_new | |||
Drawworks%ia_ref = Drawworks%y_new+Kpn*((30.0*Drawworks%w_ref/pi)-(30.0*Drawworks%w_new/pi)) | |||
if ( Drawworks%ia_ref>1400. ) then | |||
Drawworks%ia_ref = 1400. | |||
end if | |||
Drawworks%Vt = Drawworks%x_new+(Kpi*(Drawworks%ia_ref-Drawworks%ia_new)) | |||
IF (Drawworks%Vt>810.) THEN | |||
Drawworks%Vt = 810.0 | |||
ELSE IF (Drawworks%Vt<0.) THEN | |||
Drawworks%Vt = 0.0 | |||
END IF | |||
w_array(Drawworks%i) = Drawworks%w_new/Drawworks%Conv_Ratio | |||
Drawworks%i = Drawworks%i+1 | |||
END DO | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
!>>>>>>>>> Hook Height Calculation <<<<<<<<<<< | |||
!>>>>>>>>>>>> Simpson1/3 Method <<<<<<<<<<<<<< | |||
sigma_w = w_array(0)+w_array(Drawworks%n) | |||
do jj=1,Drawworks%n-1,2 | |||
sigma_w = sigma_w+(4.0*w_array(jj)) | |||
end do | |||
do kk=2,Drawworks%n-2,2 | |||
sigma_w = sigma_w+(2.0*w_array(kk)) | |||
end do | |||
Drawworks%Hook_Height = Drawworks%Hook_Height+(((Drawworks%Diameter/2.0)*(Drawworks%dt*sigma_w/3.0))/Drawworks%NumberOfLine) !m | |||
deallocate(w_array) | |||
END subroutine Drawworks_Traction_motor_ClutchMode |
@@ -1,137 +0,0 @@ | |||
subroutine Drawworks_Traction_motor_ClutchMode_Dir | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
Integer :: jj, kk | |||
REAL :: numerator, Denominator | |||
!>>>>>>>>>>>>>>>>>>>>>>> DATA <<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
La = 1700.*1d-6 | |||
Lf = 260.*1d-6 | |||
Ra = 9.5*1d-3 | |||
Rf = 5.4*1d-3 | |||
!******** controller ******* | |||
Kpn = 50.0 | |||
Kin = 3.0 | |||
Kpi = 100.0 | |||
Kii = 900.0 | |||
!*************************** | |||
Drawworks%time = Drawworks%time_step | |||
Drawworks%dt = 1.d-5 | |||
Drawworks%error = .001 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
Drawworks%x_Dir = Drawworks%x | |||
Drawworks%y_Dir = Drawworks%y | |||
Drawworks%w_Dir = Drawworks%w | |||
Drawworks%ia_Dir = Drawworks%ia | |||
Drawworks%w_old_Dir = Drawworks%w | |||
Drawworks%x_old_Dir = Drawworks%x | |||
Drawworks%y_old_Dir = Drawworks%y | |||
Drawworks%ia_old_Dir = Drawworks%ia | |||
Drawworks%n = Drawworks%time/Drawworks%dt | |||
Drawworks%w_ref = (pi*(Drawworks%N_ref)/30.0) | |||
!if (Drawworks%N_ref==0.) then | |||
! Drawworks%w_ref = 0.0d0 | |||
!end if | |||
Drawworks%ia_er = 1. | |||
Drawworks%w_er = 1. | |||
Drawworks%x_er = 1. | |||
Drawworks%y_er = 1. | |||
Drawworks%i = 1 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
DO WHILE (Drawworks%i<=Drawworks%n) | |||
!>>>>>>>>>>>> Runge-Kutta Method (4th order) <<<<<<<<<<<<<< | |||
call dx((Drawworks%i*Drawworks%dt),Drawworks%ia_Dir,Drawworks%w_Dir,Drawworks%x_Dir,Drawworks%y_Dir) | |||
call dy((Drawworks%i*Drawworks%dt),Drawworks%ia_Dir,Drawworks%w_Dir,Drawworks%x_Dir,Drawworks%y_Dir) | |||
call dia((Drawworks%i*Drawworks%dt),Drawworks%ia_Dir,Drawworks%w_Dir,Drawworks%fii,Drawworks%x_Dir,Drawworks%y_Dir) | |||
call dw((Drawworks%i*Drawworks%dt),Drawworks%ia_Dir,Drawworks%w_Dir,Drawworks%fii,Drawworks%TL) | |||
Drawworks%K1x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K1y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K1ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K1w = Drawworks%dt*Drawworks%dw | |||
call dx((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K1ia/2.),Drawworks%w_Dir+(Drawworks%K1w/2.),Drawworks%x_Dir+(Drawworks%K1x/2.),Drawworks%y_Dir+(Drawworks%K1y/2.)) | |||
call dy((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K1ia/2.),Drawworks%w_Dir+(Drawworks%K1w/2.),Drawworks%x_Dir+(Drawworks%K1x/2.),Drawworks%y_Dir+(Drawworks%K1y/2.)) | |||
call dia((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K1ia/2.),Drawworks%w_Dir+(Drawworks%K1w/2.),Drawworks%fii,Drawworks%x_Dir+(Drawworks%K1x/2.),Drawworks%y_Dir+(Drawworks%K1y/2.)) | |||
call dw((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K1ia/2.),Drawworks%w_Dir+(Drawworks%K1w/2.),Drawworks%fii,Drawworks%TL) | |||
Drawworks%K2x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K2y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K2ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K2w = Drawworks%dt*Drawworks%dw | |||
call dx((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K2ia/2.),Drawworks%w_Dir+(Drawworks%K2w/2.),Drawworks%x_Dir+(Drawworks%K2x/2.),Drawworks%y_Dir+(Drawworks%K2y/2.)) | |||
call dy((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K2ia/2.),Drawworks%w_Dir+(Drawworks%K2w/2.),Drawworks%x_Dir+(Drawworks%K2x/2.),Drawworks%y_Dir+(Drawworks%K2y/2.)) | |||
call dia((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K2ia/2.),Drawworks%w_Dir+(Drawworks%K2w/2.),Drawworks%fii,Drawworks%x_Dir+(Drawworks%K2x/2.),Drawworks%y_Dir+(Drawworks%K2y/2.)) | |||
call dw((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K2ia/2.),Drawworks%w_Dir+(Drawworks%K2w/2.),Drawworks%fii,Drawworks%TL) | |||
Drawworks%K3x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K3y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K3ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K3w = Drawworks%dt*Drawworks%dw | |||
call dx((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia_Dir+Drawworks%K3ia,Drawworks%w_Dir+Drawworks%K3w,Drawworks%x_Dir+Drawworks%K3x,Drawworks%y_Dir+Drawworks%K3y) | |||
call dy((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia_Dir+Drawworks%K3ia,Drawworks%w_Dir+Drawworks%K3w,Drawworks%x_Dir+Drawworks%K3x,Drawworks%y_Dir+Drawworks%K3y) | |||
call dia((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia_Dir+Drawworks%K3ia,Drawworks%w_Dir+Drawworks%K3w,Drawworks%fii,Drawworks%x_Dir+Drawworks%K3x,Drawworks%y_Dir+Drawworks%K3y) | |||
call dw((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia_Dir+Drawworks%K3ia,Drawworks%w_Dir+Drawworks%K3w,Drawworks%fii,Drawworks%TL) | |||
Drawworks%K4x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K4y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K4ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K4w = Drawworks%dt*Drawworks%dw | |||
Drawworks%x_new_Dir = Drawworks%x_old_Dir+((Drawworks%K1x+(2.0d0*Drawworks%K2x)+(2.0d0*Drawworks%K3x)+Drawworks%K4x)/6.0d0) | |||
Drawworks%y_new_Dir = Drawworks%y_old_Dir+((Drawworks%K1y+(2.0d0*Drawworks%K2y)+(2.0d0*Drawworks%K3y)+Drawworks%K4y)/6.0d0) | |||
Drawworks%ia_new_Dir = Drawworks%ia_old_Dir+((Drawworks%K1ia+(2.0d0*Drawworks%K2ia)+(2.0d0*Drawworks%K3ia)+Drawworks%K4ia)/6.0d0) | |||
Drawworks%w_new_Dir = Drawworks%w_old_Dir+((Drawworks%K1w+(2.0d0*Drawworks%K2w)+(2.0d0*Drawworks%K3w)+Drawworks%K4w)/6.0d0) | |||
Drawworks%x_old_Dir = Drawworks%x_new_Dir | |||
Drawworks%y_old_Dir = Drawworks%y_new_Dir | |||
Drawworks%ia_old_Dir = Drawworks%ia_new_Dir | |||
Drawworks%w_old_Dir = Drawworks%w_new_Dir | |||
Drawworks%x_Dir = Drawworks%x_new_Dir | |||
Drawworks%y_Dir = Drawworks%y_new_Dir | |||
Drawworks%ia_Dir = Drawworks%ia_new_Dir | |||
Drawworks%w_Dir = Drawworks%w_new_Dir | |||
Drawworks%Te = Drawworks%fii*Drawworks%ia_new_Dir | |||
Drawworks%ia_ref = Drawworks%y_new_Dir+Kpn*((30.0d0*Drawworks%w_ref/pi)-(30.0d0*Drawworks%w_new_Dir/pi)) | |||
if ( Drawworks%ia_ref>1400. ) then | |||
Drawworks%ia_ref = 1400. | |||
end if | |||
Drawworks%Vt=Drawworks%x_new_Dir+(Kpi*(Drawworks%ia_ref-Drawworks%ia_new_Dir)) | |||
IF (Drawworks%Vt>810.) THEN | |||
Drawworks%Vt = 810.0d0 | |||
ELSE IF (Drawworks%Vt<0.) THEN | |||
Drawworks%Vt = 0.0d0 | |||
END IF | |||
Drawworks%i = Drawworks%i+1 | |||
END DO | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
END subroutine Drawworks_Traction_motor_ClutchMode_Dir |
@@ -1,154 +0,0 @@ | |||
subroutine Drawworks_Traction_motor_dawnmotion | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
Integer :: jj, kk | |||
REAL :: numerator, Denominator | |||
REAL :: sigma_w | |||
REAL, allocatable, dimension(:) :: w_array | |||
!>>>>>>>>>>>>>>>>>>>>>>> DATA <<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
La = 1700.*1d-6 | |||
Lf = 260.*1d-6 | |||
Ra = 9.5*1d-3 | |||
Rf = 5.4*1d-3 | |||
!******** controller ******* | |||
Kpn = 50.0 | |||
Kin = 3.0 | |||
Kpi = 100.0 | |||
Kii = 900.0 | |||
!*************************** | |||
Drawworks%time = Drawworks%time_step | |||
Drawworks%dt = 1.d-5 | |||
Drawworks%error = .001 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
Drawworks%n = Drawworks%time/Drawworks%dt | |||
Drawworks%w_ref = (pi*(Drawworks%N_ref)/30.0) | |||
!if (Drawworks%N_ref==0.) then | |||
! Drawworks%w_ref = 0.0d0 | |||
!end if | |||
allocate(w_array(0:Drawworks%n)) | |||
w_array(0) = Drawworks%w/Drawworks%Conv_Ratio | |||
Drawworks%ia_er = 1. | |||
Drawworks%w_er = 1. | |||
Drawworks%x_er = 1. | |||
Drawworks%y_er = 1. | |||
Drawworks%i = 1 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
DO WHILE (Drawworks%i<=Drawworks%n) | |||
!>>>>>>>>>>>> Runge-Kutta Method (4th order) <<<<<<<<<<<<<< | |||
call dx((Drawworks%i*Drawworks%dt),Drawworks%ia,Drawworks%w,Drawworks%x,Drawworks%y) | |||
call dy((Drawworks%i*Drawworks%dt),Drawworks%ia,Drawworks%w,Drawworks%x,Drawworks%y) | |||
call dia((Drawworks%i*Drawworks%dt),Drawworks%ia,Drawworks%w,Drawworks%fii,Drawworks%x,Drawworks%y) | |||
call dw_DawnMotion((Drawworks%i*Drawworks%dt),Drawworks%ia,Drawworks%w,Drawworks%fii,Drawworks%TL) | |||
Drawworks%K1x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K1y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K1ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K1w = Drawworks%dt*Drawworks%dw_DawnMotion | |||
call dx((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K1ia/2.),Drawworks%w+(Drawworks%K1w/2.),Drawworks%x+(Drawworks%K1x/2.),Drawworks%y+(Drawworks%K1y/2.)) | |||
call dy((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K1ia/2.),Drawworks%w+(Drawworks%K1w/2.),Drawworks%x+(Drawworks%K1x/2.),Drawworks%y+(Drawworks%K1y/2.)) | |||
call dia((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K1ia/2.),Drawworks%w+(Drawworks%K1w/2.),Drawworks%fii,Drawworks%x+(Drawworks%K1x/2.),Drawworks%y+(Drawworks%K1y/2.)) | |||
call dw_DawnMotion((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K1ia/2.),Drawworks%w+(Drawworks%K1w/2.),Drawworks%fii,Drawworks%TL) | |||
Drawworks%K2x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K2y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K2ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K2w = Drawworks%dt*Drawworks%dw_DawnMotion | |||
call dx((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K2ia/2.),Drawworks%w+(Drawworks%K2w/2.),Drawworks%x+(Drawworks%K2x/2.),Drawworks%y+(Drawworks%K2y/2.)) | |||
call dy((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K2ia/2.),Drawworks%w+(Drawworks%K2w/2.),Drawworks%x+(Drawworks%K2x/2.),Drawworks%y+(Drawworks%K2y/2.)) | |||
call dia((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K2ia/2.),Drawworks%w+(Drawworks%K2w/2.),Drawworks%fii,Drawworks%x+(Drawworks%K2x/2.),Drawworks%y+(Drawworks%K2y/2.)) | |||
call dw_DawnMotion((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia+(Drawworks%K2ia/2.),Drawworks%w+(Drawworks%K2w/2.),Drawworks%fii,Drawworks%TL) | |||
Drawworks%K3x=Drawworks%dt*Drawworks%dx | |||
Drawworks%K3y=Drawworks%dt*Drawworks%dy | |||
Drawworks%K3ia=Drawworks%dt*Drawworks%dia | |||
Drawworks%K3w=Drawworks%dt*Drawworks%dw_DawnMotion | |||
call dx((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia+Drawworks%K3ia,Drawworks%w+Drawworks%K3w,Drawworks%x+Drawworks%K3x,Drawworks%y+Drawworks%K3y) | |||
call dy((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia+Drawworks%K3ia,Drawworks%w+Drawworks%K3w,Drawworks%x+Drawworks%K3x,Drawworks%y+Drawworks%K3y) | |||
call dia((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia+Drawworks%K3ia,Drawworks%w+Drawworks%K3w,Drawworks%fii,Drawworks%x+Drawworks%K3x,Drawworks%y+Drawworks%K3y) | |||
call dw_DawnMotion((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia+Drawworks%K3ia,Drawworks%w+Drawworks%K3w,Drawworks%fii,Drawworks%TL) | |||
Drawworks%K4x=Drawworks%dt*Drawworks%dx | |||
Drawworks%K4y=Drawworks%dt*Drawworks%dy | |||
Drawworks%K4ia=Drawworks%dt*Drawworks%dia | |||
Drawworks%K4w=Drawworks%dt*Drawworks%dw_DawnMotion | |||
Drawworks%x_new=Drawworks%x_old+((Drawworks%K1x+(2.0d0*Drawworks%K2x)+(2.0d0*Drawworks%K3x)+Drawworks%K4x)/6.0d0) | |||
Drawworks%y_new=Drawworks%y_old+((Drawworks%K1y+(2.0d0*Drawworks%K2y)+(2.0d0*Drawworks%K3y)+Drawworks%K4y)/6.0d0) | |||
Drawworks%ia_new=Drawworks%ia_old+((Drawworks%K1ia+(2.0d0*Drawworks%K2ia)+(2.0d0*Drawworks%K3ia)+Drawworks%K4ia)/6.0d0) | |||
Drawworks%w_new=Drawworks%w_old+((Drawworks%K1w+(2.0d0*Drawworks%K2w)+(2.0d0*Drawworks%K3w)+Drawworks%K4w)/6.0d0) | |||
Drawworks%x_old=Drawworks%x_new | |||
Drawworks%y_old=Drawworks%y_new | |||
Drawworks%ia_old=Drawworks%ia_new | |||
Drawworks%w_old=Drawworks%w_new | |||
Drawworks%x=Drawworks%x_new | |||
Drawworks%y=Drawworks%y_new | |||
Drawworks%ia=Drawworks%ia_new | |||
Drawworks%w=Drawworks%w_new | |||
Drawworks%Te=Drawworks%fii*Drawworks%ia_new | |||
Drawworks%ia_ref = Drawworks%y_new+Kpn*((30.0d0*Drawworks%w_ref/pi)-(30.0d0*Drawworks%w_new/pi)) | |||
if ( Drawworks%ia_ref>1400. ) then | |||
Drawworks%ia_ref = 1400. | |||
end if | |||
Drawworks%Vt=Drawworks%x_new+(Kpi*(Drawworks%ia_ref-Drawworks%ia_new)) | |||
IF (Drawworks%Vt>810.) THEN | |||
Drawworks%Vt=810.0d0 | |||
ELSE IF (Drawworks%Vt<0.) THEN | |||
Drawworks%Vt=0.0d0 | |||
END IF | |||
w_array(Drawworks%i)=Drawworks%w_new/Drawworks%Conv_Ratio | |||
Drawworks%i=Drawworks%i+1 | |||
END DO | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
!>>>>>>>>> Hook Height Calculation <<<<<<<<<<< | |||
!>>>>>>>>>>>> Simpson 1/3 Method <<<<<<<<<<<<<< | |||
sigma_w = w_array(0)+w_array(Drawworks%n) | |||
do jj = 1,Drawworks%n-1,2 | |||
sigma_w = sigma_w+(4.0d0*w_array(jj)) | |||
end do | |||
do kk = 2,Drawworks%n-2,2 | |||
sigma_w = sigma_w+(2.0d0*w_array(kk)) | |||
end do | |||
Drawworks%Hook_Height = Drawworks%Hook_Height-(((Drawworks%Diameter/2.0d0)*(Drawworks%dt*sigma_w/3.0d0))/Drawworks%NumberOfLine) !m | |||
deallocate(w_array) | |||
END subroutine Drawworks_Traction_motor_dawnmotion |
@@ -1,139 +0,0 @@ | |||
subroutine Drawworks_Traction_motor_dawnmotion_Dir | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
use Drawworks_VARIABLES | |||
IMPLICIT NONE | |||
Integer :: jj, kk | |||
REAL :: numerator, Denominator | |||
!>>>>>>>>>>>>>>>>>>>>>>> DATA <<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
La = 1700.*1d-6 | |||
Lf = 260.*1d-6 | |||
Ra = 9.5*1d-3 | |||
Rf = 5.4*1d-3 | |||
!******** controller ******* | |||
Kpn = 50.0 | |||
Kin = 3.0 | |||
Kpi = 100.0 | |||
Kii = 900.0 | |||
!*************************** | |||
Drawworks%time = Drawworks%time_step | |||
Drawworks%dt = 1.d-5 | |||
Drawworks%error = .001 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
Drawworks%x_Dir = Drawworks%x | |||
Drawworks%y_Dir = Drawworks%y | |||
Drawworks%w_Dir = Drawworks%w | |||
Drawworks%ia_Dir = Drawworks%ia | |||
Drawworks%w_old_Dir = Drawworks%w | |||
Drawworks%x_old_Dir = Drawworks%x | |||
Drawworks%y_old_Dir = Drawworks%y | |||
Drawworks%ia_old_Dir = Drawworks%ia | |||
Drawworks%n = Drawworks%time/Drawworks%dt | |||
Drawworks%w_ref = (pi*(Drawworks%N_ref)/30.0) | |||
!if (Drawworks%N_ref==0.) then | |||
! Drawworks%w_ref = 0.0 | |||
!end if | |||
Drawworks%ia_er = 1. | |||
Drawworks%w_er = 1. | |||
Drawworks%x_er = 1. | |||
Drawworks%y_er = 1. | |||
Drawworks%i = 1 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
DO WHILE (Drawworks%i<=Drawworks%n) | |||
!>>>>>>>>>>>> Runge-Kutta Method (4th order) <<<<<<<<<<<<<< | |||
call dx((Drawworks%i*Drawworks%dt),Drawworks%ia_Dir,Drawworks%w_Dir,Drawworks%x_Dir,Drawworks%y_Dir) | |||
call dy((Drawworks%i*Drawworks%dt),Drawworks%ia_Dir,Drawworks%w_Dir,Drawworks%x_Dir,Drawworks%y_Dir) | |||
call dia((Drawworks%i*Drawworks%dt),Drawworks%ia_Dir,Drawworks%w_Dir,Drawworks%fii,Drawworks%x_Dir,Drawworks%y_Dir) | |||
call dw_DawnMotion((Drawworks%i*Drawworks%dt),Drawworks%ia_Dir,Drawworks%w_Dir,Drawworks%fii,Drawworks%TL) | |||
Drawworks%K1x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K1y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K1ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K1w = Drawworks%dt*Drawworks%dw_DawnMotion | |||
call dx((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K1ia/2.),Drawworks%w_Dir+(Drawworks%K1w/2.),Drawworks%x_Dir+(Drawworks%K1x/2.),Drawworks%y_Dir+(Drawworks%K1y/2.)) | |||
call dy((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K1ia/2.),Drawworks%w_Dir+(Drawworks%K1w/2.),Drawworks%x_Dir+(Drawworks%K1x/2.),Drawworks%y_Dir+(Drawworks%K1y/2.)) | |||
call dia((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K1ia/2.),Drawworks%w_Dir+(Drawworks%K1w/2.),Drawworks%fii,Drawworks%x_Dir+(Drawworks%K1x/2.),Drawworks%y_Dir+(Drawworks%K1y/2.)) | |||
call dw_DawnMotion((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K1ia/2.),Drawworks%w_Dir+(Drawworks%K1w/2.),Drawworks%fii,Drawworks%TL) | |||
Drawworks%K2x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K2y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K2ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K2w = Drawworks%dt*Drawworks%dw_DawnMotion | |||
call dx((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K2ia/2.),Drawworks%w_Dir+(Drawworks%K2w/2.),Drawworks%x_Dir+(Drawworks%K2x/2.),Drawworks%y_Dir+(Drawworks%K2y/2.)) | |||
call dy((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K2ia/2.),Drawworks%w_Dir+(Drawworks%K2w/2.),Drawworks%x_Dir+(Drawworks%K2x/2.),Drawworks%y_Dir+(Drawworks%K2y/2.)) | |||
call dia((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K2ia/2.),Drawworks%w_Dir+(Drawworks%K2w/2.),Drawworks%fii,Drawworks%x_Dir+(Drawworks%K2x/2.),Drawworks%y_Dir+(Drawworks%K2y/2.)) | |||
call dw_DawnMotion((Drawworks%i*Drawworks%dt)+(Drawworks%dt/2.),Drawworks%ia_Dir+(Drawworks%K2ia/2.),Drawworks%w_Dir+(Drawworks%K2w/2.),Drawworks%fii,Drawworks%TL) | |||
Drawworks%K3x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K3y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K3ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K3w = Drawworks%dt*Drawworks%dw_DawnMotion | |||
call dx((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia_Dir+Drawworks%K3ia,Drawworks%w_Dir+Drawworks%K3w,Drawworks%x_Dir+Drawworks%K3x,Drawworks%y_Dir+Drawworks%K3y) | |||
call dy((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia_Dir+Drawworks%K3ia,Drawworks%w_Dir+Drawworks%K3w,Drawworks%x_Dir+Drawworks%K3x,Drawworks%y_Dir+Drawworks%K3y) | |||
call dia((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia_Dir+Drawworks%K3ia,Drawworks%w_Dir+Drawworks%K3w,Drawworks%fii,Drawworks%x_Dir+Drawworks%K3x,Drawworks%y_Dir+Drawworks%K3y) | |||
call dw_DawnMotion((Drawworks%i*Drawworks%dt)+Drawworks%dt,Drawworks%ia_Dir+Drawworks%K3ia,Drawworks%w_Dir+Drawworks%K3w,Drawworks%fii,Drawworks%TL) | |||
Drawworks%K4x = Drawworks%dt*Drawworks%dx | |||
Drawworks%K4y = Drawworks%dt*Drawworks%dy | |||
Drawworks%K4ia = Drawworks%dt*Drawworks%dia | |||
Drawworks%K4w = Drawworks%dt*Drawworks%dw_DawnMotion | |||
Drawworks%x_new_Dir = Drawworks%x_old_Dir+((Drawworks%K1x+(2.0*Drawworks%K2x)+(2.0*Drawworks%K3x)+Drawworks%K4x)/6.0) | |||
Drawworks%y_new_Dir = Drawworks%y_old_Dir+((Drawworks%K1y+(2.0*Drawworks%K2y)+(2.0*Drawworks%K3y)+Drawworks%K4y)/6.0) | |||
Drawworks%ia_new_Dir = Drawworks%ia_old_Dir+((Drawworks%K1ia+(2.0*Drawworks%K2ia)+(2.0*Drawworks%K3ia)+Drawworks%K4ia)/6.0) | |||
Drawworks%w_new_Dir = Drawworks%w_old_Dir+((Drawworks%K1w+(2.0*Drawworks%K2w)+(2.0*Drawworks%K3w)+Drawworks%K4w)/6.0) | |||
Drawworks%x_old_Dir = Drawworks%x_new_Dir | |||
Drawworks%y_old_Dir = Drawworks%y_new_Dir | |||
Drawworks%ia_old_Dir = Drawworks%ia_new_Dir | |||
Drawworks%w_old_Dir = Drawworks%w_new_Dir | |||
Drawworks%x_Dir = Drawworks%x_new_Dir | |||
Drawworks%y_Dir = Drawworks%y_new_Dir | |||
Drawworks%ia_Dir = Drawworks%ia_new_Dir | |||
Drawworks%w_Dir = Drawworks%w_new_Dir | |||
Drawworks%Te = Drawworks%fii*Drawworks%ia_new_Dir | |||
Drawworks%ia_ref = Drawworks%y_new_Dir+Kpn*((30.0*Drawworks%w_ref/pi)-(30.0*Drawworks%w_new_Dir/pi)) | |||
if ( Drawworks%ia_ref>1400. ) then | |||
Drawworks%ia_ref = 1400. | |||
end if | |||
Drawworks%Vt = Drawworks%x_new_Dir+(Kpi*(Drawworks%ia_ref-Drawworks%ia_new_Dir)) | |||
IF (Drawworks%Vt>810.) THEN | |||
Drawworks%Vt = 810.0 | |||
ELSE IF (Drawworks%Vt<0.) THEN | |||
Drawworks%Vt = 0.0 | |||
END IF | |||
Drawworks%i = Drawworks%i+1 | |||
END DO | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
END subroutine Drawworks_Traction_motor_dawnmotion_Dir |
@@ -1,18 +1,11 @@ | |||
MODULE Drawworks_VARIABLES | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
IMPLICIT NONE | |||
PUBLIC | |||
REAL, PARAMETER :: pi=3.14159265 | |||
REAL :: La, Lf, Ra, Rf | |||
REAL :: Kpn, Kin, Kpi, Kii | |||
INTEGER :: DW_OldTransMode , DW_DrillModeCond , DW_OldClutchMode , StringIsBottomOfWell | |||
REAL :: DW_TDHookHeight | |||
@@ -24,49 +17,39 @@ MODULE Drawworks_VARIABLES | |||
!***** Drawworks_VARIABLES ********************** | |||
INTEGER :: AssignmentSwitch | |||
INTEGER :: ClutchMode, TransMode, Direction_Var | |||
logical :: CrownCollision, FloorCollision | |||
INTEGER :: AssignmentSwitch , K_Throttle , Switch | |||
INTEGER :: MotorFaileMalf , ClutchEngageMalf , ClutchDisengageMalf | |||
INTEGER :: motion | |||
INTEGER :: motion, DriveType, ShearBopSituation, TDDrillStemComponentsNumbs | |||
INTEGER :: DrillModeCond, StringIsBottomOfWell | |||
INTEGER , Dimension(6) :: TDBOPElementNo | |||
REAL :: Throttle, RateChange | |||
REAL :: Diameter | |||
!REAL :: motion | |||
REAL :: EddyTorque, TracTorque, F_fastline | |||
REAL :: Hook_Height, Hook_Height_ini, Hook_Height_inim, Hook_Height_ini_graph_output, Hook_Height_final, max_Hook_Height, min_Hook_Height, HookHeight_graph_output | |||
REAL :: N_Throtle, N_Accelarator, Conv_Ratio, Inertia_Moment, NumberOfLine | |||
REAL :: EddyBreak, ManualBreak, BreakLoad , BrakeLeverCoefficient | |||
REAL, Dimension(-1:1,-1:1) :: FWD_Conv_Ratio | |||
REAL :: simulation_time, time_step | |||
INTEGER :: INT_CPU_TIME, Dt_ref | |||
REAL :: N_Throtle, Conv_Ratio, NumberOfLine, Speed, N_new, N_old ! N[RPM] | |||
REAL :: w_drum, w_old_drum ! w[rad/s] | |||
REAL , Dimension(6) :: TDBOPHeight | |||
REAL , Dimension(4) :: TDBOPRamDiam | |||
REAL :: TDBOPThickness, TDDrillStemBottom, TDWellTotalLength, TDDlMax | |||
REAL , Allocatable, DIMENSION(:) :: TDDrillStemsDownDepth | |||
REAL , Allocatable, DIMENSION(:) :: TDDrillStemsTopDepth | |||
REAL , Allocatable, DIMENSION(:) :: TDDrillStemsToolJointRange | |||
REAL , Allocatable, DIMENSION(:) :: TDDrillStemsRtoolJoint | |||
REAL :: TDHookHeight | |||
REAL :: time_step | |||
!***** Traction Motor_VARIABLES ***************** | |||
INTEGER :: i, n | |||
REAL :: NumberOfTracMotor | |||
REAL :: TL, Vt, J_coef, Ea, fii, Te | |||
REAL :: time, dt, zaman | |||
REAL :: error, ia_er, w_er ,x_er, y_er | |||
REAL :: K1ia, K2ia, K3ia, K4ia | |||
REAL :: K1w, K2w, K3w, K4w | |||
REAL :: K1x, K2x, K3x, K4x | |||
REAL :: K1y, K2y, K3y, K4y | |||
REAL :: ia, w, ia_old, w_old, ia_new, w_new | |||
REAL :: ia_ref, ia_ref_limit, w_ref, N_ref ! N[rpm] , w[rad/s] | |||
REAL :: N_new, N_old | |||
REAL :: x, x_old, x_new | |||
REAL :: y, y_old, y_new | |||
REAL :: dia, dw, dx, dy, dw_freeTrac, dw_DawnMotion, dw_freeTrac_Dmotion | |||
REAL :: ia_Dir, w_Dir, ia_old_Dir, w_old_Dir, ia_new_Dir, w_new_Dir, x_Dir, x_old_Dir, x_new_Dir, y_Dir, y_old_Dir, y_new_Dir | |||
REAL :: w_drum_Dir, w_old_drum_Dir, w_new_drum_Dir, w_drum, w_old_drum, w_new_drum | |||
INTEGER :: BLWR ! 1=On , 0=Off | |||
!************* Sound_VARIABLES ********************** | |||
INTEGER :: SoundFw , SoundRev , SoundDwBrake | |||
Logical :: SoundBlower , SoundGearCrash | |||
Logical :: SoundFloorCollision , SoundCrownCollision , SoundClutch | |||
INTEGER :: SoundFw , SoundRev | |||
Logical :: SoundBlower | |||
Logical :: SoundFloorCollision , SoundCrownCollision | |||
@@ -50,7 +50,7 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver | |||
!write(*,*) 'TD_RemoveVolume,Get_JointConnectionPossible=' , TD_RemoveVolume,Get_JointConnectionPossible() | |||
if (TD_RemoveVolume > 0.) call DisconnectingPipe !! .and. Get_JointConnectionPossible() == .false.) call DisconnectingPipe | |||
if (TD_Vol%RemoveVolume > 0.) call DisconnectingPipe !! .and. Get_JointConnectionPossible() == .false.) call DisconnectingPipe | |||
IF (KickFlux .AND. NOT(KickOffBottom)) THEN | |||
@@ -61,7 +61,7 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver | |||
IF ( MudSystem%NewInfluxNumber > 0 ) THEN | |||
!write(*,*) 'KickOffBottom , ROP=' , KickOffBottom , Rate_of_Penetration | |||
!write(*,*) 'KickOffBottom , ROP=' , KickOffBottom , ROP_Bit%RateOfPenetration | |||
call Kick_Migration | |||
endif | |||
@@ -108,8 +108,7 @@ subroutine CirculationCodeSelect ! is called in subroutine Fluid_Flow_Solver | |||
ENDIF | |||
ENDDO | |||
MudSystem%KickNumber = KickNumber | |||
MudSystem%KickNumber = KickNumber | |||
MudSystem%LostInTripOutIsDone= .false. | |||
if( MudSystem%DeltaVolumeOp >= 0.0 .and. Get_KellyConnection()==KELLY_CONNECTION_STRING) then | |||
@@ -21,7 +21,7 @@ subroutine DisconnectingPipe ! is called in subroutine CirculationCodeSelect | |||
!TD_RemoveVolume= TD_RemoveVolume* 7.48051948 ! ft^3 to gal | |||
ExcessMudVolume= sum(MudSystem%St_MudDischarged_Volume%Array(:)) - sum(MudSystem%PipeSection_VolumeCapacity(2:F_StringIntervalCounts)) | |||
ExcessMudVolume= sum(MudSystem%St_MudDischarged_Volume%Array(:)) - sum(MudSystem%PipeSection_VolumeCapacity(2:F_Counts%StringIntervalCounts)) | |||
! ======if(ExcessMudVolume <= 0.) No Modification Needed Because Removed Pipe was Empty===== | |||
@@ -44,20 +44,20 @@ subroutine ElementsCreation ! is called in subroutine Fluid_Flow_Solver | |||
ALLOCATE (MudSystem%Xstart_PipeSection(F_StringIntervalCounts+F_AnnulusIntervalCounts),MudSystem%Xend_PipeSection(F_StringIntervalCounts+F_AnnulusIntervalCounts) & | |||
,MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+F_AnnulusIntervalCounts),MudSystem%Area_PipeSectionFt(F_StringIntervalCounts+F_AnnulusIntervalCounts), & | |||
MudSystem%GeoType(F_StringIntervalCounts+F_AnnulusIntervalCounts),MudSystem%OD_PipeSectionInch(F_StringIntervalCounts+F_AnnulusIntervalCounts),MudSystem%ID_PipeSectionInch(F_StringIntervalCounts+F_AnnulusIntervalCounts)) | |||
ALLOCATE (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+F_Counts%AnnulusIntervalCounts),MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts+F_Counts%AnnulusIntervalCounts) & | |||
,MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+F_Counts%AnnulusIntervalCounts),MudSystem%Area_PipeSectionFt(F_Counts%StringIntervalCounts+F_Counts%AnnulusIntervalCounts), & | |||
MudSystem%GeoType(F_Counts%StringIntervalCounts+F_Counts%AnnulusIntervalCounts),MudSystem%OD_PipeSectionInch(F_Counts%StringIntervalCounts+F_Counts%AnnulusIntervalCounts),MudSystem%ID_PipeSectionInch(F_Counts%StringIntervalCounts+F_Counts%AnnulusIntervalCounts)) | |||
ALLOCATE (MudSystem%Xstart_OpSection(F_BottomHoleIntervalCounts),MudSystem%Xend_OpSection(F_BottomHoleIntervalCounts) & | |||
,MudSystem%OpSection_VolumeCapacity(F_BottomHoleIntervalCounts),MudSystem%Area_OpSectionFt(F_BottomHoleIntervalCounts), & | |||
MudSystem%GeoTypeOp(F_BottomHoleIntervalCounts),MudSystem%OD_OpSectionInch(F_BottomHoleIntervalCounts),MudSystem%ID_OpSectionInch(F_BottomHoleIntervalCounts)) | |||
ALLOCATE (MudSystem%Xstart_OpSection(F_Counts%BottomHoleIntervalCounts),MudSystem%Xend_OpSection(F_Counts%BottomHoleIntervalCounts) & | |||
,MudSystem%OpSection_VolumeCapacity(F_Counts%BottomHoleIntervalCounts),MudSystem%Area_OpSectionFt(F_Counts%BottomHoleIntervalCounts), & | |||
MudSystem%GeoTypeOp(F_Counts%BottomHoleIntervalCounts),MudSystem%OD_OpSectionInch(F_Counts%BottomHoleIntervalCounts),MudSystem%ID_OpSectionInch(F_Counts%BottomHoleIntervalCounts)) | |||
MudSystem%OpSection=0 | |||
MudSystem%isection=0 | |||
DO iisection=1, F_IntervalsTotalCounts | |||
DO iisection=1, F_Counts%IntervalsTotalCounts | |||
IF (F_Interval(iisection)%GeoType == 1) THEN | |||
MudSystem%OpSection= MudSystem%OpSection+1 | |||
MudSystem%Xstart_OpSection(MudSystem%OpSection)= (F_Interval(iisection)%StartDepth) | |||
@@ -113,7 +113,7 @@ ALLOCATE (MudSystem%Xstart_OpSection(F_BottomHoleIntervalCounts),MudSystem%Xend_ | |||
MudSystem%NoPipeSections= MudSystem%isection ! sections in string and annulus(GeoType 0 & 2) | |||
DO OpSection= 1,F_BottomHoleIntervalCounts | |||
DO OpSection= 1,F_Counts%BottomHoleIntervalCounts | |||
MudSystem%OpSection_VolumeCapacity(OpSection)= MudSystem%Area_OpSectionFt(OpSection)* ABS(MudSystem%Xend_OpSection(OpSection)-MudSystem%Xstart_OpSection(OpSection))* 7.48051948d0 !REAL(F_Interval(iisection)%Volume) | |||
ENDDO | |||
MudSystem%OpSection=OpSection | |||
@@ -139,20 +139,20 @@ ALLOCATE (MudSystem%Xstart_OpSection(F_BottomHoleIntervalCounts),MudSystem%Xend_ | |||
call MudSystem%Hz_MudOrKick%AddToFirst (0) | |||
call MudSystem%St_MudDischarged_Volume%AddToFirst(sum(MudSystem%PipeSection_VolumeCapacity(2:F_StringIntervalCounts))) !startup initial | |||
call MudSystem%St_MudDischarged_Volume%AddToFirst(sum(MudSystem%PipeSection_VolumeCapacity(2:F_Counts%StringIntervalCounts))) !startup initial | |||
call MudSystem%St_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_PipeSection(2)) | |||
call MudSystem%St_Mud_Backhead_section%AddToFirst (2) | |||
call MudSystem%St_Mud_Forehead_X%AddToFirst (MudSystem%Xend_PipeSection(F_StringIntervalCounts)) | |||
call MudSystem%St_Mud_Forehead_section%AddToFirst (F_StringIntervalCounts) | |||
call MudSystem%St_Mud_Forehead_X%AddToFirst (MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts)) | |||
call MudSystem%St_Mud_Forehead_section%AddToFirst (F_Counts%StringIntervalCounts) | |||
call MudSystem%St_Density%AddToFirst (MudProperties%ActiveDensity) ! initial(ppg) | |||
call MudSystem%St_RemainedVolume_in_LastSection%AddToFirst (0.0d0) | |||
call MudSystem%St_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) | |||
call MudSystem%St_MudOrKick%AddToFirst (0) | |||
call MudSystem%Ann_MudDischarged_Volume%AddToFirst(sum(MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystem%NoPipeSections))) | |||
call MudSystem%Ann_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Backhead_section%AddToFirst (F_StringIntervalCounts+1) | |||
call MudSystem%Ann_MudDischarged_Volume%AddToFirst(sum(MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:MudSystem%NoPipeSections))) | |||
call MudSystem%Ann_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Backhead_section%AddToFirst (F_Counts%StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Forehead_X%AddToFirst (MudSystem%Xend_PipeSection(MudSystem%NoPipeSections)) | |||
call MudSystem%Ann_Mud_Forehead_section%AddToFirst (MudSystem%NoPipeSections) | |||
call MudSystem%Ann_Density%AddToFirst (MudProperties%ActiveDensity) ! initial(ppg) | |||
@@ -161,9 +161,9 @@ ALLOCATE (MudSystem%Xstart_OpSection(F_BottomHoleIntervalCounts),MudSystem%Xend_ | |||
call MudSystem%Ann_MudOrKick%AddToFirst (0) | |||
call MudSystem%Ann_CuttingMud%AddToFirst (0) | |||
MudSystem%OldPosition= MudSystem%Xend_PipeSection(F_StringIntervalCounts) | |||
MudSystem%OldPosition= MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts) | |||
MudSystem%OldAnnulusCapacity= sum(MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystem%NoPipeSections)) | |||
MudSystem%OldAnnulusCapacity= sum(MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:MudSystem%NoPipeSections)) | |||
call MudSystem%ChokeLine_MudDischarged_Volume%AddToFirst(MudSystem%ChokeLine_VolumeCapacity) | |||
@@ -177,18 +177,18 @@ ALLOCATE (MudSystem%Xstart_OpSection(F_BottomHoleIntervalCounts),MudSystem%Xend_ | |||
call MudSystem%ChokeLine_MudOrKick%AddToFirst (0) | |||
call MudSystem%Op_MudDischarged_Volume%AddToFirst (sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts))) | |||
call MudSystem%Op_MudDischarged_Volume%AddToFirst (sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts))) | |||
call MudSystem%Op_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_OpSection(1)) | |||
call MudSystem%Op_Mud_Backhead_section%AddToFirst (1) | |||
call MudSystem%Op_Mud_Forehead_X%AddToFirst (MudSystem%Xend_OpSection(F_BottomHoleIntervalCounts)) | |||
call MudSystem%Op_Mud_Forehead_section%AddToFirst (F_BottomHoleIntervalCounts) | |||
call MudSystem%Op_Mud_Forehead_X%AddToFirst (MudSystem%Xend_OpSection(F_Counts%BottomHoleIntervalCounts)) | |||
call MudSystem%Op_Mud_Forehead_section%AddToFirst (F_Counts%BottomHoleIntervalCounts) | |||
call MudSystem%Op_Density%AddToFirst (MudProperties%ActiveDensity) | |||
call MudSystem%Op_RemainedVolume_in_LastSection%AddToFirst (0.0d0) | |||
call MudSystem%Op_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) | |||
call MudSystem%Op_MudOrKick%AddToFirst (0) | |||
!F_StringIntervalCountsOld= F_StringIntervalCounts ! is used for adding new pipe to string | |||
MudSystem%F_StringIntervalCounts_Old= F_StringIntervalCounts ! is used for adding new pipe to string | |||
MudSystem%F_StringIntervalCounts_Old= F_Counts%StringIntervalCounts ! is used for adding new pipe to string | |||
MudSystem%FirstMudSet= 1 | |||
@@ -201,16 +201,16 @@ ALLOCATE (MudSystem%Xstart_OpSection(F_BottomHoleIntervalCounts),MudSystem%Xend_ | |||
!DeltaVolumeOp < 0 : Trip out | |||
MudSystem%DeltaVolumeOp= ((MudSystem%Xend_PipeSection(F_StringIntervalCounts)-MudSystem%OldPosition)*PII*((MudSystem%OD_PipeSectionInch(F_StringIntervalCounts+1)/12.0d0)**2)/4.0d0)* 7.48051948d0! ft^3 to gal ! D(in) | |||
MudSystem%DeltaVolumeOp= ((MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts)-MudSystem%OldPosition)*PII*((MudSystem%OD_PipeSectionInch(F_Counts%StringIntervalCounts+1)/12.0d0)**2)/4.0d0)* 7.48051948d0! ft^3 to gal ! D(in) | |||
MudSystem%DeltaVolumeOp = INT(MudSystem%DeltaVolumeOp * 100000.d0) / 100000.d0 | |||
MudSystem%DeltaVolumePipe= ((MudSystem%Xend_PipeSection(F_StringIntervalCounts)-MudSystem%OldPosition)*PII*((MudSystem%ID_PipeSectionInch(F_StringIntervalCounts+F_AnnulusIntervalCounts)/12.0d0)**2)/4.0d0)* 7.48051948d0! ft^3 to gal | |||
MudSystem%DeltaVolumePipe= ((MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts)-MudSystem%OldPosition)*PII*((MudSystem%ID_PipeSectionInch(F_Counts%StringIntervalCounts+F_Counts%AnnulusIntervalCounts)/12.0d0)**2)/4.0d0)* 7.48051948d0! ft^3 to gal | |||
MudSystem%DeltaVolumePipe = INT(MudSystem%DeltaVolumePipe * 100000.d0) / 100000.d0 | |||
!DeltaVolumeAnnulusCapacity= ((Xend_PipeSection(F_StringIntervalCounts)-OldPosition))*Area_PipeSectionFt(NoPipeSections)* 7.48051948d0! ft^3 to gal | |||
DrillStringSpeed = (MudSystem%Xend_PipeSection(F_StringIntervalCounts)-MudSystem%OldPosition) / 0.1 | |||
!DeltaVolumeAnnulusCapacity= ((Xend_PipeSection(F_Counts%StringIntervalCounts)-OldPosition))*Area_PipeSectionFt(NoPipeSections)* 7.48051948d0! ft^3 to gal | |||
DrillStringSpeed = (MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts)-MudSystem%OldPosition) / 0.1 | |||
MudSystem%DeltaVolumeAnnulusCapacity= sum(MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystem%NoPipeSections)) - MudSystem%OldAnnulusCapacity | |||
MudSystem%DeltaVolumeAnnulusCapacity= sum(MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:MudSystem%NoPipeSections)) - MudSystem%OldAnnulusCapacity | |||
!write(*,*) 'DeltaVolumeAnnulusCapacity= ' , DeltaVolumeAnnulusCapacity | |||
@@ -219,14 +219,14 @@ ALLOCATE (MudSystem%Xstart_OpSection(F_BottomHoleIntervalCounts),MudSystem%Xend_ | |||
!write(*,*) 'DeltaVolumeOp=' , DeltaVolumeOp | |||
! | |||
! | |||
!write(*,*) 'Bit here=' , Xend_PipeSection(F_StringIntervalCounts) | |||
!write(*,*) 'Bit here=' , Xend_PipeSection(F_Counts%StringIntervalCounts) | |||
MudSystem%OldAnnulusCapacity= sum(MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystem%NoPipeSections)) | |||
MudSystem%OldAnnulusCapacity= sum(MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:MudSystem%NoPipeSections)) | |||
MudSystem%OldPosition= MudSystem%Xend_PipeSection(F_StringIntervalCounts) | |||
MudSystem%OldPosition= MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts) | |||
! Needed for trip in or out: | |||
if (MudSystem%Hz_Mud_Backhead_X%Length() == 0) then | |||
@@ -238,18 +238,18 @@ ALLOCATE (MudSystem%Xstart_OpSection(F_BottomHoleIntervalCounts),MudSystem%Xend_ | |||
MudSystem%Hz_Mud_Backhead_X%Array(1)= MudSystem%Xstart_PipeSection(1) | |||
MudSystem%Hz_Mud_Backhead_section%Array(1)= 1 | |||
MudSystem%AddedElementsToString = F_StringIntervalCounts - MudSystem%F_StringIntervalCounts_Old | |||
MudSystem%AddedElementsToString = F_Counts%StringIntervalCounts - MudSystem%F_StringIntervalCounts_Old | |||
MudSystem%St_Mud_Backhead_X%Array(1)= MudSystem%Xstart_PipeSection(2) | |||
MudSystem%St_Mud_Backhead_section%Array(1)= 2 | |||
MudSystem%Ann_Mud_Backhead_X%Array(1)= MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1) | |||
MudSystem%Ann_Mud_Backhead_section%Array(1)= F_StringIntervalCounts+1 | |||
MudSystem%Ann_Mud_Backhead_X%Array(1)= MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1) | |||
MudSystem%Ann_Mud_Backhead_section%Array(1)= F_Counts%StringIntervalCounts+1 | |||
MudSystem%Op_Mud_Backhead_X%Array(1)= MudSystem%Xstart_OpSection(1) | |||
MudSystem%Op_Mud_Backhead_section%Array(1)= 1 | |||
MudSystem%ChokeLine_Mud_Backhead_X%Array(1)= 0. | |||
MudSystem%ChokeLine_Mud_Backhead_section%Array(1)= 1 | |||
MudSystem%F_StringIntervalCounts_Old= F_StringIntervalCounts | |||
MudSystem%F_StringIntervalCounts_Old= F_Counts%StringIntervalCounts | |||
!write(*,*) 'Xstart_PipeSection(2)' , Xstart_PipeSection(2) | |||
!write(*,*) 'Xend_PipeSection(1)' , Xend_PipeSection(1) | |||
@@ -79,12 +79,12 @@ subroutine Instructor_CirculationMud_Edit ! is called in subroutine Circulat | |||
if ( DownHole%AnnDrillMud == .true. .and. (Rate_of_Penetration>0. .and. MudSystem%DeltaVolumeOp>0.0) ) then | |||
if ( DownHole%AnnDrillMud == .true. .and. (ROP_Bit%RateOfPenetration>0. .and. MudSystem%DeltaVolumeOp>0.0) ) then | |||
do imud= 1, MudSystem%Ann_Density%Length() | |||
if ( MudSystem%Ann_MudOrKick%Array(imud) == 0 ) then | |||
MudSystem%Ann_Density%Array(imud)= (MudSystem%St_Density%Last() * MudSystem%AnnulusFlowRate + 141.4296E-4*Rate_of_Penetration*Diameter_of_Bit**2)/(MudSystem%AnnulusFlowRate+6.7995E-4*Rate_of_Penetration*Diameter_of_Bit**2) | |||
MudSystem%Ann_Density%Array(imud)= (MudSystem%St_Density%Last() * MudSystem%AnnulusFlowRate + 141.4296E-4*ROP_Bit%RateOfPenetration*ROP_Spec%DiameterOfBit**2)/(MudSystem%AnnulusFlowRate+6.7995E-4*ROP_Bit%RateOfPenetration*ROP_Spec%DiameterOfBit**2) | |||
MudSystem%Ann_CuttingMud%Array(imud)= 1 | |||
endif | |||
@@ -107,10 +107,10 @@ if (MudSystem%Op_KickLoc == MudSystem%Op_MudOrKick%Length () .and. MudSystem%Ann | |||
call MudSystem%Ann_Density%AddToFirst (MudSystem%Op_Density%Last()) | |||
call MudSystem%Ann_MudDischarged_Volume%AddToFirst (MudSystem%MinKickDv) | |||
call MudSystem%Ann_Mud_Forehead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Forehead_section%AddToFirst (F_StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Backhead_section%AddToFirst (F_StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Forehead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Forehead_section%AddToFirst (F_Counts%StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Backhead_section%AddToFirst (F_Counts%StringIntervalCounts+1) | |||
call MudSystem%Ann_RemainedVolume_in_LastSection%AddToFirst (0.0d0) | |||
call MudSystem%Ann_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) | |||
call MudSystem%Ann_MudOrKick%AddToFirst (KickNumber) | |||
@@ -223,10 +223,10 @@ if (MudSystem%Op_KickLoc == MudSystem%Op_MudOrKick%Length () .and. MudSystem%Ann | |||
call MudSystem%Ann_Density%AddToFirst (MudSystem%Op_Density%Last()) | |||
call MudSystem%Ann_MudDischarged_Volume%AddToFirst (MudSystem%MinKickDv) | |||
call MudSystem%Ann_Mud_Forehead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Forehead_section%AddToFirst (F_StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Backhead_section%AddToFirst (F_StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Forehead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Forehead_section%AddToFirst (F_Counts%StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Backhead_section%AddToFirst (F_Counts%StringIntervalCounts+1) | |||
call MudSystem%Ann_RemainedVolume_in_LastSection%AddToFirst (0.0d0) | |||
call MudSystem%Ann_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) | |||
call MudSystem%Ann_MudOrKick%AddToFirst (KickNumber) | |||
@@ -315,7 +315,7 @@ if (MudSystem%Op_KickLoc == MudSystem%Op_MudOrKick%Length () .and. MudSystem%Ann | |||
! | |||
! call Ann_Density%AddToFirst (Kick_Density) | |||
! call Ann_MudDischarged_Volume%AddToFirst (KickDv) | |||
! call Ann_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(F_StringIntervalCounts+1)) | |||
! call Ann_Mud_Forehead_X%AddToFirst (Xstart_PipeSection(F_Counts%StringIntervalCounts+1)) | |||
! call Ann_Mud_Forehead_section%AddToFirst (F_StringIntervalCounts+1) | |||
! call Ann_Mud_Backhead_X%AddToFirst (Xstart_PipeSection(F_StringIntervalCounts+1)) | |||
! call Ann_Mud_Backhead_section%AddToFirst (F_StringIntervalCounts+1) | |||
@@ -13,7 +13,7 @@ module MudSystemModule | |||
use CError | |||
use CLog1 | |||
USE CDataDisplayConsoleVariables | |||
use CStudentStationVariables! , PitGainLossReset=>PitGainLossZero | |||
use CStudentStationVariables !, PitGainLossReset=>PitGainLossZero | |||
implicit none | |||
@@ -31,9 +31,9 @@ subroutine PlotFinalMudElements ! is called in subroutine CirculationCodeSel | |||
if (ChokeControlPanel%ChokePanelStrokeResetSwitch == 1) then | |||
write(*,*) 'well cap=' , sum(MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystem%NoPipeSections)) + sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) | |||
MudSystem%DeltaWellCap= sum(MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystem%NoPipeSections)) + sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) - MudSystem%WellCapOld | |||
MudSystem%WellCapOld= sum(MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystem%NoPipeSections)) + sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) | |||
write(*,*) 'well cap=' , sum(MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:MudSystem%NoPipeSections)) + sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts)) | |||
MudSystem%DeltaWellCap= sum(MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:MudSystem%NoPipeSections)) + sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts)) - MudSystem%WellCapOld | |||
MudSystem%WellCapOld= sum(MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:MudSystem%NoPipeSections)) + sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts)) | |||
write(*,*) 'cap_reset,DeltaWellCap=' , MudSystem%DeltaWellCap | |||
endif | |||
@@ -104,7 +104,7 @@ endif | |||
jmud= 1 | |||
jsection= 2 | |||
DO WHILE(jmud <= MudSystem%St_Mud_Forehead_X%Length() .and. jsection<=F_StringIntervalCounts) | |||
DO WHILE(jmud <= MudSystem%St_Mud_Forehead_X%Length() .and. jsection<=F_Counts%StringIntervalCounts) | |||
jelement= jelement+1 | |||
MudSystem%TrueMinValue= min(MudSystem%St_Mud_Forehead_X%Array(jmud), MudSystem%Xend_PipeSection(jsection)) | |||
@@ -134,7 +134,7 @@ endif | |||
jmud= 1 | |||
jsection= F_StringIntervalCounts+1 | |||
jsection= F_Counts%StringIntervalCounts+1 | |||
DO WHILE(jmud<= MudSystem%Ann_Mud_Forehead_X%Length() .and. jsection<=MudSystem%NoPipeSections) | |||
jelement= jelement+1 | |||
@@ -220,7 +220,7 @@ endif | |||
DO WHILE(jopmud<= MudSystem%Op_Mud_Forehead_X%Length() .and. jopsection<=F_BottomHoleIntervalCounts) | |||
DO WHILE(jopmud<= MudSystem%Op_Mud_Forehead_X%Length() .and. jopsection<=F_Counts%BottomHoleIntervalCounts) | |||
jopelement= jopelement+1 | |||
MudSystem%TrueMinValue= max(MudSystem%Op_Mud_Forehead_X%Array(jopmud), MudSystem%Xend_OpSection(jopsection)) | |||
@@ -269,7 +269,7 @@ endif | |||
!============================ UTUBE ============================= | |||
!IF (UtubePossibility== .true. .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. WellHeadIsOpen) THEN | |||
IF (MudSystem%UtubePossibility== .true. .and. TD_FluidStringConnectionMode==0 .and. MudSystem%WellHeadIsOpen .AND. NoGasPocket == 0) THEN | |||
IF (MudSystem%UtubePossibility== .true. .and. TD_StConn%FluidStringConnectionMode==0 .and. MudSystem%WellHeadIsOpen .AND. NoGasPocket == 0) THEN | |||
CALL WellPressureDataTransfer | |||
!WRITE (*,*) ' U-Tube Done 1' | |||
CALL Utube | |||
@@ -158,7 +158,7 @@ imud=0 | |||
!if (F_StringIntervalCounts > F_StringIntervalCountsOld) then ! StringUpdate == .true. | |||
if (MudSystem%AddedElementsToString > 0) then ! StringUpdate == .true. | |||
!NoPipeAdded= F_StringIntervalCounts - F_StringIntervalCountsOld | |||
!NoPipeAdded= F_Counts%StringIntervalCounts - F_StringIntervalCountsOld | |||
MudSystem%NewPipeFilling=0 | |||
@@ -277,11 +277,11 @@ imud=0 | |||
MudSystem%StMudVolumeSum = MudSystem%StMudVolumeSum + MudSystem%St_MudDischarged_Volume%Array(imud) | |||
if ( MudSystem%StMudVolumeSum > sum(MudSystem%PipeSection_VolumeCapacity(2:F_StringIntervalCounts)) ) then | |||
if ( MudSystem%StMudVolumeSum > sum(MudSystem%PipeSection_VolumeCapacity(2:F_Counts%StringIntervalCounts)) ) then | |||
!IF (St_MudOrKick%Array(imud) == 0) THEN | |||
MudSystem%St_MudSaved_Density =MudSystem%St_Density%Array(imud) | |||
MudSystem%St_Saved_MudDischarged_Volume = MudSystem%StMudVolumeSum - sum(MudSystem%PipeSection_VolumeCapacity(2:F_StringIntervalCounts)) | |||
MudSystem%St_Saved_MudDischarged_Volume = MudSystem%StMudVolumeSum - sum(MudSystem%PipeSection_VolumeCapacity(2:F_Counts%StringIntervalCounts)) | |||
!ELSEIF (St_MudOrKick%Array(imud) > 0 .AND. St_MudOrKick%Array(imud) <100) THEN ! 104= AIR | |||
! St_Kick_Saved_Volume = StMudVolumeSum - sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) | |||
! Saved_St_MudOrKick= St_MudOrKick%Array (imud) | |||
@@ -351,10 +351,10 @@ imud=0 | |||
MudSystem%St_RemainedVolume_in_LastSection%Array(imud)= MudSystem%St_MudDischarged_Volume%Array(imud)- MudSystem%St_EmptyVolume_inBackheadLocation%Array(imud) | |||
do | |||
if (MudSystem%isection > F_StringIntervalCounts) then ! last pipe section(string exit) F_StringIntervalCounts includes Horizontal line | |||
if (MudSystem%isection > F_Counts%StringIntervalCounts) then ! last pipe section(string exit) F_Counts%StringIntervalCounts includes Horizontal line | |||
MudSystem%St_MudDischarged_Volume%Array(imud)= MudSystem%St_MudDischarged_Volume%Array(imud)- MudSystem%St_RemainedVolume_in_LastSection%Array(imud) | |||
MudSystem%St_Mud_Forehead_X%Array(imud)= MudSystem%Xend_PipeSection(F_StringIntervalCounts) | |||
MudSystem%St_Mud_Forehead_section%Array(imud)= F_StringIntervalCounts | |||
MudSystem%St_Mud_Forehead_X%Array(imud)= MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts) | |||
MudSystem%St_Mud_Forehead_section%Array(imud)= F_Counts%StringIntervalCounts | |||
if (MudSystem%St_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the string | |||
call RemoveStringMudArrays(imud) | |||
@@ -474,13 +474,13 @@ imud=0 | |||
MudSystem%OpMudVolumeSum= MudSystem%OpMudVolumeSum + MudSystem%Op_MudDischarged_Volume%Array(imud) | |||
if ( MudSystem%OpMudVolumeSum > sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ) then | |||
if ( MudSystem%OpMudVolumeSum > sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts)) ) then | |||
IF (MudSystem%Op_MudOrKick%Array(imud) == 0) THEN | |||
MudSystem%Op_MudSaved_Density = MudSystem%Op_Density%Array(imud) | |||
MudSystem%Op_Saved_MudDischarged_Volume = MudSystem%OpMudVolumeSum - sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) | |||
MudSystem%Op_Saved_MudDischarged_Volume = MudSystem%OpMudVolumeSum - sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts)) | |||
ELSE | |||
MudSystem%Op_Kick_Saved_Volume = MudSystem%OpMudVolumeSum - sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) | |||
MudSystem%Op_Kick_Saved_Volume = MudSystem%OpMudVolumeSum - sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts)) | |||
!write(*,*) 'cond 1- Op_MudOrKick%Array (imud),Op_Density%Array(imud):' ,Op_MudOrKick%Array (imud),Op_Density%Array(imud) | |||
MudSystem%Saved_Op_MudOrKick= MudSystem%Op_MudOrKick%Array (imud) | |||
MudSystem%Op_KickSaved_Density= MudSystem%Op_Density%Array(imud) | |||
@@ -517,8 +517,8 @@ imud=0 | |||
!if (iLoc == 1) then | |||
MudSystem%MudSection= F_StringIntervalCounts+1 | |||
MudSystem%BackheadX= MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1) | |||
MudSystem%MudSection= F_Counts%StringIntervalCounts+1 | |||
MudSystem%BackheadX= MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1) | |||
!elseif (iLoc == 2) then | |||
! MudSection= Kick_Forehead_section | |||
! BackheadX= Kick_Forehead_X | |||
@@ -526,7 +526,7 @@ imud=0 | |||
!========================ANNULUS ENTRANCE==================== | |||
!if (KickMigration_2SideBit == .FALSE.) then ! because its effect is applied in Migration Code | |||
! !write(*,*) 'iloc=====' , iLoc bejaye Rate_of_Penetration ==0. in bude: DeltaVolumeOp == 0.0 | |||
! !write(*,*) 'iloc=====' , iLoc bejaye ROP_Bit%RateOfPenetration ==0. in bude: DeltaVolumeOp == 0.0 | |||
! if (ABS(AnnulusSuctionDensity_OldMudSystem%St_Density%Last()) >= DensityMixTol .OR. (DeltaVolumeOp == 0.0 .and. ABS(Ann_Density%Array(iLoc)MudSystem%St_Density%Last())>=DensityMixTol .and. MudSystem%AnnulusFlowRate/=0.0d0) ) then ! new mud is pumped | |||
! call Ann_Density%AddTo (iLocMudSystem%St_Density%Last()) | |||
! call Ann_MudDischarged_Volume%AddTo (iLoc,0.0d0) | |||
@@ -579,7 +579,7 @@ imud=0 | |||
!========================Tripping In==================== | |||
!write(*,*) 'DeltaVolumeOp=' , DeltaVolumeOp | |||
if (Rate_of_Penetration==0.) then ! .and. Op_MudOrKick%Last() == 0) then ! trip in mode(loole paeen) Mud | |||
if (ROP_Bit%RateOfPenetration==0.) then ! .and. Op_MudOrKick%Last() == 0) then ! trip in mode(loole paeen) Mud | |||
!write(*,*) 'Tripping In' | |||
!write(*,*) 'before' ,'Ann_Volume%Array(1)=' , Ann_MudDischarged_Volume%Array(1) | |||
@@ -593,10 +593,10 @@ imud=0 | |||
write(*,*) 'Kick influx enters Annulus' | |||
call MudSystem%Ann_Density%AddToFirst (MudSystem%Op_KickSaved_Density) | |||
call MudSystem%Ann_MudDischarged_Volume%AddToFirst (MudSystem%Op_Kick_Saved_Volume) | |||
call MudSystem%Ann_Mud_Forehead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Forehead_section%AddToFirst (F_StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Backhead_section%AddToFirst (F_StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Forehead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Forehead_section%AddToFirst (F_Counts%StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Backhead_section%AddToFirst (F_Counts%StringIntervalCounts+1) | |||
call MudSystem%Ann_RemainedVolume_in_LastSection%AddToFirst (0.0d0) | |||
call MudSystem%Ann_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) | |||
call MudSystem%Ann_MudOrKick%AddToFirst (MudSystem%Saved_Op_MudOrKick) !<<<<<<<< | |||
@@ -614,9 +614,9 @@ imud=0 | |||
if ((Rate_of_Penetration==0 .and. abs(MudSystem%Ann_Density%Array(MudSystem%iLoc)-MudSystem%NewDensity)< MudSystem%DensityMixTol) & | |||
.or. (Rate_of_Penetration>0. .and. MudSystem%Ann_CuttingMud%Array(MudSystem%iLoc)==1 .and. abs(MudSystem%Ann_Density%Array(MudSystem%iLoc)-MudSystem%NewDensity)< MudSystem%CuttingDensityMixTol) & | |||
.or. (Rate_of_Penetration>0. .and. MudSystem%Ann_CuttingMud%Array(MudSystem%iLoc)==0 .and. MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc) < 42.) ) then ! 1-Pockets are Merged | |||
if ((ROP_Bit%RateOfPenetration==0 .and. abs(MudSystem%Ann_Density%Array(MudSystem%iLoc)-MudSystem%NewDensity)< MudSystem%DensityMixTol) & | |||
.or. (ROP_Bit%RateOfPenetration>0. .and. MudSystem%Ann_CuttingMud%Array(MudSystem%iLoc)==1 .and. abs(MudSystem%Ann_Density%Array(MudSystem%iLoc)-MudSystem%NewDensity)< MudSystem%CuttingDensityMixTol) & | |||
.or. (ROP_Bit%RateOfPenetration>0. .and. MudSystem%Ann_CuttingMud%Array(MudSystem%iLoc)==0 .and. MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc) < 42.) ) then ! 1-Pockets are Merged | |||
MudSystem%Ann_Density%Array(MudSystem%iLoc)= (MudSystem%Ann_Density%Array(MudSystem%iLoc)*MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc)+MudSystem%NewDensity*MudSystem%NewVolume)/(MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc)+MudSystem%NewVolume) | |||
MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc)= MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc)+MudSystem%NewVolume | |||
@@ -651,7 +651,7 @@ imud=0 | |||
!========================Drilling Mode======================== | |||
if (Rate_of_Penetration>0. .and. MudSystem%DeltaVolumeOp>0.0) then ! trip in mode(loole paeen) DrillingMode== .true. | |||
if (ROP_Bit%RateOfPenetration>0. .and. MudSystem%DeltaVolumeOp>0.0) then ! trip in mode(loole paeen) DrillingMode== .true. | |||
!write(*,*) 'Drilling Mode' | |||
!if ( MudIsChanged== .true. ) then | |||
@@ -660,7 +660,7 @@ imud=0 | |||
!write(*,*) 'before' ,'Ann_Volume%Array(1)=' , Ann_MudDischarged_Volume%Array(1) | |||
!MudSystem%NewDensity= MudSystem%St_Density%Last() * MudSystem%AnnulusFlowRate + 141.4296E-4*Rate_of_Penetration*Diameter_of_Bit**2)/(MudSystem%AnnulusFlowRate+6.7995E-4*Rate_of_Penetration*Diameter_of_Bit**2) | |||
!MudSystem%NewDensity= MudSystem%St_Density%Last() * MudSystem%AnnulusFlowRate + 141.4296E-4*ROP_Bit%RateOfPenetration*ROP_Spec%DiameterOfBit**2)/(MudSystem%AnnulusFlowRate+6.7995E-4*ROP_Bit%RateOfPenetration*Diameter_of_Bit**2) | |||
MudSystem%NewDensity=MudSystem%St_Density%Last() | |||
@@ -683,10 +683,10 @@ imud=0 | |||
!write(*,*) 'Saved_Op_MudOrKick=',Saved_Op_MudOrKick | |||
call MudSystem%Ann_Density%AddToFirst (MudSystem%Op_KickSaved_Density) | |||
call MudSystem%Ann_MudDischarged_Volume%AddToFirst (MudSystem%Op_Kick_Saved_Volume) | |||
call MudSystem%Ann_Mud_Forehead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Forehead_section%AddToFirst (F_StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Backhead_section%AddToFirst (F_StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Forehead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Forehead_section%AddToFirst (F_Counts%StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Backhead_section%AddToFirst (F_Counts%StringIntervalCounts+1) | |||
call MudSystem%Ann_RemainedVolume_in_LastSection%AddToFirst (0.0d0) | |||
call MudSystem%Ann_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) | |||
call MudSystem%Ann_MudOrKick%AddToFirst (MudSystem%Saved_Op_MudOrKick) !<<<<<<<< | |||
@@ -780,9 +780,9 @@ imud=0 | |||
endif | |||
if ((Rate_of_Penetration==0 .and. abs(MudSystem%Ann_Density%Array(MudSystem%iLoc)-MudSystem%NewDensity)< MudSystem%DensityMixTol) & | |||
.or. (Rate_of_Penetration>0. .and. MudSystem%Ann_CuttingMud%Array(MudSystem%iLoc)==1 .and. abs(MudSystem%Ann_Density%Array(MudSystem%iLoc)-MudSystem%NewDensity)< MudSystem%CuttingDensityMixTol) & | |||
.or. (Rate_of_Penetration>0. .and. MudSystem%Ann_CuttingMud%Array(MudSystem%iLoc)==0 .and. MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc) < 42.) ) then ! 1-Pockets are Merged | |||
if ((ROP_Bit%RateOfPenetration==0 .and. abs(MudSystem%Ann_Density%Array(MudSystem%iLoc)-MudSystem%NewDensity)< MudSystem%DensityMixTol) & | |||
.or. (ROP_Bit%RateOfPenetration>0. .and. MudSystem%Ann_CuttingMud%Array(MudSystem%iLoc)==1 .and. abs(MudSystem%Ann_Density%Array(MudSystem%iLoc)-MudSystem%NewDensity)< MudSystem%CuttingDensityMixTol) & | |||
.or. (ROP_Bit%RateOfPenetration>0. .and. MudSystem%Ann_CuttingMud%Array(MudSystem%iLoc)==0 .and. MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc) < 42.) ) then ! 1-Pockets are Merged | |||
MudSystem%Ann_Density%Array(MudSystem%iLoc)= (MudSystem%Ann_Density%Array(MudSystem%iLoc)*MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc)+MudSystem%NewDensity*MudSystem%NewVolume)/(MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc)+MudSystem%NewVolume) | |||
MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc)= MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc)+MudSystem%NewVolume | |||
@@ -854,13 +854,13 @@ imud=0 | |||
MudSystem%AnnMudVolumeSum= MudSystem%AnnMudVolumeSum + MudSystem%Ann_MudDischarged_Volume%Array(imud) | |||
if ( MudSystem%AnnMudVolumeSum > sum(MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystem%NoPipeSections)) ) then | |||
if ( MudSystem%AnnMudVolumeSum > sum(MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:MudSystem%NoPipeSections)) ) then | |||
IF (MudSystem%Ann_MudOrKick%Array(imud) == 0) THEN | |||
MudSystem%Ann_MudSaved_Density = MudSystem%Ann_Density%Array(imud) | |||
MudSystem%Ann_Saved_MudDischarged_Volume = MudSystem%AnnMudVolumeSum - sum(MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystem%NoPipeSections)) | |||
MudSystem%Ann_Saved_MudDischarged_Volume = MudSystem%AnnMudVolumeSum - sum(MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:MudSystem%NoPipeSections)) | |||
ELSEIF (MudSystem%Ann_MudOrKick%Array(imud) > 0 .AND. MudSystem%Ann_MudOrKick%Array(imud) <100) THEN ! 104= AIR | |||
MudSystem%Ann_Kick_Saved_Volume = MudSystem%AnnMudVolumeSum - sum(MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystem%NoPipeSections)) | |||
MudSystem%Ann_Kick_Saved_Volume = MudSystem%AnnMudVolumeSum - sum(MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:MudSystem%NoPipeSections)) | |||
MudSystem%Saved_Ann_MudOrKick= MudSystem%Ann_MudOrKick%Array (imud) | |||
MudSystem%Ann_KickSaved_Density= MudSystem%Ann_Density%Array(imud) | |||
END IF | |||
@@ -1053,11 +1053,11 @@ imud=0 | |||
MudSystem%Op_RemainedVolume_in_LastSection%Array(imud)= MudSystem%Op_MudDischarged_Volume%Array(imud)- MudSystem%Op_EmptyVolume_inBackheadLocation%Array(imud) | |||
do | |||
if (MudSystem%isection > F_BottomHoleIntervalCounts) then ! last pipe section(well exit) | |||
if (MudSystem%isection > F_Counts%BottomHoleIntervalCounts) then ! last pipe section(well exit) | |||
!if( imud==1) KickDeltaVinAnnulus= Op_RemainedVolume_in_LastSection%Array(imud) ! Kick enters Annulus space | |||
MudSystem%Op_MudDischarged_Volume%Array(imud)= MudSystem%Op_MudDischarged_Volume%Array(imud)- MudSystem%Op_RemainedVolume_in_LastSection%Array(imud) | |||
MudSystem%Op_Mud_Forehead_X%Array(imud)= MudSystem%Xend_OpSection(F_BottomHoleIntervalCounts) | |||
MudSystem%Op_Mud_Forehead_section%Array(imud)= F_BottomHoleIntervalCounts | |||
MudSystem%Op_Mud_Forehead_X%Array(imud)= MudSystem%Xend_OpSection(F_Counts%BottomHoleIntervalCounts) | |||
MudSystem%Op_Mud_Forehead_section%Array(imud)= F_Counts%BottomHoleIntervalCounts | |||
if (MudSystem%Op_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well | |||
call RemoveOpMudArrays(imud) | |||
@@ -1083,7 +1083,7 @@ imud=0 | |||
endif | |||
! for OP remove: | |||
if (MudSystem%Op_Mud_Forehead_X%Array(imud)== MudSystem%Xend_OpSection(F_BottomHoleIntervalCounts)) then | |||
if (MudSystem%Op_Mud_Forehead_X%Array(imud)== MudSystem%Xend_OpSection(F_Counts%BottomHoleIntervalCounts)) then | |||
MudSystem%totalLength = MudSystem%Op_MudDischarged_Volume%Length() | |||
do while(imud < MudSystem%totalLength) | |||
@@ -1101,7 +1101,7 @@ imud=0 | |||
!if (Op_Mud_Forehead_X%Array(imud)== Xend_OpSection(F_BottomHoleIntervalCounts)) then | |||
!if (Op_Mud_Forehead_X%Array(imud)== Xend_OpSection(F_Counts%BottomHoleIntervalCounts)) then | |||
! totalLength = Op_MudDischarged_Volume%Length() | |||
! do while(imud <= totalLength) | |||
! | |||
@@ -282,10 +282,10 @@ imud=0 | |||
do imud=1, MudSystem%St_MudDischarged_Volume%Length() | |||
MudSystem%StMudVolumeSum= MudSystem%StMudVolumeSum + MudSystem%St_MudDischarged_Volume%Array(imud) | |||
if ( MudSystem%StMudVolumeSum > sum(MudSystem%PipeSection_VolumeCapacity(2:F_StringIntervalCounts)) ) then | |||
if ( MudSystem%StMudVolumeSum > sum(MudSystem%PipeSection_VolumeCapacity(2:F_Counts%StringIntervalCounts)) ) then | |||
!IF (St_MudOrKick%Array(imud) == 0) THEN | |||
MudSystem%St_MudSaved_Density = MudSystem%St_Density%Array(imud) | |||
MudSystem%St_Saved_MudDischarged_Volume = MudSystem%StMudVolumeSum - sum(MudSystem%PipeSection_VolumeCapacity(2:F_StringIntervalCounts)) | |||
MudSystem%St_Saved_MudDischarged_Volume = MudSystem%StMudVolumeSum - sum(MudSystem%PipeSection_VolumeCapacity(2:F_Counts%StringIntervalCounts)) | |||
!ELSEIF (St_MudOrKick%Array(imud) > 0 .AND. St_MudOrKick%Array(imud) <100) THEN ! 104= AIR | |||
! St_Kick_Saved_Volume = StMudVolumeSum - sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) | |||
! Saved_St_MudOrKick= St_MudOrKick%Array (imud) | |||
@@ -349,10 +349,10 @@ imud=0 | |||
MudSystem%St_RemainedVolume_in_LastSection%Array(imud)= MudSystem%St_MudDischarged_Volume%Array(imud)- MudSystem%St_EmptyVolume_inBackheadLocation%Array(imud) | |||
do | |||
if (MudSystem%isection > F_StringIntervalCounts) then ! last pipe section(string exit) | |||
if (MudSystem%isection > F_Counts%StringIntervalCounts) then ! last pipe section(string exit) | |||
MudSystem%St_MudDischarged_Volume%Array(imud)= MudSystem%St_MudDischarged_Volume%Array(imud)- MudSystem%St_RemainedVolume_in_LastSection%Array(imud) | |||
MudSystem%St_Mud_Forehead_X%Array(imud)= MudSystem%Xend_PipeSection(F_StringIntervalCounts) | |||
MudSystem%St_Mud_Forehead_section%Array(imud)= F_StringIntervalCounts | |||
MudSystem%St_Mud_Forehead_X%Array(imud)= MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts) | |||
MudSystem%St_Mud_Forehead_section%Array(imud)= F_Counts%StringIntervalCounts | |||
if (MudSystem%St_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the string | |||
call RemoveStringMudArrays(imud) | |||
@@ -408,7 +408,7 @@ imud=0 | |||
iloc_edited= 0 | |||
!write(*,*) sum(Op_MudDischarged_Volume%Array(:)) , ((MudSystem%AnnulusFlowRate/60.d0)*DeltaT_Mudline) , Ann_MudDischarged_Volume%First() , sum(OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) | |||
if (MudSystem%iLoc==2 .and. sum(MudSystem%Op_MudDischarged_Volume%Array(:))+((MudSystem%AnnulusFlowRate/60.d0)*MudSystem%DeltaT_Mudline)+MudSystem%Ann_MudDischarged_Volume%First() < sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ) then | |||
if (MudSystem%iLoc==2 .and. sum(MudSystem%Op_MudDischarged_Volume%Array(:))+((MudSystem%AnnulusFlowRate/60.d0)*MudSystem%DeltaT_Mudline)+MudSystem%Ann_MudDischarged_Volume%First() < sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts)) ) then | |||
MudSystem%iLoc = 1 | |||
iloc_edited = 1 | |||
!write(*,*) 'hellooooooo' | |||
@@ -503,14 +503,14 @@ imud=0 | |||
MudSystem%OpMudVolumeSum= MudSystem%OpMudVolumeSum + MudSystem%Op_MudDischarged_Volume%Array(imud) | |||
if ( MudSystem%OpMudVolumeSum > sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ) then !1st mode | |||
if ( MudSystem%OpMudVolumeSum > sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts)) ) then !1st mode | |||
IF (MudSystem%Op_MudOrKick%Array(imud) == 0) THEN | |||
MudSystem%Op_MudSaved_Density = MudSystem%Op_Density%Array(imud) | |||
MudSystem%Op_Saved_MudDischarged_Volume = MudSystem%OpMudVolumeSum - sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) | |||
MudSystem%Op_Saved_MudDischarged_Volume = MudSystem%OpMudVolumeSum - sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts)) | |||
ELSE | |||
MudSystem%Op_Kick_Saved_Volume = MudSystem%OpMudVolumeSum - sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) | |||
MudSystem%Op_Kick_Saved_Volume = MudSystem%OpMudVolumeSum - sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts)) | |||
MudSystem%Saved_Op_MudOrKick= MudSystem%Op_MudOrKick%Array (imud) | |||
MudSystem%Op_KickSaved_Density= MudSystem%Op_Density%Array(imud) | |||
MudSystem%iLoc= 2 | |||
@@ -536,9 +536,9 @@ imud=0 | |||
enddo | |||
if ( sum(MudSystem%Op_MudDischarged_Volume%Array(:)) < sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) ) then !2nd & 3rd mode | |||
if ( sum(MudSystem%Op_MudDischarged_Volume%Array(:)) < sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts)) ) then !2nd & 3rd mode | |||
MudSystem%Op_NeededVolume_ToFill= sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) - sum(MudSystem%Op_MudDischarged_Volume%Array(:)) | |||
MudSystem%Op_NeededVolume_ToFill= sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts)) - sum(MudSystem%Op_MudDischarged_Volume%Array(:)) | |||
endif | |||
@@ -629,8 +629,8 @@ imud=0 | |||
! (MudSystem%AnnulusFlowRate/60.)*DeltaT_Mudline) - DeltaVolumeOp will be added to annulus | |||
!if (iLoc == 1) then | |||
MudSystem%MudSection= F_StringIntervalCounts+1 | |||
MudSystem%BackheadX= MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1) | |||
MudSystem%MudSection= F_Counts%StringIntervalCounts+1 | |||
MudSystem%BackheadX= MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1) | |||
!elseif (iLoc == 2) then | |||
! MudSection= Kick_Forehead_section | |||
! BackheadX= Kick_Forehead_X | |||
@@ -679,10 +679,10 @@ imud=0 | |||
write(*,*) 'Kick influx enters Annulus' | |||
call MudSystem%Ann_Density%AddToFirst (MudSystem%Op_KickSaved_Density) | |||
call MudSystem%Ann_MudDischarged_Volume%AddToFirst (MudSystem%Op_Kick_Saved_Volume) | |||
call MudSystem%Ann_Mud_Forehead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Forehead_section%AddToFirst (F_StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Backhead_section%AddToFirst (F_StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Forehead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Forehead_section%AddToFirst (F_Counts%StringIntervalCounts+1) | |||
call MudSystem%Ann_Mud_Backhead_X%AddToFirst (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1)) | |||
call MudSystem%Ann_Mud_Backhead_section%AddToFirst (F_Counts%StringIntervalCounts+1) | |||
call MudSystem%Ann_RemainedVolume_in_LastSection%AddToFirst (0.0d0) | |||
call MudSystem%Ann_EmptyVolume_inBackheadLocation%AddToFirst (0.0d0) | |||
call MudSystem%Ann_MudOrKick%AddToFirst (MudSystem%Saved_Op_MudOrKick) !<<<<<<<< | |||
@@ -751,7 +751,7 @@ imud=0 | |||
write(*,*) 'iloc_edited=' , iloc_edited | |||
write(*,*) 'iloc_changedTo2=' , iloc_changedTo2 | |||
write(*,*) 'Op_Capacity===' , sum(MudSystem%OpSection_VolumeCapacity(1:F_BottomHoleIntervalCounts)) | |||
write(*,*) 'Op_Capacity===' , sum(MudSystem%OpSection_VolumeCapacity(1:F_Counts%BottomHoleIntervalCounts)) | |||
WRITE (*,*) 'Op_Saved_MudDischarged_Volume, Op_Kick_Saved_Volume',MudSystem%Op_Saved_MudDischarged_Volume, MudSystem%Op_Kick_Saved_Volume | |||
@@ -772,9 +772,9 @@ imud=0 | |||
if ((Rate_of_Penetration==0 .and. abs(MudSystem%Ann_Density%Array(MudSystem%iLoc)-MudSystem%NewDensity)< MudSystem%DensityMixTol) & !%%1 section | |||
.or. (Rate_of_Penetration>0. .and. MudSystem%Ann_CuttingMud%Array(MudSystem%iLoc)==1 .and. abs(MudSystem%Ann_Density%Array(MudSystem%iLoc)-MudSystem%NewDensity)< MudSystem%CuttingDensityMixTol) & | |||
.or. (Rate_of_Penetration>0. .and. MudSystem%Ann_CuttingMud%Array(MudSystem%iLoc)==0 .and. MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc) < 42.) ) then ! 1-Pockets are Merged | |||
if ((ROP_Bit%RateOfPenetration==0 .and. abs(MudSystem%Ann_Density%Array(MudSystem%iLoc)-MudSystem%NewDensity)< MudSystem%DensityMixTol) & !%%1 section | |||
.or. (ROP_Bit%RateOfPenetration>0. .and. MudSystem%Ann_CuttingMud%Array(MudSystem%iLoc)==1 .and. abs(MudSystem%Ann_Density%Array(MudSystem%iLoc)-MudSystem%NewDensity)< MudSystem%CuttingDensityMixTol) & | |||
.or. (ROP_Bit%RateOfPenetration>0. .and. MudSystem%Ann_CuttingMud%Array(MudSystem%iLoc)==0 .and. MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc) < 42.) ) then ! 1-Pockets are Merged | |||
!write(*,*) '%%1 section a)' | |||
MudSystem%Ann_Density%Array(MudSystem%iLoc)= (MudSystem%Ann_Density%Array(MudSystem%iLoc)*MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc)+MudSystem%NewDensity*MudSystem%NewVolume)/(MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc)+MudSystem%NewVolume) | |||
MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc)= MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc)+MudSystem%NewVolume | |||
@@ -841,13 +841,13 @@ imud=0 | |||
MudSystem%AnnMudVolumeSum= MudSystem%AnnMudVolumeSum + MudSystem%Ann_MudDischarged_Volume%Array(imud) | |||
if ( MudSystem%AnnMudVolumeSum > sum(MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystem%NoPipeSections)) ) then | |||
if ( MudSystem%AnnMudVolumeSum > sum(MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:MudSystem%NoPipeSections)) ) then | |||
IF (MudSystem%Ann_MudOrKick%Array(imud) == 0) THEN | |||
MudSystem%Ann_MudSaved_Density = MudSystem%Ann_Density%Array(imud) | |||
MudSystem%Ann_Saved_MudDischarged_Volume = MudSystem%AnnMudVolumeSum - sum(MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystem%NoPipeSections)) | |||
MudSystem%Ann_Saved_MudDischarged_Volume = MudSystem%AnnMudVolumeSum - sum(MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:MudSystem%NoPipeSections)) | |||
ELSEIF (MudSystem%Ann_MudOrKick%Array(imud) > 0 .AND. MudSystem%Ann_MudOrKick%Array(imud) <100) THEN ! 104= AIR | |||
MudSystem%Ann_Kick_Saved_Volume = MudSystem%AnnMudVolumeSum - sum(MudSystem%PipeSection_VolumeCapacity(F_StringIntervalCounts+1:MudSystem%NoPipeSections)) | |||
MudSystem%Ann_Kick_Saved_Volume = MudSystem%AnnMudVolumeSum - sum(MudSystem%PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:MudSystem%NoPipeSections)) | |||
MudSystem%Saved_Ann_MudOrKick= MudSystem%Ann_MudOrKick%Array (imud) | |||
MudSystem%Ann_KickSaved_Density= MudSystem%Ann_Density%Array(imud) | |||
END IF | |||
@@ -872,7 +872,7 @@ imud=0 | |||
MudSystem%Ann_Saved_MudDischarged_Volume_Final= MudSystem%Ann_Saved_MudDischarged_Volume | |||
MudSystem%Ann_Kick_Saved_Volume_Final= MudSystem%Ann_Kick_Saved_Volume | |||
!write(*,*) 'Ann cap=' , sum(PipeSection_VolumeCapacity(F_StringIntervalCounts+1:NoPipeSections)) | |||
!write(*,*) 'Ann cap=' , sum(PipeSection_VolumeCapacity(F_Counts%StringIntervalCounts+1:NoPipeSections)) | |||
!write(*,*) 'Ann mud sum vol=' , sum(Ann_MudDischarged_Volume%Array(:)) | |||
IF (MudSystem%WellHeadIsOpen) MudSystem%MudVolume_InjectedFromAnn = MudSystem%Ann_Saved_MudDischarged_Volume_Final-((MudSystem%Qlost/60.0d0)*MudSystem%DeltaT_Mudline) | |||
@@ -1173,10 +1173,10 @@ imud= MudSystem%Ann_Mud_Forehead_X%Length() + 1 | |||
MudSystem%Ann_RemainedVolume_in_LastSection%Array(imud)= MudSystem%Ann_MudDischarged_Volume%Array(imud)- MudSystem%Ann_EmptyVolume_inBackheadLocation%Array(imud) | |||
do | |||
if (MudSystem%isection < F_StringIntervalCounts+1) then ! last pipe section(well exit) F_StringIntervalCounts+1 is the first section in Annulus | |||
if (MudSystem%isection < F_Counts%StringIntervalCounts+1) then ! last pipe section(well exit) F_Counts%StringIntervalCounts+1 is the first section in Annulus | |||
MudSystem%Ann_MudDischarged_Volume%Array(imud)= MudSystem%Ann_MudDischarged_Volume%Array(imud)- MudSystem%Ann_RemainedVolume_in_LastSection%Array(imud) | |||
MudSystem%Ann_Mud_Backhead_X%Array(imud)= MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1) | |||
MudSystem%Ann_Mud_Backhead_section%Array(imud)= F_StringIntervalCounts+1 | |||
MudSystem%Ann_Mud_Backhead_X%Array(imud)= MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1) | |||
MudSystem%Ann_Mud_Backhead_section%Array(imud)= F_Counts%StringIntervalCounts+1 | |||
if (MudSystem%Ann_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well | |||
call RemoveAnnulusMudArrays(imud) | |||
@@ -1280,11 +1280,11 @@ imud=0 | |||
MudSystem%Op_RemainedVolume_in_LastSection%Array(imud)= MudSystem%Op_MudDischarged_Volume%Array(imud)- MudSystem%Op_EmptyVolume_inBackheadLocation%Array(imud) | |||
do | |||
if (MudSystem%isection > F_BottomHoleIntervalCounts) then ! last pipe section(well exit) | |||
if (MudSystem%isection > F_Counts%BottomHoleIntervalCounts) then ! last pipe section(well exit) | |||
!if( imud==1) KickDeltaVinAnnulus= Op_RemainedVolume_in_LastSection%Array(imud) ! Kick enters Annulus space | |||
MudSystem%Op_MudDischarged_Volume%Array(imud)= MudSystem%Op_MudDischarged_Volume%Array(imud)- MudSystem%Op_RemainedVolume_in_LastSection%Array(imud) | |||
MudSystem%Op_Mud_Forehead_X%Array(imud)= MudSystem%Xend_OpSection(F_BottomHoleIntervalCounts) | |||
MudSystem%Op_Mud_Forehead_section%Array(imud)= F_BottomHoleIntervalCounts | |||
MudSystem%Op_Mud_Forehead_X%Array(imud)= MudSystem%Xend_OpSection(F_Counts%BottomHoleIntervalCounts) | |||
MudSystem%Op_Mud_Forehead_section%Array(imud)= F_Counts%BottomHoleIntervalCounts | |||
if (MudSystem%Op_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well | |||
call MudSystem%Op_MudDischarged_Volume%Remove (imud) | |||
@@ -205,10 +205,10 @@ imud=0 | |||
MudSystem%St_RemainedVolume_in_LastSection%Array(imud)= MudSystem%St_MudDischarged_Volume%Array(imud)- MudSystem%St_EmptyVolume_inBackheadLocation%Array(imud) | |||
do | |||
if (MudSystem%isection > F_StringIntervalCounts) then ! last pipe section(string exit) F_StringIntervalCounts includes Horizontal line | |||
if (MudSystem%isection > F_Counts%StringIntervalCounts) then ! last pipe section(string exit) F_Counts%StringIntervalCounts includes Horizontal line | |||
MudSystem%St_MudDischarged_Volume%Array(imud)= MudSystem%St_MudDischarged_Volume%Array(imud)- MudSystem%St_RemainedVolume_in_LastSection%Array(imud) | |||
MudSystem%St_Mud_Forehead_X%Array(imud)= MudSystem%Xend_PipeSection(F_StringIntervalCounts) | |||
MudSystem%St_Mud_Forehead_section%Array(imud)= F_StringIntervalCounts | |||
MudSystem%St_Mud_Forehead_X%Array(imud)= MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts) | |||
MudSystem%St_Mud_Forehead_section%Array(imud)= F_Counts%StringIntervalCounts | |||
if (MudSystem%St_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the string | |||
call RemoveStringMudArrays(imud) | |||
@@ -291,11 +291,11 @@ imud=0 | |||
MudSystem%Op_RemainedVolume_in_LastSection%Array(imud)= MudSystem%Op_MudDischarged_Volume%Array(imud)- MudSystem%Op_EmptyVolume_inBackheadLocation%Array(imud) | |||
do | |||
if (MudSystem%isection > F_BottomHoleIntervalCounts) then ! last pipe section(well exit) | |||
if (MudSystem%isection > F_Counts%BottomHoleIntervalCounts) then ! last pipe section(well exit) | |||
if( imud==1) MudSystem%KickDeltaVinAnnulus= MudSystem%Op_RemainedVolume_in_LastSection%Array(imud) ! Kick enters Annulus space | |||
MudSystem%Op_MudDischarged_Volume%Array(imud)= MudSystem%Op_MudDischarged_Volume%Array(imud)- MudSystem%Op_RemainedVolume_in_LastSection%Array(imud) | |||
MudSystem%Op_Mud_Forehead_X%Array(imud)= MudSystem%Xend_OpSection(F_BottomHoleIntervalCounts) | |||
MudSystem%Op_Mud_Forehead_section%Array(imud)= F_BottomHoleIntervalCounts | |||
MudSystem%Op_Mud_Forehead_X%Array(imud)= MudSystem%Xend_OpSection(F_Counts%BottomHoleIntervalCounts) | |||
MudSystem%Op_Mud_Forehead_section%Array(imud)= F_Counts%BottomHoleIntervalCounts | |||
if (MudSystem%Op_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well | |||
call RemoveOpMudArrays(imud) | |||
@@ -321,7 +321,7 @@ imud=0 | |||
endif | |||
if (MudSystem%Op_Mud_Forehead_X%Array(imud)== MudSystem%Xend_OpSection(F_BottomHoleIntervalCounts)) then | |||
if (MudSystem%Op_Mud_Forehead_X%Array(imud)== MudSystem%Xend_OpSection(F_Counts%BottomHoleIntervalCounts)) then | |||
MudSystem%totalLength = MudSystem%Op_MudDischarged_Volume%Length() | |||
do while(imud < MudSystem%totalLength) | |||
@@ -353,8 +353,8 @@ imud=0 | |||
!========================Bottom Hole END================= | |||
if (MudSystem%iLoc == 1) then | |||
MudSystem%MudSection= F_StringIntervalCounts+1 | |||
MudSystem%BackheadX= MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1) | |||
MudSystem%MudSection= F_Counts%StringIntervalCounts+1 | |||
MudSystem%BackheadX= MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1) | |||
elseif (MudSystem%iLoc == 2) then | |||
MudSystem%MudSection= MudSystem%Kick_Forehead_section | |||
MudSystem%BackheadX= MudSystem%Kick_Forehead_X | |||
@@ -418,7 +418,7 @@ imud=0 | |||
endif | |||
elseif (MudSystem%DeltaVolumeOp > 0.0 .and. MudSystem%MudIsChanged== .true. .and. Rate_of_Penetration==0.) then | |||
elseif (MudSystem%DeltaVolumeOp > 0.0 .and. MudSystem%MudIsChanged== .true. .and. ROP_Bit%RateOfPenetration==0.) then | |||
MudSystem%Ann_Density%Array(MudSystem%iLoc)= MudSystem%NewDensity | |||
MudSystem%Ann_MudDischarged_Volume%Array(MudSystem%iLoc)= MudSystem%NewVolume | |||
MudSystem%Ann_Mud_Forehead_X%Array(MudSystem%iLoc)= MudSystem%BackheadX | |||
@@ -217,10 +217,10 @@ imud= MudSystem%Ann_Mud_Forehead_X%Length() + 1 | |||
MudSystem%Ann_RemainedVolume_in_LastSection%Array(imud)= MudSystem%Ann_MudDischarged_Volume%Array(imud)- MudSystem%Ann_EmptyVolume_inBackheadLocation%Array(imud) | |||
do | |||
if (MudSystem%isection < F_StringIntervalCounts+1) then ! last pipe section(well exit) F_StringIntervalCounts+1 is the first section in Annulus | |||
if (MudSystem%isection < F_Counts%StringIntervalCounts+1) then ! last pipe section(well exit) F_Counts%StringIntervalCounts+1 is the first section in Annulus | |||
MudSystem%Ann_MudDischarged_Volume%Array(imud)= MudSystem%Ann_MudDischarged_Volume%Array(imud)- MudSystem%Ann_RemainedVolume_in_LastSection%Array(imud) | |||
MudSystem%Ann_Mud_Backhead_X%Array(imud)= MudSystem%Xstart_PipeSection(F_StringIntervalCounts+1) | |||
MudSystem%Ann_Mud_Backhead_section%Array(imud)= F_StringIntervalCounts+1 | |||
MudSystem%Ann_Mud_Backhead_X%Array(imud)= MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts+1) | |||
MudSystem%Ann_Mud_Backhead_section%Array(imud)= F_Counts%StringIntervalCounts+1 | |||
if (MudSystem%Ann_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well | |||
call RemoveAnnulusMudArrays(imud) | |||
@@ -303,11 +303,11 @@ imud=0 | |||
MudSystem%Op_RemainedVolume_in_LastSection%Array(imud)= MudSystem%Op_MudDischarged_Volume%Array(imud)- MudSystem%Op_EmptyVolume_inBackheadLocation%Array(imud) | |||
do | |||
if (MudSystem%isection > F_BottomHoleIntervalCounts) then ! last pipe section(well exit) | |||
if (MudSystem%isection > F_Counts%BottomHoleIntervalCounts) then ! last pipe section(well exit) | |||
if( imud==1) MudSystem%KickDeltaVinAnnulus= MudSystem%Op_RemainedVolume_in_LastSection%Array(imud) ! Kick enters Annulus space | |||
MudSystem%Op_MudDischarged_Volume%Array(imud)= MudSystem%Op_MudDischarged_Volume%Array(imud)- MudSystem%Op_RemainedVolume_in_LastSection%Array(imud) | |||
MudSystem%Op_Mud_Forehead_X%Array(imud)= MudSystem%Xend_OpSection(F_BottomHoleIntervalCounts) | |||
MudSystem%Op_Mud_Forehead_section%Array(imud)= F_BottomHoleIntervalCounts | |||
MudSystem%Op_Mud_Forehead_X%Array(imud)= MudSystem%Xend_OpSection(F_Counts%BottomHoleIntervalCounts) | |||
MudSystem%Op_Mud_Forehead_section%Array(imud)= F_Counts%BottomHoleIntervalCounts | |||
if (MudSystem%Op_MudDischarged_Volume%Array(imud)<= 0.0d0) then ! imud is completely exited form the well | |||
call RemoveOpMudArrays(imud) | |||
@@ -332,7 +332,7 @@ imud=0 | |||
endif | |||
if (MudSystem%Op_Mud_Forehead_X%Array(imud)== MudSystem%Xend_OpSection(F_BottomHoleIntervalCounts)) then | |||
if (MudSystem%Op_Mud_Forehead_X%Array(imud)== MudSystem%Xend_OpSection(F_Counts%BottomHoleIntervalCounts)) then | |||
MudSystem%totalLength = MudSystem%Op_MudDischarged_Volume%Length() | |||
do while(imud < MudSystem%totalLength) | |||
@@ -380,10 +380,10 @@ imud=0 | |||
!if ((ABS(StringDensity_Old - Ann_Density%First()) >= DensityMixTol) .OR. (DeltaVolumeOp == 0.0 .and. MudSystem%St_Density%Last() /= Ann_Density%Array(1) .and. MudSystem%StringFlowRate/=0.0d0)) then ! new mud is pumped | |||
call MudSystem%St_Density%Add (MudSystem%Ann_Density%First()) | |||
call MudSystem%St_MudDischarged_Volume%Add (0.0d0) | |||
call MudSystem%St_Mud_Forehead_X%Add (MudSystem%Xend_PipeSection(F_StringIntervalCounts)) | |||
call MudSystem%St_Mud_Forehead_section%Add (F_StringIntervalCounts) | |||
call MudSystem%St_Mud_Backhead_X%Add (MudSystem%Xstart_PipeSection(F_StringIntervalCounts)) | |||
call MudSystem%St_Mud_Backhead_section%Add (F_StringIntervalCounts) | |||
call MudSystem%St_Mud_Forehead_X%Add (MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts)) | |||
call MudSystem%St_Mud_Forehead_section%Add (F_Counts%StringIntervalCounts) | |||
call MudSystem%St_Mud_Backhead_X%Add (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts)) | |||
call MudSystem%St_Mud_Backhead_section%Add (F_Counts%StringIntervalCounts) | |||
call MudSystem%St_RemainedVolume_in_LastSection%Add (0.0d0) | |||
call MudSystem%St_EmptyVolume_inBackheadLocation%Add (0.0d0) | |||
call MudSystem%St_MudOrKick%Add (0) | |||
@@ -411,19 +411,19 @@ write(*,*) 'DeltaVolumeOp=' , MudSystem%DeltaVolumeOp | |||
if (abs(MudSystem%St_Density%Last()-MudSystem%NewDensity)< MudSystem%DensityMixTol) then ! .OR. (St_MudDischarged_Volume%Last()< 42.) ) then !+ NewVolume)< 42.) then ! 1-Pockets are Merged | |||
MudSystem%St_Density%Array(MudSystem%St_Density%Length())= (MudSystem%St_Density%Last()*MudSystem%St_MudDischarged_Volume%Last()+MudSystem%NewDensity*MudSystem%NewVolume)/(MudSystem%St_MudDischarged_Volume%Last()+MudSystem%NewVolume) | |||
MudSystem%St_MudDischarged_Volume%Array(MudSystem%St_Density%Length())= MudSystem%St_MudDischarged_Volume%Last()+MudSystem%DeltaVolumeOp | |||
MudSystem%St_Mud_Forehead_X%Array(MudSystem%St_Density%Length())= (MudSystem%Xend_PipeSection(F_StringIntervalCounts)) | |||
MudSystem%St_Mud_Forehead_section%Array(MudSystem%St_Density%Length())= (F_StringIntervalCounts) | |||
MudSystem%St_Mud_Backhead_X%Array(MudSystem%St_Density%Length())= (MudSystem%Xstart_PipeSection(F_StringIntervalCounts)) | |||
MudSystem%St_Mud_Backhead_section%Array(MudSystem%St_Density%Length())= (F_StringIntervalCounts) | |||
MudSystem%St_Mud_Forehead_X%Array(MudSystem%St_Density%Length())= (MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts)) | |||
MudSystem%St_Mud_Forehead_section%Array(MudSystem%St_Density%Length())= (F_Counts%StringIntervalCounts) | |||
MudSystem%St_Mud_Backhead_X%Array(MudSystem%St_Density%Length())= (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts)) | |||
MudSystem%St_Mud_Backhead_section%Array(MudSystem%St_Density%Length())= (F_Counts%StringIntervalCounts) | |||
MudSystem%St_RemainedVolume_in_LastSection%Array(MudSystem%St_Density%Length())= (0.0d0) | |||
MudSystem%St_EmptyVolume_inBackheadLocation%Array(MudSystem%St_Density%Length())= (0.0d0) | |||
else ! 2-Merging conditions are not meeted, so new pocket | |||
call MudSystem%St_Density%Add (MudSystem%NewDensity) | |||
call MudSystem%St_MudDischarged_Volume%Add (MudSystem%NewVolume) | |||
call MudSystem%St_Mud_Forehead_X%Add (MudSystem%Xend_PipeSection(F_StringIntervalCounts)) | |||
call MudSystem%St_Mud_Forehead_section%Add (F_StringIntervalCounts) | |||
call MudSystem%St_Mud_Backhead_X%Add (MudSystem%Xstart_PipeSection(F_StringIntervalCounts)) | |||
call MudSystem%St_Mud_Backhead_section%Add (F_StringIntervalCounts) | |||
call MudSystem%St_Mud_Forehead_X%Add (MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts)) | |||
call MudSystem%St_Mud_Forehead_section%Add (F_Counts%StringIntervalCounts) | |||
call MudSystem%St_Mud_Backhead_X%Add (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts)) | |||
call MudSystem%St_Mud_Backhead_section%Add (F_Counts%StringIntervalCounts) | |||
call MudSystem%St_RemainedVolume_in_LastSection%Add (0.0d0) | |||
call MudSystem%St_EmptyVolume_inBackheadLocation%Add (0.0d0) | |||
call MudSystem%St_MudOrKick%Add (0) | |||
@@ -433,10 +433,10 @@ write(*,*) 'DeltaVolumeOp=' , MudSystem%DeltaVolumeOp | |||
elseif (MudSystem%DeltaVolumeOp > 0.0 .and. MudSystem%MudIsChanged== .true.) then | |||
MudSystem%St_Density%Array(MudSystem%St_Density%Length())= MudSystem%NewDensity | |||
MudSystem%St_MudDischarged_Volume%Array(MudSystem%St_Density%Length())= MudSystem%NewVolume | |||
MudSystem%St_Mud_Forehead_X%Array(MudSystem%St_Density%Length())= (MudSystem%Xend_PipeSection(F_StringIntervalCounts)) | |||
MudSystem%St_Mud_Forehead_section%Array(MudSystem%St_Density%Length())= (F_StringIntervalCounts) | |||
MudSystem%St_Mud_Backhead_X%Array(MudSystem%St_Density%Length())= (MudSystem%Xstart_PipeSection(F_StringIntervalCounts)) | |||
MudSystem%St_Mud_Backhead_section%Array(MudSystem%St_Density%Length())= (F_StringIntervalCounts) | |||
MudSystem%St_Mud_Forehead_X%Array(MudSystem%St_Density%Length())= (MudSystem%Xend_PipeSection(F_Counts%StringIntervalCounts)) | |||
MudSystem%St_Mud_Forehead_section%Array(MudSystem%St_Density%Length())= (F_Counts%StringIntervalCounts) | |||
MudSystem%St_Mud_Backhead_X%Array(MudSystem%St_Density%Length())= (MudSystem%Xstart_PipeSection(F_Counts%StringIntervalCounts)) | |||
MudSystem%St_Mud_Backhead_section%Array(MudSystem%St_Density%Length())= (F_Counts%StringIntervalCounts) | |||
MudSystem%St_RemainedVolume_in_LastSection%Array(MudSystem%St_Density%Length())= (0.0d0) | |||
MudSystem%St_EmptyVolume_inBackheadLocation%Array(MudSystem%St_Density%Length())= (0.0d0) | |||
endif | |||
@@ -2,7 +2,7 @@ subroutine Pumps_Inputs | |||
Use CDrillingConsoleVariables | |||
Use Pumps_VARIABLES | |||
use MudSystemModule | |||
Use MudSystemModule | |||
IMPLICIT NONE | |||
@@ -3,9 +3,10 @@ subroutine Pumps_Outputs | |||
Use CDataDisplayConsoleVariables | |||
Use CSimulationVariables | |||
Use Pumps_VARIABLES | |||
use MudSystemModule | |||
Use MudSystemModule | |||
Use CDrillWatchVariables | |||
Use CSounds | |||
IMPLICIT NONE | |||
@@ -1,17 +0,0 @@ | |||
subroutine RTMalfunction_MotorFailure | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
! use CSimulationVariables | |||
use RTable_VARIABLES | |||
IMPLICIT NONE | |||
if ( RTable%MotorFaileMalf==1 ) then | |||
RTable%N_new = 0.0 | |||
end if | |||
END subroutine RTMalfunction_MotorFailure |
@@ -1,25 +0,0 @@ | |||
subroutine RTTorqueLimit | |||
Use equipments_PowerLimit | |||
Use RTable_VARIABLES | |||
IMPLICIT NONE | |||
! Rotary Table Malfunction ----> Drive Motor Limit Overide | |||
if ( RTable%OverideTorqueLimitMalf==1 ) then | |||
return | |||
end if | |||
IF (RTable%ia_ref>RTable%ia_ref_limit) THEN | |||
RTable%ia_ref = RTable%ia_ref_limit | |||
END IF | |||
end subroutine |
@@ -1,90 +1,75 @@ | |||
subroutine RTable_INPUTS | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
! use CSimulationVariables | |||
use CSimulationVariables | |||
use CTdsConnectionModesEnumVariables | |||
use CTdsElevatorModesEnumVariables | |||
use CHoistingVariables | |||
use RTable_VARIABLES | |||
use TD_DrillStemComponents | |||
use CUnityInputs | |||
use CWarningsVariables | |||
use UnitySignalVariables | |||
! use CSlipsEnumVariables | |||
IMPLICIT NONE | |||
integer :: i | |||
!===> String Torque | |||
!print* , 'TD_StringTorquert=' , TD_StringTorque | |||
RTable%String_Torque = TD_StringTorque*12.d0 ![lb.ft]*12 ---> [lb.in] ????????? | |||
!RTable%String_Torque = 20000. | |||
RTable%String_Torque = 0.112984829*RTable%String_Torque ![N.m] | |||
!print* , 'TD_StringTorquert2=' , RTable%String_Torque | |||
RTable%AssignmentSwitch = DrillingConsole%AssignmentSwitch | |||
RTable%Switch = DrillingConsole%RTSwitch | |||
!RTable%GearsAbuse = RotaryGearsAbuse | |||
RTable%Throttle = DrillingConsole%RTThrottle ![RPM] | |||
RTable%String_Torque = TD_String%StringTorque*12.d0 ![lb.ft]*12 ---> [lb.in] ????????? | |||
!RTable%RpmGaugeMalf !:dar module haye C meghdardehi mishe | |||
RTable%N_new = RTable%Throttle | |||
if ( RTable%MotorFaileMalf==1 ) then | |||
RTable%N_new = 0.d0 | |||
end if | |||
RTable%String_Torque = 0.112984d0*RTable%String_Torque ![N.m] | |||
!===> String_JCoef Calculation | |||
if ( Hoisting%DriveType==0 ) then | |||
if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then | |||
RT_RotaryMode = 1 | |||
RTable%String_JCoef = 0.0 | |||
Do i = 1,TD_StringConfigurationCount | |||
RTable%String_JCoef = RTable%String_JCoef+( (TD_DrillStem(i)%TotalWeight*((TD_DrillStem(i)%Id**2)+(TD_DrillStem(i)%Od**2)))/8.0 ) ![lb.ft^2] , Jz=(1/2)*m*(r1^2+r2^2) | |||
RTable%RotaryMode = 1 | |||
RTable%String_JCoef = 0.d0 | |||
Do i = 1,TD_String%StringConfigurationCount | |||
RTable%String_JCoef = RTable%String_JCoef+( (TD_DrillStem(i)%TotalWeight*((TD_DrillStem(i)%Id**2.d0)+(TD_DrillStem(i)%Od**2.d0)))/8.d0 ) ![lb.ft^2] , Jz=(1/2)*m*(r1^2+r2^2) | |||
End Do | |||
RTable%String_JCoef = RTable%String_JCoef*0.0421401 ![kg.m^2] | |||
RTable%String_JCoef = RTable%String_JCoef*0.0421401d0 ![kg.m^2] | |||
else if ( Get_Slips() /= SLIPS_SET_END ) then | |||
RT_RotaryMode = 2 | |||
RTable%String_JCoef = 0.0 | |||
RTable%String_Torque = 0.0 | |||
RTable%RotaryMode = 2 | |||
RTable%String_JCoef = 0.d0 | |||
RTable%String_Torque = 0.d0 | |||
else | |||
RT_RotaryMode = 3 | |||
RTable%String_JCoef = 0.0 | |||
RTable%String_Torque = 0.0 | |||
RTable%RotaryMode = 3 | |||
RTable%String_JCoef = 0.d0 | |||
RTable%String_Torque = 0.d0 | |||
end if | |||
else if ( Hoisting%DriveType==1 ) then | |||
if ( Get_IsKellyBushingSetInTable() .or. Get_Slips() == SLIPS_SET_END ) then !if rotary connected to string | |||
RT_RotaryMode = 4 | |||
RTable%String_JCoef = 0.0 | |||
Do i = 1,TD_StringConfigurationCount | |||
RTable%String_JCoef = RTable%String_JCoef+( (TD_DrillStem(i)%TotalWeight*((TD_DrillStem(i)%Id**2)+(TD_DrillStem(i)%Od**2)))/8.0 ) ![lb.ft^2] , Jz=(1/2)*m*(r1^2+r2^2) | |||
RTable%RotaryMode = 4 | |||
RTable%String_JCoef = 0.d0 | |||
Do i = 1,TD_String%StringConfigurationCount | |||
RTable%String_JCoef = RTable%String_JCoef+( (TD_DrillStem(i)%TotalWeight*((TD_DrillStem(i)%Id**2.d0)+(TD_DrillStem(i)%Od**2.d0)))/8.d0 ) ![lb.ft^2] , Jz=(1/2)*m*(r1^2+r2^2) | |||
End Do | |||
RTable%String_JCoef = RTable%String_JCoef*0.0421401 ![kg.m^2] | |||
RTable%String_JCoef = RTable%String_JCoef*0.0421401e0 ![kg.m^2] | |||
else | |||
RT_RotaryMode = 5 | |||
RTable%String_JCoef = 0.0 | |||
RTable%String_Torque = 0.0 | |||
RTable%RotaryMode = 5 | |||
RTable%String_JCoef = 0.d0 | |||
RTable%String_Torque = 0.d0 | |||
end if | |||
end if | |||
!print*, 'DriveType=', DriveType , RT_RotaryMode , Get_IsKellyBushingSetInTable() , Get_Slips() | |||
!if ( Get_IsKellyBushingSetInTable() .or. Get_Slips() == SLIPS_SET_END ) then !if rotary connected to string | |||
! RTable%String_JCoef = 0.0 | |||
! Do i = 1,TD_StringConfigurationCount | |||
! RTable%String_JCoef = RTable%String_JCoef+( (TD_DrillStem(i)%TotalWeight*((TD_DrillStem(i)%Id**2)+(TD_DrillStem(i)%Od**2)))/8.0 ) ![lb.ft^2] , Jz=(1/2)*m*(r1^2+r2^2) | |||
! End Do | |||
! RTable%String_JCoef = RTable%String_JCoef*0.0421401 ![kg.m^2] | |||
!else | |||
! RTable%String_JCoef = 0.0 | |||
! RTable%String_Torque = 0.0 | |||
!end if | |||
!RTable%String_JCoef = RTable%String_JCoef/10. !???????? /10: with no reason, check it | |||
!===> Transmission Mode | |||
if (DrillingConsole%RTTransmissionLever==1) then ! in high mode | |||
RTable%Conv_Ratio = RTable%High_Conv_Ratio | |||
else if (DrillingConsole%RTTransmissionLever==-1) then ! in low mode | |||
RTable%Conv_Ratio = RTable%Low_Conv_Ratio | |||
else if (DrillingConsole%RTTransmissionLever==0) then ! in low mode | |||
RTable%Conv_Ratio = RTable%Low_Conv_Ratio | |||
end if | |||
RTable%Conv_Ratio = RTable%High_Conv_Ratio | |||
@@ -1,71 +0,0 @@ | |||
subroutine RTable_OffMode | |||
use RTable_VARIABLES | |||
use CDataDisplayConsoleVariables | |||
use CDrillingConsoleVariables | |||
! use CSimulationVariables | |||
use CWarningsVariables | |||
use CSounds | |||
IMPLICIT NONE | |||
!================================================================== | |||
! Rate limit for off Mode | |||
if (((RTable%N_old-0.0d0)/RTable%time_step)>386.0d0) then | |||
RTable%N_ref = (-386.0d0*RTable%time_step)+RTable%N_old | |||
!else | |||
! RTable%N_ref=0.0d0 | |||
!end if | |||
CALL RTable_INPUTS | |||
CALL RTable_Solver | |||
RTable%N_old = RTable%N_ref | |||
if ( RT_OldTransMode==0 .and. DrillingConsole%RTTransmissionLever/=0 .and. RTable%w_new/=0.d0 ) then | |||
Call Activate_RotaryGearsAbuse() | |||
RTable%SoundGearCrash = .true. | |||
Call SetSoundRtGearCrash(RTable%SoundGearCrash) | |||
else | |||
RTable%SoundGearCrash = .false. | |||
Call SetSoundRtGearCrash(RTable%SoundGearCrash) | |||
end if | |||
RT_OldTransMode = DrillingConsole%RTTransmissionLever | |||
!================================================================== | |||
else | |||
RTable%N_ref = 0. | |||
RTable%N_new = 0. | |||
RTable%N_old = 0. | |||
RTable%ia = 0. | |||
RTable%ia_old = 0. | |||
RTable%ia_new = 0. | |||
RTable%x = 0. | |||
RTable%x_old = 0. | |||
RTable%x_new = 0. | |||
RTable%y = 0. | |||
RTable%y_old = 0. | |||
RTable%y_new = 0. | |||
RTable%w = 0. | |||
RTable%w_old = 0. | |||
RTable%w_new = 0. | |||
RTable%Speed = 0. | |||
RT_wOld = 0. | |||
Call Set_RotaryRPMGauge(sngl(1-RTable%RpmGaugeMalf)*real(RTable%Speed,8)) | |||
RTable%SoundRPM = INT(RTable%Speed) | |||
Call SetSoundRT( RTable%SoundRPM ) | |||
!RotaryRPMGauge=RTable%Speed | |||
!RPM=RotaryRPMGauge | |||
RTable%Output_Current = 0. | |||
DataDisplayConsole%RotaryTorqueGauge = ( ((RTable%J_coef+RTable%String_JCoef)*(((RTable%w_new/RTable%Conv_Ratio)-RT_wOld)/RTable%time_step))+(RTable%String_Torque) )*0.73756215 ![N.m]*0.73756215 = [ft.lbf] | |||
RTable%Torque = ( ((RTable%J_coef+RTable%String_JCoef)*(((RTable%w_new/RTable%Conv_Ratio)-RT_wOld)/RTable%time_step))+(RTable%String_Torque) )*0.73756215 ![N.m]*0.73756215 = [ft.lbf] | |||
Call Set_RotaryTorque(sngl(1-RTable%TorqueGaugeMalf)*real(RTable%Torque,8)) | |||
!RotaryTorqueGauge=(RTable%String_Torque)/12. | |||
end if | |||
end subroutine RTable_OffMode |
@@ -0,0 +1,62 @@ | |||
subroutine RTable_OffMode | |||
use RTable_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: RT_OldSpeed, RT_OldRpmGauge | |||
RT_OldSpeed = RTable%Speed | |||
RT_OldRpmGauge = RTable%RpmGaugeOutput | |||
RTable%N_new = 0.d0 | |||
!======================= Rotary Table Rate_limit ======================= | |||
if (((RTable%N_new-RTable%N_old)/RTable%time_step)>RTable%RateChange) then | |||
RTable%N_ref = (RTable%RateChange*RTable%time_step)+RTable%N_old | |||
else if (((RTable%N_old-RTable%N_new)/RTable%time_step)>RTable%RateChange) then | |||
RTable%N_ref = (-RTable%RateChange*RTable%time_step)+RTable%N_old | |||
else | |||
RTable%N_ref = RTable%N_new | |||
end if | |||
!======================================================================= | |||
if ( any(RTable%RotaryMode==(/1,4/)) ) then !if rotary connected to string | |||
!==> RPM | |||
RTable%Speed = RTable%N_ref/RTable%Conv_Ratio | |||
RTable%Speed = min(RTable%Speed,RTable%MaxRPM) !Speed [RPM] | |||
RTable%RpmGaugeOutput = RTable%Speed | |||
!==> Sound | |||
RTable%SoundRPM = INT(RTable%Speed) | |||
!==> Torque | |||
RTable%Torque = ( ((RTable%J_coef+RTable%String_JCoef)*((((pi*RTable%Speed)/30.d0)-((pi*RT_OldSpeed)/30.d0))/RTable%time_step))+(RTable%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] ![kg.m^2]*[radians/s^2]+[N.m]=[N.m] | |||
RTable%Torque = min(RTable%Torque,RTable%MaxTorque) | |||
RTable%TorqueGaugeOutput = RTable%Torque | |||
else if ( any(RTable%RotaryMode==(/2,5/)) ) then | |||
!==> RPM | |||
RTable%Speed = 0.d0 | |||
RTable%RpmGaugeOutput = RTable%N_ref/RTable%Conv_Ratio | |||
RTable%RpmGaugeOutput = min(RTable%RpmGaugeOutput,RTable%MaxRPM) | |||
!==> Sound | |||
RTable%SoundRPM = INT(RTable%RpmGaugeOutput) | |||
!==> Torque | |||
RTable%Torque = 0.d0 | |||
RTable%TorqueGaugeOutput = ( ((RTable%J_coef+RTable%String_JCoef)*((((pi*RTable%RpmGaugeOutput)/30.d0)-((pi*RT_OldRpmGauge)/30.d0))/RTable%time_step))+(RTable%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] ![kg.m^2]*[radians/s^2]+[N.m]=[N.m] | |||
RTable%TorqueGaugeOutput = min(RTable%TorqueGaugeOutput,RTable%MaxTorque) | |||
else if ( RTable%RotaryMode==3 ) then | |||
!==> RPM | |||
RTable%Speed = 0.d0 | |||
RTable%RpmGaugeOutput = 0.d0 | |||
!==> Sound | |||
RTable%SoundRPM = INT(RTable%RpmGaugeOutput) | |||
!==> Torque | |||
RTable%Torque = 0.d0 | |||
RTable%TorqueGaugeOutput = 0.d0 | |||
end if | |||
end subroutine RTable_OffMode |
@@ -0,0 +1,51 @@ | |||
subroutine RTable_OnModeSolver | |||
Use RTable_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: RT_OldSpeed, RT_OldRpmGauge | |||
RT_OldSpeed = RTable%Speed | |||
RT_OldRpmGauge = RTable%RpmGaugeOutput | |||
if ( any(RTable%RotaryMode==(/1,4/)) ) then !if rotary connected to string | |||
!==> RPM | |||
RTable%Speed = RTable%N_ref/RTable%Conv_Ratio | |||
RTable%Speed = min(RTable%Speed,RTable%MaxRPM) !Speed [RPM] | |||
RTable%RpmGaugeOutput = RTable%Speed | |||
!==> Sound | |||
RTable%SoundRPM = INT(RTable%Speed) | |||
!==> Torque | |||
RTable%Torque = ( ((RTable%J_coef+RTable%String_JCoef)*((((pi*RTable%Speed)/30.d0)-((pi*RT_OldSpeed)/30.d0))/RTable%time_step))+(RTable%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] ![kg.m^2]*[radians/s^2]+[N.m]=[N.m] | |||
RTable%Torque = min(RTable%Torque,RTable%MaxTorque) | |||
RTable%TorqueGaugeOutput = RTable%Torque | |||
else if ( any(RTable%RotaryMode==(/2,5/)) ) then | |||
!==> RPM | |||
RTable%Speed = 0.d0 | |||
RTable%RpmGaugeOutput = RTable%N_ref/RTable%Conv_Ratio | |||
RTable%RpmGaugeOutput = min(RTable%RpmGaugeOutput,RTable%MaxRPM) !inja bayad bashe ya na??? | |||
!==> Sound | |||
RTable%SoundRPM = INT(RTable%RpmGaugeOutput) | |||
!==> Torque | |||
RTable%Torque = 0.d0 | |||
RTable%TorqueGaugeOutput = ( ((RTable%J_coef+RTable%String_JCoef)*((((pi*RTable%RpmGaugeOutput)/30.d0)-((pi*RT_OldRpmGauge)/30.d0))/RTable%time_step))+(RTable%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] ![kg.m^2]*[radians/s^2]+[N.m]=[N.m] | |||
RTable%TorqueGaugeOutput = min(RTable%TorqueGaugeOutput,RTable%MaxTorque) | |||
else if ( RTable%RotaryMode==3 ) then | |||
!==> RPM | |||
RTable%Speed = 0.d0 | |||
RTable%RpmGaugeOutput = 0.d0 | |||
!==> Sound | |||
RTable%SoundRPM = INT(RTable%RpmGaugeOutput) | |||
!==> Torque | |||
RTable%Torque = 0.d0 | |||
RTable%TorqueGaugeOutput = 0.d0 | |||
end if | |||
END subroutine RTable_OnModeSolver |
@@ -0,0 +1,29 @@ | |||
subroutine RTable_Outputs | |||
Use CDrillingConsoleVariables | |||
Use CDataDisplayConsoleVariables | |||
Use RTable_VARIABLES | |||
Use CDrillWatchVariables | |||
Use CSounds | |||
IMPLICIT NONE | |||
DrillingConsole%RTBLWR = RTable%BLWR | |||
Call SetSoundBlowerRT(RTable%SoundBlower) !.true. or .false. | |||
Call SetSoundRT( RTable%SoundRPM ) ![RPM] , integer | |||
!RTable%Speed !to other modules | |||
Call Set_RotaryRPMGauge( sngl(1-RTable%RpmGaugeMalf)*real(RTable%RpmGaugeOutput,8) ) ![RPM] | |||
DataDisplayConsole%RotaryTorqueGauge = RTable%TorqueGaugeOutput ![ft.lbf] | |||
DrillingWatch%Torque = RTable%TorqueGaugeOutput | |||
Call Set_RotaryTorque(sngl(1-RTable%TorqueGaugeMalf)*real(RTable%TorqueGaugeOutput,8)) ![ft.lbf] | |||
!RT_RPMUnityOutput = sngl(RTable%Switch)*-1.d0*RotaryRPMGauge | |||
end subroutine RTable_Outputs |
@@ -1,128 +0,0 @@ | |||
subroutine RTable_Solver | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
! use CSimulationVariables | |||
use CDrillWatchVariables | |||
use RTable_VARIABLES | |||
use CSounds | |||
use equipments_PowerLimit | |||
IMPLICIT NONE | |||
REAL :: const , RT_RpmGaugeOutput | |||
!RTable%TracTorque = RTable%String_Torque/RTable%Conv_Ratio/RTable%Mech_Efficiency | |||
RT_wOld = RTable%w_new/RTable%Conv_Ratio | |||
CALL RTable_Traction_Motor | |||
if (RTable%N_ref<=0.) then | |||
Call RTable_OffMode | |||
end if | |||
!IF (RTable%ia_new<=1150.) THEN | |||
RTable%fii = 6.3304d-3*1150. | |||
!ELSE IF (RTable%ia_new>1150.) THEN | |||
! RTable%fii = 2.8571d-7*(RTable%ia_new-1150.)+7.28 | |||
!END IF | |||
RTable%Te = RTable%fii*RTable%ia_new | |||
const = RTable%J_coef+(RTable%String_JCoef/(RTable%Mech_Efficiency*RTable%Conv_Ratio)) | |||
RTable%dw = (RTable%Te-RTable%TL)/(const) | |||
if ( any(RT_RotaryMode==(/1,4/)) ) then !if rotary connected to string | |||
RT_RpmGaugeOutput = (30.d0*RTable%w_new/pi)/RTable%Conv_Ratio | |||
RTable%Speed = min(RT_RpmGaugeOutput,200.d0) !Speed [RPM] | |||
Call Set_RotaryRPMGauge(sngl(1-RTable%RpmGaugeMalf)*real(RTable%Speed,8)) | |||
RTable%SoundRPM = INT(RTable%Speed) | |||
Call SetSoundRT( RTable%SoundRPM ) | |||
!RotaryRPMGauge = RTable%Speed | |||
!RPM = RotaryRPMGauge | |||
DataDisplayConsole%RotaryTorqueGauge = ( ((RTable%J_coef+RTable%String_JCoef)*(((RTable%w_new/RTable%Conv_Ratio)-RT_wOld)/RTable%time_step))+(RTable%String_Torque) )*0.73756215 ![N.m]*0.73756215 = [ft.lbf] | |||
RTable%Torque = ( ((RTable%J_coef+RTable%String_JCoef)*(((RTable%w_new/RTable%Conv_Ratio)-RT_wOld)/RTable%time_step))+(RTable%String_Torque) )*0.73756215 ![N.m]*0.73756215 = [ft.lbf] | |||
Call Set_RotaryTorque(sngl(1-RTable%TorqueGaugeMalf)*real(RTable%Torque,8)) | |||
DrillingWatch%Torque = DataDisplayConsole%RotaryTorqueGauge | |||
!print*, 'RTable%Speed=', RTable%Speed | |||
!print*, 'RTable%String_JCoef=', RTable%String_JCoef | |||
!print*, 'RTable%String_Torque=', RTable%String_Torque | |||
else if ( any(RT_RotaryMode==(/2,5/)) ) then | |||
RTable%Speed = 0.0 | |||
RT_RpmGaugeOutput = (30.d0*RTable%w_new/pi)/RTable%Conv_Ratio | |||
RT_RpmGaugeOutput = min(RT_RpmGaugeOutput,200.d0) | |||
!print*, 'RT_RpmGaugeOutputif=', RT_RpmGaugeOutput | |||
Call Set_RotaryRPMGauge(sngl(1-RTable%RpmGaugeMalf)*real(RT_RpmGaugeOutput,8)) | |||
RTable%SoundRPM = INT((30.d0*RTable%w_new/pi)/RTable%Conv_Ratio) | |||
Call SetSoundRT( RTable%SoundRPM ) | |||
RTable%Torque = 0.0 | |||
Call Set_RotaryTorque(sngl(1-RTable%TorqueGaugeMalf)*real( (((RTable%J_coef+RTable%String_JCoef)*(((RTable%w_new/RTable%Conv_Ratio)-RT_wOld)/RTable%time_step))+(RTable%String_Torque))*0.73756215,8 )) | |||
!print*, 'RT_Rpmtorqueif=', RTable%Torque , sngl(1-RTable%TorqueGaugeMalf)*real( (((RTable%J_coef+RTable%String_JCoef)*(((RTable%w_new/RTable%Conv_Ratio)-RT_wOld)/RTable%time_step))+(RTable%String_Torque))*0.73756215,8 ) | |||
else if ( RT_RotaryMode==3 ) then | |||
RTable%Speed = 0.0 | |||
RT_RpmGaugeOutput = 0.d0 | |||
Call Set_RotaryRPMGauge(sngl(1-RTable%RpmGaugeMalf)*real(RT_RpmGaugeOutput,8)) | |||
RTable%SoundRPM = 0 | |||
Call SetSoundRT( RTable%SoundRPM ) | |||
RTable%Torque = 0.0 | |||
Call Set_RotaryTorque(sngl(1-RTable%TorqueGaugeMalf)*real( 0.d0,8 )) | |||
end if | |||
!if ( RTable%String_JCoef/=0.0 ) then !if rotary connected to string | |||
! RT_RpmGaugeOutput = (30.d0*RTable%w_new/pi)/RTable%Conv_Ratio | |||
! RTable%Speed = min(RT_RpmGaugeOutput,200.d0) !Speed [RPM] | |||
! Call Set_RotaryRPMGauge(real(RTable%Speed,8)) | |||
! RTable%SoundRPM = INT(RTable%Speed) | |||
! Call SetSoundRT( RTable%SoundRPM ) | |||
! !RotaryRPMGauge = RTable%Speed | |||
! !RPM = RotaryRPMGauge | |||
! RotaryTorqueGauge = ( ((RTable%J_coef+RTable%String_JCoef)*(((RTable%w_new/RTable%Conv_Ratio)-RT_wOld)/RTable%time_step))+(RTable%String_Torque) )*0.73756215 ![N.m]*0.73756215 = [ft.lbf] | |||
! RTable%Torque = ( ((RTable%J_coef+RTable%String_JCoef)*(((RTable%w_new/RTable%Conv_Ratio)-RT_wOld)/RTable%time_step))+(RTable%String_Torque) )*0.73756215 ![N.m]*0.73756215 = [ft.lbf] | |||
! Call Set_RotaryTorque(real(RTable%Torque,8)) | |||
! Torque = RotaryTorqueGauge | |||
!else | |||
! RTable%Speed = 0.0 | |||
! RT_RpmGaugeOutput = (30.d0*RTable%w_new/pi)/RTable%Conv_Ratio | |||
! RT_RpmGaugeOutput = min(RT_RpmGaugeOutput,200.d0) | |||
! Call Set_RotaryRPMGauge(real(RT_RpmGaugeOutput,8)) | |||
! RTable%SoundRPM = INT((30.d0*RTable%w_new/pi)/RTable%Conv_Ratio) | |||
! Call SetSoundRT( RTable%SoundRPM ) | |||
! RTable%Torque = 0.0 | |||
! Call Set_RotaryTorque(real( (((RTable%J_coef+RTable%String_JCoef)*(((RTable%w_new/RTable%Conv_Ratio)-RT_wOld)/RTable%time_step))+(RTable%String_Torque))*0.73756215,8 )) | |||
!end if | |||
!****************************************************************** | |||
!!!!!RTable%Output_Current = (RTable%TracTorque*RTable%w_new)/RTable%Vt !???????????? | |||
!!print*, 'Power_sigma=', Power_sigma | |||
!!print*, 'power_num_of_Jenerators=', power_num_of_Jenerators | |||
!!print*, 'drilling_num_of_Jenerators=', drilling_num_of_Jenerators | |||
!!!print*, 'Jenerator_power=', Jenerator_power | |||
!print*, 'RT_RpmGaugeOutput=', RT_RpmGaugeOutput | |||
!!!print*, 'RTable%Vt=', RTable%Vt | |||
!print*, 'RTable%w=', RTable%w_new | |||
!print*, 'RTable%String_Torque=', RTable%String_Torque | |||
!print*, 'RTable%Speed=', RTable%Speed | |||
!!print*, 'RTable%Speed2=', ((30.*RTable%w_new/pi)/RTable%Conv_Ratio) | |||
!!!!!!!print*, 'RTable%Te=', RTable%Te | |||
!print*, 'RTable%TL=', RTable%TL | |||
!!print*, 'RTable%ia=', RTable%ia_new | |||
!!print*, 'RTable%ia_ref=', RTable%ia_ref | |||
!!print*, 'RTable%ia_ref_limit=', RTable%ia_ref_limit | |||
END subroutine RTable_Solver |
@@ -1,43 +1,32 @@ | |||
subroutine RTable_StartUp | |||
use CDrillingConsoleVariables | |||
use RTable_VARIABLES | |||
Use RTable_VARIABLES | |||
IMPLICIT NONE | |||
RTable%Inertia_Moment = 23.261341d0 ! 23.261341[kg.m^2] = 552[lb.ft^2] | |||
RTable%Mech_Efficiency = 0.93d0 | |||
RTable%RateChange = 1.d0 ![Hz/s] !??????? motaghayere voroudi | |||
RTable%High_Conv_Ratio = 4.825d0 | |||
RTable%Low_Conv_Ratio = 7.31d0 | |||
RTable%time_step = 0.1d0 ![s] | |||
RTable%MaxRPM = 200.d0 ![RPM] !??????? motaghayere voroudi | |||
RTable%MaxTorque = 1500.d0 ![ft.lbf] !??????? motaghayere voroudi | |||
!RTable%=0. | |||
RTable%Inertia_Moment = 23.261341e0 ! 23.261341 [kg.m^2] = 552 [lb.ft^2] | |||
RTable%J_coef = RTable%Inertia_Moment+(1.e0*(RTable%Inertia_Moment)) ! [kg.m^2]??????????? | |||
RTable%String_JCoef = 0.e0 !??????????????? | |||
RTable%Mech_Efficiency = 0.93e0 | |||
!RTable%ConstLoad = 2000.e0 ![lb.in] | |||
!RTable%ConstLoad = 0.112984829e0*RTable%ConstLoad ![N.m] | |||
RTable%Torque = 0.0e0 | |||
RTable%High_Conv_Ratio = 4.825e0 | |||
RTable%Low_Conv_Ratio = 7.31e0 | |||
RTable%Conv_Ratio = RTable%Low_Conv_Ratio | |||
RTable%time_step = 0.1e0 | |||
RTable%w = 0.e0 | |||
RTable%w_new = 0.e0 | |||
RTable%K_throttle = 0 | |||
RT_OldTransMode = DrillingConsole%RTTransmissionLever | |||
RTable%RateChange = RTable%RateChange*60.d0 ![RPM/s] ![cycle/min]=[RPM] !1[Hz]=60[RPM] | |||
RTable%J_coef = RTable%Inertia_Moment+(1.d0*(RTable%Inertia_Moment)) | |||
RTable%Conv_Ratio = RTable%Low_Conv_Ratio | |||
RTable%String_JCoef = 0.d0 | |||
RTable%Torque = 0.d0 | |||
RTable%K_throttle = 0 | |||
RTable%Speed = 0.d0 | |||
RTable%TorqueGaugeOutput = 0.d0 | |||
call RTable_OffMode | |||
end subroutine RTable_StartUp |
@@ -1,141 +0,0 @@ | |||
subroutine RTable_Traction_Motor | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
! use CSimulationVariables | |||
use RTable_VARIABLES | |||
use equipments_PowerLimit | |||
IMPLICIT NONE | |||
!integer :: jnomb | |||
!jnomb = 0 | |||
!>>>>>>>>>>>>>>>>>>>>>>> DATA <<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
RTable%TL = (RTable%String_Torque+RTable%ConstLoad)/(RTable%Mech_Efficiency*RTable%Conv_Ratio) | |||
!RTable%TL = 5700. | |||
!print*, 'RTable%TLtr=', RTable%TL , RTable%Te | |||
!print*, 'RTable%String_JCoef=', RTable%String_JCoef , RTable%J_coef+(RTable%String_JCoef/(RTable%Mech_Efficiency*RTable%Conv_Ratio)) | |||
La = 1700.*1d-6 | |||
Lf = 260.*1d-6 | |||
Ra = 9.5*1d-3 | |||
!Rf = 5.4*1d-3 | |||
Rf = 0. | |||
!******** controller ******* | |||
Kpn = 50.d0 | |||
Kin = 3.d0 | |||
Kpi = 100.d0 | |||
Kii = 900.d0 | |||
RTable%time = RTable%time_step | |||
RTable%dt = 1.d-5 | |||
RTable%error = .001 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
RTable%n = RTable%time/RTable%dt | |||
RTable%w_ref = (pi*(RTable%N_ref)/30.d0) | |||
RTable%ia_ref_limit = DrillingConsole%RTTorqueLimitKnob*100.d0 | |||
!print* , 'N_ref=' , RTThrottle , RTable%w_ref , RTable%N_ref | |||
RTable%ia_er = 1. | |||
RTable%w_er = 1. | |||
RTable%x_er = 1. | |||
RTable%y_er = 1. | |||
RTable%i = 1 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
DO WHILE (RTable%i<=RTable%n) | |||
!>>>>>>>>>>>> Runge-Kutta Method (4th order) <<<<<<<<<<<<<< | |||
call RTable_dx((RTable%i*RTable%dt),RTable%ia,RTable%w,RTable%x,RTable%y) | |||
call RTable_dy((RTable%i*RTable%dt),RTable%ia,RTable%w,RTable%x,RTable%y) | |||
call RTable_dia((RTable%i*RTable%dt),RTable%ia,RTable%w,RTable%fii,RTable%x,RTable%y) | |||
call RTable_dw((RTable%i*RTable%dt),RTable%ia,RTable%w,RTable%fii,RTable%TL) | |||
RTable%K1x = RTable%dt*RTable%dx | |||
RTable%K1y = RTable%dt*RTable%dy | |||
RTable%K1ia = RTable%dt*RTable%dia | |||
RTable%K1w = RTable%dt*RTable%dw | |||
call RTable_dx((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K1ia/2.),RTable%w+(RTable%K1w/2.),RTable%x+(RTable%K1x/2.),RTable%y+(RTable%K1y/2.)) | |||
call RTable_dy((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K1ia/2.),RTable%w+(RTable%K1w/2.),RTable%x+(RTable%K1x/2.),RTable%y+(RTable%K1y/2.)) | |||
call RTable_dia((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K1ia/2.),RTable%w+(RTable%K1w/2.),RTable%fii,RTable%x+(RTable%K1x/2.),RTable%y+(RTable%K1y/2.)) | |||
call RTable_dw((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K1ia/2.),RTable%w+(RTable%K1w/2.),RTable%fii,RTable%TL) | |||
RTable%K2x = RTable%dt*RTable%dx | |||
RTable%K2y = RTable%dt*RTable%dy | |||
RTable%K2ia = RTable%dt*RTable%dia | |||
RTable%K2w = RTable%dt*RTable%dw | |||
call RTable_dx((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K2ia/2.),RTable%w+(RTable%K2w/2.),RTable%x+(RTable%K2x/2.),RTable%y+(RTable%K2y/2.)) | |||
call RTable_dy((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K2ia/2.),RTable%w+(RTable%K2w/2.),RTable%x+(RTable%K2x/2.),RTable%y+(RTable%K2y/2.)) | |||
call RTable_dia((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K2ia/2.),RTable%w+(RTable%K2w/2.),RTable%fii,RTable%x+(RTable%K2x/2.),RTable%y+(RTable%K2y/2.)) | |||
call RTable_dw((RTable%i*RTable%dt)+(RTable%dt/2.),RTable%ia+(RTable%K2ia/2.),RTable%w+(RTable%K2w/2.),RTable%fii,RTable%TL) | |||
RTable%K3x = RTable%dt*RTable%dx | |||
RTable%K3y = RTable%dt*RTable%dy | |||
RTable%K3ia = RTable%dt*RTable%dia | |||
RTable%K3w = RTable%dt*RTable%dw | |||
call RTable_dx((RTable%i*RTable%dt)+RTable%dt,RTable%ia+RTable%K3ia,RTable%w+RTable%K3w,RTable%x+RTable%K3x,RTable%y+RTable%K3y) | |||
call RTable_dy((RTable%i*RTable%dt)+RTable%dt,RTable%ia+RTable%K3ia,RTable%w+RTable%K3w,RTable%x+RTable%K3x,RTable%y+RTable%K3y) | |||
call RTable_dia((RTable%i*RTable%dt)+RTable%dt,RTable%ia+RTable%K3ia,RTable%w+RTable%K3w,RTable%fii,RTable%x+RTable%K3x,RTable%y+RTable%K3y) | |||
call RTable_dw((RTable%i*RTable%dt)+RTable%dt,RTable%ia+RTable%K3ia,RTable%w+RTable%K3w,RTable%fii,RTable%TL) | |||
RTable%K4x = RTable%dt*RTable%dx | |||
RTable%K4y = RTable%dt*RTable%dy | |||
RTable%K4ia = RTable%dt*RTable%dia | |||
RTable%K4w = RTable%dt*RTable%dw | |||
RTable%x_new = RTable%x_old+((RTable%K1x+(2.*RTable%K2x)+(2.*RTable%K3x)+RTable%K4x)/6.) | |||
RTable%y_new = RTable%y_old+((RTable%K1y+(2.*RTable%K2y)+(2.*RTable%K3y)+RTable%K4y)/6.) | |||
RTable%ia_new = RTable%ia_old+((RTable%K1ia+(2.*RTable%K2ia)+(2.*RTable%K3ia)+RTable%K4ia)/6.) | |||
RTable%w_new = RTable%w_old+((RTable%K1w+(2.*RTable%K2w)+(2.*RTable%K3w)+RTable%K4w)/6.) | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
RTable%x_old = RTable%x_new | |||
RTable%y_old = RTable%y_new | |||
RTable%ia_old = RTable%ia_new | |||
RTable%w_old = RTable%w_new | |||
RTable%x = RTable%x_new | |||
RTable%y = RTable%y_new | |||
RTable%ia = RTable%ia_new | |||
RTable%w = RTable%w_new | |||
RTable%Te = RTable%fii*RTable%ia_new | |||
!if (jnomb==0) then | |||
! print*, 'RTable%Vt0=', RTable%Vt | |||
! jnomb=1 | |||
!end if | |||
RTable%ia_ref = RTable%y_new+Kpn*((30.0*RTable%w_ref/pi)-(30.0*RTable%w_new/pi)) | |||
call RTTorqueLimit | |||
RTable%Vt = RTable%x_new+(Kpi*(RTable%ia_ref-RTable%ia_new)) | |||
!call PowerLimits | |||
!if (Power_sigma>max_Power_sigma) then | |||
! RTable%Vt = RTable%Vt | |||
!else | |||
! RTable%Vt = RTable%x_new+(Kpi*(RTable%ia_ref-RTable%ia_new)) | |||
!end if | |||
IF (RTable%Vt>810.) THEN | |||
RTable%Vt = 810.0 | |||
ELSE IF (RTable%Vt<0.) THEN | |||
RTable%Vt = 0.0 | |||
END IF | |||
RTable%i = RTable%i+1 | |||
END DO | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
!print*, 'RTable%wtr=', RTable%w_new , RTable%ia_new , RTable%dw , RTable%dia | |||
END subroutine RTable_Traction_Motor |
@@ -3,49 +3,35 @@ MODULE RTable_VARIABLES | |||
IMPLICIT NONE | |||
PUBLIC | |||
REAL, PARAMETER :: pi=3.14159265 | |||
REAL :: La, Lf, Ra, Rf | |||
REAL :: Kpn, Kin, Kpi, Kii | |||
REAL :: RT_wOld | |||
INTEGER :: RT_OldTransMode , RT_RotaryMode | |||
REAL :: RT_RPMUnityOutput | |||
REAL, PARAMETER :: pi=3.14159265 | |||
!**************************************************************************************************** | |||
!**************** Difine Rotary Table Array **************************************************** | |||
!**************************************************************************************************** | |||
!**************** Define Rotary Table Array **************************************************** | |||
TYPE, PUBLIC :: RTable_Var | |||
!***** RTable_VARIABLES ************************* | |||
INTEGER :: j , AssignmentSwitch , K_throttle | |||
INTEGER :: MotorFaileMalf , OverideTorqueLimitMalf , RpmGaugeMalf , TorqueGaugeMalf , TorqueLimitGaugeMalf | |||
REAL :: Horsepower, Speed, Output_Current, Inertia_Moment, Mech_Efficiency, Torque | |||
!********* RTable_VARIABLES ************************* | |||
INTEGER :: AssignmentSwitch , Switch , K_throttle , RotaryMode | |||
INTEGER :: MotorFaileMalf , OverideTorqueLimitMalf , RpmGaugeMalf , TorqueGaugeMalf , TorqueLimitGaugeMalf | |||
REAL(8) :: RpmGaugeOutput , TorqueGaugeOutput | |||
REAL :: Throttle, RateChange | |||
REAL :: Speed, Inertia_Moment, Mech_Efficiency, Torque, MaxRPM, MaxTorque | |||
REAL :: Conv_Ratio, High_Conv_Ratio, Low_Conv_Ratio | |||
REAL :: String_Torque, String_JCoef | |||
REAL :: TracTorque, ConstLoad | |||
REAL :: simulation_time, time_step | |||
INTEGER :: Dt_ref | |||
!***** Traction Motor_VARIABLES ***************** | |||
INTEGER :: i, n | |||
REAL :: TL, Vt, J_coef, Ea, fii, Te | |||
REAL :: time, dt, zaman | |||
REAL :: ia, w, ia_old, w_old, ia_new, w_new | |||
REAL :: error, ia_er, w_er ,x_er, y_er | |||
REAL :: K1ia, K1w, K2ia, K2w, K3ia, K3w, K4ia, K4w | |||
REAL :: K1x, K1y, K2x, K2y, K3x, K3y, K4x, K4y | |||
REAL :: ia_ref, ia_ref_limit, w_ref, N_ref ! N(rpm) , w(rad/s) | |||
REAL :: x, y, x_old, y_old, x_new, y_new | |||
REAL :: dia, dw, dx, dy | |||
REAL :: N_new, N_old | |||
REAL :: time_step, J_coef | |||
REAL :: N_new, N_old, N_ref ! N(rpm) , w(rad/s) | |||
!********* Traction Motor_VARIABLES ***************** | |||
!****************************************************** | |||
INTEGER :: BLWR ! On=1 , Off=0 | |||
!************* Sound_VARIABLES ********************** | |||
INTEGER :: SoundRPM | |||
Logical :: SoundBlower , SoundGearCrash | |||
Logical :: SoundBlower | |||
@@ -1,126 +0,0 @@ | |||
subroutine RTable_dia(x1,x2,x3,x5,x6,x7) | |||
use equipments_PowerLimit | |||
use RTable_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1,x2,x3,x5,x6,x7 | |||
!RTable%Vt = x6+Kpi*(Kpn*((30.*RTable%w_ref/pi)-(30.*x3/pi))-x2) | |||
RTable%ia_ref = x7+Kpn*((30.*RTable%w_ref/pi)-(30.*x3/pi)) | |||
call RTTorqueLimit | |||
!if (LimitOveride==1) then | |||
! goto TorqueLimit_Limitation1 | |||
!end if | |||
!IF (RTable%ia_ref>RTable%ia_ref_limit) THEN | |||
! RTable%ia_ref = RTable%ia_ref_limit | |||
!END IF | |||
!TorqueLimit_Elimination1: | |||
!call PowerLimits | |||
!if (Power_sigma>max_Power_sigma) then | |||
! RTable%Vt = RTable%Vt | |||
!else | |||
RTable%Vt = x6+(Kpi*(RTable%ia_ref-x2)) | |||
!end if | |||
IF (RTable%Vt>810.) THEN | |||
RTable%Vt = 810.0 | |||
ELSE IF (RTable%Vt<0.) THEN | |||
RTable%Vt = 0.0 | |||
END IF | |||
!IF (x2<=1150.) THEN | |||
x5 = (6.3304d-3)*1150. | |||
!ELSE IF (x2>1150.) THEN | |||
! x5 = 2.8571d-7*(x2-1150.)+7.28 | |||
!END IF | |||
RTable%Ea = x5*x3 | |||
RTable%dia = (RTable%Vt-(Ra+Rf)*x2-RTable%Ea)/(La+Lf) | |||
!call PowerLimits | |||
!if (Power_sigma>max_Power_sigma) then | |||
! RTable%dia = 0.d0 | |||
!end if | |||
end subroutine | |||
!------------------------------------------------------------------------------- | |||
subroutine RTable_dw(x1,x2,x3,x4,x5) | |||
use RTable_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1,x2,x3,x4,x5 | |||
REAL :: const | |||
!IF (x2<=1150.) THEN | |||
x4 = 6.3304d-3*1150. | |||
!ELSE IF (x2>1150.) THEN | |||
! x4 = 2.8571d-7*(x2-1150.)+7.28 | |||
!END IF | |||
RTable%Te = x4*x2 | |||
!RTable%dw = (RTable%Te-x5)/RTable%J_coef | |||
const = RTable%J_coef+(RTable%String_JCoef/(RTable%Mech_Efficiency*RTable%Conv_Ratio)) | |||
!RTable%dw = (RTable%Te-((RTable%String_Torque)/(RTable%Mech_Efficiency*RTable%Conv_Ratio)))/(const) | |||
RTable%dw = (RTable%Te-RTable%TL)/(const) | |||
end subroutine | |||
!------------------------------------------------------------ | |||
subroutine RTable_dx(x1,x2,x3,x4,x5) | |||
use RTable_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1,x2,x3,x4,x5 | |||
!RTable%dx = Kii*(Kpn*((30.*RTable%w_ref/pi)-(30.*x3/pi))-x2) | |||
RTable%ia_ref = x5+Kpn*((30.*RTable%w_ref/pi)-(30.*x3/pi)) | |||
call RTTorqueLimit | |||
!if (LimitOveride==1) then | |||
!goto TorqueLimit_Limitation2 | |||
!end if | |||
!IF (RTable%ia_ref>RTable%ia_ref_limit) THEN | |||
!RTable%ia_ref = RTable%ia_ref_limit | |||
!END IF | |||
!TorqueLimit_Elimination2: | |||
RTable%dx = Kii*(RTable%ia_ref-x2) | |||
end subroutine | |||
!------------------------------------------------------------ | |||
subroutine RTable_dy(x1,x2,x3,x4,x5) | |||
use RTable_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1,x2,x3,x4,x5 | |||
RTable%dy = Kin*((30.0d0*RTable%w_ref/pi)-(30.0d0*x3/pi)) | |||
end subroutine |
@@ -3,14 +3,14 @@ module RotaryTableMain | |||
public | |||
contains | |||
! subroutine RotaryTable_Setup() | |||
! !! use CSimulationVariables | |||
! !call OnSimulationInitialization%Add(RotaryTable_Init) | |||
! !call OnSimulationStop%Add(RotaryTable_Init) | |||
! !call OnRotaryTableStep%Add(RotaryTable_Step) | |||
! !call OnRotaryTableOutput%Add(RotaryTable_Output) | |||
! !call OnRotaryTableMain%Add(RotaryTableMainBody) | |||
! end subroutine | |||
subroutine RotaryTable_Setup() | |||
!use CSimulationVariables | |||
!call OnSimulationInitialization%Add(RotaryTable_Init) | |||
!call OnSimulationStop%Add(RotaryTable_Init) | |||
!call OnRotaryTableStep%Add(RotaryTable_Step) | |||
!call OnRotaryTableOutput%Add(RotaryTable_Output) | |||
!call OnRotaryTableMain%Add(RotaryTableMainBody) | |||
end subroutine | |||
subroutine RotaryTable_Init | |||
Call RTable_StartUp | |||
@@ -21,48 +21,28 @@ module RotaryTableMain | |||
Call Rtable_MainSolver | |||
end subroutine RotaryTable_Step | |||
! subroutine RotaryTable_Output | |||
! implicit none | |||
! end subroutine RotaryTable_Output | |||
! subroutine RotaryTableMainBody | |||
! use CDataDisplayConsoleVariables | |||
! use CDrillingConsoleVariables | |||
! ! use CSimulationVariables | |||
! use RTable_VARIABLES | |||
! use CDrillWatchVariables | |||
! use CWarningsVariables | |||
! use CSounds | |||
! implicit none | |||
subroutine RotaryTable_Output | |||
implicit none | |||
end subroutine RotaryTable_Output | |||
! integer,dimension(8) :: RT_START_TIME, RT_END_TIME | |||
! INTEGER :: RT_SolDuration | |||
subroutine RotaryTableMainBody | |||
! Call RTable_StartUp | |||
! loopRtablestart : do | |||
! CALL DATE_AND_TIME(values=RT_START_TIME) | |||
Use RTable_VARIABLES | |||
! Call Rtable_MainSolver | |||
! if (IsStopped == .true.) then | |||
! exit loopRtablestart | |||
! end if | |||
! CALL DATE_AND_TIME(values=RT_END_TIME) | |||
! RT_SolDuration = 100-(RT_END_TIME(5)*3600000+RT_END_TIME(6)*60000+RT_END_TIME(7)*1000+RT_END_TIME(8)-RT_START_TIME(5)*3600000-RT_START_TIME(6)*60000-RT_START_TIME(7)*1000-RT_START_TIME(8)) | |||
! if(RT_SolDuration > 0.0) then | |||
! CALL sleepqq(RT_SolDuration) | |||
! end if | |||
implicit none | |||
Call RTable_StartUp | |||
loopRtablestart : do | |||
Call RTable_MainSolver | |||
! end do loopRtablestart | |||
end do loopRtablestart | |||
! end subroutine RotaryTableMainBody | |||
end subroutine RotaryTableMainBody | |||
@@ -1,107 +1,67 @@ | |||
subroutine Rtable_MainSolver | |||
subroutine RTable_MainSolver | |||
use CDataDisplayConsoleVariables | |||
use CDrillingConsoleVariables | |||
! use CSimulationVariables | |||
use RTable_VARIABLES | |||
use CDrillWatchVariables | |||
use CWarningsVariables | |||
use CSounds | |||
Use RTable_VARIABLES | |||
IMPLICIT NONE | |||
! if (IsPortable) then | |||
! RTable%AssignmentSwitch = 1 | |||
! else | |||
RTable%AssignmentSwitch = DrillingConsole%AssignmentSwitch | |||
! end if | |||
Call RTable_Inputs | |||
if (RTable%Throttle<=0.d0) then | |||
RTable%K_throttle = 1 | |||
end if | |||
if ( (any(RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (RTable%Switch==-1) ) then | |||
if (DrillingConsole%RTThrottle<=0.e0) then | |||
RTable%K_throttle = 1 | |||
RTable%SoundBlower = .true. | |||
RTable%BLWR = 1 | |||
!======================= Rotary Table Rate_limit ======================= | |||
if (((RTable%N_new-RTable%N_old)/RTable%time_step)>RTable%RateChange) then | |||
RTable%N_ref = (RTable%RateChange*RTable%time_step)+RTable%N_old | |||
else if (((RTable%N_old-RTable%N_new)/RTable%time_step)>RTable%RateChange) then | |||
RTable%N_ref = (-RTable%RateChange*RTable%time_step)+RTable%N_old | |||
else | |||
RTable%N_ref = RTable%N_new | |||
end if | |||
!======================================================================= | |||
CALL RTable_OnModeSolver | |||
if ( (any(RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (DrillingConsole%RTSwitch == -1) ) then !.and. (IsStopped == .false.) ) then | |||
RTable%SoundBlower = .true. | |||
Call SetSoundBlowerRT(RTable%SoundBlower) | |||
DrillingConsole%RTBLWR = 1 | |||
IF ( DrillingConsole%RTTransmissionLever /=0 .and. RotaryGearsAbuse==0 ) THEN !be in clutch mode ?????? | |||
RTable%N_new = DrillingConsole%RTThrottle | |||
!===> Rotary Table Malfunction ----> Drive Motor Failure | |||
call RTMalfunction_MotorFailure | |||
if (((RTable%N_new-RTable%N_old)/RTable%time_step)>193.) then | |||
RTable%N_ref = (193.*RTable%time_step)+RTable%N_old | |||
else if (((RTable%N_old-RTable%N_new)/RTable%time_step)>193.) then | |||
RTable%N_ref = (-193.*RTable%time_step)+RTable%N_old | |||
else | |||
RTable%N_ref = RTable%N_new | |||
end if | |||
CALL RTable_INPUTS | |||
CALL RTable_Solver | |||
RT_RPMUnityOutput = DataDisplayConsole%RotaryRPMGauge | |||
RTable%N_old = RTable%N_ref | |||
Else IF ( DrillingConsole%RTTransmissionLever==0) THEN !be in brake mode ?????? | |||
Call RTable_OffMode | |||
RT_RPMUnityOutput = DataDisplayConsole%RotaryRPMGauge | |||
End IF | |||
RT_OldTransMode = DrillingConsole%RTTransmissionLever | |||
else if ( (any(RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (DrillingConsole%RTSwitch == 1) .and. (RTable%K_throttle==1) ) then !.and. (IsStopped == .false.) ) then | |||
RTable%SoundBlower = .true. | |||
Call SetSoundBlowerRT(RTable%SoundBlower) | |||
DrillingConsole%RTBLWR = 1 | |||
IF ( DrillingConsole%RTTransmissionLever /=0 .and. RotaryGearsAbuse==0 ) THEN !be in clutch mode ?????? | |||
RTable%N_new = DrillingConsole%RTThrottle | |||
!===> Rotary Table Malfunction ----> Drive Motor Failure | |||
call RTMalfunction_MotorFailure | |||
if (((RTable%N_new-RTable%N_old)/RTable%time_step)>193.) then | |||
RTable%N_ref = (193.*RTable%time_step)+RTable%N_old | |||
else if (((RTable%N_old-RTable%N_new)/RTable%time_step)>193.) then | |||
RTable%N_ref = (-193.*RTable%time_step)+RTable%N_old | |||
else | |||
RTable%N_ref = RTable%N_new | |||
end if | |||
CALL RTable_INPUTS | |||
CALL RTable_Solver | |||
RT_RPMUnityOutput = -DataDisplayConsole%RotaryRPMGauge | |||
RTable%N_old = RTable%N_ref | |||
Else IF ( DrillingConsole%RTTransmissionLever==0) THEN !be in brake mode ?????? | |||
Call RTable_OffMode | |||
RT_RPMUnityOutput = -DataDisplayConsole%RotaryRPMGauge | |||
End IF | |||
RT_OldTransMode = DrillingConsole%RTTransmissionLever | |||
else | |||
else if ( (any(RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (RTable%Switch==1) .and. (RTable%K_throttle==1) ) then | |||
RTable%SoundBlower = .true. | |||
RTable%BLWR = 1 | |||
!======================= Rotary Table Rate_limit ======================= | |||
if (((RTable%N_new-RTable%N_old)/RTable%time_step)>RTable%RateChange) then | |||
RTable%N_ref = (RTable%RateChange*RTable%time_step)+RTable%N_old | |||
else if (((RTable%N_old-RTable%N_new)/RTable%time_step)>RTable%RateChange) then | |||
RTable%N_ref = (-RTable%RateChange*RTable%time_step)+RTable%N_old | |||
else | |||
RTable%N_ref = RTable%N_new | |||
end if | |||
!======================================================================= | |||
CALL RTable_OnModeSolver | |||
if((any(RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (DrillingConsole%RTSwitch /= 0) ) then !.and. (IsStopped == .false.) ) then | |||
RTable%SoundBlower = .true. | |||
Call SetSoundBlowerRT(RTable%SoundBlower) | |||
DrillingConsole%RTBLWR = 1 | |||
else | |||
RTable%SoundBlower = .false. | |||
Call SetSoundBlowerRT(RTable%SoundBlower) | |||
DrillingConsole%RTBLWR = 0 | |||
end if | |||
Call RTable_OffMode | |||
RT_RPMUnityOutput = DataDisplayConsole%RotaryRPMGauge | |||
RT_OldTransMode = DrillingConsole%RTTransmissionLever | |||
RTable%K_throttle = 0 | |||
else | |||
if((any(RTable%AssignmentSwitch==(/1,2,3,4,5,8,9,10,11/))) .and. (RTable%Switch/=0)) then | |||
RTable%SoundBlower = .true. | |||
RTable%BLWR = 1 | |||
else | |||
RTable%SoundBlower = .false. | |||
RTable%BLWR = 0 | |||
end if | |||
Call RTable_OffMode | |||
RTable%K_throttle = 0 | |||
end if | |||
end if | |||
Call RTable_Outputs | |||
RTable%N_old = RTable%N_ref | |||
END subroutine Rtable_MainSolver | |||
end subroutine RTable_MainSolver |
@@ -5,7 +5,7 @@ module TopDriveMain | |||
contains | |||
subroutine TopDrive_Init() | |||
!! use CSimulationVariables | |||
!use CSimulationVariables | |||
!implicit none | |||
!call OnSimulationStop%Add(TopDrive_Stop) | |||
!call OnTopDriveStart%Add(TopDrive_Start) | |||
@@ -29,48 +29,35 @@ module TopDriveMain | |||
subroutine TopDrive_Step | |||
implicit none | |||
call Log_4('TopDrive_Step') | |||
Call TopDrive_MainSolver | |||
Call Rtable_MainSolver | |||
end subroutine TopDrive_Step | |||
! subroutine TopDriveMainBody | |||
! ! use CSimulationVariables | |||
! use TopDrive_VARIABLES | |||
! use CDrillWatchVariables | |||
! use CWarningsVariables | |||
! use CSounds | |||
! use CTopDrivePanelVariables | |||
subroutine TopDriveMainBody | |||
use CSimulationVariables | |||
use TopDrive_VARIABLES | |||
use CDrillWatchVariables | |||
use CWarningsVariables | |||
use CSounds | |||
use CTopDrivePanelVariables | |||
! implicit none | |||
implicit none | |||
! integer,dimension(8) :: TDS_START_TIME, TDS_END_TIME | |||
! INTEGER :: TDS_SolDuration | |||
! call Log_4('TopDriveMainBody') | |||
call Log_4('TopDriveMainBody') | |||
! Call TopDrive_StartUp | |||
! loopTopDrivestart : do | |||
! CALL DATE_AND_TIME(values=TDS_START_TIME) | |||
Call TopDrive_StartUp | |||
loopTopDrivestart : do | |||
! Call TopDrive_MainSolver | |||
Call TopDrive_MainSolver | |||
! if (IsStopped == .true.) then | |||
! exit loopTopDrivestart | |||
! end if | |||
! CALL DATE_AND_TIME(values=TDS_END_TIME) | |||
! TDS_SolDuration = 100-(TDS_END_TIME(5)*3600000+TDS_END_TIME(6)*60000+TDS_END_TIME(7)*1000+TDS_END_TIME(8)-TDS_START_TIME(5)*3600000-TDS_START_TIME(6)*60000-TDS_START_TIME(7)*1000-TDS_START_TIME(8)) | |||
! !print*, 'TDStime=', TDS_SolDuration | |||
! if(TDS_SolDuration > 0.0) then | |||
! CALL sleepqq(TDS_SolDuration) | |||
! end if | |||
end do loopTopDrivestart | |||
! end do loopTopDrivestart | |||
! end subroutine TopDriveMainBody | |||
end subroutine TopDriveMainBody | |||
@@ -1,48 +1,41 @@ | |||
subroutine TopDrive_INPUTS | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
! use CSimulationVariables | |||
use CTopDrivePanelVariables | |||
use CTdsConnectionModesEnumVariables | |||
use TopDrive_VARIABLES | |||
use TD_DrillStemComponents | |||
use CUnityInputs | |||
USE UnitySignalVariables | |||
! use CSlipsEnumVariables | |||
IMPLICIT NONE | |||
integer :: i | |||
subroutine TopDrive_Inputs | |||
Use CSimulationVariables | |||
Use CTopDrivePanelVariables | |||
Use CTdsConnectionModesEnumVariables | |||
Use TopDrive_VARIABLES | |||
Use TD_DrillStemComponents | |||
IMPLICIT NONE | |||
integer :: i | |||
TDS%String_Torque = TD_StringTorque*12.d0 ![lb.ft]*12 ---> [lb.in] ????????? | |||
!TDS%String_Torque = 20000. | |||
TDS%String_Torque = 0.112984829*TDS%String_Torque ![N.m] | |||
TDS%String_Torque = TD_String%StringTorque*12.d0 ![lb.ft]*12 ---> [lb.in] ????????? | |||
!TDS%String_Torque = 20000. | |||
TDS%String_Torque = 0.112984829d0*TDS%String_Torque ![N.m] | |||
TDS%PowerState = TopDrivePanel%TopDriveTdsPowerState | |||
TDS%RpmKnob = TopDrivePanel%RpmKnob | |||
!TDS%MotorFaileMalf ! jayi meghdardehi nashode ?????????????????? | |||
TDS%RateChange = 193.d0 ![RPM/s] motaghayere voroudi ??? | |||
TDS%DrillTorqueState = TopDrivePanel%TopDriveDrillTorqueState | |||
TDS%TorqueLimitKnob = TopDrivePanel%TopDriveTorqueLimitKnob ! bayad hazf shavad??????????????/ | |||
!===> TDS%String_JCoef Calculation | |||
if ( (TopDrivePanel%TopDriveDrillTorqueState==-1) .and. ((Get_TdsConnectionModes()==TDS_CONNECTION_STRING).or.(Get_TdsConnectionModes()==TDS_CONNECTION_SPINE)) ) then !if TopDrive connected to string | |||
TDS%String_JCoef = 0.0 | |||
Do i = 1,TD_StringConfigurationCount | |||
TDS%String_JCoef = TDS%String_JCoef+( (TD_DrillStem(i)%TotalWeight*((TD_DrillStem(i)%Id**2)+(TD_DrillStem(i)%Od**2)))/8.0 ) ![lb.ft^2] , Jz=(1/2)*m*(r1^2+r2^2) | |||
if ( (TDS%DrillTorqueState==-1) .and. ((Get_TdsConnectionModes()==TDS_CONNECTION_STRING).or.(Get_TdsConnectionModes()==TDS_CONNECTION_SPINE)) ) then !if TopDrive connected to string | |||
TDS%String_JCoef = 0.d0 | |||
Do i = 1,TD_String%StringConfigurationCount | |||
TDS%String_JCoef = TDS%String_JCoef+( (TD_DrillStem(i)%TotalWeight*((TD_DrillStem(i)%Id**2.d0)+(TD_DrillStem(i)%Od**2.d0)))/8.d0 ) ![lb.ft^2] , Jz=(1/2)*m*(r1^2+r2^2) | |||
End Do | |||
TDS%String_JCoef = TDS%String_JCoef*0.0421401 ![kg.m^2] | |||
TDS%String_JCoef = TDS%String_JCoef*0.0421401d0 ![kg.m^2] | |||
else | |||
TDS%String_JCoef = 0.0 | |||
TDS%String_Torque = 0.0 | |||
TDS%String_JCoef = 0.d0 | |||
TDS%String_Torque = 0.d0 | |||
end if | |||
TDS%String_JCoef = TDS%String_JCoef/10. !???????? /10: bi dalil, check it | |||
!print*, 'TDS%String_JCoef=', TDS%String_JCoef | |||
TDS%Conv_Ratio = TDS%High_Conv_Ratio | |||
TDS%String_JCoef = TDS%String_JCoef/10.d0 !???????? /10: bi dalil, check it | |||
@@ -1,67 +1,83 @@ | |||
subroutine TopDrive_MainSolver | |||
!use CDataDisplayConsoleVariables | |||
!use CDrillingConsoleVariables | |||
! use CSimulationVariables | |||
use TopDrive_VARIABLES | |||
use CDrillWatchVariables | |||
use CWarningsVariables | |||
use CSounds | |||
use CTopDrivePanelVariables | |||
Use TopDrive_VARIABLES | |||
IMPLICIT NONE | |||
!if ( (TopDriveTdsPowerState==-1) .and. (RpmKnob==0.) ) then !FWD | |||
if ( TopDrivePanel%TopDriveTdsPowerState==-1 ) then !.and. (IsStopped == .false.) | |||
CALL TopDrive_Inputs | |||
if ( (TDS%PowerState==-1) ) then !FWD | |||
TDS%SoundBlower = .true. | |||
!Call SetSoundBlowerRT(TDS%SoundBlower) | |||
TopDrivePanel%TopDriveTdsPowerLed = 1 | |||
!IF ( RTTransmissionLever /=0 .and. RotaryGearsAbuse==0 ) THEN !be in clutch mode ???? | |||
TDS%N_new = (TopDrivePanel%RpmKnob/250.d0)*965.d0 ! 0<RpmKnob<250 , 0<TDS%N_ref(truction motor)<965 | |||
TDS%PowerLed = 1 | |||
TDS%N_new = (TDS%RpmKnob/250.d0)*965.d0 ! 0<TDS%RpmKnob<250 , 0<TDS%N_ref(truction motor)<965 | |||
!===> Top Drive Malfunction ----> Drive Motor Failure | |||
call TopDrive_Malfunction_MotorFailure | |||
if (((TDS%N_new-TDS%N_old)/TDS%time_step)>193.) then | |||
TDS%N_ref = (193.*TDS%time_step)+TDS%N_old | |||
else if (((TDS%N_old-TDS%N_new)/TDS%time_step)>193.) then | |||
TDS%N_ref = (-193.*TDS%time_step)+TDS%N_old | |||
if ( TDS%MotorFaileMalf==1 ) then | |||
TDS%N_new = 0.d0 | |||
end if | |||
!========================== Top Drive Rate limit ========================== | |||
if (((TDS%N_new-TDS%N_old)/TDS%time_step)>TDS%RateChange) then | |||
TDS%N_ref = (TDS%RateChange*TDS%time_step)+TDS%N_old | |||
else if (((TDS%N_old-TDS%N_new)/TDS%time_step)>TDS%RateChange) then | |||
TDS%N_ref = (-TDS%RateChange*TDS%time_step)+TDS%N_old | |||
else | |||
TDS%N_ref = TDS%N_new | |||
end if | |||
CALL TopDrive_INPUTS | |||
!========================================================================== | |||
CALL TopDrive_Solver | |||
TDS%N_old = TDS%N_ref | |||
!else if ( (TopDriveTdsPowerState==1) .and. (RpmKnob==0.) ) then !REV | |||
else if ( (TopDrivePanel%TopDriveTdsPowerState==1) ) then !REV .and. (IsStopped == .false.) | |||
TDS%SoundBlower = .true. | |||
!Call SetSoundBlowerRT(TDS%SoundBlower) | |||
TopDrivePanel%TopDriveTdsPowerLed = 1 | |||
TDS%N_new = (TopDrivePanel%RpmKnob/250.d0)*965.d0 | |||
!===> Top Drive Malfunction ----> Drive Motor Failure | |||
call TopDrive_Malfunction_MotorFailure | |||
else if ( (TDS%PowerState==1) ) then !REV | |||
if (((TDS%N_new-TDS%N_old)/TDS%time_step)>193.) then | |||
TDS%N_ref = (193.*TDS%time_step)+TDS%N_old | |||
else if (((TDS%N_old-TDS%N_new)/TDS%time_step)>193.) then | |||
TDS%N_ref = (-193.*TDS%time_step)+TDS%N_old | |||
TDS%SoundBlower = .true. | |||
TDS%PowerLed = 1 | |||
TDS%N_new = (TDS%RpmKnob/250.d0)*965.d0 | |||
!===> Top Drive Malfunction ----> Drive Motor Failure | |||
if ( TDS%MotorFaileMalf==1 ) then | |||
TDS%N_new = 0.d0 | |||
end if | |||
!========================== Top Drive Rate limit ========================== | |||
if (((TDS%N_new-TDS%N_old)/TDS%time_step)>TDS%RateChange) then | |||
TDS%N_ref =(TDS%RateChange*TDS%time_step)+TDS%N_old | |||
else if (((TDS%N_old-TDS%N_new)/TDS%time_step)>TDS%RateChange) then | |||
TDS%N_ref = (-TDS%RateChange*TDS%time_step)+TDS%N_old | |||
else | |||
TDS%N_ref = TDS%N_new | |||
end if | |||
CALL TopDrive_INPUTS | |||
!========================================================================== | |||
CALL TopDrive_Solver | |||
TDS%N_old = TDS%N_ref | |||
else | |||
if( (TopDrivePanel%TopDriveTdsPowerState /= 0) ) then !.and. (IsStopped == .false.) | |||
if( (TDS%PowerState /= 0) ) then | |||
TDS%SoundBlower = .true. | |||
!Call SetSoundBlowerRT(TDS%SoundBlower) | |||
TopDrivePanel%TopDriveTdsPowerLed = 1 | |||
TDS%PowerLed = 1 | |||
else | |||
TDS%SoundBlower = .false. | |||
!Call SetSoundBlowerRT(TDS%SoundBlower) | |||
TopDrivePanel%TopDriveTdsPowerLed = 0 | |||
TDS%PowerLed = 0 | |||
end if | |||
Call TopDrive_OffMode | |||
end if | |||
Call TopDrive_Outputs | |||
TDS%N_old = TDS%N_ref | |||
end subroutine TopDrive_MainSolver |
@@ -1,17 +0,0 @@ | |||
subroutine TopDrive_Malfunction_MotorFailure | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
! use CSimulationVariables | |||
use TopDrive_VARIABLES | |||
IMPLICIT NONE | |||
if ( TDS%MotorFaileMalf==1 ) then | |||
TDS%N_new = 0.0 | |||
end if | |||
END subroutine |
@@ -1,73 +1,37 @@ | |||
subroutine TopDrive_OffMode | |||
use TopDrive_VARIABLES | |||
!use CDataDisplayConsoleVariables | |||
!use CDrillingConsoleVariables | |||
! use CSimulationVariables | |||
use CWarningsVariables | |||
use CSounds | |||
use CTopDrivePanelVariables | |||
Use TopDrive_VARIABLES | |||
IMPLICIT NONE | |||
TDS%N_new = 0.d0 | |||
!================================================================== | |||
! Rate limit for off Mode | |||
if ( ((TDS%N_old-0.0d0)/TDS%time_step)>386.0d0 ) then | |||
TDS%N_ref = (-386.0d0*TDS%time_step)+TDS%N_old | |||
!else | |||
! TDS%N_ref=0.0d0 | |||
!end if | |||
CALL TopDrive_INPUTS | |||
CALL TopDrive_Solver | |||
TDS%N_old = TDS%N_ref | |||
!if ( TDS_OldTransMode==0 .and. TDS%w_new/=0.d0 ) then | |||
! Call Activate_RotaryGearsAbuse() | |||
! TDS%SoundGearCrash = .true. | |||
! Call SetSoundRtGearCrash(TDS%SoundGearCrash) | |||
!else | |||
! TDS%SoundGearCrash = .false. | |||
! Call SetSoundRtGearCrash(TDS%SoundGearCrash) | |||
!end if | |||
!TDS_OldTransMode = RTTransmissionLever | |||
if (((TDS%N_old-TDS%N_new)/TDS%time_step)>(2.d0*TDS%RateChange)) then ! baraye 0 shodan RateChange ro *2 karde ??? | |||
TDS%N_ref = (-(2.d0*TDS%RateChange)*TDS%time_step)+TDS%N_old | |||
Call TopDrive_Solver | |||
!================================================================== | |||
else | |||
TDS%N_ref = 0. | |||
TDS%N_new = 0. | |||
TDS%N_old = 0. | |||
TDS%ia = 0. | |||
TDS%ia_old = 0. | |||
TDS%ia_new = 0. | |||
TDS%x = 0. | |||
TDS%x_old = 0. | |||
TDS%x_new = 0. | |||
TDS%y = 0. | |||
TDS%y_old = 0. | |||
TDS%y_new = 0. | |||
TDS%w = 0. | |||
TDS%w_old = 0. | |||
TDS%w_new = 0. | |||
TDS%Speed = 0. | |||
TDS_wOld = 0. | |||
TDS%N_ref = 0.d0 | |||
TDS%N_new = 0.d0 | |||
TDS%N_old = 0.d0 | |||
TDS%Speed = 0.d0 | |||
TDS%TDS_wOld = 0.d0 | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = -TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 ![ft.lbf] | |||
TDS_OldPowerMode = 1 | |||
TDS%OperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = -TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf] | |||
TDS%OldPowerMode = 1 | |||
TDS_OldPowerMode = 0 | |||
TDS%OldPowerMode = 0 | |||
End if | |||
@@ -0,0 +1,23 @@ | |||
Subroutine TopDrive_Outputs | |||
Use TopDrive_VARIABLES | |||
Use CTopDrivePanelVariables | |||
IMPLICIT NONE | |||
TopDrivePanel%TopDriveTdsPowerLed = TDS%PowerLed | |||
TopDrivePanel%TopDriveOperationFaultLed = TDS%OperationFaultLed | |||
!TDS%Speed ! to other modules ![RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%RpmGaugeOutput ![RPM] | |||
TopDrivePanel%TopDriveTorqueGauge = TDS%TorqueGaugeOutput ![ft.lbf] | |||
!TDS%SoundBlower | |||
!TDS%RPMUnityOutput | |||
End Subroutine TopDrive_Outputs |
@@ -1,314 +1,248 @@ | |||
subroutine TopDrive_Solver | |||
!use CDrillingConsoleVariables | |||
!use CDataDisplayConsoleVariables | |||
! use CSimulationVariables | |||
use CDrillWatchVariables | |||
use TopDrive_VARIABLES | |||
use CSounds | |||
use CTopDrivePanelVariables | |||
use CTdsConnectionModesEnumVariables | |||
use equipments_PowerLimit | |||
Use TopDrive_VARIABLES | |||
Use CTdsConnectionModesEnumVariables | |||
IMPLICIT NONE | |||
REAL :: const | |||
!TDS%TracTorque = TDS%String_Torque/TDS%Conv_Ratio/TDS%Mech_Efficiency | |||
TDS_wOld = TDS%w_new/TDS%Conv_Ratio | |||
CALL TopDrive_Traction_Motor | |||
!if (TDS%N_ref<=0.) then | |||
! Call TopDrive_OffMode | |||
!end if | |||
TDS%TDS_wOld = ((pi*TDS%Speed)/30.d0) ![rad/s] | |||
!****************************************************************** | |||
!IF (TDS%ia_new<=1150.) THEN | |||
TDS%fii = 6.3304d-3*1150.d0 | |||
!ELSE IF (TDS%ia_new>1150.) THEN | |||
! TDS%fii = 2.8571d-7*(TDS%ia_new-1150.)+7.28 | |||
!END IF | |||
TDS%Te = TDS%fii*TDS%ia_new | |||
const = TDS%J_coef+(TDS%String_JCoef/(TDS%Mech_Efficiency*TDS%Conv_Ratio)) | |||
TDS%dw = (TDS%Te-TDS%TL)/(const) | |||
if ( TopDrivePanel%TopDriveTdsPowerState==-1 .or. TDS_OldPowerMode==-1 ) then !FWD | |||
if ( TDS%PowerState==-1 .or. TDS%OldPowerMode==-1 ) then !FWD | |||
if ( TopDrivePanel%TopDriveDrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then ! TdsMu_SPINE | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = 30.d0 | |||
TD_RPMUnityOutput = TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 30 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 | |||
TDS_OldPowerMode = -1 | |||
else if ( TopDrivePanel%TopDriveDrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then ! TdsMu_SPINE | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 1000.d0 | |||
TDS_OldPowerMode = -1 | |||
else if ( TopDrivePanel%TopDriveDrillTorqueState==1 ) then ! TdsMu_Torque | |||
if ( TopDrivePanel%RpmKnob>0. ) then | |||
TopDrivePanel%TopDriveOperationFaultLed = 1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 ![ft.lbf] | |||
TDS_OldPowerMode = -1 | |||
if ( TDS%DrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then ! TdsMu_SPINE | |||
TDS%OperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = 30.d0 | |||
TDS%RPMUnityOutput = TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 30 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 0.d0 | |||
TDS%OldPowerMode = -1 | |||
else if ( TDS%DrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then ! TdsMu_SPINE | |||
TDS%OperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 1000.d0 | |||
TDS%OldPowerMode = -1 | |||
else if ( TDS%DrillTorqueState==1 ) then ! TdsMu_Torque | |||
if ( TDS%RpmKnob>0. ) then | |||
TDS%OperationFaultLed = 1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf] | |||
TDS%OldPowerMode = -1 | |||
else | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%OperationFaultLed = 0 | |||
if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = max( 1000.d0,((TopDrivePanel%TopDriveTorqueLimitKnob/10.d0)*60000.d0) ) ![ft.lbf] ???? | |||
TDS_OldPowerMode = -1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = max( 1000.d0,((TDS%TorqueLimitKnob/10.d0)*60000.d0) ) ![ft.lbf] ???? | |||
TDS%OldPowerMode = -1 | |||
else if ( Get_TdsConnectionModes()==Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 ![ft.lbf] | |||
TDS_OldPowerMode = -1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf] | |||
TDS%OldPowerMode = -1 | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 1000.d0 ![ft.lbf] | |||
TDS_OldPowerMode = -1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 1000.d0 ![ft.lbf] | |||
TDS%OldPowerMode = -1 | |||
end if | |||
end if | |||
else if ( TopDrivePanel%TopDriveDrillTorqueState==-1 ) then ! TdsMu_DRILL | |||
else if ( TDS%DrillTorqueState==-1 ) then ! TdsMu_DRILL | |||
if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%Speed = (30.d0*TDS%w_new/pi)/TDS%Conv_Ratio !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = INT(TDS%Speed) | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = ( ((TDS%J_coef+TDS%String_JCoef)*(((TDS%w_new/TDS%Conv_Ratio)-TDS_wOld)/TDS%time_step))+(TDS%String_Torque) )*0.73756215 ![N.m]*0.73756215 = [ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge= TDS%Torque | |||
TDS_OldPowerMode = -1 | |||
else if ( Get_TdsConnectionModes()==Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%Speed = 0.0d0 | |||
TopDrivePanel%TopDriveRpmGauge = ((30.d0*TDS%w_new/pi)/TDS%Conv_Ratio) !Speed [RPM] | |||
TD_RPMUnityOutput = TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = INT((30.d0*TDS%w_new/pi)/TDS%Conv_Ratio) | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.0d0 | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 ![ft.lbf] | |||
TDS_OldPowerMode = -1 | |||
TDS%OperationFaultLed = 0 | |||
TDS%Speed = TDS%N_ref/TDS%Conv_Ratio !Speed [RPM] | |||
TDS%Speed = min(TDS%Speed,TDS%MaxRPM) | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = TDS%RpmGaugeOutput | |||
TDS%SoundRPM = INT(TDS%Speed) | |||
TDS%Torque = ( ((TDS%J_coef+TDS%String_JCoef)*(((((pi*TDS%N_ref)/30.d0)/TDS%Conv_Ratio)-TDS%TDS_wOld)/TDS%time_step))+(TDS%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] | |||
TDS%Torque = min(TDS%Torque,TDS%MaxTorque) ! [ft.lbf] | |||
TDS%TorqueGaugeOutput = TDS%Torque | |||
TDS%OldPowerMode = -1 | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then | |||
TDS%OperationFaultLed = 0 | |||
TDS%Speed = 0.0d0 | |||
TDS%RpmGaugeOutput = TDS%N_ref/TDS%Conv_Ratio !Speed [RPM] | |||
TDS%RPMUnityOutput = TDS%RpmGaugeOutput | |||
TDS%SoundRPM = INT(TDS%N_ref/TDS%Conv_Ratio) | |||
TDS%Torque = 0.0d0 | |||
TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf] | |||
TDS%OldPowerMode = -1 | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then | |||
if ( TopDrivePanel%RpmKnob>0. ) then | |||
TopDrivePanel%TopDriveOperationFaultLed = 1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 ![ft.lbf] | |||
TDS_OldPowerMode = -1 | |||
if ( TDS%RpmKnob>0. ) then | |||
TDS%OperationFaultLed = 1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf] | |||
TDS%OldPowerMode = -1 | |||
else | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 ![ft.lbf] | |||
TDS_OldPowerMode = -1 | |||
TDS%OperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf] | |||
TDS%OldPowerMode = -1 | |||
end if | |||
end if | |||
else | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 ![ft.lbf] | |||
TDS_OldPowerMode = -1 | |||
TDS%OperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf] | |||
TDS%OldPowerMode = -1 | |||
end if | |||
else if ( TopDrivePanel%TopDriveTdsPowerState==1 .or. TDS_OldPowerMode==1 ) then !REV | |||
else if ( TDS%PowerState==1 .or. TDS%OldPowerMode==1 ) then !REV | |||
if ( TopDrivePanel%TopDriveDrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then ! TdsMu_SPINE | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = 30.d0 | |||
TD_RPMUnityOutput = -TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 30 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 | |||
TDS_OldPowerMode = 1 | |||
else if ( TopDrivePanel%TopDriveDrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then ! TdsMu_SPINE | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = 30.d0 | |||
TD_RPMUnityOutput = -TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 1000.d0 | |||
TDS_OldPowerMode = 1 | |||
else if ( TopDrivePanel%TopDriveDrillTorqueState==1 ) then ! TdsMu_Torque | |||
if ( TopDrivePanel%RpmKnob>0. ) then | |||
TopDrivePanel%TopDriveOperationFaultLed = 1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = -TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 ![ft.lbf] | |||
TDS_OldPowerMode = 1 | |||
if ( TDS%DrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then ! TdsMu_SPINE | |||
TDS%OperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = 30.d0 | |||
TDS%RPMUnityOutput = -TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 30 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 0.d0 | |||
TDS%OldPowerMode = 1 | |||
else if ( TDS%DrillTorqueState==0 .and. Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then ! TdsMu_SPINE | |||
TDS%OperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = 30.d0 | |||
TDS%RPMUnityOutput = -TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 1000.d0 | |||
TDS%OldPowerMode = 1 | |||
else if ( TDS%DrillTorqueState==1 ) then ! TdsMu_Torque | |||
if ( TDS%RpmKnob>0.d0 ) then | |||
TDS%OperationFaultLed = 1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = -TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf] | |||
TDS%OldPowerMode = 1 | |||
else | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%OperationFaultLed = 0 | |||
if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = -TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 2000.d0 | |||
TDS_OldPowerMode = 1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = -TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 2000.d0 | |||
TDS%OldPowerMode = 1 | |||
else if ( Get_TdsConnectionModes()==Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = -TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 ![ft.lbf] | |||
TDS_OldPowerMode = 1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = -TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf] | |||
TDS%OldPowerMode = 1 | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 1000.d0 ![ft.lbf] | |||
TDS_OldPowerMode = -1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 1000.d0 ![ft.lbf] | |||
TDS%OldPowerMode = -1 | |||
end if | |||
end if | |||
else if ( TopDrivePanel%TopDriveDrillTorqueState==-1 ) then ! TdsMu_DRILL | |||
else if ( TDS%DrillTorqueState==-1 ) then ! TdsMu_DRILL | |||
if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%Speed = (30.d0*TDS%w_new/pi)/TDS%Conv_Ratio !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = -TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = INT(TDS%Speed) | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = ( ((TDS%J_coef+TDS%String_JCoef)*(((TDS%w_new/TDS%Conv_Ratio)-TDS_wOld)/TDS%time_step))+(TDS%String_Torque) )*0.73756215 ![N.m]*0.73756215 = [ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge= TDS%Torque | |||
TDS_OldPowerMode = 1 | |||
else if ( Get_TdsConnectionModes()==Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%Speed = 0.0d0 | |||
TopDrivePanel%TopDriveRpmGauge = ((30.d0*TDS%w_new/pi)/TDS%Conv_Ratio) !Speed [RPM] | |||
TD_RPMUnityOutput = -TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = INT((30.d0*TDS%w_new/pi)/TDS%Conv_Ratio) | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.0d0 | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 ![ft.lbf] | |||
TDS_OldPowerMode = 1 | |||
TDS%OperationFaultLed = 0 | |||
TDS%Speed = TDS%N_ref/TDS%Conv_Ratio !Speed [RPM] | |||
TDS%Speed = min(TDS%Speed,TDS%MaxRPM) | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = -TDS%RpmGaugeOutput | |||
TDS%SoundRPM = INT(TDS%Speed) | |||
TDS%Torque = ( ((TDS%J_coef+TDS%String_JCoef)*(((((pi*TDS%N_ref)/30.d0)/TDS%Conv_Ratio)-TDS%TDS_wOld)/TDS%time_step))+(TDS%String_Torque) )*0.73756215d0 ![N.m]*0.73756215 = [ft.lbf] | |||
TDS%Torque = min(TDS%Torque,TDS%MaxTorque) ! [ft.lbf] | |||
TDS%TorqueGaugeOutput = TDS%Torque | |||
TDS%OldPowerMode = 1 | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING ) then | |||
TDS%OperationFaultLed = 0 | |||
TDS%Speed = 0.0d0 | |||
TDS%RpmGaugeOutput = TDS%N_ref/TDS%Conv_Ratio !Speed [RPM] | |||
TDS%RPMUnityOutput = -TDS%RpmGaugeOutput | |||
TDS%SoundRPM = INT(TDS%N_ref/TDS%Conv_Ratio) | |||
TDS%Torque = 0.0d0 | |||
TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf] | |||
TDS%OldPowerMode = 1 | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then | |||
if ( TopDrivePanel%RpmKnob>0. ) then | |||
TopDrivePanel%TopDriveOperationFaultLed = 1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = -TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 ![ft.lbf] | |||
TDS_OldPowerMode = 1 | |||
if ( TDS%RpmKnob>0. ) then | |||
TDS%OperationFaultLed = 1 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = -TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf] | |||
TDS%OldPowerMode = 1 | |||
else | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = -TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 ![ft.lbf] | |||
TDS_OldPowerMode = 1 | |||
TDS%OperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = -TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf] | |||
TDS%OldPowerMode = 1 | |||
end if | |||
end if | |||
else | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TopDrivePanel%TopDriveRpmGauge = TDS%Speed | |||
TD_RPMUnityOutput = -TopDrivePanel%TopDriveRpmGauge | |||
TDS%SoundRPM = 0 | |||
!Call SetSound( TDS%SoundRPM ) | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TopDrivePanel%TopDriveTorqueGauge = 0.d0 ![ft.lbf] | |||
TDS_OldPowerMode = 1 | |||
TDS%OperationFaultLed = 0 | |||
TDS%Speed = 0.d0 !Speed [RPM] | |||
TDS%RpmGaugeOutput = TDS%Speed | |||
TDS%RPMUnityOutput = -TDS%RpmGaugeOutput | |||
TDS%SoundRPM = 0 | |||
TDS%Torque = 0.d0 ![ft.lbf] | |||
TDS%TorqueGaugeOutput = 0.d0 ![ft.lbf] | |||
TDS%OldPowerMode = 1 | |||
end if | |||
end if | |||
!****************************************************************** | |||
!!!!TDS%Output_Current = (TDS%TracTorque*TDS%w_new)/TDS%Vt !???????????? | |||
!print*, 'Power_sigma=', Power_sigma | |||
!print*, 'power_num_of_Jenerators=', power_num_of_Jenerators | |||
!print*, 'drilling_num_of_Jenerators=', drilling_num_of_Jenerators | |||
!!print*, 'Jenerator_power=', Jenerator_power | |||
!print*, 'max_Power_sigma=', max_Power_sigma | |||
!print*, 'TDS%Vt=', TDS%Vt | |||
!!print*, 'TDS%w=', TDS%w_new | |||
!!!print*, 'TDS%String_Torque=', TDS%String_Torque | |||
!!print*, 'TDS%Speed=', TDS%Speed | |||
!!print*, 'TDS%Speed2=', ((30.*TDS%w_new/pi)/TDS%Conv_Ratio) | |||
!!!!!print*, 'TDS%Te=', TDS%Te | |||
!!print*, 'TDS%TL=', TDS%TL | |||
!print*, 'TDS%ia=', TDS%ia_new | |||
!print*, 'TDS%ia_ref=', TDS%ia_ref | |||
!print*, 'TDS%ia_ref_limit=', TDS%ia_ref_limit | |||
END subroutine |
@@ -1,44 +1,30 @@ | |||
subroutine TopDrive_StartUp | |||
use CTopDrivePanelVariables | |||
use TopDrive_VARIABLES | |||
Use TopDrive_VARIABLES | |||
IMPLICIT NONE | |||
TopDrivePanel%TopDriveOperationFaultLed = 0 | |||
TDS_OldPowerMode = 0 | |||
TDS%MaxRPM = 200.d0 ![RPM] !??????? motaghayere voroudi | |||
TDS%MaxTorque = 1500.d0 ![ft.lbf] !??????? motaghayere voroudi | |||
TDS%time_step = 0.10d0 ![s] | |||
TDS%Inertia_Moment = 23.261341d0 ! 23.261341 [kg.m^2] = 552 [lb.ft^2] | |||
TDS%J_coef = TDS%Inertia_Moment+(1.d0*(TDS%Inertia_Moment)) ! [kg.m^2]??????????? | |||
TDS%String_JCoef = 0.d0 | |||
!TDS%Mech_Efficiency = 0.930d0 | |||
TDS%Torque = 0.d0 | |||
TDS%Speed = 0.d0 | |||
TDS%OperationFaultLed = 0 | |||
TDS%OldPowerMode = 0 | |||
TDS%MotorFaileMalf = 0 | |||
!TDS%=0. | |||
TDS%High_Conv_Ratio = 4.825d0 | |||
TDS%Low_Conv_Ratio = 7.310d0 | |||
TDS%Conv_Ratio = TDS%High_Conv_Ratio | |||
TDS%Inertia_Moment = 23.261341 ! 23.261341 [kg.m^2] = 552 [lb.ft^2] | |||
TDS%J_coef = TDS%Inertia_Moment+(1.*(TDS%Inertia_Moment)) ! [kg.m^2]??????????? | |||
TDS%String_JCoef = 0. !??????????????? | |||
TDS%Mech_Efficiency = 0.930 | |||
TDS%ConstLoad = 2000. ![lb.in] | |||
TDS%ConstLoad = 0.112984829*TDS%ConstLoad ![N.m] | |||
TDS%Torque = 0.0 | |||
TDS%High_Conv_Ratio = 4.8250 | |||
TDS%Low_Conv_Ratio = 7.310 | |||
TDS%Conv_Ratio = TDS%High_Conv_Ratio | |||
TDS%time_step = .10 | |||
TDS%w = 0.0 | |||
TDS%w_new = 0.0 | |||
!TDS_OldTransMode = RTTransmissionLever ?????? | |||
call TopDrive_OffMode | |||
Call TopDrive_OffMode | |||
@@ -1,25 +0,0 @@ | |||
subroutine TopDrive_TorqueLimit | |||
Use equipments_PowerLimit | |||
Use TopDrive_VARIABLES | |||
IMPLICIT NONE | |||
! Top Drive Malfunction ----> Drive Motor Limit Overide | |||
if ( TDS%OverideTorqueLimitMalf==1 ) then | |||
return | |||
end if | |||
IF (TDS%ia_ref>TDS%ia_ref_limit) THEN | |||
TDS%ia_ref = TDS%ia_ref_limit | |||
END IF | |||
end subroutine |
@@ -1,139 +0,0 @@ | |||
subroutine TopDrive_Traction_Motor | |||
use CDrillingConsoleVariables | |||
use CDataDisplayConsoleVariables | |||
! use CSimulationVariables | |||
use CTopDrivePanelVariables | |||
use TopDrive_VARIABLES | |||
use equipments_PowerLimit | |||
IMPLICIT NONE | |||
!integer :: jnomb | |||
!jnomb = 0 | |||
!>>>>>>>>>>>>>>>>>>>>>>> DATA <<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
TDS%TL = (TDS%String_Torque+TDS%ConstLoad)/(TDS%Mech_Efficiency*TDS%Conv_Ratio) | |||
La = 1700.*1d-6 | |||
Lf = 260.*1d-6 | |||
Ra = 9.5*1d-3 | |||
!Rf = 5.4*1d-3 | |||
Rf = 0. | |||
!******** controller ******* | |||
Kpn = 50.d0 | |||
Kin = 3.d0 | |||
Kpi = 100.d0 | |||
Kii = 900.d0 | |||
TDS%time = TDS%time_step | |||
TDS%dt = 1.d-5 | |||
TDS%error = .001 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
TDS%n = TDS%time/TDS%dt | |||
TDS%w_ref = (pi*(TDS%N_ref)/30.) | |||
TDS%ia_ref_limit = TopDrivePanel%TopDriveTorqueLimitKnob/60.d0 | |||
TDS%ia_er = 1. | |||
TDS%w_er = 1. | |||
TDS%x_er = 1. | |||
TDS%y_er = 1. | |||
TDS%i = 1 | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
DO WHILE (TDS%i<=TDS%n) | |||
!>>>>>>>>>>>> Runge-Kutta Method (4th order) <<<<<<<<<<<<<< | |||
call TDS_dx((TDS%i*TDS%dt),TDS%ia,TDS%w,TDS%x,TDS%y) | |||
call TDS_dy((TDS%i*TDS%dt),TDS%ia,TDS%w,TDS%x,TDS%y) | |||
call TDS_dia((TDS%i*TDS%dt),TDS%ia,TDS%w,TDS%fii,TDS%x,TDS%y) | |||
call TDS_dw((TDS%i*TDS%dt),TDS%ia,TDS%w,TDS%fii,TDS%TL) | |||
TDS%K1x = TDS%dt*TDS%dx | |||
TDS%K1y = TDS%dt*TDS%dy | |||
TDS%K1ia = TDS%dt*TDS%dia | |||
TDS%K1w = TDS%dt*TDS%dw | |||
call TDS_dx((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K1ia/2.),TDS%w+(TDS%K1w/2.),TDS%x+(TDS%K1x/2.),TDS%y+(TDS%K1y/2.)) | |||
call TDS_dy((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K1ia/2.),TDS%w+(TDS%K1w/2.),TDS%x+(TDS%K1x/2.),TDS%y+(TDS%K1y/2.)) | |||
call TDS_dia((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K1ia/2.),TDS%w+(TDS%K1w/2.),TDS%fii,TDS%x+(TDS%K1x/2.),TDS%y+(TDS%K1y/2.)) | |||
call TDS_dw((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K1ia/2.),TDS%w+(TDS%K1w/2.),TDS%fii,TDS%TL) | |||
TDS%K2x = TDS%dt*TDS%dx | |||
TDS%K2y = TDS%dt*TDS%dy | |||
TDS%K2ia = TDS%dt*TDS%dia | |||
TDS%K2w = TDS%dt*TDS%dw | |||
call TDS_dx((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K2ia/2.),TDS%w+(TDS%K2w/2.),TDS%x+(TDS%K2x/2.),TDS%y+(TDS%K2y/2.)) | |||
call TDS_dy((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K2ia/2.),TDS%w+(TDS%K2w/2.),TDS%x+(TDS%K2x/2.),TDS%y+(TDS%K2y/2.)) | |||
call TDS_dia((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K2ia/2.),TDS%w+(TDS%K2w/2.),TDS%fii,TDS%x+(TDS%K2x/2.),TDS%y+(TDS%K2y/2.)) | |||
call TDS_dw((TDS%i*TDS%dt)+(TDS%dt/2.),TDS%ia+(TDS%K2ia/2.),TDS%w+(TDS%K2w/2.),TDS%fii,TDS%TL) | |||
TDS%K3x = TDS%dt*TDS%dx | |||
TDS%K3y = TDS%dt*TDS%dy | |||
TDS%K3ia = TDS%dt*TDS%dia | |||
TDS%K3w = TDS%dt*TDS%dw | |||
call TDS_dx((TDS%i*TDS%dt)+TDS%dt,TDS%ia+TDS%K3ia,TDS%w+TDS%K3w,TDS%x+TDS%K3x,TDS%y+TDS%K3y) | |||
call TDS_dy((TDS%i*TDS%dt)+TDS%dt,TDS%ia+TDS%K3ia,TDS%w+TDS%K3w,TDS%x+TDS%K3x,TDS%y+TDS%K3y) | |||
call TDS_dia((TDS%i*TDS%dt)+TDS%dt,TDS%ia+TDS%K3ia,TDS%w+TDS%K3w,TDS%fii,TDS%x+TDS%K3x,TDS%y+TDS%K3y) | |||
call TDS_dw((TDS%i*TDS%dt)+TDS%dt,TDS%ia+TDS%K3ia,TDS%w+TDS%K3w,TDS%fii,TDS%TL) | |||
TDS%K4x = TDS%dt*TDS%dx | |||
TDS%K4y = TDS%dt*TDS%dy | |||
TDS%K4ia = TDS%dt*TDS%dia | |||
TDS%K4w = TDS%dt*TDS%dw | |||
TDS%x_new = TDS%x_old+((TDS%K1x+(2.*TDS%K2x)+(2.*TDS%K3x)+TDS%K4x)/6.) | |||
TDS%y_new = TDS%y_old+((TDS%K1y+(2.*TDS%K2y)+(2.*TDS%K3y)+TDS%K4y)/6.) | |||
TDS%ia_new = TDS%ia_old+((TDS%K1ia+(2.*TDS%K2ia)+(2.*TDS%K3ia)+TDS%K4ia)/6.) | |||
TDS%w_new = TDS%w_old+((TDS%K1w+(2.*TDS%K2w)+(2.*TDS%K3w)+TDS%K4w)/6.) | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
TDS%x_old = TDS%x_new | |||
TDS%y_old = TDS%y_new | |||
TDS%ia_old = TDS%ia_new | |||
TDS%w_old = TDS%w_new | |||
TDS%x = TDS%x_new | |||
TDS%y = TDS%y_new | |||
TDS%ia = TDS%ia_new | |||
TDS%w = TDS%w_new | |||
TDS%Te = TDS%fii*TDS%ia_new | |||
!if (jnomb==0) then | |||
! print*, 'TDS%Vt0=', TDS%Vt | |||
! jnomb=1 | |||
!end if | |||
TDS%ia_ref = TDS%y_new+Kpn*((30.0*TDS%w_ref/pi)-(30.0*TDS%w_new/pi)) | |||
call RTTorqueLimit | |||
TDS%Vt = TDS%x_new+(Kpi*(TDS%ia_ref-TDS%ia_new)) | |||
!call PowerLimits | |||
!if (Power_sigma>max_Power_sigma) then | |||
! TDS%Vt = TDS%Vt | |||
!else | |||
! TDS%Vt = TDS%x_new+(Kpi*(TDS%ia_ref-TDS%ia_new)) | |||
!end if | |||
IF (TDS%Vt>810.) THEN | |||
TDS%Vt = 810.0 | |||
ELSE IF (TDS%Vt<0.) THEN | |||
TDS%Vt = 0.0 | |||
END IF | |||
TDS%i = TDS%i+1 | |||
END DO | |||
!>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |||
END subroutine |
@@ -3,54 +3,35 @@ MODULE TopDrive_VARIABLES | |||
IMPLICIT NONE | |||
PUBLIC | |||
REAL, PARAMETER :: pi=3.14159265 | |||
REAL :: La, Lf, Ra, Rf | |||
REAL :: Kpn, Kin, Kpi, Kii | |||
REAL :: TDS_wOld | |||
INTEGER :: TDS_OldTransMode , TDS_OldPowerMode | |||
REAL :: TD_RPMUnityOutput | |||
REAL, PARAMETER :: pi=3.14159265d0 | |||
!**************************************************************************************************** | |||
!**************** Difine Top Drive Array **************************************************** | |||
!**************** Define Top Drive Array **************************************************** | |||
TYPE, PUBLIC :: TDS_Var | |||
!***** TopDrive_VARIABLES ************************* | |||
INTEGER :: j | |||
INTEGER :: MotorFaileMalf , OverideTorqueLimitMalf | |||
INTEGER :: MotorFaileMalf , OverideTorqueLimitMalf , PowerState , OldPowerMode , DrillTorqueState | |||
REAL :: Speed, Inertia_Moment, Torque, RpmKnob, TorqueLimitKnob | |||
REAL :: Conv_Ratio, High_Conv_Ratio, Low_Conv_Ratio, RateChange, N_new, N_old, N_ref, TDS_wOld ! N[rpm] , w[rad/s] | |||
REAL :: RpmGaugeOutput, RPMUnityOutput, TorqueGaugeOutput, MaxRPM, MaxTorque | |||
REAL :: String_Torque, String_JCoef, J_coef | |||
REAL :: time_step | |||
REAL :: Horsepower, Speed, Output_Current, Inertia_Moment, Mech_Efficiency, Torque | |||
REAL :: Conv_Ratio, High_Conv_Ratio, Low_Conv_Ratio | |||
REAL :: String_Torque, String_JCoef | |||
REAL :: TracTorque, ConstLoad | |||
REAL :: simulation_time, time_step | |||
INTEGER :: Dt_ref | |||
!***** Traction Motor_VARIABLES ***************** | |||
INTEGER :: i, n | |||
REAL :: TL, Vt, J_coef, Ea, fii, Te | |||
REAL :: time, dt, zaman | |||
REAL :: ia, w, ia_old, w_old, ia_new, w_new | |||
REAL :: error, ia_er, w_er ,x_er, y_er | |||
REAL :: K1ia, K1w, K2ia, K2w, K3ia, K3w, K4ia, K4w | |||
REAL :: K1x, K1y, K2x, K2y, K3x, K3y, K4x, K4y | |||
REAL :: ia_ref, ia_ref_limit, w_ref, N_ref ! N(rpm) , w(rad/s) | |||
REAL :: x, y, x_old, y_old, x_new, y_new | |||
REAL :: dia, dw, dx, dy | |||
REAL :: N_new, N_old | |||
INTEGER :: PowerLed ! 1=On , 0=Off | |||
INTEGER :: OperationFaultLed | |||
!************* Sound_VARIABLES ********************** | |||
INTEGER :: SoundRPM | |||
Logical :: SoundBlower , SoundGearCrash | |||
Logical :: SoundBlower | |||
END TYPE TDS_Var | |||
TYPE(TDS_Var) :: TDS | |||
!*********************************************************************************************** | |||
!**************************************************************************************************** | |||
@@ -1,124 +0,0 @@ | |||
subroutine TDS_dia(x1,x2,x3,x5,x6,x7) | |||
use equipments_PowerLimit | |||
use TopDrive_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1,x2,x3,x5,x6,x7 | |||
!TDS%Vt = x6+Kpi*(Kpn*((30.*TDS%w_ref/pi)-(30.*x3/pi))-x2) | |||
TDS%ia_ref = x7+Kpn*((30.*TDS%w_ref/pi)-(30.*x3/pi)) | |||
call TopDrive_TorqueLimit | |||
!IF (TDS%ia_ref>TDS%ia_ref_limit) THEN | |||
! TDS%ia_ref = TDS%ia_ref_limit | |||
!END IF | |||
!TorqueLimit_Elimination1: | |||
!call PowerLimits | |||
!if (Power_sigma>max_Power_sigma) then | |||
! TDS%Vt = TDS%Vt | |||
!else | |||
TDS%Vt = x6+(Kpi*(TDS%ia_ref-x2)) | |||
!end if | |||
IF (TDS%Vt>810.) THEN | |||
TDS%Vt = 810.0 | |||
ELSE IF (TDS%Vt<0.) THEN | |||
TDS%Vt = 0.0 | |||
END IF | |||
!IF (x2<=1150.) THEN | |||
x5 = (6.3304d-3)*1150. | |||
!ELSE IF (x2>1150.) THEN | |||
! x5 = 2.8571d-7*(x2-1150.)+7.28 | |||
!END IF | |||
TDS%Ea = x5*x3 | |||
TDS%dia = (TDS%Vt-(Ra+Rf)*x2-TDS%Ea)/(La+Lf) | |||
!call PowerLimits | |||
!if (Power_sigma>max_Power_sigma) then | |||
! TDS%dia = 0.d0 | |||
!end if | |||
end subroutine | |||
!------------------------------------------------------------------------------- | |||
subroutine TDS_dw(x1,x2,x3,x4,x5) | |||
use TopDrive_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1,x2,x3,x4,x5 | |||
REAL :: const | |||
!IF (x2<=1150.) THEN | |||
x4 = 6.3304d-3*1150. | |||
!ELSE IF (x2>1150.) THEN | |||
! x4 = 2.8571d-7*(x2-1150.)+7.28 | |||
!END IF | |||
TDS%Te = x4*x2 | |||
!TDS%dw = (TDS%Te-x5)/TDS%J_coef | |||
const = TDS%J_coef+(TDS%String_JCoef/(TDS%Mech_Efficiency*TDS%Conv_Ratio)) | |||
!TDS%dw = (TDS%Te-((TDS%String_Torque)/(TDS%Mech_Efficiency*TDS%Conv_Ratio)))/(const) | |||
TDS%dw = (TDS%Te-TDS%TL)/(const) | |||
end subroutine | |||
!------------------------------------------------------------ | |||
subroutine TDS_dx(x1,x2,x3,x4,x5) | |||
use TopDrive_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1,x2,x3,x4,x5 | |||
!TDS%dx = Kii*(Kpn*((30.*TDS%w_ref/pi)-(30.*x3/pi))-x2) | |||
TDS%ia_ref = x5+Kpn*((30.*TDS%w_ref/pi)-(30.*x3/pi)) | |||
call TopDrive_TorqueLimit | |||
!if (LimitOveride==1) then | |||
!goto TorqueLimit_Limitation2 | |||
!end if | |||
!IF (TDS%ia_ref>TDS%ia_ref_limit) THEN | |||
!TDS%ia_ref = TDS%ia_ref_limit | |||
!END IF | |||
!TorqueLimit_Elimination2: | |||
TDS%dx = Kii*(TDS%ia_ref-x2) | |||
end subroutine | |||
!------------------------------------------------------------ | |||
subroutine TDS_dy(x1,x2,x3,x4,x5) | |||
use TopDrive_VARIABLES | |||
IMPLICIT NONE | |||
REAL :: x1,x2,x3,x4,x5 | |||
TDS%dy = Kin*((30.0d0*TDS%w_ref/pi)-(30.0d0*x3/pi)) | |||
end subroutine |
@@ -0,0 +1,515 @@ | |||
subroutine MeshGeneration_FluidModule | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_StringConnectionData | |||
Use GeoElements_FluidModule | |||
Use CPumpsVariables | |||
Use CStringConfigurationVariables | |||
Use CBopStackVariables | |||
!Use Drawworks_VARIABLES , only: Drawworks | |||
implicit none | |||
Integer :: ii , jj , semijj , kk , k , m , s | |||
Integer :: ElementsCount , StringConfigCount | |||
REAL(8) :: mm , nn , dl , StartAngle , EndAngle | |||
REAL(8) :: A(30) !?????????10 | |||
REAL(8) :: TD_ElementLength | |||
A = 0.d0 | |||
A(1) = BopStackSpecification%AboveAnnularHeight ! WellHead[ft] | |||
jj = 1 | |||
!==================================================== | |||
! Mesh Generation of DrillStem Components | |||
!==================================================== | |||
!TD_String%StringConfigurationCount = StringConfigurationCount !??????????? | |||
StringConfigCount = TD_String%StringConfigurationCount | |||
if (allocated(F_String)) Deallocate(F_String) | |||
if (TD_DrillStem(1)%ComponentType==0) then | |||
Allocate (F_String(StringConfigCount-1)) | |||
else | |||
Allocate (F_String(StringConfigCount)) | |||
end if | |||
if (TD_DrillStem(1)%ComponentType==0) then | |||
ElementsCount = 1 | |||
Do ii=1,(StringConfigCount-1) | |||
F_String(ii)%ID = TD_DrillStem(ii+1)%Id*12.d0 ![inch] | |||
F_String(ii)%OD = TD_DrillStem(ii+1)%Od*12.d0 ![inch] | |||
F_String(ii)%FirstElement = ElementsCount+1 | |||
F_String(ii)%LastElement = F_String(ii)%FirstElement+(TD_DrillStem(ii+1)%Numbs-1) | |||
F_String(ii)%ElType = TD_DrillStem(ii+1)%ComponentType | |||
ElementsCount = F_String(ii)%LastElement | |||
End Do | |||
StringConfigCount = StringConfigCount-1 | |||
else | |||
ElementsCount = 0 | |||
Do ii=1,StringConfigCount | |||
F_String(ii)%ID = TD_DrillStem(ii)%Id*12.d0 ![inch] | |||
F_String(ii)%OD = TD_DrillStem(ii)%Od*12.d0 ![inch] | |||
F_String(ii)%FirstElement = ElementsCount+1 | |||
F_String(ii)%LastElement = F_String(ii)%FirstElement+(TD_DrillStem(ii)%Numbs-1) | |||
F_String(ii)%ElType = TD_DrillStem(ii)%ComponentType | |||
ElementsCount = F_String(ii)%LastElement | |||
End Do | |||
end if | |||
Do ii=1,StringConfigCount | |||
F_String(ii)%TopDepth = TD_DrillStems(F_String(ii)%LastElement)%TopDepthIni ![ft] | |||
F_String(ii)%DownDepth = TD_DrillStems(F_String(ii)%FirstElement)%DownDepthIni ![ft] | |||
if (F_String(ii)%DownDepth>A(1)) then | |||
jj = jj+1 | |||
A(jj) = F_String(ii)%DownDepth | |||
end if | |||
End Do | |||
!=========> Removed Volume Calculation in DrillStem | |||
TD_ElementLength = F_String(StringConfigCount)%DownDepth-F_String(StringConfigCount)%TopDepth | |||
if ( StringConfigCount==TD_Vol%PreCount ) then | |||
if ( TD_Vol%PreElementLength>TD_ElementLength ) then | |||
TD_Vol%RemoveVolume = (TD_Vol%PreElementLength-TD_ElementLength)*((pi*((F_String(StringConfigCount)%ID/12.d0)**2))/4.d0) ![ft^3] | |||
else | |||
TD_Vol%RemoveVolume = 0.d0 | |||
end if | |||
else if ( StringConfigCount<TD_Vol%PreCount ) then | |||
TD_Vol%RemoveVolume = TD_Vol%PreElementVolume | |||
else | |||
TD_Vol%RemoveVolume = 0.d0 | |||
end if | |||
TD_Vol%PreCount = StringConfigCount | |||
TD_Vol%PreElementVolume = TD_ElementLength*(((pi*((F_String(StringConfigCount)%ID/12.d0)**2))/4.d0)) ![ft^3] | |||
TD_Vol%PreElementLength = TD_ElementLength | |||
!print*, 'TD_Vol%RemoveVolume=' , TD_Vol%RemoveVolume | |||
!==================================================== | |||
! Mesh Generation of Annulus Components | |||
!==================================================== | |||
if (TD_Casing(1)%Length>0.) then | |||
jj = jj+1 | |||
A(jj) = TD_Casing(1)%DownDepth | |||
OD_Annulus(4)%StartMD = TD_Casing(1)%DownDepth ![ft] | |||
OD_Annulus(4)%EndMD = TD_Casing(1)%TopDepth ![ft] | |||
OD_Annulus(4)%ODValue = TD_Casing(1)%Id*12.d0 ![inch] | |||
!else | |||
! OD_Annulus(4)%StartMD = 0. !???????????????????? | |||
! OD_Annulus(4)%EndMD = OD_Annulus(4)%StartMD !???????????????????? | |||
! OD_Annulus(4)%ODValue = TD_Casing(1)%Id !???????????????????? | |||
end if | |||
if (TD_Liner(1)%Length>0.) then | |||
jj = jj+1 | |||
A(jj) = TD_Liner(1)%DownDepth | |||
OD_Annulus(3)%StartMD = TD_Liner(1)%DownDepth ![ft] | |||
OD_Annulus(3)%EndMD = TD_Liner(1)%TopDepth ![ft] | |||
OD_Annulus(3)%ODValue = TD_Liner(1)%Id*12.d0 ![inch] | |||
else | |||
OD_Annulus(3)%StartMD = TD_Casing(1)%DownDepth !???????????????????? | |||
OD_Annulus(3)%EndMD = OD_Annulus(3)%StartMD !???????????????????? | |||
OD_Annulus(3)%ODValue = OD_Annulus(4)%ODValue !???????????????????? | |||
end if | |||
if (TD_OpenHole(1)%Length>0.) then | |||
!jj = jj+1 | |||
!A(jj) = TD_OpenHole(1)%DownDepth | |||
OD_Annulus(2)%StartMD = TD_OpenHole(1)%DownDepth ![ft] | |||
OD_Annulus(2)%EndMD = TD_OpenHole(1)%TopDepth ![ft] | |||
OD_Annulus(2)%ODValue = TD_OpenHole(1)%Id*12.d0 ![inch] | |||
do ii = 1,TD_WellGeneral%WellIntervalsCount-1 | |||
if ( TD_WellGeo(ii)%DownDepth>TD_OpenHole(1)%TopDepth ) then | |||
jj = jj+1 | |||
A(jj) = TD_WellGeo(ii)%DownDepth | |||
end if | |||
end do | |||
else | |||
OD_Annulus(2)%StartMD = TD_Liner(1)%DownDepth !?????????????? | |||
OD_Annulus(2)%EndMD = OD_Annulus(2)%StartMD !?????????????? | |||
OD_Annulus(2)%ODValue = OD_Annulus(3)%ODValue !?????????????? | |||
end if | |||
if (TD_ROPHole(1)%Length>0.) then | |||
jj = jj+1 | |||
A(jj) = TD_ROPHole(1)%DownDepth | |||
OD_Annulus(1)%StartMD = TD_ROPHole(1)%DownDepth ![ft] | |||
OD_Annulus(1)%EndMD = TD_ROPHole(1)%TopDepth ![ft] | |||
OD_Annulus(1)%ODValue = TD_ROPHole(1)%Id*12.d0 ![inch] | |||
else | |||
OD_Annulus(1)%StartMD = TD_OpenHole(1)%DownDepth !?????????????? | |||
OD_Annulus(1)%EndMD = OD_Annulus(1)%StartMD !?????????????? | |||
OD_Annulus(1)%ODValue = OD_Annulus(2)%ODValue !?????????????? | |||
end if | |||
!print*, 'A(jj)2=' , A | |||
!==================================================== | |||
! Mesh Generation of Well | |||
!==================================================== | |||
!Do ii=2,TD_WellGeneral%WellIntervalsCount-1 | |||
! jj = jj+1 | |||
! A(jj) = TD_WellGeo(ii)%TopDepth | |||
!End Do | |||
!print*, 'A(jj)3=' , A | |||
!print*, 'A=' , A | |||
!print*, 'jj=' , jj | |||
semijj = jj | |||
!print*, 'semijj=' , semijj | |||
Do ii=1,jj | |||
do kk = 1,jj | |||
if ( A(ii)==A(KK) .and. ii/=kk .and. A(KK)/=0. ) then !A(KK)/=0. ????????????????? | |||
!print*, 'indoA=' , semijj , ii , kk , A(KK) , A(ii) | |||
A(kk) = 0.d0 | |||
semijj = semijj-1 | |||
!print*, 'indoA2=' , semijj , ii , kk , A(KK) , A(ii) | |||
end if | |||
end do | |||
End Do | |||
!print*, 'semijj2=' , semijj | |||
jj = semijj | |||
!print*, 'jj2=' , jj | |||
!print*, 'AA=' , A | |||
if (allocated(TDGeo%MD)) Deallocate(TDGeo%MD) | |||
Allocate (TDGeo%MD(jj)) | |||
TDGeo%MD = 0.0d0 | |||
Do ii=1,jj | |||
TDGeo%MD(ii)=A(1) | |||
do kk = 2,jj | |||
if (A(KK)>TDGeo%MD(ii)) then | |||
TDGeo%MD(ii) = A(kk) | |||
k=kk | |||
end if | |||
end do | |||
!!TDGeo%MD(ii) = MAXVAL(A) | |||
!!kk = MAXLOC(A) | |||
!!A(kk) = 0.0d0 | |||
A(k) = 0.0d0 | |||
End Do | |||
!==================================================== | |||
! Geometrical Intervals Configuration (for fluid module) | |||
!==================================================== | |||
if (allocated(F_Interval)) Deallocate(F_Interval) | |||
Allocate (F_Interval(jj-1+StringConfigCount+1)) | |||
!F_Interval = 0.0d0 | |||
F_Counts%IntervalsTotalCounts = jj-1+StringConfigCount+1 | |||
!=========> String Intervals Configuration | |||
! pump output | |||
ii = 1 | |||
F_Interval(ii)%Number = ii | |||
F_Interval(ii)%GeoType = 0 | |||
F_Interval(ii)%EndDepth = F_String(StringConfigCount)%TopDepth | |||
F_Interval(ii)%StartDepth = F_String(StringConfigCount)%TopDepth-265.d0 | |||
F_Interval(ii)%ID = 0.0d0 | |||
F_Interval(ii)%OD = dmax1(PumpsSpecification%MudPump1Output,PumpsSpecification%MudPump2Output) !??????????? | |||
F_Interval(ii)%HydDiameter = F_Interval(ii)%OD ![inch] | |||
F_Interval(ii)%Volume = ((pi*((F_Interval(ii)%OD/12.d0)**2))/4.d0) & | |||
*(F_Interval(ii)%EndDepth-F_Interval(ii)%StartDepth)*7.48051948d0 ![gal-us] | |||
Do ii=2,StringConfigCount+1 | |||
F_Interval(ii)%Number = ii | |||
F_Interval(ii)%GeoType = 0 | |||
F_Interval(ii)%EndDepth = F_String(StringConfigCount+1-ii+1)%DownDepth | |||
F_Interval(ii)%StartDepth = F_String(StringConfigCount+1-ii+1)%TopDepth | |||
F_Interval(ii)%ID = 0.0d0 | |||
F_Interval(ii)%OD = F_String(StringConfigCount+1-ii+1)%ID | |||
F_Interval(ii)%HydDiameter = F_Interval(ii)%OD | |||
F_Interval(ii)%Volume = ((pi*((F_Interval(ii)%OD/12.d0)**2))/4.d0) & | |||
*(F_Interval(ii)%EndDepth-F_Interval(ii)%StartDepth)*7.48051948d0 ![gal-us] | |||
End Do | |||
F_Counts%StringIntervalCounts = StringConfigCount+1 | |||
!if (F_String(1)%ElType==0) then !bit | |||
! !F_Interval(StringConfigCount)%Number = ii | |||
! F_Interval(StringConfigCount)%EndDepth = F_String(1)%DownDepth | |||
! F_Interval(StringConfigCount)%StartDepth = F_String(1)%TopDepth | |||
! F_Interval(StringConfigCount)%ID = 0.0d0 | |||
! F_Interval(StringConfigCount)%OD = F_String(1)%OD | |||
! F_Interval(StringConfigCount)%HydDiameter = F_Interval(StringConfigCount)%OD | |||
! F_Interval(StringConfigCount)%Volume = ((pi*((F_Interval(StringConfigCount)%OD/12.)**2))/4.)*(F_Interval(StringConfigCount)%EndDepth-F_Interval(StringConfigCount)%StartDepth)*7.48051948 | |||
!end if | |||
!=========> Annulus Intervals Configuration | |||
F_Counts%BottomHoleIntervalCounts = 0 | |||
F_Counts%AnnulusIntervalCounts = 0 | |||
Do ii=(StringConfigCount+2),(jj-1+StringConfigCount+1) | |||
F_Interval(ii)%Number = ii | |||
F_Interval(ii)%StartDepth = TDGeo%MD(ii-StringConfigCount-1) | |||
F_Interval(ii)%EndDepth = TDGeo%MD(ii+1-StringConfigCount-1) | |||
if (F_Interval(ii)%EndDepth>=F_Interval(StringConfigCount+1)%EndDepth) then | |||
F_Interval(ii)%GeoType = 1 | |||
F_Counts%BottomHoleIntervalCounts = F_Counts%BottomHoleIntervalCounts+1 | |||
else | |||
F_Interval(ii)%GeoType = 2 | |||
F_Counts%AnnulusIntervalCounts = F_Counts%AnnulusIntervalCounts+1 | |||
end if | |||
End Do | |||
!==================================================== | |||
! Diameter Calculation of Annulus Intervals | |||
!==================================================== | |||
!=========> OD | |||
m = 1 | |||
Do ii = (StringConfigCount+2),F_Counts%IntervalsTotalCounts | |||
do kk = m,4 | |||
if (F_Interval(ii)%StartDepth<=OD_Annulus(kk)%StartMD .and. F_Interval(ii)%EndDepth>=OD_Annulus(kk)%EndMD) then | |||
F_Interval(ii)%OD = OD_Annulus(kk)%ODValue | |||
m = kk | |||
exit | |||
end if | |||
end do | |||
End Do | |||
!=========> ID | |||
m = 1 | |||
Do ii = (StringConfigCount+2),F_Counts%IntervalsTotalCounts | |||
do kk = m,StringConfigCount | |||
if (F_Interval(ii)%StartDepth<=F_String(kk)%DownDepth .and. F_Interval(ii)%EndDepth>=F_String(kk)%TopDepth) then | |||
F_Interval(ii)%ID = F_String(kk)%OD | |||
m = kk | |||
exit | |||
else | |||
F_Interval(ii)%ID = 0.0d0 | |||
end if | |||
end do | |||
F_Interval(ii)%HydDiameter = F_Interval(ii)%OD-F_Interval(ii)%ID | |||
F_Interval(ii)%Volume = ((pi*(((F_Interval(ii)%OD/12.d0)**2)-((F_Interval(ii)%ID/12.d0)**2)))/4.d0) & | |||
*abs(F_Interval(ii)%EndDepth-F_Interval(ii)%StartDepth)*7.48051948d0 ![gal-us] | |||
End Do | |||
!print*, 'StringConfigCount=' , StringConfigCount | |||
!print*, 'F_Counts%IntervalsTotalCounts=' , F_Counts%IntervalsTotalCounts | |||
!print*, 'F_Counts%StringIntervalCounts=' , F_Counts%StringIntervalCounts | |||
!print*, 'F_Counts%BottomHoleIntervalCounts=' , F_Counts%BottomHoleIntervalCounts | |||
!print*, 'F_Counts%AnnulusIntervalCounts=' , F_Counts%AnnulusIntervalCounts | |||
!Do ii=1,(F_Counts%IntervalsTotalCounts) | |||
! print*, 'Number/' , 'StartDepth/' , 'EndDepth/' | |||
! print*, 'ID/' , 'OD/' , 'GeoType/' | |||
! print*, 'HydDiameter/' , 'Volume/' | |||
! print*, F_Interval(ii)%Number , F_Interval(ii)%StartDepth , F_Interval(ii)%EndDepth | |||
! print*, F_Interval(ii)%ID , F_Interval(ii)%OD , F_Interval(ii)%GeoType | |||
! print*, F_Interval(ii)%HydDiameter , F_Interval(ii)%Volume | |||
!End Do | |||
!==================================================== | |||
! TVD Calculation of Geo Intervals | |||
!==================================================== | |||
!=========> Out of Well Intervals | |||
F_Interval(1)%StartTVD = 0.0d0 !?????????????? | |||
F_Interval(1)%EndTVD = -TD_StConn%ConnectionHeight | |||
F_Interval(1)%StartAngle = 0.d0 !??????????????????????? | |||
F_Interval(1)%EndAngle = 0.d0 !??????????????????????? | |||
F_Counts%OutOfWellIntervalCounts = 1 | |||
Do ii= 2 , StringConfigCount+1 | |||
if ( F_Interval(ii)%StartDepth<=0.d0 ) then | |||
F_Interval(ii)%StartTVD = F_Interval(ii)%StartDepth | |||
F_Interval(ii)%StartAngle = 0.0d0 | |||
end if | |||
if ( F_Interval(ii)%EndDepth<=0.d0 ) then | |||
F_Interval(ii)%EndTVD = F_Interval(ii)%EndDepth | |||
F_Interval(ii)%EndAngle = 0.0d0 | |||
F_Counts%OutOfWellIntervalCounts = F_Counts%OutOfWellIntervalCounts+1 | |||
end if | |||
End Do | |||
!=========> | |||
if (allocated(TDGeo%TVD)) Deallocate(TDGeo%TVD) | |||
Allocate (TDGeo%TVD(jj)) | |||
if (allocated(TDGeo%Angle)) Deallocate(TDGeo%Angle) | |||
Allocate (TDGeo%Angle(jj)) | |||
TDGeo%TVD(1) = TD_WellGeneral%WellTotalVerticalLength !????? | |||
!print*, 'TD_WellGeneral%WellTotalVerticalLength=' ,TD_WellGeneral%WellTotalVerticalLength | |||
TDGeo%TVD(jj) = BopStackSpecification%AboveAnnularHeight ! WellHead[ft] !0.d0 ???????????????? | |||
k = 1 | |||
mm = 0.d0 | |||
nn = 0.d0 | |||
EndAngle = TD_WellGeo(1)%StartAngle !??????????????? | |||
TDGeo%Angle(jj) = EndAngle | |||
Do ii = jj-1,1,-1 !???1or2 | |||
do kk = k, TD_WellGeneral%WellIntervalsCount | |||
StartAngle = EndAngle | |||
if ( TDGeo%MD(ii)>TD_WellGeo(kk)%TopDepth ) then | |||
if ( TDGeo%MD(ii)>TD_WellGeo(kk)%DownDepth ) then | |||
dl = TD_WellGeo(kk)%DownDepth-nn ![ft] | |||
nn = TD_WellGeo(kk)%DownDepth | |||
if ( TD_WellGeo(kk)%HoleType==0 ) then | |||
EndAngle = StartAngle | |||
!print*, 'StartAngle1=' ,ii , kk, StartAngle | |||
!print*, 'EndAngle1=' ,ii , kk, EndAngle | |||
TDGeo%TVD(ii) = mm+(dl*cos(TD_WellGeo(kk)%StartAngle)) ![ft] | |||
TDGeo%Angle(ii) = EndAngle | |||
!print*, 'TDGeo%TVD(ii)1=' ,ii , kk, TDGeo%TVD(ii) | |||
else if ( TD_WellGeo(kk)%HoleType==1 ) then | |||
EndAngle = StartAngle+(dl/TD_WellGeo(kk)%RCurvature) !????????????????? | |||
!print*, 'StartAngle2=' ,ii , kk, StartAngle | |||
!print*, 'EndAngle2=' ,ii , kk, EndAngle | |||
TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle))*cos(abs(StartAngle)))-(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(EndAngle)-abs(StartAngle)))*sin(abs(StartAngle))) | |||
!TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle))) | |||
TDGeo%Angle(ii) = EndAngle | |||
!print*, 'TDGeo%TVD(ii)2=' , ii , kk, TDGeo%TVD(ii) | |||
else if ( TD_WellGeo(kk)%HoleType==2 ) then | |||
EndAngle = StartAngle-(dl/TD_WellGeo(kk)%RCurvature) !????????????????? | |||
!print*, 'StartAngle22=' ,ii , kk, StartAngle | |||
!print*, 'EndAngle22=' ,ii , kk, EndAngle | |||
TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(abs(EndAngle)-abs(StartAngle)))*cos(abs(StartAngle)))+(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(abs(EndAngle)-abs(StartAngle))))*sin(abs(StartAngle))) | |||
!TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle))) | |||
TDGeo%Angle(ii) = EndAngle | |||
!print*, 'TDGeo%TVD(ii)22=' , ii , kk, TDGeo%TVD(ii) | |||
end if | |||
mm = TDGeo%TVD(ii) | |||
else | |||
dl = TDGeo%MD(ii)-nn | |||
nn = TDGeo%MD(ii) | |||
if ( TD_WellGeo(kk)%HoleType==0 ) then | |||
EndAngle = StartAngle | |||
!print*, 'StartAngle3=' ,ii , kk, StartAngle | |||
!print*, 'EndAngle3=' ,ii , kk, EndAngle | |||
TDGeo%TVD(ii) = mm+(dl*cos(TD_WellGeo(kk)%StartAngle)) | |||
TDGeo%Angle(ii) = EndAngle | |||
!print*, 'TDGeo%TVD(ii)3=' ,ii , kk, TDGeo%TVD(ii) | |||
else if ( TD_WellGeo(kk)%HoleType==1 ) then | |||
EndAngle = StartAngle+(dl/TD_WellGeo(kk)%RCurvature) !??????????????????? | |||
!print*, 'StartAngle4=' ,ii , kk, StartAngle | |||
!print*, 'EndAngle4=' ,ii , kk, EndAngle | |||
TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle))*cos(abs(StartAngle)))-(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(EndAngle)-abs(StartAngle)))*sin(abs(StartAngle))) | |||
TDGeo%Angle(ii) = EndAngle | |||
!TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle))) | |||
!print*, 'mm=' ,mm | |||
!print*, 'TDGeo%TVD(ii)4=' ,ii , kk, TDGeo%TVD(ii) | |||
else if ( TD_WellGeo(kk)%HoleType==2 ) then | |||
EndAngle = StartAngle-(dl/TD_WellGeo(kk)%RCurvature) !??????????????????? | |||
!print*, 'StartAngle44=' ,ii , kk, StartAngle | |||
!print*, 'EndAngle44=' ,ii , kk, EndAngle | |||
TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(abs(EndAngle)-abs(StartAngle)))*cos(abs(StartAngle)))+(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(abs(EndAngle)-abs(StartAngle))))*sin(abs(StartAngle))) | |||
TDGeo%Angle(ii) = EndAngle | |||
!TDGeo%TVD(ii) = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle))) | |||
!print*, 'mm=' ,mm , (TD_WellGeo(kk)%RCurvature*sin(abs(abs(EndAngle)-abs(StartAngle)))*cos(abs(StartAngle)))+(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(abs(EndAngle)-abs(StartAngle))))*sin(abs(StartAngle))) | |||
!print*, 'TDGeo%TVD(ii)44=' ,ii , kk, TDGeo%TVD(ii) | |||
end if | |||
mm = TDGeo%TVD(ii) | |||
k = kk | |||
exit | |||
end if | |||
end if | |||
end do | |||
End Do | |||
!if (F_Counts%OutOfWellIntervalCounts==1) then | |||
! s = 2 | |||
!else | |||
! s = F_Counts%OutOfWellIntervalCounts | |||
!end if | |||
! | |||
Do ii = (F_Counts%OutOfWellIntervalCounts+1),F_Counts%IntervalsTotalCounts | |||
do kk = jj,1,-1 | |||
if ( F_Interval(ii)%StartDepth==TDGeo%MD(kk) ) then | |||
F_Interval(ii)%StartTVD = TDGeo%TVD(kk) ![ft] | |||
F_Interval(ii)%StartAngle = TDGeo%Angle(kk) ![rad] | |||
end if | |||
if ( F_Interval(ii)%EndDepth==TDGeo%MD(kk) ) then | |||
F_Interval(ii)%EndTVD = TDGeo%TVD(kk) ![ft] | |||
F_Interval(ii)%EndAngle = TDGeo%Angle(kk) ![rad] | |||
end if | |||
end do | |||
End Do | |||
!Do ii=1,(F_Counts%IntervalsTotalCounts) | |||
! print*, 'F_Interval(ii)%StartTVD=' , ii , F_Interval(ii)%StartTVD | |||
! print*, 'F_Interval(ii)%EndTVD=' , ii , F_Interval(ii)%EndTVD | |||
! print*, 'F_Interval(ii)%StartAngle=' , ii , F_Interval(ii)%StartAngle | |||
! print*, 'F_Interval(ii)%EndAngle=' , ii , F_Interval(ii)%EndAngle | |||
!end do | |||
! | |||
! | |||
!Do ii=1,TD_WellGeneral%WellIntervalsCount | |||
! print*, 'TD_WellGeo(kk)%TopDepth=' , ii , TD_WellGeo(ii)%TopDepth | |||
! print*, 'TD_WellGeo(kk)%DownDepth=' , ii , TD_WellGeo(ii)%DownDepth | |||
! print*, 'TD_WellGeo(kk)%HoleType=' , ii , TD_WellGeo(ii)%HoleType | |||
! print*, 'TD_WellGeo(kk)%RCurvature=' , ii , TD_WellGeo(ii)%RCurvature | |||
! print*, 'TD_WellGeo(kk)%EndAngle=' , ii , TD_WellGeo(ii)%EndAngle | |||
! print*, 'TD_WellGeo(kk)%StartAngle=' , ii , TD_WellGeo(ii)%StartAngle | |||
!end do | |||
end subroutine |
@@ -0,0 +1,314 @@ | |||
subroutine TD_AddComponents | |||
Use CStringConfigurationVariables | |||
use UnitySignalVariables | |||
! Use CStringUpdateVariables | |||
! Use CSafetyValveEnumVariables | |||
! Use CIbopEnumVariables | |||
! Use COperationConditionEnumVariables | |||
! Use CKellyConnectionEnumVariables | |||
use COperationScenariosVariables!, only: Get_ElevatorConnection | |||
! Use CElevatorConnectionEnumVariables | |||
Use CHoistingVariables | |||
! Use CTdsConnectionModesEnumVariables | |||
! Use CTdsElevatorModesEnumVariables | |||
Use TD_DrillStemComponents | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
Use TD_StringConnectionData | |||
implicit none | |||
integer :: i , kk , TD_NumOfAddedComponents | |||
!==================================================== | |||
! Add Single | |||
!==================================================== | |||
if ( Get_StringUpdate() == STRING_UPDATE_ADD_SINGLE ) then | |||
kk = 0 | |||
Do i= TD_String%DrillStemComponentsNumbs , 1 , -1 | |||
if (TD_DrillStems(i)%ComponentType==3) then | |||
kk = i | |||
exit | |||
end if | |||
End Do | |||
! DrillStems Array: | |||
TD_NumOfAddedComponents = 1 | |||
Do i= (TD_String%DrillStemComponentsNumbs+1) , (TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents) | |||
TD_DrillStems(i)%ComponentType = 3 | |||
TD_DrillStems(i)%Id = TD_DrillStems(kk)%Id | |||
TD_DrillStems(i)%Od = TD_DrillStems(kk)%Od | |||
TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.d0 | |||
TD_DrillStems(i)%RtoolJoint = TD_DrillStems(i)%Od*1.3d0/2.d0 | |||
TD_DrillStems(i)%ToolJointRange = TD_String%ToolJointRange | |||
TD_DrillStems(i)%Length = TD_DrillStems(kk)%LengthIni | |||
TD_DrillStems(i)%LengthIni = TD_DrillStems(kk)%LengthIni | |||
TD_DrillStems(i)%WeightperLength = TD_DrillStems(kk)%WeightperLength | |||
TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length | |||
TD_DrillStems(i)%Density = TD_DrillStems(kk)%Density | |||
TD_DrillStems(i)%ElasticModule = TD_DrillStems(kk)%ElasticModule | |||
End Do | |||
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents | |||
! DrillStem Array: | |||
i = TD_String%StringConfigurationCount+1 | |||
TD_DrillStem(i)%ComponentType = 3 | |||
TD_DrillStem(i)%Numbs = 1 | |||
TD_DrillStem(i)%Id = TD_DrillStems(kk)%Id ! [ft] | |||
TD_DrillStem(i)%Od = TD_DrillStems(kk)%Od ! [ft] | |||
TD_DrillStem(i)%Length = TD_DrillStems(kk)%LengthIni | |||
TD_DrillStem(i)%WeightperLength = TD_DrillStems(kk)%WeightperLength | |||
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length | |||
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount+1 | |||
Call Set_StringUpdate(STRING_UPDATE_NEUTRAL) | |||
end if | |||
!==================================================== | |||
! Add Stand | |||
!==================================================== | |||
if ( Get_StringUpdate() == STRING_UPDATE_ADD_STAND ) then | |||
kk = 0 | |||
Do i= TD_String%DrillStemComponentsNumbs , 1 , -1 | |||
if (TD_DrillStems(i)%ComponentType==3) then | |||
kk = i | |||
exit | |||
end if | |||
End Do | |||
! DrillStems Array: | |||
TD_NumOfAddedComponents = 3 | |||
Do i= (TD_String%DrillStemComponentsNumbs+1) , (TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents) | |||
TD_DrillStems(i)%ComponentType = 3 | |||
TD_DrillStems(i)%Id = TD_DrillStems(kk)%Id | |||
TD_DrillStems(i)%Od = TD_DrillStems(kk)%Od | |||
TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.0d0 | |||
TD_DrillStems(i)%RtoolJoint = TD_DrillStems(i)%Od*1.30d0/2.0d0 | |||
TD_DrillStems(i)%ToolJointRange = TD_String%ToolJointRange | |||
TD_DrillStems(i)%Length = TD_DrillStems(kk)%LengthIni | |||
TD_DrillStems(i)%LengthIni = TD_DrillStems(kk)%LengthIni | |||
TD_DrillStems(i)%WeightperLength = TD_DrillStems(kk)%WeightperLength | |||
TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length | |||
TD_DrillStems(i)%Density = TD_DrillStems(kk)%Density | |||
TD_DrillStems(i)%ElasticModule = TD_DrillStems(kk)%ElasticModule | |||
End Do | |||
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents | |||
! DrillStem Array: | |||
i = TD_String%StringConfigurationCount+1 | |||
TD_DrillStem(i)%ComponentType = 3 | |||
TD_DrillStem(i)%Numbs = 3 | |||
TD_DrillStem(i)%Id = TD_DrillStems(kk)%Id ! [ft] | |||
TD_DrillStem(i)%Od = TD_DrillStems(kk)%Od ! [ft] | |||
TD_DrillStem(i)%Length = TD_DrillStems(kk)%LengthIni | |||
TD_DrillStem(i)%WeightperLength = TD_DrillStems(kk)%WeightperLength | |||
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length | |||
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount+1 | |||
Call Set_StringUpdate(STRING_UPDATE_NEUTRAL) | |||
end if | |||
!==================================================== | |||
! Add IBOP | |||
!==================================================== | |||
!if ( Get_Ibop()==IBOP_INSTALL ) then | |||
! TD_Count%IBOPNewAdd = 1 | |||
!else | |||
! TD_Count%IBOPNewAdd = 0 | |||
! TD_Count%IBOPOldAdd = 0 | |||
! end if | |||
if ( Get_Ibop()==IBOP_INSTALL .and. TD_Count%IBOPOldAdd==0 ) then | |||
kk = 0 | |||
Do i= TD_String%DrillStemComponentsNumbs , 1 , -1 | |||
if (TD_DrillStems(i)%ComponentType==3) then | |||
kk = i | |||
exit | |||
end if | |||
End Do | |||
! DrillStems Array: | |||
TD_NumOfAddedComponents = 1 | |||
Do i= (TD_String%DrillStemComponentsNumbs+1) , (TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents) | |||
TD_DrillStems(i)%ComponentType = 5 | |||
TD_DrillStems(i)%Id = TD_DrillStems(kk)%Id | |||
TD_DrillStems(i)%Od = TD_DrillStems(kk)%RtoolJoint | |||
TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.0d0 | |||
TD_DrillStems(i)%RtoolJoint = TD_DrillStems(kk)%RtoolJoint | |||
TD_DrillStems(i)%ToolJointRange = 0.0d0 | |||
TD_DrillStems(i)%Length = TD_StConn%IBOPLength ! [ft] | |||
TD_DrillStems(i)%LengthIni = TD_StConn%IBOPLength ! [ft] | |||
TD_DrillStems(i)%WeightperLength = 55.0d0 ! [lb/ft] | |||
TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length | |||
TD_DrillStems(i)%Density = TD_DrillStems(kk)%Density !???????????? | |||
TD_DrillStems(i)%ElasticModule = TD_DrillStems(kk)%ElasticModule !???????????? | |||
End Do | |||
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents | |||
! DrillStem Array: | |||
i = TD_String%StringConfigurationCount+1 | |||
TD_DrillStem(i)%ComponentType = 5 | |||
TD_DrillStem(i)%Numbs = 1 | |||
TD_DrillStem(i)%Id = TD_DrillStems(kk)%Id ! [ft] | |||
TD_DrillStem(i)%Od = TD_DrillStems(kk)%RtoolJoint ! [ft] | |||
TD_DrillStem(i)%Length = 1.540d0 ! [ft] | |||
TD_DrillStem(i)%WeightperLength = 55.0d0 ! [lb/ft] | |||
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length | |||
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount+1 | |||
!TD_Count%IBOPOldAdd = TD_Count%IBOPNewAdd | |||
if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+TD_DrillStem(i)%Length | |||
end if | |||
end if | |||
if ( Get_Ibop()==IBOP_INSTALL ) then | |||
TD_Count%IBOPOldAdd = 1 | |||
else | |||
TD_Count%IBOPOldAdd = 0 | |||
end if | |||
!==================================================== | |||
! Add Safety Valve & Kelly (OPERATION_DRILL) | |||
!==================================================== | |||
if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then | |||
TD_Count%KellyNewAdd = 1 | |||
else | |||
TD_Count%KellyNewAdd = 0 | |||
TD_Count%KellyOldAdd = 0 | |||
end if | |||
if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() == KELLY_CONNECTION_STRING .and. TD_Count%KellyNewAdd/=TD_Count%KellyOldAdd ) then | |||
! DrillStems Array: | |||
TD_NumOfAddedComponents = 1 | |||
Do i= (TD_String%DrillStemComponentsNumbs+1) , (TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents) | |||
TD_DrillStems(i)%ComponentType = 6 | |||
TD_DrillStems(i)%Id = TD_StConn%KellyElementID ! [ft] | |||
TD_DrillStems(i)%Od = TD_StConn%KellyElementOD ! [ft] | |||
TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.0d0 | |||
TD_DrillStems(i)%RtoolJoint = TD_DrillStems(i)%Od*1.30d0/2.0d0 | |||
TD_DrillStems(i)%ToolJointRange = 0.0d0 | |||
TD_DrillStems(i)%Length = TD_StConn%KellyElementConst ! [ft] | |||
TD_DrillStems(i)%LengthIni = TD_StConn%KellyElementConst ! [ft] | |||
TD_DrillStems(i)%WeightperLength = 55.0d0 ! [lb/ft] | |||
TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length | |||
TD_DrillStems(i)%Density = 7850.d0*0.06242796d0 ! [kg/m3]*0.06242796=[lb/ft3] | |||
TD_DrillStems(i)%ElasticModule = 200.0d9*0.02088543d0 ! [lb/ft2] !200GPa=29Mpsi (steel) | |||
End Do | |||
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents | |||
! DrillStem Array: | |||
i = TD_String%StringConfigurationCount+1 | |||
TD_DrillStem(i)%ComponentType = 6 | |||
TD_DrillStem(i)%Numbs = 1 | |||
TD_DrillStem(i)%Id = 3.0d0/12.d0 ! [ft] | |||
TD_DrillStem(i)%Od = 5.90d0/12.d0 ! [ft] | |||
TD_DrillStem(i)%Length = TD_StConn%KellyElementConst ! [ft] | |||
TD_DrillStem(i)%WeightperLength = 55.0d0 ! [lb/ft] | |||
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length | |||
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount+1 | |||
TD_Count%KellyOldAdd = TD_Count%KellyNewAdd | |||
end if | |||
!==================================================== | |||
! Add Safety Valve (OPERATION_TRIP) | |||
!==================================================== | |||
!if ( Get_OperationCondition()==OPERATION_TRIP .and. Get_SafetyValve()==SAFETY_VALVE_INSTALL ) then | |||
! TD_Count%SafetyValveNewAdd = 1 | |||
!else | |||
! TD_Count%SafetyValveNewAdd = 0 | |||
! TD_Count%SafetyValveOldAdd = 0 | |||
!end if | |||
if ( TD_StConn%KellyDriveTypeMode/=0 .and. TD_StConn%OldOperationCondition/=0 .and. Get_SafetyValve()==SAFETY_VALVE_INSTALL .and. TD_Count%SafetyValveOldAdd==0 ) then | |||
kk = 0 | |||
Do i= TD_String%DrillStemComponentsNumbs , 1 , -1 | |||
if (TD_DrillStems(i)%ComponentType==3) then | |||
kk = i | |||
exit | |||
end if | |||
End Do | |||
! DrillStems Array: | |||
TD_NumOfAddedComponents = 1 | |||
Do i= (TD_String%DrillStemComponentsNumbs+1) , (TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents) | |||
TD_DrillStems(i)%ComponentType = 7 | |||
TD_DrillStems(i)%Id = TD_DrillStems(kk)%Id | |||
TD_DrillStems(i)%Od = TD_DrillStems(kk)%RtoolJoint | |||
TD_DrillStems(i)%Area = (pi*((TD_DrillStems(i)%Od**2)-(TD_DrillStems(i)%Id**2)))/4.0d0 | |||
TD_DrillStems(i)%RtoolJoint = TD_DrillStems(kk)%RtoolJoint | |||
TD_DrillStems(i)%ToolJointRange = 0.0d0 | |||
TD_DrillStems(i)%Length = TD_StConn%SafetyValveLength ! [ft] | |||
TD_DrillStems(i)%LengthIni = TD_StConn%SafetyValveLength ! [ft] | |||
TD_DrillStems(i)%WeightperLength = 55.0d0 ! [lb/ft] | |||
TD_DrillStems(i)%Weight = TD_DrillStems(i)%WeightperLength*TD_DrillStems(i)%Length | |||
TD_DrillStems(i)%Density = TD_DrillStems(kk)%Density !???????????? | |||
TD_DrillStems(i)%ElasticModule = TD_DrillStems(kk)%ElasticModule !???????????? | |||
End Do | |||
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs+TD_NumOfAddedComponents | |||
! DrillStem Array: | |||
i = TD_String%StringConfigurationCount+1 | |||
TD_DrillStem(i)%ComponentType = 7 | |||
TD_DrillStem(i)%Numbs = 1 | |||
TD_DrillStem(i)%Id = TD_DrillStems(kk)%Id ! [ft] | |||
TD_DrillStem(i)%Od = TD_DrillStems(kk)%RtoolJoint ! [ft] | |||
TD_DrillStem(i)%Length = 1.540d0 ! [ft] | |||
TD_DrillStem(i)%WeightperLength = 55.0d0 ! [lb/ft] | |||
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length | |||
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount+1 | |||
!TD_Count%SafetyValveOldAdd = TD_Count%SafetyValveNewAdd | |||
if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+TD_DrillStem(i)%Length | |||
end if | |||
end if | |||
if ( Get_SafetyValve()==SAFETY_VALVE_INSTALL ) then | |||
TD_Count%SafetyValveOldAdd = 1 | |||
else | |||
TD_Count%SafetyValveOldAdd = 0 | |||
end if | |||
end subroutine |
@@ -0,0 +1,180 @@ | |||
subroutine TD_BOPDiamCalculation | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
Use TD_StringConnectionData | |||
Use CBopStackVariables | |||
Use VARIABLES | |||
Integer :: i , j , n , m , TD_Numbs | |||
Real(8) :: TD_LimitUp , TD_LimitDown , TD_OldFillingValue , TD_AnnTjDiff , TD_AnnularFilling | |||
Real(8) :: TD_ElToolJoints(2,2) | |||
!TD_String%ToolJointRange = 0.4005d0*3.28 ! [ft] | |||
!==================================================== | |||
! Read BOP Data | |||
!==================================================== | |||
TD_BOP%BOPHeight(5) = BopStackSpecification%AboveAnnularHeight | |||
TD_BOP%BOPHeight(1) = BopStackSpecification%AnnularPreventerHeight | |||
TD_BOP%BOPHeight(2) = BopStackSpecification%UpperRamHeight | |||
TD_BOP%BOPHeight(3) = BopStackSpecification%BlindRamHeight | |||
TD_BOP%BOPHeight(6) = BopStackSpecification%KillHeight | |||
TD_BOP%BOPHeight(4) = BopStackSpecification%LowerRamHeight | |||
TD_BOP%BOPRamDiam(1) = ShearRam%IDAnnularfinal | |||
TD_BOP%BOPRamDiam(2) = ShearRam%IDPipeRam1final | |||
TD_BOP%BOPRamDiam(3) = ShearRam%IDshearBopfinal | |||
TD_BOP%BOPRamDiam(4) = ShearRam%IDPipeRam2final | |||
!==================================================== | |||
! Element Counts in BOPStack Domain | |||
!==================================================== | |||
!if (TD_String%DrillStemComponentsNumbs>5) then | |||
TD_Numbs = TD_String%DrillStemComponentsNumbs-7 ! 7 Elements from the Top of DrillStem | |||
!else | |||
! TD_Numbs = 1 | |||
!end if | |||
!==================================================== | |||
! Determination of Elements Diameter in BOPStack Domain | |||
!==================================================== | |||
TD_BOP%BOPDiam = 0.d0 | |||
TD_OldFillingValue = 0.d0 | |||
Do i = TD_String%DrillStemComponentsNumbs,TD_Numbs,-1 | |||
TD_LimitUp = TD_DrillStems(i)%TopDepth+TD_DrillStems(i)%ToolJointRange | |||
TD_LimitDown = TD_DrillStems(i)%DownDepth-TD_DrillStems(i)%ToolJointRange | |||
TD_ElToolJoints(1,1) = TD_DrillStems(i)%TopDepth ! TD_ElToolJoints(i,j) , i=top & down tooljoints of element , j=top & down tooljoints Depth | |||
TD_ElToolJoints(1,2) = TD_LimitUp | |||
TD_ElToolJoints(2,1) = TD_LimitDown | |||
TD_ElToolJoints(2,2) = TD_DrillStems(i)%DownDepth | |||
!===> che meghdar az fazaye annular ba tooljoint por mishavad (for BOP Module) | |||
Do m = 1,2 | |||
TD_AnnTjDiff = min(TD_ElToolJoints(m,2),(TD_BOP%BOPHeight(1)+TD_BOP%BOPThickness))-max(TD_ElToolJoints(m,1),(TD_BOP%BOPHeight(1)-TD_BOP%BOPThickness)) | |||
if (TD_AnnTjDiff<0.) then ! tooljoint is not in the annular range | |||
TD_AnnTjDiff = 0.d0 | |||
end if | |||
TD_AnnularFilling = TD_OldFillingValue+(TD_AnnTjDiff/(TD_BOP%BOPThickness*2.d0)) ! 0=<TD_AnnularFilling<=1 | |||
TD_OldFillingValue = TD_AnnularFilling | |||
End Do | |||
do j = 1,6 | |||
if ( (TD_BOP%BOPHeight(j)-TD_BOP%BOPThickness)>TD_LimitUp .and. (TD_BOP%BOPHeight(j)+TD_BOP%BOPThickness)<TD_LimitDown ) then | |||
TD_BOP%BOPDiam(j) = TD_DrillStems(i)%Od | |||
TD_BOP%BOPElementNo(j) = i | |||
if ( TD_DrillStems(i)%ComponentType==3 .and. j/=1 .and. TD_String%DrillStemRotVelocity==0. ) then | |||
TD_BOP%BOPConnectionPossibility(j) = 1 | |||
else if ( j==1 ) then | |||
TD_BOP%BOPConnectionPossibility(j) = 1 | |||
else | |||
TD_BOP%BOPConnectionPossibility(j) = 0 | |||
end if | |||
!print* , 'T.DP. , B.DP. 1=' , TD_DrillStems(i)%TopDepth , TD_DrillStems(i)%DownDepth | |||
!print* , 'T.R. , B.R. , LimitUp , LimitDown 1=' , (TD_BOP%BOPHeight(j)-TD_BOP%BOPThickness) , (TD_BOP%BOPHeight(j)+TD_BOP%BOPThickness) , TD_LimitUp , TD_LimitDown | |||
!print* , 'stringNo , ramsNo , Possibility , BOPDiam 1=' , i , j , TD_BOP%BOPConnectionPossibility(j) , TD_BOP%BOPDiam(j) | |||
else if ( (TD_BOP%BOPHeight(j)+TD_BOP%BOPThickness)>=TD_DrillStems(i)%TopDepth .and. (TD_BOP%BOPHeight(j)-TD_BOP%BOPThickness)<=TD_DrillStems(i)%DownDepth ) then | |||
TD_BOP%BOPDiam(j) = TD_DrillStems(i)%RtoolJoint*2.d0 | |||
TD_BOP%BOPElementNo(j) = i | |||
if ( j==1 ) then | |||
TD_BOP%BOPConnectionPossibility(j) = 1 | |||
else | |||
TD_BOP%BOPConnectionPossibility(j) = 0 | |||
end if | |||
!print* , 'T.DP. , B.DP. 2=' , TD_DrillStems(i)%TopDepth , TD_DrillStems(i)%DownDepth | |||
!print* , 'T.R. , B.R. , LimitUp , LimitDown 2=' , (TD_BOP%BOPHeight(j)-TD_BOP%BOPThickness) , (TD_BOP%BOPHeight(j)+TD_BOP%BOPThickness) , TD_LimitUp , TD_LimitDown | |||
!print* , 'stringNo , ramsNo , Possibility , BOPDiam 2=' , i , j , TD_BOP%BOPConnectionPossibility(j) , TD_BOP%BOPDiam(j) | |||
end if | |||
end do | |||
End Do | |||
TD_BOP%AnnularFillingFinal = TD_AnnularFilling | |||
TD_BOP%AboveAnnularDiam = TD_BOP%BOPDiam(5) | |||
TD_BOP%AnnularPreventerDiam = TD_BOP%BOPDiam(1) | |||
TD_BOP%UpperRamDiam = TD_BOP%BOPDiam(2) | |||
TD_BOP%BlindRamDiam = TD_BOP%BOPDiam(3) | |||
TD_BOP%KillDiam = TD_BOP%BOPDiam(6) | |||
TD_BOP%LowerRamDiam = TD_BOP%BOPDiam(4) | |||
!print* , 'TD_BOP%BOPElementNo=' , TD_BOP%BOPElementNo | |||
!print* , 'TD_BOP%BOPConnectionPossibility=' , TD_BOP%BOPConnectionPossibility | |||
!print* , 'TD_BOP%BOPDiam=' , TD_BOP%BOPDiam | |||
!!===> BOP RAMs Condition *** TD_BOP%BOPCondition: 0=open , 1=close | |||
!do j = 1,4 | |||
! if ( TD_BOP%BOPDiam(j)>=TD_BOP%BOPRamDiam(j) ) then | |||
! TD_BOP%BOPCondition(j) = 1 | |||
! else | |||
! TD_BOP%BOPCondition(j) = 0 | |||
! end if | |||
!end do | |||
!==================================================== | |||
! String Elements Configuration in BOPStack Domain | |||
!==================================================== | |||
!if ( allocated(TD_BOPElement) ) deallocate (TD_BOPElement) | |||
!allocate(TD_BOPElement()) | |||
n = 0 | |||
TD_BOPElement%ElementType = 0.d0 | |||
TD_BOPElement%ElementStart = 0.d0 | |||
TD_BOPElement%ElementEnd = 0.d0 | |||
do k = TD_String%DrillStemComponentsNumbs,TD_Numbs,-1 | |||
if( ((TD_DrillStems(k)%TopDepth>=TD_BOP%BOPHeight(5)).and.(TD_DrillStems(k)%TopDepth<=TD_BOP%BOPHeight(4))) .or. ((TD_DrillStems(k)%DownDepth>=TD_BOP%BOPHeight(5)).and.(TD_DrillStems(k)%DownDepth<=TD_BOP%BOPHeight(4))) ) then | |||
n = n+1 | |||
TD_BOPElement(n)%ElementType = TD_DrillStems(k)%ComponentType | |||
TD_BOPElement(n)%ElementStart = TD_DrillStems(k)%TopDepth | |||
TD_BOPElement(n)%ElementEnd = TD_DrillStems(k)%DownDepth | |||
else if ( TD_DrillStems(k)%TopDepth<=TD_BOP%BOPHeight(5) .and. TD_DrillStems(k)%DownDepth>=TD_BOP%BOPHeight(4) ) then | |||
n = n+1 | |||
TD_BOPElement(n)%ElementType = TD_DrillStems(k)%ComponentType | |||
TD_BOPElement(n)%ElementStart = TD_DrillStems(k)%TopDepth | |||
TD_BOPElement(n)%ElementEnd = TD_DrillStems(k)%DownDepth | |||
end if | |||
end do | |||
Call SetBopElements(TD_BOPElement) | |||
end subroutine |
@@ -0,0 +1,318 @@ | |||
subroutine TD_DrillStemConfiguration | |||
Use CStringConfigurationVariables | |||
use SoftwareInputsVariables | |||
! Use CNearFloorConnection | |||
Use CDataDisplayConsoleVariables | |||
Use CDrillWatchVariables | |||
use UnitySignalVariables | |||
! Use COperationConditionEnumVariables | |||
Use CKellyConnectionEnumVariables | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_StringConnectionData | |||
Use sROP_Variables | |||
implicit none | |||
Integer :: i , j , k , kk , TD_Status | |||
!==================================================== | |||
! Drill Stem Components Data Modification | |||
!==================================================== | |||
!=====> Drill Stem Total Length&Weight Calculation | |||
TD_String%DrillStemTotalLength = 0.0d0 | |||
TD_String%DrillStemTotalLengthIni = 0.0d0 | |||
TD_String%DrillStemTotalWeight = 0.0d0 | |||
Do i= 1,TD_String%DrillStemComponentsNumbs | |||
TD_String%DrillStemTotalLength = TD_String%DrillStemTotalLength+TD_DrillStems(i)%Length | |||
TD_String%DrillStemTotalLengthIni = TD_String%DrillStemTotalLengthIni+TD_DrillStems(i)%LengthIni | |||
TD_String%DrillStemTotalWeight = TD_String%DrillStemTotalWeight+TD_DrillStems(i)%Weight | |||
End Do | |||
!=====> Top&Down Depth Calculation Of Initial Drill Stem Components (Graphic) | |||
TD_DrillStems(1)%DownDepth = TD_String%DrillStemTotalLength-TD_StConn%ConnectionHeight | |||
TD_String%DrillStemBottom = TD_DrillStems(1)%DownDepth | |||
if ( TD_DrillStems(1)%DownDepth>=TD_WellGeneral%WellTotalLength ) then | |||
!if ( TD_StConn%HookHeight>=TD_StConn%HookHeightOld .and. ROP_Bit%RateOfPenetration==0. ) then | |||
! TD_StConn%GRigidConnectionHeight = TD_StConn%GRigidConnectionHeight | |||
!else | |||
TD_StConn%GRigidConnectionHeight = TD_StConn%GRigidConnectionHeight-(TD_WellGeneral%WellTotalLength-TD_DrillStems(1)%DownDepthIniG) | |||
TD_DrillStems(1)%DownDepthIniG = TD_WellGeneral%WellTotalLength !??????????? | |||
! !TD_StConn%GRigidConnectionHeight = TD_StConn%GRigidConnectionHeight | |||
!end if | |||
else | |||
TD_StConn%GRigidConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_DrillStems(1)%DownDepthIniG = TD_String%DrillStemTotalLengthIni-TD_StConn%GRigidConnectionHeight | |||
end if | |||
!TD_DrillStems(1)%DownDepthIniG = TD_String%DrillStemTotalLengthIni-TD_StConn%GRigidConnectionHeight | |||
!if ( TD_DrillStems(1)%DownDepthIniG>TD_WellGeneral%WellTotalLength ) then | |||
! TD_StConn%GRigidConnectionHeight = TD_StConn%GRigidConnectionHeight+(TD_DrillStems(1)%DownDepthIniG-TD_WellGeneral%WellTotalLength) | |||
! TD_DrillStems(1)%DownDepthIniG = TD_WellGeneral%WellTotalLength !??????????? | |||
!end if | |||
TD_DrillStems(1)%TopDepthIniG = TD_DrillStems(1)%DownDepthIniG-TD_DrillStems(1)%LengthIni | |||
Do i = 2,TD_String%DrillStemComponentsNumbs | |||
TD_DrillStems(i)%TopDepthIniG = TD_DrillStems(i-1)%TopDepthIniG-TD_DrillStems(i)%LengthIni | |||
TD_DrillStems(i)%DownDepthIniG = TD_DrillStems(i-1)%DownDepthIniG-TD_DrillStems(i-1)%LengthIni | |||
End Do | |||
!=====> Top&Down Depth Calculation Of Initial Drill Stem Components (for fluid module) | |||
if ( TD_DrillStems(1)%DownDepthIniG>=(TD_WellGeneral%WellTotalLength-.1d0) ) then | |||
TD_StConn%RigidConnectionHeight = TD_StConn%GRigidConnectionHeight+(.1d0-(TD_WellGeneral%WellTotalLength-TD_DrillStems(1)%DownDepthIniG)) | |||
else | |||
TD_StConn%RigidConnectionHeight = TD_StConn%GRigidConnectionHeight | |||
end if | |||
TD_DrillStems(1)%DownDepthIni = TD_String%DrillStemTotalLengthIni-TD_StConn%RigidConnectionHeight | |||
TD_DrillStems(1)%TopDepthIni = TD_DrillStems(1)%DownDepthIni-TD_DrillStems(1)%LengthIni | |||
Do i = 2,TD_String%DrillStemComponentsNumbs | |||
TD_DrillStems(i)%TopDepthIni = TD_DrillStems(i-1)%TopDepthIni-TD_DrillStems(i)%LengthIni | |||
TD_DrillStems(i)%DownDepthIni = TD_DrillStems(i-1)%DownDepthIni-TD_DrillStems(i-1)%LengthIni | |||
End Do | |||
!=====> Top&Down Depth Calculation Of Drill Stem Components | |||
TD_DrillStems(1)%TopDepth = TD_String%DrillStemTotalLength-TD_DrillStems(1)%Length-TD_StConn%GRigidConnectionHeight | |||
TD_DrillStems(1)%DownDepth = TD_String%DrillStemTotalLength-TD_StConn%GRigidConnectionHeight | |||
Do i = 2,TD_String%DrillStemComponentsNumbs | |||
TD_DrillStems(i)%TopDepth = TD_DrillStems(i-1)%TopDepth-TD_DrillStems(i)%Length | |||
TD_DrillStems(i)%DownDepth = TD_DrillStems(i-1)%DownDepth-TD_DrillStems(i-1)%Length | |||
End Do | |||
!TD_String%DrillStemBottom = TD_DrillStems(1)%DownDepth | |||
!=====> Hole Type & Inclination Determination Of Drill Stem Components | |||
Do i = 1,TD_String%DrillStemComponentsNumbs | |||
if (TD_DrillStems(i)%TopDepth .ge. 0.d0) then | |||
Do j = 1,TD_WellGeneral%WellIntervalsCount | |||
if (TD_DrillStems(i)%TopDepth>TD_WellGeo(j)%TopDepth .and. TD_DrillStems(i)%TopDepth<TD_WellGeo(j)%DownDepth) then | |||
TD_DrillStems(i)%HoleType = TD_WellGeo(j)%HoleType | |||
if (TD_DrillStems(i)%HoleType == 1) then | |||
TD_DrillStems(i)%StartAngle = TD_WellGeo(j)%StartAngle+(((TD_DrillStems(i)%TopDepth-TD_WellGeo(j)%TopDepth)/TD_WellGeo(j)%RCurvature)) ![rad] | |||
TD_DrillStems(i)%EndAngle = TD_WellGeo(j)%StartAngle+(((TD_DrillStems(i)%DownDepth-TD_WellGeo(j)%TopDepth)/TD_WellGeo(j)%RCurvature)) | |||
TD_DrillStems(i)%RCurvature = TD_WellGeo(j)%RCurvature | |||
else if (TD_DrillStems(i)%HoleType == 2) then | |||
TD_DrillStems(i)%StartAngle = TD_WellGeo(j)%StartAngle-(((TD_DrillStems(i)%TopDepth-TD_WellGeo(j)%TopDepth)/TD_WellGeo(j)%RCurvature)) | |||
TD_DrillStems(i)%EndAngle = TD_WellGeo(j)%StartAngle-(((TD_DrillStems(i)%DownDepth-TD_WellGeo(j)%TopDepth)/TD_WellGeo(j)%RCurvature)) | |||
TD_DrillStems(i)%RCurvature = TD_WellGeo(j)%RCurvature | |||
else | |||
TD_DrillStems(i)%StartAngle = TD_WellGeo(j)%EndAngle !Straight | |||
TD_DrillStems(i)%EndAngle = TD_DrillStems(i)%StartAngle | |||
end if | |||
end if | |||
End Do | |||
else | |||
TD_DrillStems(i)%HoleType = 0 !Straight | |||
TD_DrillStems(i)%StartAngle = 0.0d0 | |||
TD_DrillStems(i)%EndAngle = 0.0d0 | |||
end if | |||
End Do | |||
!=====> Hole(Well) Diameter Determination Of Drill Stem Components | |||
Do i = 1,TD_String%DrillStemComponentsNumbs | |||
If (TD_DrillStems(i)%TopDepth>TD_Casing(1)%TopDepth .and. TD_DrillStems(i)%TopDepth<TD_Casing(1)%DownDepth) then | |||
TD_DrillStems(i)%HoleDiameter = TD_Casing(1)%Id | |||
Else if (TD_Liner(1)%Length/=0.d0 .and. TD_DrillStems(i)%TopDepth>TD_Liner(1)%TopDepth .and. TD_DrillStems(i)%TopDepth<TD_Liner(1)%DownDepth) then | |||
TD_DrillStems(i)%HoleDiameter = TD_Liner(1)%Id | |||
Else if (TD_OpenHole(1)%Length/=0.d0 .and. TD_DrillStems(i)%TopDepth>TD_OpenHole(1)%TopDepth .and. TD_DrillStems(i)%TopDepth<TD_OpenHole(1)%DownDepth) then | |||
TD_DrillStems(i)%HoleDiameter = TD_OpenHole(1)%Id | |||
Else if (TD_ROPHole(1)%Length/=0.d0 .and. TD_DrillStems(i)%TopDepth>TD_ROPHole(1)%TopDepth .and. TD_DrillStems(i)%TopDepth<TD_ROPHole(1)%DownDepth) then | |||
TD_DrillStems(i)%HoleDiameter = TD_ROPHole(1)%Id !????????? check | |||
End If | |||
!=====> Viscosity Correction Coefficient Calculation | |||
if (TD_DrillStems(i)%HoleType == 1 .or. TD_DrillStems(i)%HoleType == 2) then | |||
TD_DrillStems(i)%MudVisCorrectCoef = (2.0d0/pi)*atan(sqrt(TD_DrillStems(i)%HoleDiameter**2-(TD_DrillStems(i)%Od**2)) & | |||
/ (TD_DrillStems(i)%Od))*(4.0d0/pi-1.0d0) + 1.0d0 | |||
else if (TD_DrillStems(i)%HoleType == 0) then | |||
TD_DrillStems(i)%MudVisCorrectCoef = 1.d0 | |||
end if | |||
End Do | |||
!=====> Out_of_Well Length Of DrillStem | |||
if (TD_DrillStems(TD_String%DrillStemComponentsNumbs)%TopDepth<0.) then | |||
TD_String%OutOfWellLength = abs(TD_DrillStems(TD_String%DrillStemComponentsNumbs)%TopDepth) | |||
else | |||
TD_String%OutOfWellLength = 0.d0 | |||
end if | |||
!=====> Near Floor Connection | |||
Do i = TD_String%DrillStemComponentsNumbs, 1, -1 | |||
if ( TD_DrillStems(i)%TopDepth<=0.d0 ) then | |||
TD_String%NearFloorConnectionNo = i | |||
TD_String%NearFloorConnectionHeight = abs(TD_DrillStems(i)%TopDepth) | |||
end if | |||
if (TD_DrillStems(i)%TopDepth>0.d0) then | |||
exit | |||
end if | |||
End Do | |||
Call Set_NearFloorConnection(real(TD_String%NearFloorConnectionHeight)) | |||
!=====> Graphic Output | |||
kk = 0 | |||
k = 0 | |||
Do i= 1,TD_String%StringConfigurationCount | |||
k = k+1 | |||
if ( TD_DrillStems(k)%DownDepthIniG>0.d0 ) then | |||
kk = kk+1 | |||
if (TD_DrillStems(k+TD_DrillStem(i)%Numbs-1)%TopDepthIniG<=0.d0) then | |||
exit | |||
end if | |||
k = k+TD_DrillStem(i)%Numbs-1 | |||
end if | |||
End Do | |||
if (allocated(G_StringElement)) deallocate(G_StringElement) | |||
allocate(G_StringElement(kk)) | |||
k = 0 | |||
Do i= 1,kk | |||
G_StringElement(kk-i+1)%Id = TD_DrillStem(i)%Id | |||
G_StringElement(kk-i+1)%Od = TD_DrillStem(i)%Od | |||
if ( TD_DrillStem(i)%ComponentType>4 ) then | |||
G_StringElement(kk-i+1)%ComponentType = 3 | |||
else | |||
G_StringElement(kk-i+1)%ComponentType = TD_DrillStem(i)%ComponentType | |||
end if | |||
G_StringElement(kk-i+1)%TopDepth = TD_DrillStems(k+TD_DrillStem(i)%Numbs)%TopDepthIniG | |||
G_StringElement(kk-i+1)%DownDepth = TD_DrillStems(k+1)%DownDepthIniG | |||
k = k+TD_DrillStem(i)%Numbs | |||
End Do | |||
if (G_StringElement(1)%TopDepth<=0.d0) then | |||
G_StringElement(1)%TopDepth = 0.d0 | |||
end if | |||
Call SetString(kk, G_StringElement) | |||
if(TD_DrillStems(1)%DownDepth<0.d0) then | |||
DrillingWatch%BitPosition = TD_DrillStems(1)%DownDepth | |||
else | |||
DrillingWatch%BitPosition = G_StringElement(kk)%DownDepth !??????????? | |||
!if ( G_StringElement(kk)%DownDepth>TD_WellGeneral%WellTotalLength ) then | |||
! DrillingWatch%BitPosition = TD_WellGeneral%WellTotalLength !??????????? | |||
!end if | |||
end if | |||
!print*, 'kk=' , kk | |||
!Do i=1,kk | |||
! print*, 'Number/' , 'downDepth/' , 'topDepth/' | |||
! print*, 'ID/' , 'OD/' , 'Type/' | |||
! print*, i , G_StringElement(i)%DownDepth , G_StringElement(i)%TopDepth | |||
! print*, G_StringElement(i)%Id , G_StringElement(i)%Od , G_StringElement(i)%ComponentType | |||
!End Do | |||
!print*, 'Top Joint Height before=' , TD_String%TopJointHeight | |||
!=====> Top Joint Height | |||
if ( Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() == KELLY_CONNECTION_STRING ) then | |||
TD_String%TopJointHeight = abs(TD_DrillStems(TD_String%DrillStemComponentsNumbs-1)%TopDepth) | |||
!print*, 'TopDepth1=' , TD_DrillStems(TD_String%DrillStemComponentsNumbs-1)%TopDepth | |||
!print*, 'numb1=' , TD_String%DrillStemComponentsNumbs-1 | |||
!print*, 'TD_String%TopJointHeight=' , TD_String%TopJointHeight | |||
else | |||
TD_String%TopJointHeight = abs(TD_DrillStems(TD_String%DrillStemComponentsNumbs)%TopDepth) | |||
!print*, 'TopDepth2=' , TD_DrillStems(TD_String%DrillStemComponentsNumbs)%TopDepth | |||
!print*, 'numb2=' , TD_String%DrillStemComponentsNumbs | |||
!print*, 'TD_String%TopJointHeight2=' , TD_String%TopJointHeight | |||
end if | |||
!print*, 'TD_String%DrillStemComponentsNumbs=' , TD_String%DrillStemComponentsNumbs | |||
!print*, 'TD_String%TopJointHeight_=' , TD_String%TopJointHeight | |||
!Print*, 'TD_StConn%ConnectionHeight_=' , TD_StConn%ConnectionHeight | |||
!Print*, 'TD_StConn%StringConnectionMode_=' , TD_StConn%StringConnectionMode | |||
! | |||
!print*, 'Top Joint Height after=' , TD_String%TopJointHeight | |||
end subroutine |
@@ -0,0 +1,359 @@ | |||
subroutine TD_RemoveComponents | |||
Use CStringConfigurationVariables | |||
use UnitySignalVariables | |||
! Use CStringUpdateVariables | |||
! Use CSafetyValveEnumVariables | |||
! Use CIbopEnumVariables | |||
! Use COperationConditionEnumVariables | |||
! Use CKellyConnectionEnumVariables | |||
! Use CElevatorConnectionEnumVariables | |||
Use COperationScenariosVariables | |||
! Use CTdsConnectionModesEnumVariables | |||
! Use CTdsElevatorModesEnumVariables | |||
Use CHoistingVariables | |||
Use TD_DrillStemComponents | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
Use TD_StringConnectionData | |||
implicit none | |||
integer :: i , TD_NumOfRemovedComponents | |||
!==================================================== | |||
! Remove Safety Valve & Kelly (OPERATION_DRILL) | |||
!==================================================== | |||
if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING ) then | |||
TD_Count%KellyNewRemove = 1 | |||
else | |||
TD_Count%KellyNewRemove = 0 | |||
TD_Count%KellyOldRemove = 0 | |||
end if | |||
if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. TD_Count%KellyNewRemove/=TD_Count%KellyOldRemove ) then | |||
!print* , 'Remove Safety Valve & Kelly=' | |||
TD_NumOfRemovedComponents = 1 | |||
Do i= TD_String%DrillStemComponentsNumbs , (TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1 | |||
TD_DrillStems(i)%ComponentType = 0 !???????????? | |||
TD_DrillStems(i)%Id = 0. | |||
TD_DrillStems(i)%Od = 0. | |||
TD_DrillStems(i)%Area = 0. | |||
TD_DrillStems(i)%RtoolJoint = 0. | |||
TD_DrillStems(i)%ToolJointRange = 0. | |||
TD_DrillStems(i)%Length = 0. | |||
TD_DrillStems(i)%LengthIni = 0. | |||
TD_DrillStems(i)%WeightperLength = 0. | |||
TD_DrillStems(i)%Weight = 0. | |||
End Do | |||
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents | |||
i = TD_String%StringConfigurationCount | |||
if ( TD_DrillStem(i)%Numbs>1 ) then | |||
TD_DrillStem(i)%ComponentType = 6 | |||
TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-1 | |||
TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft] | |||
TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft] | |||
TD_DrillStem(i)%Length = TD_DrillStem(i)%Length ![ft] | |||
TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength | |||
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length | |||
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount | |||
else if ( TD_DrillStem(i)%Numbs==1 ) then | |||
TD_DrillStem(i)%ComponentType = 6 | |||
TD_DrillStem(i)%Numbs = 0 | |||
TD_DrillStem(i)%Id = 0. | |||
TD_DrillStem(i)%Od = 0. | |||
TD_DrillStem(i)%Length = 0. | |||
TD_DrillStem(i)%WeightperLength = 0. | |||
TD_DrillStem(i)%TotalLength = 0. | |||
TD_DrillStem(i)%TotalWeight = 0. | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount-1 | |||
end if | |||
TD_Count%KellyOldRemove = TD_Count%KellyNewRemove | |||
!print* , 'Remove Safety Valve & Kelly (OPERATION_DRILL)' | |||
end if | |||
!==================================================== | |||
! Remove Single | |||
!==================================================== | |||
if ( Get_StringUpdate() == STRING_UPDATE_REMOVE_SINGLE ) then | |||
!print* , 'STRING_UPDATE_REMOVE_SINGLE=' | |||
TD_NumOfRemovedComponents = 1 | |||
Do i= TD_String%DrillStemComponentsNumbs , (TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1 | |||
TD_DrillStems(i)%ComponentType = 0 !???????????? | |||
TD_DrillStems(i)%Id = 0. | |||
TD_DrillStems(i)%Od = 0. | |||
TD_DrillStems(i)%Area = 0. | |||
TD_DrillStems(i)%RtoolJoint = 0. | |||
TD_DrillStems(i)%ToolJointRange = 0. | |||
TD_DrillStems(i)%Length = 0. | |||
TD_DrillStems(i)%LengthIni = 0. | |||
TD_DrillStems(i)%WeightperLength = 0. | |||
TD_DrillStems(i)%Weight = 0. | |||
End Do | |||
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents | |||
i = TD_String%StringConfigurationCount | |||
if ( TD_DrillStem(i)%Numbs>1 ) then | |||
TD_DrillStem(i)%ComponentType = 3 | |||
TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-1 | |||
TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft] | |||
TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft] | |||
TD_DrillStem(i)%Length = TD_DrillStem(i)%Length | |||
TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength | |||
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length | |||
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount | |||
else if ( TD_DrillStem(i)%Numbs==1 ) then | |||
TD_DrillStem(i)%ComponentType = 3 | |||
TD_DrillStem(i)%Numbs = 0 | |||
TD_DrillStem(i)%Id = 0. | |||
TD_DrillStem(i)%Od = 0. | |||
TD_DrillStem(i)%Length = 0. | |||
TD_DrillStem(i)%WeightperLength = 0. | |||
TD_DrillStem(i)%TotalLength = 0. | |||
TD_DrillStem(i)%TotalWeight = 0. | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount-1 | |||
end if | |||
Call Set_StringUpdate(STRING_UPDATE_NEUTRAL) | |||
!print* , 'Remove Single' | |||
end if | |||
!==================================================== | |||
! Remove Stand | |||
!==================================================== | |||
if ( Get_StringUpdate() == STRING_UPDATE_REMOVE_STAND ) then | |||
TD_NumOfRemovedComponents = 3 | |||
Do i= TD_String%DrillStemComponentsNumbs , (TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1 | |||
TD_DrillStems(i)%ComponentType = 0 !???????????? | |||
TD_DrillStems(i)%Id = 0. | |||
TD_DrillStems(i)%Od = 0. | |||
TD_DrillStems(i)%Area = 0. | |||
TD_DrillStems(i)%RtoolJoint = 0. | |||
TD_DrillStems(i)%ToolJointRange = 0. | |||
TD_DrillStems(i)%Length = 0. | |||
TD_DrillStems(i)%LengthIni = 0. | |||
TD_DrillStems(i)%WeightperLength = 0. | |||
TD_DrillStems(i)%Weight = 0. | |||
End Do | |||
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents | |||
i = TD_String%StringConfigurationCount | |||
if ( TD_DrillStem(i)%Numbs>3 ) then | |||
TD_DrillStem(i)%ComponentType = 3 | |||
TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-3 | |||
TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft] | |||
TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft] | |||
TD_DrillStem(i)%Length = TD_DrillStem(i)%Length | |||
TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength | |||
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length | |||
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount | |||
else if ( TD_DrillStem(i)%Numbs==3 ) then | |||
TD_DrillStem(i)%ComponentType = 3 | |||
TD_DrillStem(i)%Numbs = 0 | |||
TD_DrillStem(i)%Id = 0. | |||
TD_DrillStem(i)%Od = 0. | |||
TD_DrillStem(i)%Length = 0. | |||
TD_DrillStem(i)%WeightperLength = 0. | |||
TD_DrillStem(i)%TotalLength = 0. | |||
TD_DrillStem(i)%TotalWeight = 0. | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount-1 | |||
end if | |||
Call Set_StringUpdate(STRING_UPDATE_NEUTRAL) | |||
!print* , 'Remove Stand' | |||
end if | |||
!==================================================== | |||
! Remove IBOP | |||
!==================================================== | |||
!if ( Get_Ibop() == IBOP_REMOVE ) then | |||
! TD_Count%IBOPNewRemove = 1 | |||
!else | |||
! TD_Count%IBOPNewRemove = 0 | |||
! TD_Count%IBOPOldRemove = 0 | |||
!end if | |||
if ( Get_Ibop() == IBOP_REMOVE .and. TD_Count%IBOPOldRemove==0 ) then | |||
TD_NumOfRemovedComponents = 1 | |||
Do i= TD_String%DrillStemComponentsNumbs , (TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1 | |||
TD_DrillStems(i)%ComponentType = 0 !???????????? | |||
TD_DrillStems(i)%Id = 0. | |||
TD_DrillStems(i)%Od = 0. | |||
TD_DrillStems(i)%Area = 0. | |||
TD_DrillStems(i)%RtoolJoint = 0. | |||
TD_DrillStems(i)%ToolJointRange = 0. | |||
TD_DrillStems(i)%Length = 0. | |||
TD_DrillStems(i)%LengthIni = 0. | |||
TD_DrillStems(i)%WeightperLength = 0. | |||
TD_DrillStems(i)%Weight = 0. | |||
End Do | |||
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents | |||
i = TD_String%StringConfigurationCount | |||
if ( TD_DrillStem(i)%Numbs>1 ) then | |||
TD_DrillStem(i)%ComponentType = 5 | |||
TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-1 | |||
TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft] | |||
TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft] | |||
TD_DrillStem(i)%Length = TD_DrillStem(i)%Length ![ft] | |||
TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength | |||
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length | |||
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount | |||
else if ( TD_DrillStem(i)%Numbs==1 ) then | |||
TD_DrillStem(i)%ComponentType = 5 | |||
TD_DrillStem(i)%Numbs = 0 | |||
TD_DrillStem(i)%Id = 0. | |||
TD_DrillStem(i)%Od = 0. | |||
TD_DrillStem(i)%Length = 0. | |||
TD_DrillStem(i)%WeightperLength = 0. | |||
TD_DrillStem(i)%TotalLength = 0. | |||
TD_DrillStem(i)%TotalWeight = 0. | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount-1 | |||
end if | |||
!TD_Count%IBOPOldRemove = TD_Count%IBOPNewRemove | |||
if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-TD_StConn%IBOPLength | |||
end if | |||
!print* , 'Remove IBOP' | |||
end if | |||
if ( Get_Ibop() == IBOP_REMOVE ) then | |||
TD_Count%IBOPOldRemove = 1 | |||
else | |||
TD_Count%IBOPOldRemove = 0 | |||
end if | |||
!==================================================== | |||
! Remove Safety Valve (OPERATION_TRIP) | |||
!==================================================== | |||
!if ( TD_StConn%OldOperationCondition==1 .and. TD_StConn%KellyDriveTypeMode==1 .and. Get_SafetyValve() == SAFETY_VALVE_REMOVE ) then | |||
! TD_Count%SafetyValveNewRemove = 1 | |||
!else | |||
! TD_Count%SafetyValveNewRemove = 0 | |||
! TD_Count%SafetyValveOldRemove = 0 | |||
!end if | |||
!print* , 'Get_SafetyValve()=' , Get_SafetyValve() | |||
if ( TD_StConn%KellyDriveTypeMode/=0 .and. TD_StConn%OldOperationCondition/=0 .and. Get_SafetyValve() == SAFETY_VALVE_REMOVE .and. TD_Count%SafetyValveOldRemove==0 ) then | |||
TD_NumOfRemovedComponents = 1 | |||
Do i= TD_String%DrillStemComponentsNumbs , (TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents+1) , -1 | |||
TD_DrillStems(i)%ComponentType = 0 !???????????? | |||
TD_DrillStems(i)%Id = 0. | |||
TD_DrillStems(i)%Od = 0. | |||
TD_DrillStems(i)%Area = 0. | |||
TD_DrillStems(i)%RtoolJoint = 0. | |||
TD_DrillStems(i)%ToolJointRange = 0. | |||
TD_DrillStems(i)%Length = 0. | |||
TD_DrillStems(i)%LengthIni = 0. | |||
TD_DrillStems(i)%WeightperLength = 0. | |||
TD_DrillStems(i)%Weight = 0. | |||
End Do | |||
TD_String%DrillStemComponentsNumbs = TD_String%DrillStemComponentsNumbs-TD_NumOfRemovedComponents | |||
i = TD_String%StringConfigurationCount | |||
if ( TD_DrillStem(i)%Numbs>1 ) then | |||
TD_DrillStem(i)%ComponentType = 7 | |||
TD_DrillStem(i)%Numbs = TD_DrillStem(i)%Numbs-1 | |||
TD_DrillStem(i)%Id = TD_DrillStem(i)%Id ![ft] | |||
TD_DrillStem(i)%Od = TD_DrillStem(i)%Od ![ft] | |||
TD_DrillStem(i)%Length = TD_DrillStem(i)%Length ![ft] | |||
TD_DrillStem(i)%WeightperLength = TD_DrillStem(i)%WeightperLength | |||
TD_DrillStem(i)%TotalLength = TD_DrillStem(i)%Numbs*TD_DrillStem(i)%Length | |||
TD_DrillStem(i)%TotalWeight = TD_DrillStem(i)%TotalLength*TD_DrillStem(i)%WeightperLength | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount | |||
else if ( TD_DrillStem(i)%Numbs==1 ) then | |||
TD_DrillStem(i)%ComponentType = 7 | |||
TD_DrillStem(i)%Numbs = 0 | |||
TD_DrillStem(i)%Id = 0. | |||
TD_DrillStem(i)%Od = 0. | |||
TD_DrillStem(i)%Length = 0. | |||
TD_DrillStem(i)%WeightperLength = 0. | |||
TD_DrillStem(i)%TotalLength = 0. | |||
TD_DrillStem(i)%TotalWeight = 0. | |||
TD_String%StringConfigurationCount = TD_String%StringConfigurationCount-1 | |||
end if | |||
!print* , 'Get_OperationCondition()=' , Get_OperationCondition() | |||
!print* , 'TD_StConn%OldOperationCondition=' , TD_StConn%OldOperationCondition | |||
!print* , 'TD_Count%SafetyValveNewRemove=' , TD_Count%SafetyValveNewRemove | |||
!print* , 'TD_Count%SafetyValveOldRemove=' , TD_Count%SafetyValveOldRemove | |||
!TD_Count%SafetyValveOldRemove = TD_Count%SafetyValveNewRemove | |||
if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-TD_StConn%SafetyValveLength | |||
end if | |||
end if | |||
if ( Get_SafetyValve() == SAFETY_VALVE_REMOVE ) then | |||
TD_Count%SafetyValveOldRemove = 1 | |||
else | |||
TD_Count%SafetyValveOldRemove = 0 | |||
end if | |||
if ( TD_StConn%KellyDriveTypeMode==1 ) then | |||
TD_StConn%OldOperationCondition = 1 | |||
else | |||
TD_StConn%OldOperationCondition = 0 | |||
end if | |||
!print* , 'TD_StConn%KellyDriveTypeMode=' , TD_StConn%KellyDriveTypeMode | |||
!print* , 'TD_StConn%OldOperationCondition2=' , TD_StConn%OldOperationCondition | |||
!print* , 'TD_Count%SafetyValveNewRemove2=' , TD_Count%SafetyValveNewRemove | |||
!print* , 'TD_Count%SafetyValveOldRemove2=' , TD_Count%SafetyValveOldRemove | |||
end subroutine |
@@ -0,0 +1,830 @@ | |||
subroutine TD_StringConnectionModes | |||
Use CHoistingVariables | |||
Use CDrillingConsoleVariables | |||
use UnitySignalVariables | |||
! Use CKellyConnectionEnumVariables | |||
! Use CElevatorConnectionEnumVariables | |||
! Use CSlipsEnumVariables | |||
! Use COperationConditionEnumVariables | |||
use SoftwareInputsVariables | |||
! Use CZeroStringSpeed | |||
! Use CTdsConnectionModesEnumVariables | |||
! Use CTdsElevatorModesEnumVariables | |||
Use COperationScenariosVariables | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
Use TD_StringConnectionData | |||
Use Drawworks_VARIABLES!, only: Drawworks | |||
implicit none | |||
integer :: i , kk | |||
Real(8) :: LengthSum | |||
!!=====> Read Data | |||
!kk = 0 | |||
!LengthSum = 0.d0 | |||
! | |||
!Do i = TD_String%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 -----> Hoisting%DriveType = | |||
! = 0 TopDrive_DriveType | |||
! = 1 Kelly_DriveType | |||
!####C_Program -----> TD_StConn%KellyDriveTypeMode = | |||
! = 0 Drill Mode (Kelly) | |||
! = 1 Trip Mode (Elevator) | |||
! = 2 TopDrive Mode | |||
if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL ) then | |||
TD_StConn%KellyDriveTypeMode = 0 | |||
else if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_TRIP ) then | |||
TD_StConn%KellyDriveTypeMode = 1 | |||
else if ( Hoisting%DriveType==0 ) then | |||
TD_StConn%KellyDriveTypeMode = 2 | |||
end if | |||
TD_StConn%HookHeight = Drawworks%TDHookHeight ! unit: [ft] | |||
TD_StConn%ElevatorConst = 17.985d0 ! [ft] Elevator Length(14.84) ????????????????? adad ha daghigh shavand | |||
TD_StConn%ElevatorECG = OperationScenario%ECG ! [ft] | |||
TD_StConn%KellyConst = 63.280d0 ! [ft] Kelly Length(61.74) + Safety Valve Length(1.54) | |||
TD_StConn%KellyElementConst = 41.840d0 ! [ft] Kelly Element Length(40.3) + Safety Valve Length(1.54) | |||
TD_StConn%TDSLength = 24.08d0 !??????????????????? ! [ft] | |||
TD_StConn%TDSToolJointLength = 0.77d0 !??????????????????? ! [ft] | |||
TD_StConn%TDSElevatorLength = 26.837d0 !?????? ! TDS with Elevator Length [ft] | |||
TD_StConn%TDSElevatorToolLength= 0.859d0 !??????????????????? ! [ft] | |||
TD_StConn%TDSElevatorECG = 2.454d0 ! [ft] | |||
TD_Load%NumOfCables = Hoisting%NumberOfLine | |||
TD_Load%WeightTB = Hoisting%TravelingBlockWeight ! [lb] | |||
TD_Load%WeightTD = Hoisting%TopDriveWeight ! [lb] | |||
TD_Load%KellyWeight = Hoisting%KellyWeight ! [lb] | |||
!=====> Velocity Calculation | |||
TD_StConn%HookVelocity = (TD_StConn%HookHeight-TD_StConn%HookHeightOld)/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 = TD_String%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_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 (TD_String%DlTouch<=0.) then ![ft] | |||
! if(TD_StConn%HookVelocity<=0.) then | |||
! TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
! TD_StConn%StringVelocity = 0.0d0 | |||
! return | |||
! end if | |||
!end if | |||
!=====> Connection Height Determination | |||
if ( TD_StConn%KellyDriveTypeMode==0 ) then | |||
if(Get_KellyConnection() == KELLY_CONNECTION_STRING) then | |||
TD_Count%KellyNewStatus(1) = 1 | |||
else | |||
TD_Count%KellyNewStatus(1) = 0 | |||
!TD_Count%KellyOldStatus(1) = 0 | |||
end if | |||
if(Get_KellyConnection()==KELLY_CONNECTION_NOTHING) then | |||
TD_Count%KellyNewStatus(2) = 1 | |||
else | |||
TD_Count%KellyNewStatus(2) = 0 | |||
!TD_Count%KellyOldStatus(2) = 0 | |||
end if | |||
if(Get_KellyConnection()==KELLY_CONNECTION_SINGLE) then | |||
TD_Count%KellyNewStatus(3) = 1 | |||
else | |||
TD_Count%KellyNewStatus(3) = 0 | |||
!TD_Count%KellyOldStatus(3) = 0 | |||
end if | |||
if ( Get_KellyConnection() == KELLY_CONNECTION_STRING ) then | |||
TD_StConn%StringConnectionMode = 1 | |||
!print*, 'TD_StConn%ConnectionHeight10=' , TD_StConn%ConnectionHeight | |||
!print*, 'TD_StConn%KellyElementConst1=' , TD_StConn%KellyElementConst | |||
!print*, 'TD_DrillStems(kk)%LengthIni1=' , TD_DrillStems(kk)%LengthIni | |||
if (TD_Count%KellyOldStatus(2)==1 .and. TD_Count%KellyNewStatus(1)/=TD_Count%KellyOldStatus(1)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+TD_StConn%KellyElementConst | |||
TD_Count%KellyOldStatus(1) = TD_Count%KellyNewStatus(1) | |||
TD_Count%KellyOldStatus(2) = 0 | |||
else if (TD_Count%KellyOldStatus(3)==1 .and. TD_Count%KellyNewStatus(1)/=TD_Count%KellyOldStatus(1)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+TD_StConn%KellyElementConst+30.d0 !TD_DrillStems(kk)%LengthIni | |||
TD_Count%KellyOldStatus(1) = TD_Count%KellyNewStatus(1) | |||
TD_Count%KellyOldStatus(3) = 0 | |||
end if | |||
!print*, 'TD_StConn%ConnectionHeight1=' , TD_StConn%ConnectionHeight | |||
if ( Get_Slips() == SLIPS_SET_END ) then | |||
!!if ( TD_StConn%HookVelocity>0. ) then | |||
!! Print*, '*** UnSet Slips ***' !????????? | |||
!!end if | |||
TD_StConn%KellyConnectionHeight = TD_StConn%HookHeight-(TD_StConn%KellyConst-TD_StConn%KellyElementConst) !????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else | |||
!if (TD_String%DlTouch<=0. .and. TD_StConn%HookVelocity<=0.) then | |||
! TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
! TD_StConn%StringVelocity = 0.0d0 | |||
!else | |||
TD_StConn%KellyConnectionHeight = TD_StConn%HookHeight-(TD_StConn%KellyConst-TD_StConn%KellyElementConst) !?????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%KellyConnectionHeight | |||
TD_StConn%StringVelocity = TD_StConn%HookVelocity | |||
!end if | |||
end if | |||
else if ( Get_KellyConnection() == KELLY_CONNECTION_NOTHING ) then | |||
TD_StConn%StringConnectionMode = 2 | |||
!print*, 'TD_StConn%ConnectionHeight20=' , TD_StConn%ConnectionHeight | |||
!print*, 'TD_StConn%KellyElementConst2=' , TD_StConn%KellyElementConst | |||
if (TD_Count%KellyOldStatus(1)==1 .and. TD_Count%KellyNewStatus(2)/=TD_Count%KellyOldStatus(2)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-TD_StConn%KellyElementConst | |||
TD_Count%KellyOldStatus(2) = TD_Count%KellyNewStatus(2) | |||
TD_Count%KellyOldStatus(1) = 0 | |||
else if (TD_Count%KellyOldStatus(3)==1 .and. TD_Count%KellyNewStatus(2)/=TD_Count%KellyOldStatus(2)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(2) = TD_Count%KellyNewStatus(2) | |||
TD_Count%KellyOldStatus(3) = 0 | |||
else if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(2)/=TD_Count%KellyOldStatus(2)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(2) = TD_Count%KellyNewStatus(2) | |||
TD_Count%KellyOldStatus(5) = 0 | |||
end if | |||
!print*, 'TD_StConn%ConnectionHeight2=' , TD_StConn%ConnectionHeight | |||
TD_StConn%KellyConnectionHeight = TD_StConn%HookHeight-TD_StConn%KellyConst | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else if ( Get_KellyConnection() == KELLY_CONNECTION_SINGLE ) then | |||
!print*, 'KELLY_CONNECTION_SINGLE' , TD_StConn%ConnectionHeight | |||
TD_StConn%StringConnectionMode = 3 | |||
!print*, 'TD_StConn%ConnectionHeight30=' , TD_StConn%ConnectionHeight | |||
!print*, 'TD_StConn%KellyElementConst3=' , TD_StConn%KellyElementConst | |||
!print*, 'TD_DrillStems(kk)%LengthIni3=' , TD_DrillStems(kk)%LengthIni | |||
if (TD_Count%KellyOldStatus(1)==1 .and. TD_Count%KellyNewStatus(3)/=TD_Count%KellyOldStatus(3)) then | |||
!print*, 'KELLY_CONNECTION_SINGLE1' , TD_StConn%ConnectionHeight | |||
!print*, 'TD_StConn%KellyElementConst=' , TD_StConn%KellyElementConst | |||
!print*, 'TD_DrillStems(kk)%LengthIni=' , TD_DrillStems(kk)%LengthIni | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-TD_StConn%KellyElementConst-30.d0 !TD_DrillStems(kk)%LengthIni | |||
TD_Count%KellyOldStatus(3) = TD_Count%KellyNewStatus(3) | |||
TD_Count%KellyOldStatus(1) = 0 | |||
else if (TD_Count%KellyOldStatus(2)==1 .and. TD_Count%KellyNewStatus(3)/=TD_Count%KellyOldStatus(3)) then | |||
!print*, 'KELLY_CONNECTION_SINGLE2' , TD_StConn%ConnectionHeight | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(3) = TD_Count%KellyNewStatus(3) | |||
TD_Count%KellyOldStatus(2) = 0 | |||
end if | |||
!print*, 'TD_StConn%ConnectionHeight3=' , TD_StConn%ConnectionHeight | |||
!print*, 'KELLY_CONNECTION_SINGLE3' , TD_StConn%ConnectionHeight | |||
TD_StConn%KellyConnectionHeight = TD_StConn%HookHeight-TD_StConn%KellyConst-TD_DrillStems(kk)%LengthIni | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
!print*, 'KELLY_CONNECTION_SINGLE4' , TD_StConn%ConnectionHeight | |||
end if | |||
!print*, 'KELLY_CONNECTION_SINGLE5' , TD_StConn%ConnectionHeight | |||
else if ( TD_StConn%KellyDriveTypeMode==1 ) then | |||
if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING) then | |||
TD_Count%KellyNewStatus(4) = 1 | |||
else | |||
TD_Count%KellyNewStatus(4) = 0 | |||
!TD_Count%KellyOldStatus(4) = 0 | |||
end if | |||
if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING) then | |||
TD_Count%KellyNewStatus(5) = 1 | |||
else | |||
TD_Count%KellyNewStatus(5) = 0 | |||
!TD_Count%KellyOldStatus(5) = 0 | |||
end if | |||
if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND) then | |||
TD_Count%KellyNewStatus(6) = 1 | |||
else | |||
TD_Count%KellyNewStatus(6) = 0 | |||
!TD_Count%KellyOldStatus(6) = 0 | |||
end if | |||
if(Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE) then | |||
TD_Count%KellyNewStatus(7) = 1 | |||
else | |||
TD_Count%KellyNewStatus(7) = 0 | |||
!TD_Count%KellyOldStatus(7) = 0 | |||
end if | |||
if(Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) then | |||
TD_Count%KellyNewStatus(8) = 1 | |||
else | |||
TD_Count%KellyNewStatus(8) = 0 | |||
!TD_Count%KellyOldStatus(8) = 0 | |||
end if | |||
if(Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE) then | |||
TD_Count%KellyNewStatus(18) = 1 | |||
else | |||
TD_Count%KellyNewStatus(18) = 0 | |||
!TD_Count%KellyOldStatus(18) = 0 | |||
end if | |||
if(Get_ElevatorConnection() == ELEVATOR_LATCH_STAND) then | |||
TD_Count%KellyNewStatus(19) = 1 | |||
else | |||
TD_Count%KellyNewStatus(19) = 0 | |||
!TD_Count%KellyOldStatus(19) = 0 | |||
end if | |||
if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING ) then | |||
TD_StConn%StringConnectionMode = 4 | |||
if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(4)/=TD_Count%KellyOldStatus(4)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(4) = TD_Count%KellyNewStatus(4) | |||
TD_Count%KellyOldStatus(5) = 0 | |||
else if (TD_Count%KellyOldStatus(6)==1 .and. TD_Count%KellyNewStatus(4)/=TD_Count%KellyOldStatus(4)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+(3.d0*TD_DrillStems(kk)%LengthIni) | |||
TD_Count%KellyOldStatus(4) = TD_Count%KellyNewStatus(4) | |||
TD_Count%KellyOldStatus(6) = 0 | |||
else if (TD_Count%KellyOldStatus(7)==1 .and. TD_Count%KellyNewStatus(4)/=TD_Count%KellyOldStatus(4)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+TD_DrillStems(kk)%LengthIni | |||
TD_Count%KellyOldStatus(4) = TD_Count%KellyNewStatus(4) | |||
TD_Count%KellyOldStatus(7) = 0 | |||
else if (TD_Count%KellyOldStatus(8)==1 .and. TD_Count%KellyNewStatus(4)/=TD_Count%KellyOldStatus(4)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(4) = TD_Count%KellyNewStatus(4) | |||
TD_Count%KellyOldStatus(8) = 0 | |||
end if | |||
if ( Get_Slips() == SLIPS_SET_END ) then | |||
!if ( TD_StConn%HookVelocity>0. ) then | |||
! Print*, '*** UnSet Slips ***' !??????????????????? | |||
!end if | |||
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst !????????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else | |||
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst | |||
TD_StConn%ConnectionHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst+(LengthSum+TD_StConn%ElevatorECG) !(LengthSum+TD_DrillStems(kk)%ToolJointRange) | |||
TD_StConn%StringVelocity = TD_StConn%HookVelocity | |||
end if | |||
else if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING ) then | |||
TD_StConn%StringConnectionMode = 5 | |||
if (TD_Count%KellyOldStatus(4)==1 .and. TD_Count%KellyNewStatus(5)/=TD_Count%KellyOldStatus(5)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(5) = TD_Count%KellyNewStatus(5) | |||
TD_Count%KellyOldStatus(4) = 0 | |||
else if (TD_Count%KellyOldStatus(6)==1 .and. TD_Count%KellyNewStatus(5)/=TD_Count%KellyOldStatus(5)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(5) = TD_Count%KellyNewStatus(5) | |||
TD_Count%KellyOldStatus(6) = 0 | |||
else if (TD_Count%KellyOldStatus(7)==1 .and. TD_Count%KellyNewStatus(5)/=TD_Count%KellyOldStatus(5)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(5) = TD_Count%KellyNewStatus(5) | |||
TD_Count%KellyOldStatus(7) = 0 | |||
else if (TD_Count%KellyOldStatus(8)==1 .and. TD_Count%KellyNewStatus(5)/=TD_Count%KellyOldStatus(5)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(5) = TD_Count%KellyNewStatus(5) | |||
TD_Count%KellyOldStatus(8) = 0 | |||
else if (TD_Count%KellyOldStatus(2)==1 .and. TD_Count%KellyNewStatus(5)/=TD_Count%KellyOldStatus(5)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(5) = TD_Count%KellyNewStatus(5) | |||
TD_Count%KellyOldStatus(2) = 0 | |||
end if | |||
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND ) then | |||
TD_StConn%StringConnectionMode = 6 | |||
if (TD_Count%KellyOldStatus(4)==1 .and. TD_Count%KellyNewStatus(6)/=TD_Count%KellyOldStatus(6)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-(3.*TD_DrillStems(kk)%LengthIni) | |||
TD_Count%KellyOldStatus(6) = TD_Count%KellyNewStatus(6) | |||
TD_Count%KellyOldStatus(4) = 0 | |||
else if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(6)/=TD_Count%KellyOldStatus(6)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(6) = TD_Count%KellyNewStatus(6) | |||
TD_Count%KellyOldStatus(5) = 0 | |||
else if (TD_Count%KellyOldStatus(7)==1 .and. TD_Count%KellyNewStatus(6)/=TD_Count%KellyOldStatus(6)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(6) = TD_Count%KellyNewStatus(6) | |||
TD_Count%KellyOldStatus(7) = 0 | |||
else if (TD_Count%KellyOldStatus(8)==1 .and. TD_Count%KellyNewStatus(6)/=TD_Count%KellyOldStatus(6)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(6) = TD_Count%KellyNewStatus(6) | |||
TD_Count%KellyOldStatus(8) = 0 | |||
end if | |||
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst-(3.*TD_DrillStems(kk)%LengthIni) | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else if ( Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE ) then | |||
TD_StConn%StringConnectionMode = 7 | |||
if (TD_Count%KellyOldStatus(4)==1 .and. TD_Count%KellyNewStatus(7)/=TD_Count%KellyOldStatus(7)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-TD_DrillStems(kk)%LengthIni | |||
TD_Count%KellyOldStatus(7) = TD_Count%KellyNewStatus(7) | |||
TD_Count%KellyOldStatus(4) = 0 | |||
else if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(7)/=TD_Count%KellyOldStatus(7)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(7) = TD_Count%KellyNewStatus(7) | |||
TD_Count%KellyOldStatus(5) = 0 | |||
else if (TD_Count%KellyOldStatus(6)==1 .and. TD_Count%KellyNewStatus(7)/=TD_Count%KellyOldStatus(7)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(7) = TD_Count%KellyNewStatus(7) | |||
TD_Count%KellyOldStatus(6) = 0 | |||
else if (TD_Count%KellyOldStatus(8)==1 .and. TD_Count%KellyNewStatus(7)/=TD_Count%KellyOldStatus(7)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(7) = TD_Count%KellyNewStatus(7) | |||
TD_Count%KellyOldStatus(8) = 0 | |||
end if | |||
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst-TD_DrillStems(kk)%LengthIni | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else if ( Get_ElevatorConnection() == ELEVATOR_LATCH_STRING ) then | |||
TD_StConn%StringConnectionMode = 8 | |||
if (TD_Count%KellyOldStatus(4)==1 .and. TD_Count%KellyNewStatus(8)/=TD_Count%KellyOldStatus(8)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(8) = TD_Count%KellyNewStatus(8) | |||
TD_Count%KellyOldStatus(4) = 0 | |||
else if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(8)/=TD_Count%KellyOldStatus(8)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(8) = TD_Count%KellyNewStatus(8) | |||
TD_Count%KellyOldStatus(5) = 0 | |||
else if (TD_Count%KellyOldStatus(6)==1 .and. TD_Count%KellyNewStatus(8)/=TD_Count%KellyOldStatus(8)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(8) = TD_Count%KellyNewStatus(8) | |||
TD_Count%KellyOldStatus(6) = 0 | |||
else if (TD_Count%KellyOldStatus(7)==1 .and. TD_Count%KellyNewStatus(8)/=TD_Count%KellyOldStatus(8)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(8) = TD_Count%KellyNewStatus(8) | |||
TD_Count%KellyOldStatus(7) = 0 | |||
end if | |||
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else if ( Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE ) then | |||
TD_StConn%StringConnectionMode = 18 | |||
if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(18)/=TD_Count%KellyOldStatus(18)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(18) = TD_Count%KellyNewStatus(18) | |||
TD_Count%KellyOldStatus(5) = 0 | |||
else if (TD_Count%KellyOldStatus(7)==1 .and. TD_Count%KellyNewStatus(18)/=TD_Count%KellyOldStatus(18)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(18) = TD_Count%KellyNewStatus(18) | |||
TD_Count%KellyOldStatus(7) = 0 | |||
else if (TD_Count%KellyOldStatus(8)==1 .and. TD_Count%KellyNewStatus(18)/=TD_Count%KellyOldStatus(18)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(18) = TD_Count%KellyNewStatus(18) | |||
TD_Count%KellyOldStatus(8) = 0 | |||
end if | |||
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else if ( Get_ElevatorConnection() == ELEVATOR_LATCH_STAND ) then | |||
TD_StConn%StringConnectionMode = 19 | |||
if (TD_Count%KellyOldStatus(5)==1 .and. TD_Count%KellyNewStatus(19)/=TD_Count%KellyOldStatus(19)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(19) = TD_Count%KellyNewStatus(19) | |||
TD_Count%KellyOldStatus(5) = 0 | |||
else if (TD_Count%KellyOldStatus(6)==1 .and. TD_Count%KellyNewStatus(19)/=TD_Count%KellyOldStatus(19)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(19) = TD_Count%KellyNewStatus(19) | |||
TD_Count%KellyOldStatus(6) = 0 | |||
else if (TD_Count%KellyOldStatus(8)==1 .and. TD_Count%KellyNewStatus(19)/=TD_Count%KellyOldStatus(19)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(19) = TD_Count%KellyNewStatus(19) | |||
TD_Count%KellyOldStatus(8) = 0 | |||
end if | |||
TD_StConn%ElevatorHeight = TD_StConn%HookHeight-TD_StConn%ElevatorConst | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
end if | |||
else if ( TD_StConn%KellyDriveTypeMode==2 ) then | |||
if( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then | |||
TD_Count%KellyNewStatus(9) = 1 | |||
else | |||
TD_Count%KellyNewStatus(9) = 0 | |||
!TD_Count%KellyOldStatus(9) = 0 | |||
end if | |||
if( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then | |||
TD_Count%KellyNewStatus(10) = 1 | |||
else | |||
TD_Count%KellyNewStatus(10) = 0 | |||
!TD_Count%KellyOldStatus(10) = 0 | |||
end if | |||
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STRING ) then | |||
TD_Count%KellyNewStatus(11) = 1 | |||
else | |||
TD_Count%KellyNewStatus(11) = 0 | |||
!TD_Count%KellyOldStatus(11) = 0 | |||
end if | |||
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING ) then | |||
TD_Count%KellyNewStatus(12) = 1 | |||
else | |||
TD_Count%KellyNewStatus(12) = 0 | |||
!TD_Count%KellyOldStatus(12) = 0 | |||
end if | |||
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then | |||
TD_Count%KellyNewStatus(13) = 1 | |||
else | |||
TD_Count%KellyNewStatus(13) = 0 | |||
!TD_Count%KellyOldStatus(13) = 0 | |||
end if | |||
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STAND ) then | |||
TD_Count%KellyNewStatus(14) = 1 | |||
else | |||
TD_Count%KellyNewStatus(14) = 0 | |||
!TD_Count%KellyOldStatus(14) = 0 | |||
end if | |||
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_SINGLE ) then | |||
TD_Count%KellyNewStatus(15) = 1 | |||
else | |||
TD_Count%KellyNewStatus(15) = 0 | |||
!TD_Count%KellyOldStatus(15) = 0 | |||
end if | |||
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_SINGLE ) then | |||
TD_Count%KellyNewStatus(16) = 1 | |||
else | |||
TD_Count%KellyNewStatus(16) = 0 | |||
!TD_Count%KellyOldStatus(16) = 0 | |||
end if | |||
if( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STAND ) then | |||
TD_Count%KellyNewStatus(17) = 1 | |||
else | |||
TD_Count%KellyNewStatus(17) = 0 | |||
!TD_Count%KellyOldStatus(17) = 0 | |||
end if | |||
if ( Get_TdsConnectionModes()==TDS_CONNECTION_SPINE ) then | |||
TD_StConn%StringConnectionMode = 9 | |||
if (TD_Count%KellyOldStatus(10)==1 .and. TD_Count%KellyNewStatus(9)/=TD_Count%KellyOldStatus(9)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(9) = TD_Count%KellyNewStatus(9) | |||
TD_Count%KellyOldStatus(10) = 0 | |||
else if (TD_Count%KellyOldStatus(11)==1 .and. TD_Count%KellyNewStatus(9)/=TD_Count%KellyOldStatus(9)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(9) = TD_Count%KellyNewStatus(9) | |||
TD_Count%KellyOldStatus(11) = 0 | |||
else if (TD_Count%KellyOldStatus(13)==1 .and. TD_Count%KellyNewStatus(9)/=TD_Count%KellyOldStatus(9)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(9) = TD_Count%KellyNewStatus(9) | |||
TD_Count%KellyOldStatus(13) = 0 | |||
end if | |||
if ( Get_Slips() == SLIPS_SET_END ) then | |||
!if ( TD_StConn%HookVelocity>0. ) then | |||
! Print*, '*** UnSet Slips ***' !??????????????????? | |||
!end if | |||
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength-TD_StConn%TDSToolJointLength !????????????? | |||
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !????????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else | |||
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength-TD_StConn%TDSToolJointLength !????????????? | |||
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !????????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%TDSHeight | |||
TD_StConn%StringVelocity = TD_StConn%HookVelocity | |||
end if | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_STRING ) then | |||
TD_StConn%StringConnectionMode = 10 | |||
if (TD_Count%KellyOldStatus(9)==1 .and. TD_Count%KellyNewStatus(10)/=TD_Count%KellyOldStatus(10)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(10) = TD_Count%KellyNewStatus(10) | |||
TD_Count%KellyOldStatus(9) = 0 | |||
end if | |||
if ( Get_Slips() == SLIPS_SET_END ) then | |||
!if ( TD_StConn%HookVelocity>0. ) then | |||
! Print*, '*** UnSet Slips ***' !??????????????????? | |||
!end if | |||
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength-TD_StConn%TDSToolJointLength !????????????? | |||
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !????????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else | |||
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength-TD_StConn%TDSToolJointLength !????????????? | |||
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !????????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%TDSHeight | |||
TD_StConn%StringVelocity = TD_StConn%HookVelocity | |||
end if | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STRING ) then | |||
TD_StConn%StringConnectionMode = 11 | |||
if (TD_Count%KellyOldStatus(9)==1 .and. TD_Count%KellyNewStatus(11)/=TD_Count%KellyOldStatus(11)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(11) = TD_Count%KellyNewStatus(11) | |||
TD_Count%KellyOldStatus(9) = 0 | |||
else if (TD_Count%KellyOldStatus(12)==1 .and. TD_Count%KellyNewStatus(11)/=TD_Count%KellyOldStatus(11)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(11) = TD_Count%KellyNewStatus(11) | |||
TD_Count%KellyOldStatus(12) = 0 | |||
else if (TD_Count%KellyOldStatus(13)==1 .and. TD_Count%KellyNewStatus(11)/=TD_Count%KellyOldStatus(11)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(11) = TD_Count%KellyNewStatus(11) | |||
TD_Count%KellyOldStatus(13) = 0 | |||
else if (TD_Count%KellyOldStatus(16)==1 .and. TD_Count%KellyNewStatus(11)/=TD_Count%KellyOldStatus(11)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+(TD_DrillStems(kk)%LengthIni) | |||
TD_Count%KellyOldStatus(11) = TD_Count%KellyNewStatus(11) | |||
TD_Count%KellyOldStatus(16) = 0 | |||
else if (TD_Count%KellyOldStatus(17)==1 .and. TD_Count%KellyNewStatus(11)/=TD_Count%KellyOldStatus(11)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+(3.d0*TD_DrillStems(kk)%LengthIni) | |||
TD_Count%KellyOldStatus(11) = TD_Count%KellyNewStatus(11) | |||
TD_Count%KellyOldStatus(17) = 0 | |||
end if | |||
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !????????????? | |||
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !????????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STRING ) then | |||
TD_StConn%StringConnectionMode = 12 | |||
if (TD_Count%KellyOldStatus(11)==1 .and. TD_Count%KellyNewStatus(12)/=TD_Count%KellyOldStatus(12)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(12) = TD_Count%KellyNewStatus(12) | |||
TD_Count%KellyOldStatus(11) = 0 | |||
else if (TD_Count%KellyOldStatus(14)==1 .and. TD_Count%KellyNewStatus(12)/=TD_Count%KellyOldStatus(12)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+(3.d0*TD_DrillStems(kk)%LengthIni) | |||
TD_Count%KellyOldStatus(12) = TD_Count%KellyNewStatus(12) | |||
TD_Count%KellyOldStatus(14) = 0 | |||
else if (TD_Count%KellyOldStatus(15)==1 .and. TD_Count%KellyNewStatus(12)/=TD_Count%KellyOldStatus(12)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+(TD_DrillStems(kk)%LengthIni) | |||
TD_Count%KellyOldStatus(12) = TD_Count%KellyNewStatus(12) | |||
TD_Count%KellyOldStatus(15) = 0 | |||
end if | |||
if ( Get_Slips() == SLIPS_SET_END ) then | |||
!if ( TD_StConn%HookVelocity>0. ) then | |||
! Print*, '*** UnSet Slips ***' !??????????????????? | |||
!end if | |||
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !????????????? | |||
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !????????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else | |||
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !????????????? | |||
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSLength-TD_StConn%TDSElevatorLength !????????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength+(LengthSum+TD_StConn%TDSElevatorECG) !????????????? | |||
TD_StConn%StringVelocity = TD_StConn%HookVelocity | |||
end if | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_NOTHING ) then | |||
TD_StConn%StringConnectionMode = 13 | |||
if (TD_Count%KellyOldStatus(9)==1 .and. TD_Count%KellyNewStatus(13)/=TD_Count%KellyOldStatus(13)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(13) = TD_Count%KellyNewStatus(13) | |||
TD_Count%KellyOldStatus(9) = 0 | |||
else if (TD_Count%KellyOldStatus(11)==1 .and. TD_Count%KellyNewStatus(13)/=TD_Count%KellyOldStatus(13)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(13) = TD_Count%KellyNewStatus(13) | |||
TD_Count%KellyOldStatus(11) = 0 | |||
else if (TD_Count%KellyOldStatus(12)==1 .and. TD_Count%KellyNewStatus(13)/=TD_Count%KellyOldStatus(13)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(13) = TD_Count%KellyNewStatus(13) | |||
TD_Count%KellyOldStatus(12) = 0 | |||
else if (TD_Count%KellyOldStatus(14)==1 .and. TD_Count%KellyNewStatus(13)/=TD_Count%KellyOldStatus(13)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(13) = TD_Count%KellyNewStatus(13) | |||
TD_Count%KellyOldStatus(14) = 0 | |||
else if (TD_Count%KellyOldStatus(15)==1 .and. TD_Count%KellyNewStatus(13)/=TD_Count%KellyOldStatus(13)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(13) = TD_Count%KellyNewStatus(13) | |||
TD_Count%KellyOldStatus(15) = 0 | |||
else if (TD_Count%KellyOldStatus(16)==1 .and. TD_Count%KellyNewStatus(13)/=TD_Count%KellyOldStatus(13)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(13) = TD_Count%KellyNewStatus(13) | |||
TD_Count%KellyOldStatus(16) = 0 | |||
end if | |||
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !????????????? | |||
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !????????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_STAND ) then | |||
TD_StConn%StringConnectionMode = 14 | |||
if (TD_Count%KellyOldStatus(12)==1 .and. TD_Count%KellyNewStatus(14)/=TD_Count%KellyOldStatus(14)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-(3.d0*TD_DrillStems(kk)%LengthIni) | |||
TD_Count%KellyOldStatus(14) = TD_Count%KellyNewStatus(14) | |||
TD_Count%KellyOldStatus(12) = 0 | |||
else if (TD_Count%KellyOldStatus(13)==1 .and. TD_Count%KellyNewStatus(14)/=TD_Count%KellyOldStatus(14)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(14) = TD_Count%KellyNewStatus(14) | |||
TD_Count%KellyOldStatus(13) = 0 | |||
else if (TD_Count%KellyOldStatus(17)==1 .and. TD_Count%KellyNewStatus(14)/=TD_Count%KellyOldStatus(14)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(14) = TD_Count%KellyNewStatus(14) | |||
TD_Count%KellyOldStatus(17) = 0 | |||
end if | |||
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !????????????? | |||
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !????????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_CONNECTION_SINGLE ) then | |||
TD_StConn%StringConnectionMode = 15 | |||
if (TD_Count%KellyOldStatus(12)==1 .and. TD_Count%KellyNewStatus(15)/=TD_Count%KellyOldStatus(15)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-(TD_DrillStems(kk)%LengthIni) | |||
TD_Count%KellyOldStatus(15) = TD_Count%KellyNewStatus(15) | |||
TD_Count%KellyOldStatus(12) = 0 | |||
else if (TD_Count%KellyOldStatus(13)==1 .and. TD_Count%KellyNewStatus(15)/=TD_Count%KellyOldStatus(15)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(15) = TD_Count%KellyNewStatus(15) | |||
TD_Count%KellyOldStatus(13) = 0 | |||
else if (TD_Count%KellyOldStatus(16)==1 .and. TD_Count%KellyNewStatus(15)/=TD_Count%KellyOldStatus(15)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(15) = TD_Count%KellyNewStatus(15) | |||
TD_Count%KellyOldStatus(16) = 0 | |||
end if | |||
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !????????????? | |||
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !????????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_SINGLE ) then | |||
TD_StConn%StringConnectionMode = 16 | |||
if (TD_Count%KellyOldStatus(11)==1 .and. TD_Count%KellyNewStatus(16)/=TD_Count%KellyOldStatus(16)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-(TD_DrillStems(kk)%LengthIni) | |||
TD_Count%KellyOldStatus(16) = TD_Count%KellyNewStatus(16) | |||
TD_Count%KellyOldStatus(11) = 0 | |||
else if (TD_Count%KellyOldStatus(13)==1 .and. TD_Count%KellyNewStatus(16)/=TD_Count%KellyOldStatus(16)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(16) = TD_Count%KellyNewStatus(16) | |||
TD_Count%KellyOldStatus(13) = 0 | |||
else if (TD_Count%KellyOldStatus(15)==1 .and. TD_Count%KellyNewStatus(16)/=TD_Count%KellyOldStatus(16)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_Count%KellyOldStatus(16) = TD_Count%KellyNewStatus(16) | |||
TD_Count%KellyOldStatus(15) = 0 | |||
end if | |||
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !????????????? | |||
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !????????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
else if ( Get_TdsConnectionModes()==TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()==TDS_ELEVATOR_LATCH_STAND ) then | |||
TD_StConn%StringConnectionMode = 17 | |||
if (TD_Count%KellyOldStatus(11)==1 .and. TD_Count%KellyNewStatus(17)/=TD_Count%KellyOldStatus(17)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight-(3.d0*TD_DrillStems(kk)%LengthIni) | |||
TD_Count%KellyOldStatus(17) = TD_Count%KellyNewStatus(17) | |||
TD_Count%KellyOldStatus(11) = 0 | |||
else if (TD_Count%KellyOldStatus(14)==1 .and. TD_Count%KellyNewStatus(17)/=TD_Count%KellyOldStatus(17)) then | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight+(3.d0*TD_DrillStems(kk)%LengthIni) | |||
TD_Count%KellyOldStatus(17) = TD_Count%KellyNewStatus(17) | |||
TD_Count%KellyOldStatus(14) = 0 | |||
end if | |||
TD_StConn%TDSHeight = TD_StConn%HookHeight-TD_StConn%TDSLength !????????????? | |||
TD_StConn%TDSElevatorHeight = TD_StConn%HookHeight-TD_StConn%TDSElevatorLength !????????????? | |||
TD_StConn%ConnectionHeight = TD_StConn%ConnectionHeight | |||
TD_StConn%StringVelocity = 0.0d0 | |||
end if | |||
end if | |||
!Print*, 'TD_StConn%StringConnectionMode=' , TD_StConn%StringConnectionMode | |||
!print* , 'TD_StConn%ConnectionHeight=' , TD_StConn%ConnectionHeight | |||
!Print*, 'TD_StConn%StringConnectionMode=' , TD_StConn%StringConnectionMode | |||
!print*, 'TD_String%DrillStemComponentsNumbs=' , TD_String%DrillStemComponentsNumbs | |||
!!Print*, 'TD_Count%KellyNewStatus(1)=' , TD_Count%KellyNewStatus(1) | |||
!Print*, 'TD_Count%KellyOldStatus(1)=' , TD_Count%KellyOldStatus(1) | |||
!Print*, 'TD_Count%KellyNewStatus(2)=' , TD_Count%KellyNewStatus(2) | |||
!Print*, 'TD_Count%KellyOldStatus(2)=' , TD_Count%KellyOldStatus(2) | |||
!Print*, 'TD_Count%KellyNewStatus(3)=' , TD_Count%KellyNewStatus(3) | |||
!Print*, 'TD_Count%KellyOldStatus(3)=' , TD_Count%KellyOldStatus(3) | |||
if ( (any(TD_StConn%StringConnectionMode==(/1,9,10/))) .or. DrillingConsole%CloseSafetyValve==.true. ) then !for fluid module | |||
TD_StConn%FluidStringConnectionMode = 1 !string is connected | |||
!else if ( (any(TD_StConn%StringConnectionMode==(/1,9,10/))) .or. DrillingConsole%CloseSafetyValve==.true. ) then | |||
! | |||
else | |||
TD_StConn%FluidStringConnectionMode = 0 !string is not connected | |||
end if | |||
!==================================================== | |||
! Zero String Speed | |||
!==================================================== | |||
if ( abs(TD_StConn%StringVelocity)<=0.05d0 ) then ! [ft/s] | |||
TD_Load%ZeroStringSpeed = 1 | |||
Call Set_ZeroStringSpeed(.true.) | |||
else | |||
TD_Load%ZeroStringSpeed = 0 | |||
Call Set_ZeroStringSpeed(.false.) | |||
end if | |||
end subroutine |
@@ -0,0 +1,28 @@ | |||
subroutine TD_WellElementsConfiguration | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
implicit none | |||
Integer :: i, j | |||
!==================================================== | |||
! Modified Well Elements Data | |||
!==================================================== | |||
Do i = 1 , TD_WellEl%ROPHoleNumbs | |||
!TD_ROPHole(i)%TopDepth = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%TopDepth | |||
TD_ROPHole(i)%DownDepth = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%DownDepth | |||
TD_ROPHole(i)%Length = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%IntervalLength | |||
TD_ROPHole(i)%Id = TD_ROPHole(i)%Id !!??????????? | |||
End Do | |||
end subroutine |
@@ -0,0 +1,51 @@ | |||
subroutine TD_WellGeoConfiguration | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
Use sROP_Variables | |||
Use CDataDisplayConsoleVariables | |||
Use CWarningsVariables | |||
implicit none | |||
!==================================================== | |||
! Well Geometry Data Modification | |||
!==================================================== | |||
!=====> ROP Calculation | |||
if ( TD_DrillStems(1)%ComponentType==0 .and. MaximumWellDepthExceeded==.false. ) then | |||
Call ROP_MainCalculation | |||
else | |||
ROP_Bit%RateOfPenetration = 0.d0 | |||
Call Set_ROP(ROP_Bit%RateOfPenetration) | |||
end if | |||
!=====> ROPHole Data correction | |||
TD_WellEl%ROP = (ROP_Bit%RateOfPenetration/3600.d0) ! [ft/s] | |||
TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%VerticalDepth = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%VerticalDepth++((TD_WellEl%ROP*TD_General%TimeStep)*cos(TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%StartAngle)) | |||
TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%IntervalLength = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%IntervalLength+(TD_WellEl%ROP*TD_General%TimeStep) !????????check | |||
TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%DownDepth = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%TopDepth+TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%IntervalLength | |||
!=====> Well Total Length Calculation | |||
TD_WellGeneral%WellTotalLength = TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%DownDepth | |||
TD_WellGeneral%WellTotalVerticalLength = TD_WellGeneral%WellTotalVerticalLength+((TD_WellEl%ROP*TD_General%TimeStep)*cos(TD_WellGeo(TD_WellGeneral%WellIntervalsCount)%StartAngle)) | |||
Call Set_TotalDepth(real(TD_WellGeneral%WellTotalLength,8)) | |||
end subroutine |
@@ -0,0 +1,78 @@ | |||
subroutine TVD_Calculator(MeasuredDepth,VerticalDepth) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_StringConnectionData | |||
implicit none | |||
Integer :: kk | |||
REAL(8) :: MeasuredDepth , VerticalDepth | |||
REAL(8) :: mm , nn , dl , StartAngle , EndAngle | |||
if ( MeasuredDepth<=0. ) then | |||
VerticalDepth = MeasuredDepth | |||
!TDGeo%Angle(ii) = 0.d0 | |||
return | |||
end if | |||
mm = 0.d0 !last vertical depth | |||
nn = 0.d0 !last measured depth | |||
EndAngle = TD_WellGeo(1)%StartAngle | |||
!TDGeo%Angle(jj) = EndAngle | |||
do kk = 1, TD_WellGeneral%WellIntervalsCount | |||
StartAngle = EndAngle | |||
if ( MeasuredDepth>TD_WellGeo(kk)%TopDepth ) then | |||
if ( MeasuredDepth>TD_WellGeo(kk)%DownDepth ) then | |||
dl = TD_WellGeo(kk)%DownDepth-nn ![ft] | |||
nn = TD_WellGeo(kk)%DownDepth | |||
if ( TD_WellGeo(kk)%HoleType==0 ) then | |||
EndAngle = StartAngle | |||
VerticalDepth = mm+(dl*cos(TD_WellGeo(kk)%StartAngle)) ![ft] | |||
!TDGeo%Angle(ii) = EndAngle | |||
else if ( TD_WellGeo(kk)%HoleType==1 ) then | |||
EndAngle = StartAngle+(dl/TD_WellGeo(kk)%RCurvature) !????? | |||
VerticalDepth = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle))*cos(abs(StartAngle)))-(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(EndAngle)-abs(StartAngle)))*sin(abs(StartAngle))) | |||
!TDGeo%Angle(ii) = EndAngle | |||
else if ( TD_WellGeo(kk)%HoleType==2 ) then | |||
EndAngle = StartAngle-(dl/TD_WellGeo(kk)%RCurvature) !????? | |||
VerticalDepth = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(abs(EndAngle)-abs(StartAngle)))*cos(abs(StartAngle)))+(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(abs(EndAngle)-abs(StartAngle))))*sin(abs(StartAngle))) | |||
!TDGeo%Angle(ii) = EndAngle | |||
end if | |||
mm = VerticalDepth | |||
else | |||
dl = MeasuredDepth-nn | |||
nn = MeasuredDepth | |||
if ( TD_WellGeo(kk)%HoleType==0 ) then | |||
EndAngle = StartAngle | |||
VerticalDepth = mm+(dl*cos(TD_WellGeo(kk)%StartAngle)) | |||
!TDGeo%Angle(ii) = EndAngle | |||
else if ( TD_WellGeo(kk)%HoleType==1 ) then | |||
EndAngle = StartAngle+(dl/TD_WellGeo(kk)%RCurvature) !????? | |||
VerticalDepth = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(EndAngle)-abs(StartAngle))*cos(abs(StartAngle)))-(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(EndAngle)-abs(StartAngle)))*sin(abs(StartAngle))) | |||
!TDGeo%Angle(ii) = EndAngle | |||
else if ( TD_WellGeo(kk)%HoleType==2 ) then | |||
EndAngle = StartAngle-(dl/TD_WellGeo(kk)%RCurvature) !????? | |||
VerticalDepth = mm+(TD_WellGeo(kk)%RCurvature*sin(abs(abs(EndAngle)-abs(StartAngle)))*cos(abs(StartAngle)))+(TD_WellGeo(kk)%RCurvature*(1.-cos(abs(abs(EndAngle)-abs(StartAngle))))*sin(abs(StartAngle))) | |||
!TDGeo%Angle(ii) = EndAngle | |||
end if | |||
mm = VerticalDepth | |||
exit | |||
end if | |||
end if | |||
end do | |||
end subroutine |
@@ -0,0 +1,32 @@ | |||
subroutine TD_BouyancyFactor (i) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
!==================================================== | |||
! Bouyancy Factor Calculation | |||
!==================================================== | |||
if ( TD_DrillStems(i)%MudDensityOut==0.d0 .or. TD_DrillStems(i)%MudDensityIn==0.d0 ) then | |||
TD_DrillStems(i)%BouyancyFactor = 0.d0 | |||
else | |||
TD_DrillStems(i)%BouyancyFactor = 1.d0-( ((TD_DrillStems(i)%MudDensityOut*(TD_DrillStems(i)%Od**2)/4.0d0) & | |||
-(TD_DrillStems(i)%MudDensityIn*(TD_DrillStems(i)%Id**2)/4.0d0)) & | |||
/(TD_DrillStems(i)%Density*((TD_DrillStems(i)%Od**2-TD_DrillStems(i)%Id**2))/4.0d0) ) | |||
end if | |||
end subroutine |
@@ -0,0 +1,65 @@ | |||
subroutine TD_ForceDownB(i,TD_SemiMudVisc) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
Real(8) :: TD_SemiMudVisc | |||
If (i==1) then | |||
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit | |||
TD_DrillStems(1)%Force2 = (TD_DrillStems(1)%Force1 * exp(-(TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))) - & | |||
(TD_DrillStems(1)%WeightperLength * TD_DrillStems(1)%RCurvature * & | |||
(sin(TD_DrillStems(1)%EndAngle) - (exp(-(TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef) * & | |||
(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle)) * & | |||
sin(TD_DrillStems(1)%StartAngle)))) | |||
if (TD_DrillStems(i)%ComponentType==0) then | |||
TD_DrillStems(i)%Torque = TD_String%BitTorque | |||
else | |||
TD_DrillStems(i)%Torque = (TD_SemiMudVisc * TD_DrillStems(i)%RtoolJoint * (TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * & | |||
TD_DrillStems(i)%RCurvature * sin(TD_DrillStems(i)%StartAngle))) * & | |||
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) + & | |||
(2.0d0 * TD_SemiMudVisc * TD_DrillStems(i)%RtoolJoint * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(cos(TD_DrillStems(i)%EndAngle) - cos(TD_DrillStems(i)%StartAngle))) | |||
end if | |||
return | |||
End If | |||
!=========> F1 Calculation | |||
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2 | |||
!=========> F2 Calculation | |||
TD_DrillStems(i)%Force2 = (TD_DrillStems(i)%Force1 * exp(-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))) - & | |||
(TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(sin(TD_DrillStems(i)%EndAngle) - (exp(-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef) * & | |||
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) * & | |||
sin(TD_DrillStems(i)%StartAngle)))) | |||
! | |||
! Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length ) / & | |||
! (Elements(i)%Area * Element%ElasticModule) | |||
! | |||
TD_DrillStems(i)%Torque = (TD_SemiMudVisc * TD_DrillStems(i)%RtoolJoint * (TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * & | |||
TD_DrillStems(i)%RCurvature * sin(TD_DrillStems(i)%StartAngle))) * & | |||
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) + & | |||
(2.0d0 * TD_SemiMudVisc * TD_DrillStems(i)%RtoolJoint * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(cos(TD_DrillStems(i)%EndAngle) - cos(TD_DrillStems(i)%StartAngle))) | |||
end subroutine |
@@ -0,0 +1,56 @@ | |||
subroutine TD_ForceDownBRot(i,TD_SemiMudVisc) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
Real(8) :: TD_SemiMudVisc | |||
If (i==1) then | |||
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit | |||
TD_DrillStems(1)%Force2 = TD_DrillStems(1)%Force1 + (TD_DrillStems(1)%Force1 * & | |||
(exp(-(TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*abs(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))-1.0d0) * & | |||
sin(TD_DrillStems(1)%CombVelRatio )) + (TD_DrillStems(1)%BouyancyFactor * & | |||
TD_DrillStems(1)%WeightperLength * TD_DrillStems(1)%Length * & | |||
((sin(TD_DrillStems(1)%EndAngle)-sin(TD_DrillStems(1)%StartAngle))/ & | |||
(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))) | |||
if (TD_DrillStems(i)%ComponentType==0) then | |||
TD_DrillStems(i)%Torque = TD_String%BitTorque | |||
else | |||
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* & | |||
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio) | |||
end if | |||
return | |||
End If | |||
!=========> F1 Calculation | |||
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2 | |||
!=========> F2 Calculation | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%Force1 * & | |||
(exp(-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))-1.0d0) * & | |||
sin(TD_DrillStems(i)%CombVelRatio )) + (TD_DrillStems(i)%BouyancyFactor * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
((sin(TD_DrillStems(i)%EndAngle)-sin(TD_DrillStems(i)%StartAngle))/ & | |||
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))) | |||
! | |||
!Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length) / & | |||
! (Elements(i)%Area * Element%ElasticModule) | |||
! | |||
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* & | |||
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio) | |||
end subroutine |
@@ -0,0 +1,75 @@ | |||
subroutine TD_ForceUpB(i,TD_SemiMudVisc) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
Real(8) :: TD_SemiMudVisc | |||
If (i==1) then | |||
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit | |||
TD_DrillStems(1)%Force2 = (TD_DrillStems(1)%Force1 * exp((TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))) - & | |||
(((TD_DrillStems(1)%WeightperLength * TD_DrillStems(1)%RCurvature) / (1 + (TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)**2)) * & | |||
(((1-(TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)**2)*(sin(TD_DrillStems(1)%EndAngle) - & | |||
(exp((TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle)) * sin(TD_DrillStems(1)%StartAngle))))) - & | |||
(2.0d0* (TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*(cos(TD_DrillStems(1)%EndAngle) - & | |||
(exp((TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))* & | |||
cos(TD_DrillStems(1)%StartAngle))))) | |||
if (TD_DrillStems(i)%ComponentType==0) then | |||
TD_DrillStems(i)%Torque = TD_String%BitTorque | |||
else | |||
TD_DrillStems(i)%Torque = (TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * (TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * & | |||
TD_DrillStems(i)%RCurvature * sin(TD_DrillStems(i)%StartAngle))) * & | |||
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) + & | |||
(2.0d0 * TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(cos(TD_DrillStems(i)%EndAngle) - cos(TD_DrillStems(i)%StartAngle))) | |||
end if | |||
return | |||
End If | |||
!=========> F1 Calculation | |||
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2 | |||
!=========> F2 Calculation | |||
TD_DrillStems(i)%Force2 = (TD_DrillStems(i)%Force1 * exp((TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))) - & | |||
(((TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature) / (1 + (TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)**2)) * & | |||
(((1-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)**2)*(sin(TD_DrillStems(i)%EndAngle) - & | |||
(exp((TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) * sin(TD_DrillStems(i)%StartAngle))))) - & | |||
(2.0d0* (TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(cos(TD_DrillStems(i)%EndAngle) - & | |||
(exp((TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))* & | |||
cos(TD_DrillStems(i)%StartAngle))))) | |||
! | |||
! Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length ) / & | |||
! (Elements(i)%Area * Element%ElasticModule) | |||
! | |||
TD_DrillStems(i)%Torque = (TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * (TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * & | |||
TD_DrillStems(i)%RCurvature * sin(TD_DrillStems(i)%StartAngle))) * & | |||
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) + & | |||
(2.0d0 * TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(cos(TD_DrillStems(i)%EndAngle) - cos(TD_DrillStems(i)%StartAngle))) | |||
!!if (TD_DrillStems(i)%Torque>500.) then | |||
! print* , 'TD_String%TotalTorqueb=' , i , TD_String%TotalTorque , TD_DrillStems(i)%Torque , TD_String%WeightOnBit , sin(30.) , sin(3.14/6.) | |||
! print* , 'torquepropertiesb=' , TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint , (TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * & | |||
! TD_DrillStems(i)%RCurvature * sin(TD_DrillStems(i)%StartAngle))) , abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle), & | |||
! 2.0d0 * TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * & | |||
! TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature , (cos(TD_DrillStems(i)%EndAngle) - cos(TD_DrillStems(i)%StartAngle)) | |||
! print* , 'propertiesb=' , TD_DrillStems(i)%Force2 , TD_DrillStems(i)%Force1 , TD_DrillStems(i)%MudViscosity , TD_DrillStems(i)%EndAngle , TD_DrillStems(i)%StartAngle , TD_DrillStems(i)%WeightperLength , TD_DrillStems(i)%MudVisCorrectCoef , TD_DrillStems(i)%RCurvature | |||
! !end if | |||
end subroutine |
@@ -0,0 +1,56 @@ | |||
subroutine TD_ForceUpBRot(i,TD_SemiMudVisc) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
Real(8) :: TD_SemiMudVisc | |||
If (i==1) then | |||
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit | |||
TD_DrillStems(1)%Force2 = TD_DrillStems(1)%Force1 + (TD_DrillStems(1)%Force1 * & | |||
(exp(+(TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*abs(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))-1.0d0) * & | |||
sin(TD_DrillStems(1)%CombVelRatio )) + (TD_DrillStems(1)%BouyancyFactor * & | |||
TD_DrillStems(1)%WeightperLength * TD_DrillStems(1)%Length * & | |||
((sin(TD_DrillStems(1)%EndAngle)-sin(TD_DrillStems(1)%StartAngle))/ & | |||
(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))) | |||
if (TD_DrillStems(i)%ComponentType==0) then | |||
TD_DrillStems(i)%Torque = TD_String%BitTorque | |||
else | |||
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* & | |||
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio) | |||
end if | |||
return | |||
End If | |||
!=========> F1 Calculation | |||
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2 | |||
!=========> F2 Calculation | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%Force1 * & | |||
(exp(+(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))-1.0d0) * & | |||
sin(TD_DrillStems(i)%CombVelRatio )) + (TD_DrillStems(i)%BouyancyFactor * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
((sin(TD_DrillStems(i)%EndAngle)-sin(TD_DrillStems(i)%StartAngle))/ & | |||
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))) | |||
! | |||
!Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length) / & | |||
! (Elements(i)%Area * Element%ElasticModule) | |||
! | |||
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* & | |||
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio) | |||
end subroutine |
@@ -0,0 +1,21 @@ | |||
subroutine TD_CombinedMotionData (i) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
TD_DrillStems(i)%CombVelRatio = atan( TD_String%DrillStemAxialVelocity/TD_String%DrillStemRotVelocity ) | |||
end subroutine |
@@ -0,0 +1,61 @@ | |||
subroutine TD_ForceDownD(i,TD_SemiMudVisc) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
Real(8) :: TD_SemiMudVisc | |||
If (i==1) then | |||
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit | |||
TD_DrillStems(i)%Force2 = (TD_DrillStems(i)%Force1 * exp(-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))) + & | |||
(TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(sin(TD_DrillStems(i)%EndAngle) - (exp(-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef) * & | |||
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) * & | |||
sin(TD_DrillStems(i)%StartAngle)))) | |||
if (TD_DrillStems(i)%ComponentType==0) then | |||
TD_DrillStems(i)%Torque = TD_String%BitTorque | |||
else | |||
TD_DrillStems(i)%Torque = (TD_SemiMudVisc * TD_DrillStems(i)%RtoolJoint * (TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * & | |||
TD_DrillStems(i)%RCurvature * sin(TD_DrillStems(i)%StartAngle))) * & | |||
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) - & | |||
(2.0d0 * TD_SemiMudVisc * TD_DrillStems(i)%RtoolJoint * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(cos(TD_DrillStems(i)%EndAngle) - cos(TD_DrillStems(i)%StartAngle))) | |||
end if | |||
return | |||
End If | |||
!=========> F1 Calculation | |||
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2 | |||
!=========> F2 Calculation | |||
TD_DrillStems(i)%Force2 = (TD_DrillStems(i)%Force1 * exp(-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))) + & | |||
(TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(sin(TD_DrillStems(i)%EndAngle) - (exp(-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef) * & | |||
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) * & | |||
sin(TD_DrillStems(i)%StartAngle)))) | |||
! | |||
! Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length ) / & | |||
! (Elements(i)%Area * Element%ElasticModule) | |||
! | |||
TD_DrillStems(i)%Torque = (TD_SemiMudVisc * TD_DrillStems(i)%RtoolJoint * (TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * & | |||
TD_DrillStems(i)%RCurvature * sin(TD_DrillStems(i)%StartAngle))) * & | |||
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) - & | |||
(2.0d0 * TD_SemiMudVisc * TD_DrillStems(i)%RtoolJoint * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(cos(TD_DrillStems(i)%EndAngle) - cos(TD_DrillStems(i)%StartAngle))) | |||
end subroutine |
@@ -0,0 +1,56 @@ | |||
subroutine TD_ForceDownDRot(i,TD_SemiMudVisc) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
Real(8) :: TD_SemiMudVisc | |||
If (i==1) then | |||
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit | |||
TD_DrillStems(1)%Force2 = TD_DrillStems(1)%Force1 + (TD_DrillStems(1)%Force1 * & | |||
(exp(-(TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*abs(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))-1.0d0) * & | |||
sin(TD_DrillStems(1)%CombVelRatio )) + (TD_DrillStems(1)%BouyancyFactor * & | |||
TD_DrillStems(1)%WeightperLength * TD_DrillStems(1)%Length * & | |||
((sin(TD_DrillStems(1)%EndAngle)-sin(TD_DrillStems(1)%StartAngle))/ & | |||
(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))) | |||
if (TD_DrillStems(i)%ComponentType==0) then | |||
TD_DrillStems(i)%Torque = TD_String%BitTorque | |||
else | |||
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* & | |||
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio) | |||
end if | |||
return | |||
End If | |||
!=========> F1 Calculation | |||
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2 | |||
!=========> F2 Calculation | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%Force1 * & | |||
(exp(-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))-1.0d0) * & | |||
sin(TD_DrillStems(i)%CombVelRatio )) + (TD_DrillStems(i)%BouyancyFactor * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
((sin(TD_DrillStems(i)%EndAngle)-sin(TD_DrillStems(i)%StartAngle))/ & | |||
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))) | |||
! | |||
!Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length) / & | |||
! (Elements(i)%Area * Element%ElasticModule) | |||
! | |||
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* & | |||
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio) | |||
end subroutine |
@@ -0,0 +1,68 @@ | |||
subroutine TD_ForceUpD(i,TD_SemiMudVisc) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
Real(8) :: TD_SemiMudVisc | |||
If (i==1) then | |||
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit | |||
TD_DrillStems(i)%Force2 = (TD_DrillStems(i)%Force1 * exp((TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))) + & | |||
(((TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature) / (1 + (TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)**2)) * & | |||
(((1-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)**2)*(sin(TD_DrillStems(i)%EndAngle) - & | |||
(exp((TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) * sin(TD_DrillStems(i)%StartAngle))))) - & | |||
(2.0d0* (TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(cos(TD_DrillStems(i)%EndAngle) - & | |||
(exp((TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))* & | |||
cos(TD_DrillStems(i)%StartAngle))))) | |||
if (TD_DrillStems(i)%ComponentType==0) then | |||
TD_DrillStems(i)%Torque = TD_String%BitTorque | |||
else | |||
TD_DrillStems(i)%Torque = (TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * (TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * & | |||
TD_DrillStems(i)%RCurvature * sin(TD_DrillStems(i)%StartAngle))) * & | |||
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) - & | |||
(2.0d0 * TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(cos(TD_DrillStems(i)%EndAngle) - cos(TD_DrillStems(i)%StartAngle))) | |||
end if | |||
return | |||
End If | |||
!=========> F1 Calculation | |||
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2 | |||
!=========> F2 Calculation | |||
TD_DrillStems(i)%Force2 = (TD_DrillStems(i)%Force1 * exp((TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))) + & | |||
(((TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature) / (1 + (TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)**2)) * & | |||
(((1-(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)**2)*(sin(TD_DrillStems(i)%EndAngle) - & | |||
(exp((TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) * sin(TD_DrillStems(i)%StartAngle))))) - & | |||
(2.0d0* (TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(cos(TD_DrillStems(i)%EndAngle) - & | |||
(exp((TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))* & | |||
cos(TD_DrillStems(i)%StartAngle))))) | |||
!Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length) / & | |||
! (Elements(i)%Area * Element%ElasticModule) | |||
! | |||
TD_DrillStems(i)%Torque = (TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * (TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * & | |||
TD_DrillStems(i)%RCurvature * sin(TD_DrillStems(i)%StartAngle))) * & | |||
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)) - & | |||
(2.0d0 * TD_DrillStems(i)%MudViscosity * TD_DrillStems(i)%RtoolJoint * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(cos(TD_DrillStems(i)%EndAngle) - cos(TD_DrillStems(i)%StartAngle))) | |||
!return | |||
end subroutine |
@@ -0,0 +1,55 @@ | |||
subroutine TD_ForceUpDRot(i,TD_SemiMudVisc) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
Real(8) :: TD_SemiMudVisc | |||
If (i==1) then | |||
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit | |||
TD_DrillStems(1)%Force2 = TD_DrillStems(1)%Force1 + (TD_DrillStems(1)%Force1 * & | |||
(exp(+(TD_SemiMudVisc*TD_DrillStems(1)%MudVisCorrectCoef)*abs(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))-1.0d0) * & | |||
sin(TD_DrillStems(1)%CombVelRatio )) + (TD_DrillStems(1)%BouyancyFactor * & | |||
TD_DrillStems(1)%WeightperLength * TD_DrillStems(1)%Length * & | |||
((sin(TD_DrillStems(1)%EndAngle)-sin(TD_DrillStems(1)%StartAngle))/ & | |||
(TD_DrillStems(1)%EndAngle-TD_DrillStems(1)%StartAngle))) | |||
if (TD_DrillStems(i)%ComponentType==0) then | |||
TD_DrillStems(i)%Torque = TD_String%BitTorque | |||
else | |||
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* & | |||
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio) | |||
end if | |||
return | |||
End If | |||
!=========> F1 Calculation | |||
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2 | |||
!=========> F2 Calculation | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%Force1 * & | |||
(exp(+(TD_SemiMudVisc*TD_DrillStems(i)%MudVisCorrectCoef)*abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))-1.0d0) * & | |||
sin(TD_DrillStems(i)%CombVelRatio )) + (TD_DrillStems(i)%BouyancyFactor * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
((sin(TD_DrillStems(i)%EndAngle)-sin(TD_DrillStems(i)%StartAngle))/ & | |||
(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle))) | |||
! | |||
!Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length) / & | |||
! (Elements(i)%Area * Element%ElasticModule) | |||
! | |||
TD_DrillStems(i)%Torque = TD_SemiMudVisc*TD_DrillStems(i)%RtoolJoint*TD_DrillStems(i)%Force1* & | |||
abs(TD_DrillStems(i)%EndAngle-TD_DrillStems(i)%StartAngle)*cos(TD_DrillStems(i)%CombVelRatio) | |||
end subroutine |
@@ -0,0 +1,138 @@ | |||
subroutine TD_ForceCalculation | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
Real(8) :: TD_SemiMudVisc | |||
if (TD_String%DrillStemForceType == 1) then | |||
Do i = 1 , TD_String%DrillStemComponentsNumbs | |||
TD_SemiMudVisc = TD_DrillStems(i)%MudViscosity | |||
if (TD_DrillStems(i)%HoleType == 0) then | |||
Call TD_ForceUpS(i,TD_SemiMudVisc) | |||
else if (TD_DrillStems(i)%HoleType == 1) then | |||
Call TD_ForceUpB(i,TD_SemiMudVisc) | |||
else if (TD_DrillStems(i)%HoleType == 2) then | |||
Call TD_ForceUpD(i,TD_SemiMudVisc) | |||
end if | |||
Call TD_StrainCalculation(i) | |||
Call TD_TorqueCalculation(i) | |||
End Do | |||
else if (TD_String%DrillStemForceType == 2) then | |||
Do i = 1 , TD_String%DrillStemComponentsNumbs | |||
TD_SemiMudVisc = TD_DrillStems(i)%MudViscosity | |||
if (TD_DrillStems(i)%HoleType == 0) then | |||
Call TD_ForceUpSRot(i,TD_SemiMudVisc) | |||
else if (TD_DrillStems(i)%HoleType == 1) then | |||
Call TD_ForceUpBRot(i,TD_SemiMudVisc) | |||
else if (TD_DrillStems(i)%HoleType == 2) then | |||
Call TD_ForceUpDRot(i,TD_SemiMudVisc) | |||
end if | |||
Call TD_StrainCalculation(i) | |||
Call TD_TorqueCalculation(i) | |||
End Do | |||
else if (TD_String%DrillStemForceType == 3) then | |||
Do i = 1 , TD_String%DrillStemComponentsNumbs | |||
TD_SemiMudVisc = TD_DrillStems(i)%MudViscosity | |||
if (TD_DrillStems(i)%HoleType == 0) then | |||
Call TD_ForceDownS(i,TD_SemiMudVisc) | |||
else if (TD_DrillStems(i)%HoleType == 1) then | |||
Call TD_ForceDownB(i,TD_SemiMudVisc) | |||
else if (TD_DrillStems(i)%HoleType == 2) then | |||
Call TD_ForceDownD(i,TD_SemiMudVisc) | |||
end if | |||
Call TD_StrainCalculation(i) | |||
Call TD_TorqueCalculation(i) | |||
End Do | |||
else if (TD_String%DrillStemForceType == 4) then | |||
Do i = 1 , TD_String%DrillStemComponentsNumbs | |||
TD_SemiMudVisc = TD_DrillStems(i)%MudViscosity | |||
if (TD_DrillStems(i)%HoleType == 0) then | |||
Call TD_ForceDownSRot(i,TD_SemiMudVisc) | |||
else if (TD_DrillStems(i)%HoleType == 1) then | |||
Call TD_ForceDownBRot(i,TD_SemiMudVisc) | |||
else if (TD_DrillStems(i)%HoleType == 2) then | |||
Call TD_ForceDownDRot(i,TD_SemiMudVisc) | |||
end if | |||
Call TD_StrainCalculation(i) | |||
Call TD_TorqueCalculation(i) | |||
End Do | |||
else if (TD_String%DrillStemForceType == 5) then | |||
Do i = 1 , TD_String%DrillStemComponentsNumbs | |||
TD_SemiMudVisc = 0.0d0 | |||
if (TD_DrillStems(i)%HoleType == 0) then | |||
Call TD_ForceUpS(i,TD_SemiMudVisc) | |||
else if (TD_DrillStems(i)%HoleType == 1) then | |||
Call TD_ForceUpB(i,TD_SemiMudVisc) | |||
else if (TD_DrillStems(i)%HoleType == 2) then | |||
Call TD_ForceUpD(i,TD_SemiMudVisc) | |||
end if | |||
Call TD_StrainCalculation(i) | |||
Call TD_TorqueCalculation(i) | |||
End Do | |||
end if | |||
!----------------------------------------------------------------------------------- | |||
! | |||
!if (TD_String%DrillStemAxialVelocity>0.) then | |||
! | |||
! i = 1 | |||
! TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 - TD_DrillStems(i)%Drag | |||
! TD_DrillStems(i)%Dl = TD_DrillStems(i)%Force2 * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule | |||
! TD_DrillStems(i)%DlTotal = TD_DrillStems(i)%Dl | |||
! | |||
! do i = 2 , TD_String%DrillStemComponentsNumbs | |||
! TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 - TD_DrillStems(i)%Drag | |||
! TD_DrillStems(i)%Dl = TD_DrillStems(i)%Force2 * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule | |||
! TD_DrillStems(i)%DlTotal = TD_DrillStems(i-1)%DlTotal + TD_DrillStems(i)%Dl | |||
! end do | |||
! !print*, 'i=' ,i | |||
! !print*, 'TD_String%DrillStemComponentsNumbs=' ,TD_String%DrillStemComponentsNumbs | |||
! | |||
!else if (TD_String%DrillStemAxialVelocity<0.) then | |||
! i = 1 | |||
! TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 + TD_DrillStems(i)%Drag | |||
! TD_DrillStems(i)%Dl = TD_DrillStems(i)%Force2 * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule | |||
! TD_DrillStems(i)%DlTotal = TD_DrillStems(i)%Dl | |||
! | |||
! do i = 2 , TD_String%DrillStemComponentsNumbs | |||
! TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 + TD_DrillStems(i)%Drag | |||
! TD_DrillStems(i)%Dl = TD_DrillStems(i)%Force2 * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule | |||
! TD_DrillStems(i)%DlTotal = TD_DrillStems(i-1)%DlTotal + TD_DrillStems(i)%Dl | |||
! end do | |||
!end if | |||
TD_String%DlTotal = TD_DrillStems(TD_String%DrillStemComponentsNumbs)%DlTotal | |||
!!=====> Modified Length of the Drill Stem | |||
! do i = 1 , TD_String%DrillStemComponentsNumbs | |||
! TD_DrillStems(i)%Length = TD_DrillStems(i)%Length + TD_DrillStems(i)%Dl | |||
! end do | |||
end subroutine |
@@ -0,0 +1,286 @@ | |||
subroutine TD_HookLoadCalculation | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
Use TD_StringConnectionData | |||
Use Drawworks_VARIABLES, only: Drawworks | |||
Use CDataDisplayConsoleVariables | |||
Use CHoistingVariables | |||
! Use CSlipsEnumVariables | |||
use UnitySignalVariables | |||
Use CBopStackVariables | |||
Use VARIABLES | |||
Use CUnityInputs | |||
implicit none | |||
Integer :: i , kk | |||
Real(8) :: TD_eConst=0.98d0 , TD_SumWeight | |||
!==================================================== | |||
! Torque & Hook Load Calculation | |||
!==================================================== | |||
!=========> HookLoad | |||
TD_String%HookLoad = TD_DrillStems(TD_String%DrillStemComponentsNumbs)%Force2 ! [lb] | |||
!print* , 'TD_String%HookLoad1=' , TD_String%HookLoad | |||
if ( Drawworks%motion==1 ) then | |||
if ( PipeRam1%Situation_forTD==1 ) then !Upper Ram | |||
TD_String%HookLoad = TD_String%HookLoad+BopStackSpecification%RamStringDrag | |||
end if | |||
if ( PipeRam2%Situation_forTD==1 ) then !Lower Ram | |||
TD_String%HookLoad = TD_String%HookLoad+BopStackSpecification%RamStringDrag | |||
end if | |||
if ( RamLine%ShearBop_Situation_forTD==1 ) then !Blind Ram | |||
TD_String%HookLoad = TD_String%HookLoad+BopStackSpecification%RamStringDrag !???????????????????? | |||
end if | |||
if ( Annular%Annular_Situation_forTD==1 ) then !Annular Preventer | |||
TD_String%HookLoad = TD_String%HookLoad+(AnnularComputational%p_annular*BopStackSpecification%AnnularStringDrag) | |||
end if | |||
else if ( Drawworks%motion==-1 ) then | |||
if ( PipeRam1%Situation_forTD==1 ) then !Upper Ram | |||
TD_String%HookLoad = TD_String%HookLoad-BopStackSpecification%RamStringDrag | |||
end if | |||
if ( PipeRam2%Situation_forTD==1 ) then !Lower Ram | |||
TD_String%HookLoad = TD_String%HookLoad-BopStackSpecification%RamStringDrag | |||
end if | |||
if ( RamLine%ShearBop_Situation_forTD==1 ) then !Blind Ram | |||
TD_String%HookLoad = TD_String%HookLoad-BopStackSpecification%RamStringDrag !???????????????????? | |||
end if | |||
if ( Annular%Annular_Situation_forTD==1 ) then !Annular Preventer | |||
TD_String%HookLoad = TD_String%HookLoad-(AnnularComputational%p_annular*BopStackSpecification%AnnularStringDrag) | |||
end if | |||
end if | |||
!print* , 'TD_String%HookLoad2=' , TD_String%HookLoad | |||
!if ( UpperRamClose_withPossibility==1 ) then | |||
! if ( Drawworks%motion==1 ) then | |||
! TD_String%HookLoad = TD_String%HookLoad+RamStringDrag | |||
! else if ( Drawworks%motion==-1 ) then | |||
! TD_String%HookLoad = TD_String%HookLoad-RamStringDrag | |||
! end if | |||
!end if | |||
!if ( LowerRamClose_withPossibility==1 ) then | |||
! if ( Drawworks%motion==1 ) then | |||
! TD_String%HookLoad = TD_String%HookLoad+RamStringDrag | |||
! else if ( Drawworks%motion==-1 ) then | |||
! TD_String%HookLoad = TD_String%HookLoad-RamStringDrag | |||
! end if | |||
!end if | |||
!if ( BlindRamClose_withPossibility==1 ) then | |||
! if ( Drawworks%motion==1 ) then | |||
! TD_String%HookLoad = TD_String%HookLoad+RamStringDrag | |||
! else if ( Drawworks%motion==-1 ) then | |||
! TD_String%HookLoad = TD_String%HookLoad-RamStringDrag | |||
! end if | |||
!end if | |||
!if ( AnnularPreventerClose_withPossibility==1 ) then | |||
! if ( Drawworks%motion==1 ) then | |||
! TD_String%HookLoad = TD_String%HookLoad+AnnularStringDrag | |||
! else if ( Drawworks%motion==-1 ) then | |||
! TD_String%HookLoad = TD_String%HookLoad-AnnularStringDrag | |||
! end if | |||
!end if | |||
!=========> Torque | |||
TD_String%StringTorque = TD_String%TotalTorque ![lb.ft] ?????????? | |||
!print* , 'TD_String%StringTorque=' , TD_String%StringTorque | |||
!==================================================== | |||
! Weight Indicator Calculation | |||
!==================================================== | |||
kk = 0 | |||
Do i = TD_String%DrillStemComponentsNumbs , 1 , -1 | |||
if (TD_DrillStems(i)%ComponentType==3) then | |||
kk = i | |||
exit | |||
end if | |||
End Do | |||
if ( TD_StConn%KellyDriveTypeMode==0 ) then | |||
if ( TD_StConn%StringConnectionMode == 1 ) then | |||
if ( Get_Slips() == SLIPS_SET_END ) then | |||
TD_SumWeight = TD_Load%WeightTB+TD_Load%KellyWeight | |||
else | |||
TD_SumWeight = TD_String%HookLoad+TD_Load%WeightTB+TD_Load%KellyWeight ! TD_String%HookLoad = String Weight | |||
end if | |||
else if ( TD_StConn%StringConnectionMode == 2 ) then | |||
if ( Get_JointConnectionPossible() ) then | |||
TD_SumWeight = TD_Load%WeightTB | |||
else | |||
TD_SumWeight = TD_Load%WeightTB+TD_Load%KellyWeight | |||
end if | |||
else if ( TD_StConn%StringConnectionMode == 3 ) then | |||
if ( Get_JointConnectionPossible() ) then | |||
TD_SumWeight = TD_Load%WeightTB | |||
else | |||
TD_SumWeight = TD_Load%WeightTB+TD_Load%KellyWeight+TD_DrillStems(kk)%Weight | |||
end if | |||
end if | |||
else if ( TD_StConn%KellyDriveTypeMode==1 ) then | |||
if ( TD_StConn%StringConnectionMode == 4 ) then | |||
if ( Get_Slips() == SLIPS_SET_END ) then | |||
TD_SumWeight = TD_Load%WeightTB | |||
else | |||
TD_SumWeight = TD_String%HookLoad+TD_Load%WeightTB | |||
end if | |||
else if ( TD_StConn%StringConnectionMode == 5 ) then | |||
TD_SumWeight = TD_Load%WeightTB | |||
else if ( TD_StConn%StringConnectionMode == 6 ) then | |||
if ( Get_JointConnectionPossible() ) then | |||
TD_SumWeight = TD_Load%WeightTB | |||
else | |||
TD_SumWeight = TD_Load%WeightTB+(3.d0*TD_DrillStems(kk)%Weight) | |||
end if | |||
else if ( TD_StConn%StringConnectionMode == 7 ) then | |||
if ( Get_JointConnectionPossible() ) then | |||
TD_SumWeight = TD_Load%WeightTB | |||
else | |||
TD_SumWeight = TD_Load%WeightTB+TD_DrillStems(kk)%Weight | |||
end if | |||
else if ( TD_StConn%StringConnectionMode == 8 ) then | |||
TD_SumWeight = TD_Load%WeightTB | |||
else if ( TD_StConn%StringConnectionMode == 18 ) then | |||
TD_SumWeight = TD_Load%WeightTB | |||
else if ( TD_StConn%StringConnectionMode == 19 ) then | |||
TD_SumWeight = TD_Load%WeightTB | |||
end if | |||
else if ( TD_StConn%KellyDriveTypeMode==2 ) then | |||
if ( TD_StConn%StringConnectionMode == 9 ) then | |||
if ( Get_Slips() == SLIPS_SET_END ) then | |||
TD_SumWeight = TD_Load%WeightTD | |||
else | |||
TD_SumWeight = TD_String%HookLoad+TD_Load%WeightTD | |||
end if | |||
else if ( TD_StConn%StringConnectionMode == 10 ) then | |||
if ( Get_Slips() == SLIPS_SET_END ) then | |||
TD_SumWeight = TD_Load%WeightTD | |||
else | |||
TD_SumWeight = TD_String%HookLoad+TD_Load%WeightTD | |||
end if | |||
else if ( TD_StConn%StringConnectionMode == 11 ) then | |||
TD_SumWeight = TD_Load%WeightTD | |||
else if ( TD_StConn%StringConnectionMode == 12 ) then | |||
if ( Get_Slips() == SLIPS_SET_END ) then | |||
TD_SumWeight = TD_Load%WeightTD | |||
else | |||
TD_SumWeight = TD_String%HookLoad+TD_Load%WeightTD | |||
end if | |||
else if ( TD_StConn%StringConnectionMode == 13 ) then | |||
TD_SumWeight = TD_Load%WeightTD | |||
else if ( TD_StConn%StringConnectionMode == 14 ) then | |||
TD_SumWeight = TD_Load%WeightTD+(3.d0*TD_DrillStems(kk)%Weight) | |||
else if ( TD_StConn%StringConnectionMode == 15 ) then | |||
TD_SumWeight = TD_Load%WeightTD+(TD_DrillStems(kk)%Weight) | |||
else if ( TD_StConn%StringConnectionMode == 16 ) then | |||
TD_SumWeight = TD_Load%WeightTD | |||
else if ( TD_StConn%StringConnectionMode == 17 ) then | |||
TD_SumWeight = TD_Load%WeightTD | |||
end if | |||
end if | |||
!print* , 'TD_String%HookLoad3=' , TD_String%HookLoad | |||
!if ( Hoisting%DriveType==1 ) then !==> Kelly_DriveType | |||
! | |||
! if ( TD_String%DrillStemForceType==1 .or. TD_String%DrillStemForceType==2 ) then | |||
! TD_Load%WeightIndicator = ( sngl(TD_Load%NumOfCables)*(TD_eConst-1.d0)*(TD_SumWeight) )& | |||
! /( TD_eConst*(1.d0-(1.d0/(TD_eConst**TD_Load%NumOfCables))) ) | |||
! else if ( TD_String%DrillStemForceType==3 .or. TD_String%DrillStemForceType==4 ) then | |||
! TD_Load%WeightIndicator = ( sngl(TD_Load%NumOfCables)*(1.d0-TD_eConst)*(TD_SumWeight) )& | |||
! /( 1.d0-(TD_eConst**TD_Load%NumOfCables) ) | |||
! else if ( TD_String%DrillStemForceType==5 ) then | |||
TD_Load%WeightIndicator = TD_SumWeight | |||
! end if | |||
! | |||
! | |||
!else if ( Hoisting%DriveType==0 ) then !==> TopDrive_DriveType ?????????????? | |||
! | |||
! if ( TD_String%DrillStemForceType==1 .or. TD_String%DrillStemForceType==2 ) then | |||
! TD_Load%WeightIndicator = ( sngl(TD_Load%NumOfCables)*(TD_eConst-1.d0)*(TD_SumWeight) )& | |||
! /( TD_eConst*(1.d0-(1.d0/(TD_eConst**TD_Load%NumOfCables))) ) | |||
! else if ( TD_String%DrillStemForceType==3 .or. TD_String%DrillStemForceType==4 ) then | |||
! TD_Load%WeightIndicator = ( sngl(TD_Load%NumOfCables)*(1.d0-TD_eConst)*(TD_SumWeight) )& | |||
! /( 1.d0-(TD_eConst**TD_Load%NumOfCables) ) | |||
! else if ( TD_String%DrillStemForceType==5 ) then | |||
! TD_Load%WeightIndicator = TD_SumWeight | |||
! end if | |||
! | |||
!!else | |||
!!TD_Load%WeightIndicator = 0. !????????????????? | |||
! | |||
!end if | |||
TD_Load%DrawworksLoadInput = TD_Load%WeightIndicator/(sngl(TD_Load%NumOfCables)) ! [lb] | |||
!print* , 'TD_String%HookLoad4=' , TD_String%HookLoad | |||
!HookLoadPointer = TD_Load%WeightIndicator/1.0d3 ! [klb] | |||
call Set_HookLoad ((1-TD_General%WeightIndicatorMalf)*AINT(TD_Load%WeightIndicator/1.0d3)) ! [klb] | |||
end subroutine |
@@ -0,0 +1,71 @@ | |||
subroutine TD_StaticHookLoadCalculation | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
i = 1 | |||
if(TD_DrillStems(i)%HoleType == 0) then | |||
TD_DrillStems(i)%StaticHookLoad = TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
TD_DrillStems(i)%BouyancyFactor * cos(TD_DrillStems(i)%StartAngle) | |||
else if (TD_DrillStems(i)%HoleType == 1) then | |||
TD_DrillStems(i)%StaticHookLoad = -(TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(sin(TD_DrillStems(i)%EndAngle) - sin(TD_DrillStems(i)%StartAngle))) | |||
else if (TD_DrillStems(i)%HoleType == 2) then | |||
TD_DrillStems(i)%StaticHookLoad = (TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(sin(TD_DrillStems(i)%EndAngle) - sin(TD_DrillStems(i)%StartAngle))) | |||
end if | |||
do i = 2, TD_String%DrillStemComponentsNumbs | |||
if(TD_DrillStems(i)%HoleType == 0) then | |||
TD_DrillStems(i)%StaticHookLoad = TD_DrillStems(i-1)%StaticHookLoad + TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
TD_DrillStems(i)%BouyancyFactor * cos(TD_DrillStems(i)%StartAngle) | |||
else if (TD_DrillStems(i)%HoleType == 1) then | |||
TD_DrillStems(i)%StaticHookLoad = TD_DrillStems(i-1)%StaticHookLoad -(TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(sin(TD_DrillStems(i)%EndAngle) - sin(TD_DrillStems(i)%StartAngle))) | |||
else if (TD_DrillStems(i)%HoleType == 2) then | |||
TD_DrillStems(i)%StaticHookLoad = TD_DrillStems(i-1)%StaticHookLoad +(TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%RCurvature * & | |||
(sin(TD_DrillStems(i)%EndAngle) - sin(TD_DrillStems(i)%StartAngle))) | |||
end if | |||
end do | |||
! | |||
!--------------------------------------------------------------------------------------------------- | |||
! | |||
i = 1 | |||
!TD_DrillStems(i)%TotalSHookLoad = TD_DrillStems(i)%StaticHookLoad ???????????????????????????? | |||
TD_DrillStems(i)%Dl = TD_DrillStems(i)%StaticHookLoad * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule | |||
TD_DrillStems(i)%DlTotal = TD_DrillStems(i)%Dl | |||
do i = 2 , TD_String%DrillStemComponentsNumbs | |||
!TD_DrillStems(i)%TotalSHookLoad = TD_DrillStems(i-1)%TotalSHookLoad + TD_DrillStems(i)%StaticHookLoad ????????????????????????? | |||
TD_DrillStems(i)%Dl = TD_DrillStems(i)%StaticHookLoad * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule | |||
TD_DrillStems(i)%DlTotal = TD_DrillStems(i-1)%DlTotal + TD_DrillStems(i)%Dl | |||
end do | |||
TD_String%StaticHookLoad = TD_DrillStems(TD_String%DrillStemComponentsNumbs)%StaticHookLoad | |||
TD_String%DlMax = TD_DrillStems(TD_String%DrillStemComponentsNumbs)%DlTotal | |||
end subroutine |
@@ -0,0 +1,64 @@ | |||
subroutine TD_ForceDownS(i,TD_SemiMudVisc) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
Real(8) :: TD_SemiMudVisc , TD_SemiAngle | |||
if ( TD_DrillStems(i)%StartAngle<=(pi/180.) ) then | |||
TD_SemiAngle = (pi/180.) | |||
else | |||
TD_SemiAngle = TD_DrillStems(i)%StartAngle | |||
end if | |||
If (i==1) then | |||
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
TD_DrillStems(i)%BouyancyFactor * (cos(TD_DrillStems(i)%StartAngle) - & | |||
(TD_SemiMudVisc * sin(TD_DrillStems(i)%StartAngle)))) | |||
if (TD_DrillStems(i)%ComponentType==0) then | |||
TD_DrillStems(i)%Torque = TD_String%BitTorque | |||
else | |||
TD_DrillStems(i)%Torque = TD_SemiMudVisc* TD_DrillStems(i)%BouyancyFactor* & | |||
TD_DrillStems(i)%WeightperLength* TD_DrillStems(i)%Length* TD_DrillStems(i)%RtoolJoint * & | |||
sin(TD_SemiAngle) | |||
end if | |||
return | |||
End If | |||
!=========> F1 Calculation | |||
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2 | |||
!=========> F2 Calculation | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
TD_DrillStems(i)%BouyancyFactor * (cos(TD_DrillStems(i)%StartAngle) - & | |||
(TD_SemiMudVisc * sin(TD_DrillStems(i)%StartAngle)))) | |||
! | |||
! | |||
!Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length ) / & | |||
! (Elements(i)%Area * Element%ElasticModule) | |||
! | |||
TD_DrillStems(i)%Torque = TD_SemiMudVisc* TD_DrillStems(i)%BouyancyFactor* & | |||
TD_DrillStems(i)%WeightperLength* TD_DrillStems(i)%Length* TD_DrillStems(i)%RtoolJoint * & | |||
sin(TD_SemiAngle) | |||
! | |||
end subroutine |
@@ -0,0 +1,60 @@ | |||
subroutine TD_ForceDownSRot(i,TD_SemiMudVisc) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
Real(8) :: TD_SemiMudVisc , TD_SemiAngle | |||
if ( TD_DrillStems(i)%StartAngle<=(pi/180.) ) then | |||
TD_SemiAngle = (pi/180.) | |||
else | |||
TD_SemiAngle = TD_DrillStems(i)%StartAngle | |||
end if | |||
If (i==1) then | |||
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%BouyancyFactor * TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
cos(TD_DrillStems(i)%StartAngle)) - (TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
sin(TD_DrillStems(i)%StartAngle) * sin(TD_DrillStems(i)%CombVelRatio)) | |||
if (TD_DrillStems(i)%ComponentType==0) then | |||
TD_DrillStems(i)%Torque = TD_String%BitTorque | |||
else | |||
TD_DrillStems(i)%Torque = TD_DrillStems(i)%RtoolJoint * TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * sin(TD_SemiAngle) * cos(TD_DrillStems(i)%CombVelRatio) | |||
end if | |||
return | |||
End If | |||
!=========> F1 Calculation | |||
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2 | |||
!=========> F2 Calculation | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%BouyancyFactor * TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
cos(TD_DrillStems(i)%StartAngle)) - (TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
sin(TD_DrillStems(i)%StartAngle) * sin(TD_DrillStems(i)%CombVelRatio)) | |||
! | |||
TD_DrillStems(i)%Torque = TD_DrillStems(i)%RtoolJoint * TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * sin(TD_SemiAngle) * cos(TD_DrillStems(i)%CombVelRatio) | |||
! | |||
!Strains(i)%dL = TDForces(i)%Force * (Elements(i)%Length) / & | |||
! (Elements(i)%Area * Element%ElasticModule) | |||
end subroutine |
@@ -0,0 +1,65 @@ | |||
subroutine TD_ForceUpS(i,TD_SemiMudVisc) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
Real(8) :: TD_SemiMudVisc , TD_SemiAngle | |||
if ( TD_DrillStems(i)%StartAngle<=(pi/180.) ) then | |||
TD_SemiAngle = (pi/180.) | |||
else | |||
TD_SemiAngle = TD_DrillStems(i)%StartAngle | |||
end if | |||
If (i==1) then | |||
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
TD_DrillStems(i)%BouyancyFactor * (cos(TD_DrillStems(i)%StartAngle) + & | |||
(TD_SemiMudVisc * sin(TD_DrillStems(i)%StartAngle)))) | |||
if (TD_DrillStems(i)%ComponentType==0) then | |||
TD_DrillStems(i)%Torque = TD_String%BitTorque | |||
else | |||
TD_DrillStems(i)%Torque = TD_DrillStems(i)%MudViscosity* TD_DrillStems(i)%BouyancyFactor* & | |||
TD_DrillStems(i)%WeightperLength* TD_DrillStems(i)%Length* TD_DrillStems(i)%RtoolJoint * & | |||
sin(TD_SemiAngle) | |||
end if | |||
return | |||
End If | |||
!=========> F1 Calculation | |||
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2 | |||
!=========> F2 Calculation | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
TD_DrillStems(i)%BouyancyFactor * (cos(TD_DrillStems(i)%StartAngle) + & | |||
(TD_SemiMudVisc * sin(TD_DrillStems(i)%StartAngle)))) | |||
!Strains(i)%Dl = TDForces(i)%Force * (Elements(i)%Length ) / & | |||
! (Elements(i)%Area * Element%ElasticModule) | |||
TD_DrillStems(i)%Torque = TD_DrillStems(i)%MudViscosity* TD_DrillStems(i)%BouyancyFactor* & | |||
TD_DrillStems(i)%WeightperLength* TD_DrillStems(i)%Length* TD_DrillStems(i)%RtoolJoint * & | |||
sin(TD_SemiAngle) | |||
!!if (TD_DrillStems(i)%Torque>500.) then | |||
! print* , 'TD_String%TotalTorque=' , i , TD_String%TotalTorque , TD_DrillStems(i)%Torque , TD_String%WeightOnBit | |||
! print* , 'propertiess=' , TD_DrillStems(i)%Force2 , TD_DrillStems(i)%Force1 , TD_DrillStems(i)%MudViscosity , TD_DrillStems(i)%EndAngle , TD_DrillStems(i)%StartAngle , TD_DrillStems(i)%WeightperLength , TD_DrillStems(i)%MudVisCorrectCoef | |||
! !end if | |||
end subroutine |
@@ -0,0 +1,59 @@ | |||
subroutine TD_ForceUpSRot(i,TD_SemiMudVisc) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
Real(8) :: TD_SemiMudVisc , TD_SemiAngle | |||
if ( TD_DrillStems(i)%StartAngle<=(pi/180.d0) ) then | |||
TD_SemiAngle = (pi/180.) | |||
else | |||
TD_SemiAngle = TD_DrillStems(i)%StartAngle | |||
end if | |||
If (i==1) then | |||
TD_DrillStems(1)%Force1 = -TD_String%WeightOnBit | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%BouyancyFactor * TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
cos(TD_DrillStems(i)%StartAngle)) + (TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
sin(TD_DrillStems(i)%StartAngle) * sin(TD_DrillStems(i)%CombVelRatio)) | |||
if (TD_DrillStems(i)%ComponentType==0) then | |||
TD_DrillStems(i)%Torque = TD_String%BitTorque | |||
else | |||
TD_DrillStems(i)%Torque = TD_DrillStems(i)%RtoolJoint * TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * sin(TD_SemiAngle) * cos(TD_DrillStems(i)%CombVelRatio) | |||
end if | |||
return | |||
End If | |||
!=========> F1 Calculation | |||
TD_DrillStems(i)%Force1 = TD_DrillStems(i-1)%Force2 | |||
!=========> F2 Calculation | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force1 + (TD_DrillStems(i)%BouyancyFactor * TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
cos(TD_DrillStems(i)%StartAngle)) + (TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * & | |||
sin(TD_DrillStems(i)%StartAngle) * sin(TD_DrillStems(i)%CombVelRatio)) | |||
! | |||
TD_DrillStems(i)%Torque = TD_DrillStems(i)%RtoolJoint * TD_SemiMudVisc * TD_DrillStems(i)%BouyancyFactor * & | |||
TD_DrillStems(i)%WeightperLength * TD_DrillStems(i)%Length * sin(TD_SemiAngle) * cos(TD_DrillStems(i)%CombVelRatio) | |||
! | |||
!Strains(i)%dL = TDForces(i)%Force * (Elements(i)%Length) / & | |||
! (Elements(i)%Area * Element%ElasticModule) | |||
end subroutine |
@@ -0,0 +1,54 @@ | |||
subroutine TD_StrainCalculation(i) | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
if (TD_String%DrillStemAxialVelocity>=0.d0) then | |||
if (i == 1) then | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 + TD_DrillStems(i)%Drag | |||
TD_DrillStems(i)%Dl = (TD_DrillStems(i)%Force2) * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule | |||
TD_DrillStems(i)%DlTotal = TD_DrillStems(i)%Dl | |||
else | |||
!do i = 2 , TD_String%DrillStemComponentsNumbs | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 + TD_DrillStems(i)%Drag | |||
TD_DrillStems(i)%Dl = (TD_DrillStems(i)%Force2) * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule | |||
TD_DrillStems(i)%DlTotal = TD_DrillStems(i-1)%DlTotal + TD_DrillStems(i)%Dl | |||
!end do | |||
end if | |||
else if (TD_String%DrillStemAxialVelocity<0.) then | |||
if (i == 1) then | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 - TD_DrillStems(i)%Drag | |||
TD_DrillStems(i)%Dl = (TD_DrillStems(i)%Force2) * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule | |||
TD_DrillStems(i)%DlTotal = TD_DrillStems(i)%Dl | |||
else | |||
!do i = 2 , TD_String%DrillStemComponentsNumbs | |||
TD_DrillStems(i)%Force2 = TD_DrillStems(i)%Force2 - TD_DrillStems(i)%Drag | |||
TD_DrillStems(i)%Dl = (TD_DrillStems(i)%Force2) * TD_DrillStems(i)%Length / TD_DrillStems(i)%Area / TD_DrillStems(i)%ElasticModule | |||
TD_DrillStems(i)%DlTotal = TD_DrillStems(i-1)%DlTotal + TD_DrillStems(i)%Dl | |||
!end do | |||
end if | |||
end if | |||
!=====> Modified Length of Drill Stem | |||
!TD_DrillStems(i)%Length = TD_DrillStems(i)%LengthIni + TD_DrillStems(i)%Dl | |||
TD_DrillStems(i)%Length = TD_DrillStems(i)%LengthIni | |||
end subroutine |
@@ -0,0 +1,42 @@ | |||
subroutine TD_TorqueCalculation(i) | |||
Use CHoistingVariables | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
Use RTable_VARIABLES, only: RTable | |||
Use TopDrive_VARIABLES, only: TDS | |||
implicit none | |||
Integer :: i | |||
if ( Hoisting%DriveType==1 .and. RTable%Speed==0.d0 ) then | |||
TD_DrillStems(i)%Torque = 0.d0 | |||
else if ( Hoisting%DriveType==0 .and. TDS%Speed==0.d0 .and. RTable%Speed==0.d0 ) then | |||
TD_DrillStems(i)%Torque = 0.d0 | |||
end if | |||
if ( i==1 ) then | |||
TD_String%TotalTorque = TD_DrillStems(i)%Torque | |||
else | |||
TD_String%TotalTorque = TD_String%TotalTorque + TD_DrillStems(i)%Torque | |||
end if | |||
!if (TD_DrillStems(i)%Torque>500.) then | |||
! print* , 'TD_String%TotalTorque=' , i , TD_String%TotalTorque , TD_DrillStems(i)%Torque | |||
! !print* , 'properties=' , TD_DrillStems(i)%Force1 , TD_DrillStems(i)%MudViscosity , TD_DrillStems(i)%EndAngle , TD_DrillStems(i)%StartAngle , TD_DrillStems(i)%WeightperLength , TD_DrillStems(i)%MudVisCorrectCoef | |||
!end if | |||
end subroutine |
@@ -0,0 +1,176 @@ | |||
subroutine TD_ViscousDragForce | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
implicit none | |||
Integer :: i | |||
real(8) :: TDden, TDpreup , TDpredown , TDtem , TDmdup , TDmddown | |||
Real(8) :: TD_ThetaCoef1 , TD_ThetaCoef2 , TD_NCoef , TD_KCoef | |||
Real(8) :: TD_DragSum | |||
Do i = 1 , TD_String%DrillStemComponentsNumbs | |||
if ( TD_DrillStems(i)%MudDensityOut==0.d0 .or. TD_DrillStems(i)%MudDensityIn==0.d0 ) then | |||
TD_DrillStems(i)%Drag = 0.d0 | |||
cycle | |||
end if | |||
TDmdup = TD_DrillStems(i)%TopDepthIni | |||
Call AnnulusPropertyCalculator ( INT(TDmdup) , TDden , TDpreup , TDtem ) | |||
TDmddown = TD_DrillStems(i)%DownDepthIni | |||
Call AnnulusPropertyCalculator ( INT(TDmddown) , TDden , TDpredown , TDtem ) | |||
TD_DrillStems(i)%Drag = abs(TDpredown-TDpreup)*(pi*TD_DrillStems(i)%Length*12.d0*TD_DrillStems(i)%Od*12.d0) ![psi]*[inch^2]=[lb] ????? | |||
TD_DrillStems(i)%Drag = 0.0d0 !????????????????????? | |||
End Do | |||
!Do i = 1 , TD_String%DrillStemComponentsNumbs | |||
! | |||
! | |||
! if ( TD_DrillStems(i)%MudDensityOut==0.d0 .or. TD_DrillStems(i)%MudDensityIn==0.d0 ) then | |||
! TD_DrillStems(i)%Drag = 0.d0 | |||
! cycle | |||
! end if | |||
! | |||
! !------------------------------------------------------------------------------------ | |||
! TD_DrillStems(i)%Od = TD_DrillStems(i)%Od*12.d0 ! [inch] | |||
! TD_DrillStems(i)%HoleDiameter = TD_DrillStems(i)%HoleDiameter*12.d0 ! [inch] | |||
! TD_DrillStems(i)%MudDensityOut = TD_DrillStems(i)%MudDensityOut/7.48051948d0 ! [ppg] | |||
! !------------------------------------------------------------------------------------ | |||
! | |||
! | |||
! TD_ThetaCoef1 = TD_DrillStems(i)%MudYieldPoint+TD_DrillStems(i)%MudPlasticVis | |||
! TD_ThetaCoef2 = (2.0d0*TD_DrillStems(i)%MudPlasticVis)+TD_DrillStems(i)%MudYieldPoint | |||
! TD_NCoef = 3.32d0*log10(TD_ThetaCoef2/TD_ThetaCoef1) | |||
! TD_KCoef = (TD_ThetaCoef1)/(511.d0*TD_NCoef) | |||
! | |||
! | |||
! | |||
! If (TD_DrillStems(i)%TopDepth>0.d0) then | |||
! | |||
! TD_DrillStems(i)%PipeVelocity = abs(TD_String%DrillStemAxialVelocity) | |||
! | |||
! TD_DrillStems(i)%DiamRatio = (TD_DrillStems(i)%Od)/TD_DrillStems(i)%HoleDiameter | |||
! | |||
! | |||
! TD_DrillStems(i)%MudClingingConst = ((TD_DrillStems(i)%DiamRatio**2) * (1.0d0 - (2.0d0*log(TD_DrillStems(i)%DiamRatio))) - 1.0d0) & | |||
! / (2.0d0*(1.0d0-(TD_DrillStems(i)%DiamRatio**2))*log(TD_DrillStems(i)%DiamRatio)) | |||
! | |||
! TD_DrillStems(i)%AveEffVelocity = TD_DrillStems(i)%PipeVelocity * ( ((TD_DrillStems(i)%DiamRatio**2)/(1.0d0-(TD_DrillStems(i)%DiamRatio**2))) & | |||
! + TD_DrillStems(i)%MudClingingConst) | |||
! | |||
! TD_DrillStems(i)%ReNumber = (926.4*(TD_DrillStems(i)%MudDensityOut * TD_DrillStems(i)%AveEffVelocity * (TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od))) & | |||
! / TD_DrillStems(i)%MudPlasticVis !Bingham-plastic drilling fluid | |||
! !TD_DrillStems(i)%ReNumber = 10.9d4*( TD_DrillStems(i)%MudDensityOut*(TD_DrillStems(i)%AveEffVelocity**(2-TD_NCoef))/TD_DrillStems(i)%MudPlasticVis ) & | |||
! ! *( (((TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od)/48.)*(TD_NCoef/((2.*TD_NCoef)+1.)))**TD_NCoef ) !Power-law fluid | |||
! | |||
! if ( TD_DrillStems(i)%ReNumber .le. 2.1d3 ) then !Bingham-plastic drilling fluid | |||
! !if ( TD_DrillStems(i)%ReNumber .le. (3479.-(1370.*TD_NCoef)) ) then !Power-law fluid | |||
! | |||
! TD_DrillStems(i)%FricFactor = 1.60d1/TD_DrillStems(i)%ReNumber | |||
! | |||
! !TD_DrillStems(i)%Dp_Dl = ( TD_KCoef/(14.4d4*(TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od)) )& | |||
! ! *( ((48./(TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od))*(((2.*TD_NCoef)+1.)/TD_NCoef))**TD_NCoef ) !Power-law fluid | |||
! TD_DrillStems(i)%Dp_Dl = (TD_DrillStems(i)%FricFactor * (TD_DrillStems(i)%AveEffVelocity**2) * TD_DrillStems(i)%MudDensityOut) & | |||
! / (25.78d0*(TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od)) !Bingham-plastic drilling fluid | |||
! | |||
! else !Bingham-plastic drilling fluid | |||
! !else if ( TD_DrillStems(i)%ReNumber .gt. (4270.-(1370.*TD_NCoef)) ) then !Power-law fluid | |||
! | |||
! TD_DrillStems(i)%MudClingingConst = (sqrt(( (TD_DrillStems(i)%DiamRatio**4) + TD_DrillStems(i)%DiamRatio ) & | |||
! /(1.0d0 + TD_DrillStems(i)%DiamRatio )) - (TD_DrillStems(i)%DiamRatio**2)) & | |||
! /(1.0d0- (TD_DrillStems(i)%DiamRatio**2)) | |||
! | |||
! TD_DrillStems(i)%AveEffVelocity = TD_DrillStems(i)%PipeVelocity * ( ((TD_DrillStems(i)%DiamRatio**2)/(1.0d0-(TD_DrillStems(i)%DiamRatio**2))) & | |||
! + TD_DrillStems(i)%MudClingingConst) | |||
! | |||
! TD_DrillStems(i)%ReNumber = (926.4d0*(TD_DrillStems(i)%MudDensityOut * TD_DrillStems(i)%AveEffVelocity * (TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od))) & | |||
! / TD_DrillStems(i)%MudPlasticVis !Bingham-plastic drilling fluid | |||
! !TD_DrillStems(i)%ReNumber = 10.9d4*( TD_DrillStems(i)%MudDensityOut*(TD_DrillStems(i)%AveEffVelocity**(2-TD_NCoef))/TD_DrillStems(i)%MudPlasticVis ) & | |||
! ! *( (((TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od)/48.)*(TD_NCoef/((2.*TD_NCoef)+1.)))**TD_NCoef ) !Power-law fluid | |||
! | |||
! TD_DrillStems(i)%FricFactor = 0.0791d0/(TD_DrillStems(i)%ReNumber**0.25d0) | |||
! | |||
! TD_DrillStems(i)%Dp_Dl = (TD_DrillStems(i)%FricFactor * (TD_DrillStems(i)%AveEffVelocity**2) * TD_DrillStems(i)%MudDensityOut) & | |||
! / (25.78d0*(TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od)) !Bingham-plastic drilling fluid | |||
! !TD_DrillStems(i)%Dp_Dl = (TD_DrillStems(i)%FricFactor * (TD_DrillStems(i)%AveEffVelocity**2) * TD_DrillStems(i)%MudDensityOut) & | |||
! ! / (21.1*(TD_DrillStems(i)%HoleDiameter - TD_DrillStems(i)%Od)) !Power-law fluid | |||
! | |||
! end if | |||
! | |||
! | |||
! TD_DrillStems(i)%Drag = ( (pi/4.0d0)*TD_DrillStems(i)%Dp_Dl*TD_DrillStems(i)%Length*(TD_DrillStems(i)%Od**2)/10.d0 ) ! drag/10 = because of the value of drag force | |||
! | |||
! Else | |||
! TD_DrillStems(i)%Drag = 0.0d0 | |||
! | |||
! End if | |||
! | |||
! | |||
! !------------------------------------------------------------------------------------ | |||
! TD_DrillStems(i)%Od = TD_DrillStems(i)%Od/12.d0 ! [ft] | |||
! TD_DrillStems(i)%HoleDiameter = TD_DrillStems(i)%HoleDiameter/12.d0 ! [ft] | |||
! TD_DrillStems(i)%MudDensityOut = TD_DrillStems(i)%MudDensityOut*7.48051948d0 ! [lb/ft3] | |||
! !------------------------------------------------------------------------------------ | |||
! | |||
! | |||
!end do | |||
if (TD_DrillStems(1)%ComponentType==0) then | |||
TD_DrillStems(1)%Drag = 50.d0*TD_DrillStems(1)%Od !Od[ft] , Drag[lb]????? | |||
if ( TD_DrillStems(1)%MudDensityOut==0.d0 .or. TD_DrillStems(1)%MudDensityIn==0.d0 ) then | |||
TD_DrillStems(1)%Drag = 0.d0 | |||
end if | |||
end if | |||
!!TD_DragSum = 0. | |||
!!Do i = 1 , TD_String%DrillStemComponentsNumbs | |||
!! TD_DragSum = TD_DragSum+TD_DrillStems(i)%Drag | |||
!!end do | |||
! print*, 'TD_NCoef=' , TD_NCoef | |||
! print*, 'TD_KCoef=' , TD_KCoef | |||
! | |||
! print*, 'TD_DrillStems(1)%DiamRatio=' , TD_DrillStems(1)%DiamRatio | |||
! print*, 'TD_DrillStems(1)%Od=' , TD_DrillStems(1)%Od | |||
! print*, 'TD_DrillStems(1)%HoleDiameter=' , TD_DrillStems(1)%HoleDiameter | |||
! ! | |||
! print*, 'TD_DrillStems(1)%MudClingingConst=' , TD_DrillStems(1)%MudClingingConst | |||
! ! | |||
! print*, 'TD_DrillStems(1)%AveEffVelocity=' , TD_DrillStems(1)%AveEffVelocity | |||
! ! | |||
! !print*, 'TD_DrillStems(1)%MudPlasticVis=' , TD_DrillStems(1)%MudPlasticVis | |||
! print*, 'TD_DrillStems(1)%MudDensityOut=' , TD_DrillStems(1)%MudDensityOut | |||
! print*, 'TD_DrillStems(1)%ReNumber=' , TD_DrillStems(1)%ReNumber | |||
! ! | |||
! print*, 'TD_DrillStems(1)%FricFactor=' , TD_DrillStems(1)%FricFactor | |||
! print*, 'TD_DrillStems(1)%Dp_Dl=' , TD_DrillStems(1)%Dp_Dl | |||
! print*, 'TD_DrillStems(1)%Drag=' , TD_DrillStems(1)%Drag | |||
! print*, 'TD_DrillStems(2)%Drag=' , TD_DrillStems(2)%Drag | |||
! print*, 'TD_DrillStems(3)%Drag=' , TD_DrillStems(3)%Drag | |||
! print*, 'TD_DragSum=' , TD_DragSum | |||
! print*, 'TD_DrillStems(330)%Drag=' , TD_DrillStems(330)%Drag | |||
! print*, 'TD_DrillStems(331)%Drag=' , TD_DrillStems(331)%Drag | |||
! print*, 'TD_DrillStems(333)%Drag=' , TD_DrillStems(333)%Drag | |||
end subroutine |
@@ -0,0 +1,40 @@ | |||
subroutine TD_WeightOnBitCalculation | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
Use TD_StringConnectionData | |||
Use CDataDisplayConsoleVariables | |||
implicit none | |||
Integer :: i | |||
!TD_StConn%TouchConnectionHeight = TD_String%DlMax + TD_String%DrillStemTotalLengthIni - TD_WellGeneral%WellTotalLength | |||
TD_StConn%TouchConnectionHeight = TD_String%DrillStemTotalLengthIni - TD_WellGeneral%WellTotalLength | |||
!if (TD_DrillStems(1)%ComponentType == 0) then ????????????? | |||
!if (TD_DrillStems(1)%DownDepth < TD_WellGeneral%WellTotalLength) then | |||
if (TD_StConn%ConnectionHeight < TD_StConn%TouchConnectionHeight) then | |||
TD_String%DlTouch = TD_String%DlMax-(TD_StConn%TouchConnectionHeight-TD_StConn%ConnectionHeight) | |||
TD_String%WeightOnBit = ((TD_String%StaticHookLoad/2.0d0)/TD_String%DlMax)*(TD_String%DlMax-TD_String%DlTouch) !(TD_String%StaticHookLoad/2.0d0) ---> because of Uniform drill stem(drillpipes) ?????????? | |||
else | |||
TD_String%WeightOnBit = 0.d0 ![lb] | |||
end if | |||
Call Set_WeightOnBit(AINT(real(TD_String%WeightOnBit,8))) | |||
end subroutine |
@@ -0,0 +1,120 @@ | |||
subroutine TD_MainCalculations | |||
Use CCasingLinerChokeVariables | |||
Use CStringConfigurationVariables | |||
Use CSimulationVariables | |||
Use TD_DrillStemComponents | |||
Use TD_WellElements | |||
Use TD_WellGeometry | |||
Use TD_GeneralData | |||
Use TD_StringConnectionData | |||
Use FricPressDropVars | |||
Use MudSystemVARIABLES | |||
implicit none | |||
Integer :: i | |||
!Integer :: TD_SolDuration | |||
!integer,dimension(8) :: TD_StartTime , TD_EndTime | |||
TD_General%TimeStep = 0.1d0 ! Unit: [s] | |||
!Call TD_StartUp | |||
!Call TD_WellReadData | |||
!Call TD_WellElementsReadData | |||
!Call TD_DrillStemReadData | |||
!Call TD_PipePropertiesReadData | |||
!!Call TD_WellGeoConfiguration | |||
!!Call TD_WellElementsConfiguration | |||
!!Call TD_StringConnectionModes | |||
!!Call TD_DrillStemConfiguration | |||
!loop1: do | |||
Call TD_WellGeoConfiguration | |||
Call TD_WellElementsConfiguration | |||
Call TD_StringConnectionModes | |||
Call TD_DrillStemConfiguration | |||
Call TD_ForceReadData | |||
!===> Mud properties Read_Data from Fluid Module | |||
!!TD_StringNoHorizontalMudElements = TDNoHorizontalMudElements | |||
!!TD_String%NoStringMudElements = TDNoStringMudElements | |||
!!TD_String%NoCasingMudElements = TDNoCasingMudElements | |||
!! | |||
!!if (allocated(TDDensity_MudElementArray) .and. (TD_StringNoHorizontalMudElements+TD_String%NoStringMudElements+TD_String%NoCasingMudElements)/=0) then | |||
!! if (Allocated(TD_String%FluidMudDensity)) Deallocate(TD_String%FluidMudDensity) | |||
!! Allocate(TD_String%FluidMudDensity(TD_StringNoHorizontalMudElements+TD_String%NoStringMudElements+TD_String%NoCasingMudElements)) | |||
!! TD_String%FluidMudDensity(:) = TDDensity_MudElementArray(:) | |||
!!end if | |||
!! | |||
!!if (allocated(TDXend_MudElementArray)) then | |||
!! if (Allocated(TD_String%FluidMudEndX)) Deallocate(TD_String%FluidMudEndX) | |||
!! Allocate(TD_String%FluidMudEndX(TD_StringNoHorizontalMudElements+TD_String%NoStringMudElements+TD_String%NoCasingMudElements)) | |||
!! TD_String%FluidMudEndX(:) = TDXend_MudElementArray(:) | |||
!!end if | |||
!! | |||
!!if (allocated(TDXstart_MudElementArray)) then | |||
!! if (Allocated(TD_String%FluidMudStartX)) Deallocate(TD_String%FluidMudStartX) | |||
!! Allocate(TD_String%FluidMudStartX(TD_StringNoHorizontalMudElements+TD_String%NoStringMudElements+TD_String%NoCasingMudElements)) | |||
!! TD_String%FluidMudStartX(:) = TDXstart_MudElementArray(:) | |||
!!end if | |||
if (TD_DrillStem(1)%ComponentType==0) then | |||
Do i = 2 , TD_String%DrillStemComponentsNumbs | |||
Call TD_MudPropertiesReadData(i) | |||
Call TD_BouyancyFactor(i) | |||
Call TD_CombinedMotionData(i) | |||
End Do | |||
TD_DrillStems(1)%MudDensityIn = TD_DrillStems(2)%MudDensityIn !(1): bit mud properties | |||
TD_DrillStems(1)%MudDensityOut = TD_DrillStems(2)%MudDensityOut | |||
TD_DrillStems(1)%MudWeight = TD_DrillStems(2)%MudWeight | |||
TD_DrillStems(1)%MudPlasticVis = 5.d0+(5.d0*(TD_DrillStems(1)%MudWeight-8.3d0)) | |||
TD_DrillStems(1)%MudViscosity = 0.2d0 !TD_DrillStems(i)%MudPlasticVis | |||
TD_DrillStems(1)%MudYieldPoint = 10.d0+(TD_DrillStems(1)%MudWeight-8.3d0) | |||
Call TD_BouyancyFactor(1) | |||
Call TD_CombinedMotionData(1) | |||
else | |||
Do i = 1 , TD_String%DrillStemComponentsNumbs | |||
Call TD_MudPropertiesReadData(i) | |||
Call TD_BouyancyFactor(i) | |||
Call TD_CombinedMotionData(i) | |||
End Do | |||
end if | |||
!================================================ | |||
Call TD_BOPDiamCalculation | |||
Call TD_StaticHookLoadCalculation | |||
Call TD_WeightOnBitCalculation | |||
if (abs(TD_String%DrillStemAxialVelocity)>3.2808d0) then !1[m/s]=3.2808[ft/s] | |||
Call TD_ViscousDragForce | |||
else | |||
TD_DrillStems%Drag = 0.d0 | |||
TD_String%DrillStemForceType = 5 | |||
end if | |||
Call TD_ForceCalculation | |||
Call TD_HookLoadCalculation | |||
TD_StConn%HookHeightOld = TD_StConn%HookHeight | |||
end subroutine TD_MainCalculations |