Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

147 lines
3.9 KiB

  1. module COperationConditionEnum
  2. use CLog4
  3. use COperationScenariosVariables
  4. implicit none
  5. contains
  6. subroutine Evaluate_OperationCondition()
  7. implicit none
  8. ! if (DriveType == TopDrive_DriveType) then
  9. !#ifdef OST
  10. ! print*, 'Evaluate_OperationCondition=TopDrive'
  11. !#endif
  12. ! endif
  13. !
  14. !
  15. !
  16. !
  17. !
  18. !
  19. !
  20. !
  21. ! if (DriveType == Kelly_DriveType) then
  22. !#ifdef OST
  23. ! print*, 'Evaluate_OperationCondition=Kelly'
  24. !#endif
  25. ! endif
  26. end subroutine
  27. ! subroutine Subscribe_OperationCondition()
  28. ! use CDrillingConsoleVariables
  29. ! implicit none
  30. ! call OnLatchPipePress%Add(ButtonPress_Latch_OperationCondition)
  31. ! call OnUnlatchPipePress%Add(ButtonPress_Unlatch_OperationCondition)
  32. ! end subroutine
  33. subroutine ButtonPress_Latch_OperationCondition()
  34. use CHoistingVariables!, only: Hoisting%DriveType, Kelly_DriveType
  35. use CManifolds, only: InstallKellyCock
  36. implicit none
  37. if (Hoisting%DriveType == TopDrive_DriveType) then
  38. #ifdef OST
  39. print*, 'ButtonPress_Latch_OperationCondition=TopDrive'
  40. #endif
  41. endif
  42. if (Hoisting%DriveType == Kelly_DriveType) then
  43. #ifdef OST
  44. print*, 'ButtonPress_Latch_OperationCondition=Kelly'
  45. #endif
  46. !OPERATION-CODE=17
  47. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  48. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .and.&
  49. Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and.&
  50. Get_Swing() == SWING_RAT_HOLE_END .and.&
  51. Get_LatchLed() .and.&
  52. Get_UnlatchLed() == .false.) then
  53. call Set_OperationCondition(OPERATION_DRILL)
  54. call Set_LatchLed(.false.)
  55. call Set_UnlatchLed(.true.)
  56. call Set_Kelly(KELLY_INSTALL)
  57. if(Hoisting%DriveType == Kelly_DriveType) then
  58. call InstallKellyCock() !drill mode
  59. endif
  60. return
  61. end if
  62. endif
  63. end subroutine
  64. subroutine ButtonPress_Unlatch_OperationCondition()
  65. use CHoistingVariables!, only: Hoisting%DriveType, Kelly_DriveType
  66. use CManifolds, only: RemoveKellyCock
  67. implicit none
  68. if (Hoisting%DriveType == TopDrive_DriveType) then
  69. #ifdef OST
  70. print*, 'ButtonPress_Unlatch_OperationCondition=TopDrive'
  71. #endif
  72. endif
  73. if (Hoisting%DriveType == Kelly_DriveType) then
  74. #ifdef OST
  75. print*, 'ButtonPress_Unlatch_OperationConditions=Kelly'
  76. #endif
  77. !OPERATION-CODE=18
  78. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  79. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .and.&
  80. Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and.&
  81. Get_Swing() == SWING_RAT_HOLE_END .and.&
  82. Get_LatchLed() == .false. .and.&
  83. Get_UnlatchLed()) then
  84. call Set_Kelly(KELLY_REMOVE)
  85. call Set_Swing(SWING_WELL_BEGIN)
  86. call Set_OperationCondition(OPERATION_TRIP)
  87. call Set_LatchLed(.true.)
  88. call Set_UnlatchLed(.false.)
  89. call Set_IrSafetyValveLed(.false.)
  90. if(Hoisting%DriveType == Kelly_DriveType) then ! top drive mode
  91. call RemoveKellyCock() !trip mode
  92. endif
  93. return
  94. end if
  95. endif
  96. end subroutine
  97. end module COperationConditionEnum