Simulation Core
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

112 lignes
4.9 KiB

  1. # 1 "/mnt/c/Projects/VSIM/SimulationCore2/Equipments/MudSystem/Disconnecting_Pipe.f90"
  2. subroutine DisconnectingPipe ! is called in subroutine CirculationCodeSelect
  3. Use GeoElements_FluidModule
  4. USE CMudPropertiesVariables
  5. USE MudSystemVARIABLES
  6. use SimulationVariables !@@@
  7. use SimulationVariables
  8. use SimulationVariables !@
  9. ! !use CTanks
  10. !@use ConfigurationVariables, TripTankVolume2 => data%Equipments%DrillingWatch%TripTankVolume, TripTankDensity2 => TripTankDensity
  11. USE sROP_Other_Variables
  12. USE sROP_Variables
  13. use KickVARIABLESModule
  14. USE TD_DrillStemComponents
  15. use OperationScenariosModule
  16. Use CUnityOutputs
  17. USE CManifolds
  18. implicit none
  19. Real(8) ExcessMudVolume, ExcessMudVolume_Remained
  20. write(*,*) 'DisconnectingPipe'
  21. !TD_RemoveVolume= TD_RemoveVolume* 7.48051948 ! ft^3 to gal
  22. ExcessMudVolume= sum(data%State%MudSystem%St_MudDischarged_Volume%Array(:)) - sum(data%State%MudSystem%PipeSection_VolumeCapacity(2:data%State%F_Counts%StringIntervalCounts))
  23. ! ======if(ExcessMudVolume <= 0.) No Modification Needed Because Removed Pipe was Empty=====
  24. if (Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and. Manifold%Valve(56)%Status == .False.) ExcessMudVolume= 0.d0 !Valve(56)%Status == .False. :: safety valve installed
  25. if (ExcessMudVolume > 0.) then
  26. if ( Manifold%Valve(53)%Status == .true. ) then
  27. data%State%MudSystem%MudBucketVolume= ExcessMudVolume
  28. else
  29. data%State%MudSystem%MudBucketVolume= 0.0
  30. endif
  31. !========================Flow Disconnect Unity Input Signals=================
  32. !if ( Get_JointConnectionPossible() == .false. ) then
  33. if (Get_KellyConnection() == KELLY_CONNECTION_NOTHING) then
  34. Call Set_FlowKellyDisconnect(.true.)
  35. else
  36. Call Set_FlowPipeDisconnect(.true.)
  37. endif
  38. !endif
  39. !====================Flow Disconnect Unity Input Signals-End=================
  40. !========================Disconnecting Pipe from the String=================
  41. ExcessMudVolume_Remained= ExcessMudVolume ! ft^3 to gal
  42. imud=1
  43. Do
  44. if(data%State%MudSystem%St_MudDischarged_Volume%Array(imud) < ExcessMudVolume_Remained) then
  45. ExcessMudVolume_Remained= ExcessMudVolume_Remained- data%State%MudSystem%St_MudDischarged_Volume%Array(imud)
  46. call data%State%MudSystem%St_MudDischarged_Volume%Remove (imud)
  47. call data%State%MudSystem%St_Mud_Backhead_X%Remove (imud)
  48. call data%State%MudSystem%St_Mud_Backhead_section%Remove (imud)
  49. call data%State%MudSystem%St_Mud_Forehead_X%Remove (imud)
  50. call data%State%MudSystem%St_Mud_Forehead_section%Remove (imud)
  51. call data%State%MudSystem%St_Density%Remove (imud)
  52. call data%State%MudSystem%St_RemainedVolume_in_LastSection%Remove (imud)
  53. call data%State%MudSystem%St_EmptyVolume_inBackheadLocation%Remove (imud)
  54. call data%State%MudSystem%St_MudOrKick%Remove (imud)
  55. elseif(data%State%MudSystem%St_MudDischarged_Volume%Array(imud) > ExcessMudVolume_Remained) then
  56. data%State%MudSystem%St_MudDischarged_Volume%Array(imud)= data%State%MudSystem%St_MudDischarged_Volume%Array(imud)- ExcessMudVolume_Remained
  57. exit
  58. else !(St_MudDischarged_Volume%Array(imud) == ExcessMudVolume_Remained)
  59. call data%State%MudSystem%St_MudDischarged_Volume%Remove (imud)
  60. call data%State%MudSystem%St_Mud_Backhead_X%Remove (imud)
  61. call data%State%MudSystem%St_Mud_Backhead_section%Remove (imud)
  62. call data%State%MudSystem%St_Mud_Forehead_X%Remove (imud)
  63. call data%State%MudSystem%St_Mud_Forehead_section%Remove (imud)
  64. call data%State%MudSystem%St_Density%Remove (imud)
  65. call data%State%MudSystem%St_RemainedVolume_in_LastSection%Remove (imud)
  66. call data%State%MudSystem%St_EmptyVolume_inBackheadLocation%Remove (imud)
  67. call data%State%MudSystem%St_MudOrKick%Remove (imud)
  68. exit
  69. endif
  70. enddo
  71. !=================Disconnecting Pipe from the String - End===================
  72. endif
  73. end subroutine DisconnectingPipe