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