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.

CIrSafetyValveLedNotificationVariables.f90 3.1 KiB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. module CIrSafetyValveLedNotificationVariables
  2. use CVoidEventHandlerCollection
  3. implicit none
  4. logical :: IrSafetyValveLed = .false.
  5. integer :: operation_IrSafetyValveLed = 0
  6. public
  7. type(VoidEventHandlerCollection) :: OnIrSafetyValveLedChange
  8. private :: IrSafetyValveLed
  9. contains
  10. subroutine Set_IrSafetyValveLed(v)
  11. use CDrillingConsoleVariables, only: IRSafetyValveLedHw => IRSafetyValveLed
  12. use CManifolds, only: &
  13. InstallSafetyValve_TopDrive, &
  14. InstallSafetyValve_KellyMode, &
  15. InstallSafetyValve_TripMode, &
  16. RemoveSafetyValve_TopDrive, &
  17. RemoveSafetyValve_KellyMode, &
  18. RemoveSafetyValve_TripMode
  19. use CSafetyValveEnumVariables, only: Set_SafetyValve_Install, Set_SafetyValve_Remove
  20. use CHoistingVariables, only: DriveType, TopDrive_DriveType, Kelly_DriveType
  21. implicit none
  22. logical , intent(in) :: v
  23. #ifdef ExcludeExtraChanges
  24. if(IrSafetyValveLed == v) return
  25. #endif
  26. IrSafetyValveLed = v
  27. if(IrSafetyValveLed) then
  28. IRSafetyValveLedHw = 1
  29. if(DriveType == TopDrive_DriveType) call InstallSafetyValve_TopDrive()
  30. if(DriveType == Kelly_DriveType .and. operation_IrSafetyValveLed == 0) call InstallSafetyValve_KellyMode()
  31. if(DriveType == Kelly_DriveType .and. operation_IrSafetyValveLed == 1) call InstallSafetyValve_TripMode()
  32. call Set_SafetyValve_Install()
  33. else
  34. IRSafetyValveLedHw = 0
  35. if(DriveType == TopDrive_DriveType) call RemoveSafetyValve_TopDrive()
  36. if(DriveType == Kelly_DriveType .and. operation_IrSafetyValveLed == 0) call RemoveSafetyValve_KellyMode()
  37. if(DriveType == Kelly_DriveType .and. operation_IrSafetyValveLed == 1) call RemoveSafetyValve_TripMode()
  38. call Set_SafetyValve_Remove()
  39. endif
  40. call OnIrSafetyValveLedChange%RunAll()
  41. end subroutine
  42. logical function Get_IrSafetyValveLed()
  43. implicit none
  44. Get_IrSafetyValveLed = IrSafetyValveLed
  45. end function
  46. subroutine Set_IrSafetyValveLed_WN(v)
  47. !DEC$ ATTRIBUTES DLLEXPORT :: Set_IrSafetyValveLed_WN
  48. !DEC$ ATTRIBUTES ALIAS: 'Set_IrSafetyValveLed_WN' :: Set_IrSafetyValveLed_WN
  49. implicit none
  50. logical , intent(in) :: v
  51. call Set_IrSafetyValveLed(v)
  52. end subroutine
  53. logical function Get_IrSafetyValveLed_WN()
  54. !DEC$ ATTRIBUTES DLLEXPORT :: Get_IrSafetyValveLed_WN
  55. !DEC$ ATTRIBUTES ALIAS: 'Get_IrSafetyValveLed_WN' :: Get_IrSafetyValveLed_WN
  56. implicit none
  57. Get_IrSafetyValveLed_WN = IrSafetyValveLed
  58. end function
  59. subroutine Set_IrSafetyValveLed_off()
  60. implicit none
  61. call Set_IrSafetyValveLed(.false.)
  62. end subroutine
  63. subroutine Set_IrSafetyValveLed_on()
  64. implicit none
  65. call Set_IrSafetyValveLed(.true.)
  66. end subroutine
  67. end module CIrSafetyValveLedNotificationVariables