|
- 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_KellyNewRemove = 1
- else
- TD_KellyNewRemove = 0
- TD_KellyOldRemove = 0
- end if
- if ( Hoisting%DriveType==1 .and. Get_OperationCondition()==OPERATION_DRILL .and. Get_KellyConnection() /= KELLY_CONNECTION_STRING .and. TD_KellyNewRemove/=TD_KellyOldRemove ) then
- !print* , 'Remove Safety Valve & Kelly='
- TD_NumOfRemovedComponents = 1
- Do i= TD_DrillStemComponentsNumbs , (TD_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_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents
-
-
- i = TD_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_StringConfigurationCount = TD_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_StringConfigurationCount = TD_StringConfigurationCount-1
- end if
-
-
- TD_KellyOldRemove = TD_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_DrillStemComponentsNumbs , (TD_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_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents
-
-
- i = TD_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_StringConfigurationCount = TD_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_StringConfigurationCount = TD_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_DrillStemComponentsNumbs , (TD_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_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents
-
-
- i = TD_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_StringConfigurationCount = TD_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_StringConfigurationCount = TD_StringConfigurationCount-1
- end if
-
-
-
- Call Set_StringUpdate(STRING_UPDATE_NEUTRAL)
- !print* , 'Remove Stand'
- end if
-
-
-
-
-
-
-
-
- !====================================================
- ! Remove IBOP
- !====================================================
-
- !if ( Get_Ibop() == IBOP_REMOVE ) then
- ! TD_IBOPNewRemove = 1
- !else
- ! TD_IBOPNewRemove = 0
- ! TD_IBOPOldRemove = 0
- !end if
- if ( Get_Ibop() == IBOP_REMOVE .and. TD_IBOPOldRemove==0 ) then
-
- TD_NumOfRemovedComponents = 1
- Do i= TD_DrillStemComponentsNumbs , (TD_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_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents
-
-
- i = TD_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_StringConfigurationCount = TD_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_StringConfigurationCount = TD_StringConfigurationCount-1
- end if
-
-
- !TD_IBOPOldRemove = TD_IBOPNewRemove
-
- if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then
- TD_ConnectionHeight = TD_ConnectionHeight-TD_IBOPLength
- end if
- !print* , 'Remove IBOP'
- end if
-
- if ( Get_Ibop() == IBOP_REMOVE ) then
- TD_IBOPOldRemove = 1
- else
- TD_IBOPOldRemove = 0
- end if
-
-
-
-
-
-
-
-
- !====================================================
- ! Remove Safety Valve (OPERATION_TRIP)
- !====================================================
-
- !if ( TD_OldOperationCondition==1 .and. TD_KellyDriveTypeMode==1 .and. Get_SafetyValve() == SAFETY_VALVE_REMOVE ) then
- ! TD_SafetyValveNewRemove = 1
- !else
- ! TD_SafetyValveNewRemove = 0
- ! TD_SafetyValveOldRemove = 0
- !end if
- !print* , 'Get_SafetyValve()=' , Get_SafetyValve()
- if ( TD_KellyDriveTypeMode/=0 .and. TD_OldOperationCondition/=0 .and. Get_SafetyValve() == SAFETY_VALVE_REMOVE .and. TD_SafetyValveOldRemove==0 ) then
-
- TD_NumOfRemovedComponents = 1
- Do i= TD_DrillStemComponentsNumbs , (TD_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_DrillStemComponentsNumbs = TD_DrillStemComponentsNumbs-TD_NumOfRemovedComponents
-
-
- i = TD_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_StringConfigurationCount = TD_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_StringConfigurationCount = TD_StringConfigurationCount-1
- end if
- !print* , 'Get_OperationCondition()=' , Get_OperationCondition()
- !print* , 'TD_OldOperationCondition=' , TD_OldOperationCondition
- !print* , 'TD_SafetyValveNewRemove=' , TD_SafetyValveNewRemove
- !print* , 'TD_SafetyValveOldRemove=' , TD_SafetyValveOldRemove
- !TD_SafetyValveOldRemove = TD_SafetyValveNewRemove
-
- if ( Get_ElevatorConnection() /= ELEVATOR_CONNECTION_STRING .or. (Get_TdsConnectionModes()/=TDS_CONNECTION_NOTHING .and. Get_TdsElevatorModes()/=TDS_ELEVATOR_CONNECTION_STRING) ) then
- TD_ConnectionHeight = TD_ConnectionHeight-TD_SafetyValveLength
- end if
-
- end if
-
- if ( Get_SafetyValve() == SAFETY_VALVE_REMOVE ) then
- TD_SafetyValveOldRemove = 1
- else
- TD_SafetyValveOldRemove = 0
- end if
-
- if ( TD_KellyDriveTypeMode==1 ) then
- TD_OldOperationCondition = 1
- else
- TD_OldOperationCondition = 0
- end if
-
- !print* , 'TD_KellyDriveTypeMode2=' , TD_KellyDriveTypeMode
- !print* , 'TD_OldOperationCondition2=' , TD_OldOperationCondition
- !print* , 'TD_SafetyValveNewRemove2=' , TD_SafetyValveNewRemove
- !print* , 'TD_SafetyValveOldRemove2=' , TD_SafetyValveOldRemove
-
-
- end subroutine
|