module CIrSafetyValveLedNotificationVariables use CVoidEventHandlerCollection implicit none logical :: IrSafetyValveLed = .false. integer :: operation_IrSafetyValveLed = 0 public type(VoidEventHandlerCollection) :: OnIrSafetyValveLedChange private :: IrSafetyValveLed contains subroutine Set_IrSafetyValveLed(v) use CDrillingConsoleVariables, only: IRSafetyValveLedHw => IRSafetyValveLed use CManifolds, only: & InstallSafetyValve_TopDrive, & InstallSafetyValve_KellyMode, & InstallSafetyValve_TripMode, & RemoveSafetyValve_TopDrive, & RemoveSafetyValve_KellyMode, & RemoveSafetyValve_TripMode use CSafetyValveEnumVariables, only: Set_SafetyValve_Install, Set_SafetyValve_Remove use CHoistingVariables, only: DriveType, TopDrive_DriveType, Kelly_DriveType implicit none logical , intent(in) :: v #ifdef ExcludeExtraChanges if(IrSafetyValveLed == v) return #endif IrSafetyValveLed = v if(IrSafetyValveLed) then IRSafetyValveLedHw = 1 if(DriveType == TopDrive_DriveType) call InstallSafetyValve_TopDrive() if(DriveType == Kelly_DriveType .and. operation_IrSafetyValveLed == 0) call InstallSafetyValve_KellyMode() if(DriveType == Kelly_DriveType .and. operation_IrSafetyValveLed == 1) call InstallSafetyValve_TripMode() call Set_SafetyValve_Install() else IRSafetyValveLedHw = 0 if(DriveType == TopDrive_DriveType) call RemoveSafetyValve_TopDrive() if(DriveType == Kelly_DriveType .and. operation_IrSafetyValveLed == 0) call RemoveSafetyValve_KellyMode() if(DriveType == Kelly_DriveType .and. operation_IrSafetyValveLed == 1) call RemoveSafetyValve_TripMode() call Set_SafetyValve_Remove() endif call OnIrSafetyValveLedChange%RunAll() end subroutine logical function Get_IrSafetyValveLed() implicit none Get_IrSafetyValveLed = IrSafetyValveLed end function subroutine Set_IrSafetyValveLed_WN(v) !DEC$ ATTRIBUTES DLLEXPORT :: Set_IrSafetyValveLed_WN !DEC$ ATTRIBUTES ALIAS: 'Set_IrSafetyValveLed_WN' :: Set_IrSafetyValveLed_WN implicit none logical , intent(in) :: v call Set_IrSafetyValveLed(v) end subroutine logical function Get_IrSafetyValveLed_WN() !DEC$ ATTRIBUTES DLLEXPORT :: Get_IrSafetyValveLed_WN !DEC$ ATTRIBUTES ALIAS: 'Get_IrSafetyValveLed_WN' :: Get_IrSafetyValveLed_WN implicit none Get_IrSafetyValveLed_WN = IrSafetyValveLed end function subroutine Set_IrSafetyValveLed_off() implicit none call Set_IrSafetyValveLed(.false.) end subroutine subroutine Set_IrSafetyValveLed_on() implicit none call Set_IrSafetyValveLed(.true.) end subroutine end module CIrSafetyValveLedNotificationVariables